From 1915850a09d49f7e7271b85cf83957859368552c Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 7 Apr 2022 14:12:56 +0200 Subject: [PATCH 001/141] feat(claim_photo): added videos --- back/methods/dms/uploadFile.js | 2 +- loopback/server/datasources.json | 19 +++++++++++++++++-- modules/claim/back/model-config.json | 3 +++ .../claim/back/models/claim-container.json | 10 ++++++++++ modules/claim/front/photos/index.html | 7 ++++++- modules/claim/front/photos/index.js | 9 ++++++++- modules/claim/front/photos/style.scss | 17 +++++++++++++++++ 7 files changed, 62 insertions(+), 5 deletions(-) create mode 100644 modules/claim/back/models/claim-container.json diff --git a/back/methods/dms/uploadFile.js b/back/methods/dms/uploadFile.js index a4212b804..b20ffa868 100644 --- a/back/methods/dms/uploadFile.js +++ b/back/methods/dms/uploadFile.js @@ -49,7 +49,7 @@ module.exports = Self => { Self.uploadFile = async(ctx, options) => { const models = Self.app.models; const TempContainer = models.TempContainer; - const DmsContainer = models.DmsContainer; + const DmsContainer = models.ClaimContainer; const fileOptions = {}; const args = ctx.args; diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 0df03882c..78a4e98c3 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -38,7 +38,8 @@ "multipart/x-zip", "image/png", "image/jpeg", - "image/jpg" + "image/jpg", + "video/mp4" ] }, "dmsStorage": { @@ -58,7 +59,8 @@ "multipart/x-zip", "image/png", "image/jpeg", - "image/jpg" + "image/jpg", + "video/mp4" ] }, "imageStorage": { @@ -83,5 +85,18 @@ "application/octet-stream", "application/pdf" ] + }, + "claimStorage": { + "name": "claimStorage", + "connector": "loopback-component-storage", + "provider": "filesystem", + "root": "./storage/claim", + "maxFileSize": "31457280", + "allowedContentTypes": [ + "image/png", + "image/jpeg", + "image/jpg", + "video/mp4" + ] } } \ No newline at end of file diff --git a/modules/claim/back/model-config.json b/modules/claim/back/model-config.json index 16d34543c..d4d772b58 100644 --- a/modules/claim/back/model-config.json +++ b/modules/claim/back/model-config.json @@ -37,5 +37,8 @@ }, "ClaimLog": { "dataSource": "vn" + }, + "ClaimContainer": { + "dataSource": "claimStorage" } } diff --git a/modules/claim/back/models/claim-container.json b/modules/claim/back/models/claim-container.json new file mode 100644 index 000000000..446be77b9 --- /dev/null +++ b/modules/claim/back/models/claim-container.json @@ -0,0 +1,10 @@ +{ + "name": "ClaimContainer", + "base": "Container", + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} \ No newline at end of file diff --git a/modules/claim/front/photos/index.html b/modules/claim/front/photos/index.html index 9cc6c649c..a3288f008 100644 --- a/modules/claim/front/photos/index.html +++ b/modules/claim/front/photos/index.html @@ -1,6 +1,7 @@
+ zoom-image="{{$ctrl.getImagePath(photo.dmsFk)}}" + ng-if="photo.dms.contentType == 'image/jpeg'">
+
Date: Fri, 8 Apr 2022 07:37:17 +0200 Subject: [PATCH 002/141] feat(claim_action): add smart-table and 'change destinantion' to all rows --- .../methods/claim/updateClaimDestination.js | 53 +++++ modules/claim/back/models/claim.js | 1 + modules/claim/front/action/index.html | 190 +++++++++++------- modules/claim/front/action/index.js | 68 +++++++ modules/claim/front/action/locale/es.yml | 5 +- modules/claim/front/action/style.scss | 4 + 6 files changed, 249 insertions(+), 72 deletions(-) create mode 100644 modules/claim/back/methods/claim/updateClaimDestination.js diff --git a/modules/claim/back/methods/claim/updateClaimDestination.js b/modules/claim/back/methods/claim/updateClaimDestination.js new file mode 100644 index 000000000..104fbaf0b --- /dev/null +++ b/modules/claim/back/methods/claim/updateClaimDestination.js @@ -0,0 +1,53 @@ + +module.exports = Self => { + Self.remoteMethod('updateClaimDestination', { + description: 'Update a claim with privileges', + accessType: 'WRITE', + accepts: [{ + arg: 'rows', + type: ['object'], + required: true, + description: `the sales which will be modified the claimDestinationFk` + }, { + arg: 'claimDestinationFk', + type: 'number', + required: true + }], + returns: { + type: 'object', + root: true + }, + http: { + path: `/updateClaimDestination`, + verb: 'post' + } + }); + + Self.updateClaimDestination = async(rows, claimDestinationFk, options) => { + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const models = Self.app.models; + for (let row of rows) { + const claimEnd = await models.ClaimEnd.findById(row.id, null, myOptions); + await claimEnd.updateAttribute('claimDestinationFk', claimDestinationFk, myOptions); + } + + if (tx) await tx.commit(); + + return {}; + } catch (e) { + if (tx) await tx.rollback(); + throw e; + } + }; +}; diff --git a/modules/claim/back/models/claim.js b/modules/claim/back/models/claim.js index fba11cfb6..36187b78b 100644 --- a/modules/claim/back/models/claim.js +++ b/modules/claim/back/models/claim.js @@ -7,4 +7,5 @@ module.exports = Self => { require('../methods/claim/uploadFile')(Self); require('../methods/claim/updateClaimAction')(Self); require('../methods/claim/isEditable')(Self); + require('../methods/claim/updateClaimDestination')(Self); }; diff --git a/modules/claim/front/action/index.html b/modules/claim/front/action/index.html index 6c0e2402d..425c0cbe9 100644 --- a/modules/claim/front/action/index.html +++ b/modules/claim/front/action/index.html @@ -19,65 +19,88 @@ -
- - - - - - - - -
- - - - - Id - Ticket - Destination - Landed - Quantity - Description - Price - Disc. - Total - - - - + +
+ + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + +
+ + + IdTicketDestinationLandedQuantityDescriptionPriceDisc.Total
+ {{::saleClaimed.sale.itemFk | zeroFill:6}} - - - - + + {{::saleClaimed.sale.ticketFk}} - - - + + - - {{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}} - {{::saleClaimed.sale.quantity}} - {{::saleClaimed.sale.concept}} - {{::saleClaimed.sale.price | currency: 'EUR':2}} - {{::saleClaimed.sale.discount}} % - + {{::saleClaimed.sale.ticket.landed | date: 'dd/MM/yyyy'}}{{::saleClaimed.sale.quantity}}{{::saleClaimed.sale.concept}}{{::saleClaimed.sale.price | currency: 'EUR':2}}{{::saleClaimed.sale.discount}} % {{saleClaimed.sale.quantity * saleClaimed.sale.price * ((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}} - - + - - - - - - - +
+ +
- \ No newline at end of file + + + + + +
+
{{$ctrl.$t('Change destination to all selected rows', {total: $ctrl.checked.length})}}
+ + + + +
+
+ + + + +
\ No newline at end of file diff --git a/modules/claim/front/action/index.js b/modules/claim/front/action/index.js index 4b3214211..c65e45a77 100644 --- a/modules/claim/front/action/index.js +++ b/modules/claim/front/action/index.js @@ -5,6 +5,7 @@ import './style.scss'; export default class Controller extends Section { constructor($element, $) { super($element, $); + this.newDestination; this.filter = { include: [ {relation: 'sale', @@ -21,6 +22,55 @@ export default class Controller extends Section { }; this.getResolvedState(); this.maxResponsibility = 5; + this.smartTableOptions = { + activeButtons: { + search: true + }, + columns: [ + { + field: 'claimDestinationFk', + autocomplete: { + url: 'ClaimDestinations', + showField: 'description', + valueField: 'id' + } + } + ] + }; + } + + exprBuilder(param, value) { + console.log(param, value); + switch (param) { + case 'search': + return {saleFk: value}; + case 'itemFk': + return {'sale.itemFk': value}; + case 'ticketFk': + return {'sale.ticketFk': value}; + case 'claimDestinationFk': + case 'landed': + case 'quantity': + case 'description': + case 'price': + case 'discount': + case 'total': + case 'id': + return {[param]: value}; + } + } + + get checked() { + const salesClaimed = this.$.model.data || []; + console.log(salesClaimed); + + const checkedSalesClaimed = []; + for (let saleClaimed of salesClaimed) { + if (saleClaimed.$checked) + checkedSalesClaimed.push(saleClaimed); + } + + return checkedSalesClaimed; } getResolvedState() { @@ -125,6 +175,24 @@ export default class Controller extends Section { onSave() { this.vnApp.showSuccess(this.$t('Data saved!')); } + + onResponse() { + const rowsToEdit = []; + for (let row of this.checked) + rowsToEdit.push({id: row.id}); + + const data = { + rows: rowsToEdit, + claimDestinationFk: this.newDestination + }; + + const query = `Claims/updateClaimDestination`; + this.$http.post(query, data) + .then(() => { + this.$.model.refresh(); + this.vnApp.showSuccess(this.$t('Data saved!')); + }); + } } ngModule.vnComponent('vnClaimAction', { diff --git a/modules/claim/front/action/locale/es.yml b/modules/claim/front/action/locale/es.yml index 22b2740b3..97640d9dc 100644 --- a/modules/claim/front/action/locale/es.yml +++ b/modules/claim/front/action/locale/es.yml @@ -7,4 +7,7 @@ Regularize: Regularizar Do you want to insert greuges?: Desea insertar greuges? Insert greuges on client card: Insertar greuges en la ficha del cliente Greuge added: Greuge añadido -ClaimGreugeDescription: Reclamación id {{claimId}} \ No newline at end of file +ClaimGreugeDescription: Reclamación id {{claimId}} +Change destination: Cambiar destino +Change destination to all selected rows: Cambiar destino a {{total}} fila(s) seleccionada(s) +Add observation to all selected clients: Añadir observación a {{total}} cliente(s) seleccionado(s) diff --git a/modules/claim/front/action/style.scss b/modules/claim/front/action/style.scss index bac316287..f93d41f9f 100644 --- a/modules/claim/front/action/style.scss +++ b/modules/claim/front/action/style.scss @@ -39,4 +39,8 @@ vn-claim-action { max-height: 350px; } } + + .right { + float: right; + } } \ No newline at end of file From 5567e0777324403407759fb59b21a110b2700e3f Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 8 Apr 2022 09:34:46 +0200 Subject: [PATCH 003/141] feat(claim_photo): can upload videos --- back/methods/dms/uploadFile.js | 2 +- loopback/server/datasources.json | 3 +- .../claim/back/methods/claim/downloadFile.js | 59 +++++++++++++++++ .../claim/back/methods/claim/uploadFile.js | 63 ++++++++++++++++++- .../claim/back/models/claim-container.json | 10 --- modules/claim/back/models/claim.js | 1 + modules/claim/front/photos/index.html | 2 +- modules/claim/front/photos/index.js | 6 +- modules/claim/front/photos/locale/es.yml | 6 +- 9 files changed, 130 insertions(+), 22 deletions(-) create mode 100644 modules/claim/back/methods/claim/downloadFile.js delete mode 100644 modules/claim/back/models/claim-container.json diff --git a/back/methods/dms/uploadFile.js b/back/methods/dms/uploadFile.js index b20ffa868..a4212b804 100644 --- a/back/methods/dms/uploadFile.js +++ b/back/methods/dms/uploadFile.js @@ -49,7 +49,7 @@ module.exports = Self => { Self.uploadFile = async(ctx, options) => { const models = Self.app.models; const TempContainer = models.TempContainer; - const DmsContainer = models.ClaimContainer; + const DmsContainer = models.DmsContainer; const fileOptions = {}; const args = ctx.args; diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index 78a4e98c3..f0940dd81 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -59,8 +59,7 @@ "multipart/x-zip", "image/png", "image/jpeg", - "image/jpg", - "video/mp4" + "image/jpg" ] }, "imageStorage": { diff --git a/modules/claim/back/methods/claim/downloadFile.js b/modules/claim/back/methods/claim/downloadFile.js new file mode 100644 index 000000000..b7af03715 --- /dev/null +++ b/modules/claim/back/methods/claim/downloadFile.js @@ -0,0 +1,59 @@ +const UserError = require('vn-loopback/util/user-error'); + +module.exports = Self => { + Self.remoteMethodCtx('downloadFile', { + description: 'Get the user image', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'Number', + description: 'The document id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, + { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, + { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/downloadFile`, + verb: 'GET' + } + }); + + Self.downloadFile = async function(ctx, id) { + const models = Self.app.models; + const ClaimContainer = models.ClaimContainer; + const dms = await models.Dms.findById(id); + const pathHash = ClaimContainer.getHash(dms.id); + try { + await ClaimContainer.getFile(pathHash, dms.file); + } catch (e) { + if (e.code != 'ENOENT') + throw e; + + const error = new UserError(`File doesn't exists`); + error.statusCode = 404; + + throw error; + } + + const stream = ClaimContainer.downloadStream(pathHash, dms.file); + + return [stream, dms.contentType, `filename="${dms.file}"`]; + }; +}; diff --git a/modules/claim/back/methods/claim/uploadFile.js b/modules/claim/back/methods/claim/uploadFile.js index 81ad40219..263ccff80 100644 --- a/modules/claim/back/methods/claim/uploadFile.js +++ b/modules/claim/back/methods/claim/uploadFile.js @@ -1,3 +1,7 @@ +const UserError = require('vn-loopback/util/user-error'); +const fs = require('fs-extra'); +const path = require('path'); + module.exports = Self => { Self.remoteMethodCtx('uploadFile', { description: 'Upload and attach a document', @@ -65,10 +69,42 @@ module.exports = Self => { } const models = Self.app.models; const promises = []; + const TempContainer = models.TempContainer; + const ClaimContainer = models.ClaimContainer; + const fileOptions = {}; + const args = ctx.args; try { - const uploadedFiles = await models.Dms.uploadFile(ctx, myOptions); - uploadedFiles.forEach(dms => { + const hasWriteRole = await models.DmsType.hasWriteRole(ctx, args.dmsTypeId, myOptions); + if (!hasWriteRole) + throw new UserError(`You don't have enough privileges`); + + // Upload file to temporary path + const tempContainer = await TempContainer.container('dms'); + const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions); + const files = Object.values(uploaded.files).map(file => { + return file[0]; + }); + + const addedDms = []; + for (const uploadedFile of files) { + const newDms = await createDms(ctx, uploadedFile, myOptions); + const pathHash = ClaimContainer.getHash(newDms.id); + + const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name); + srcFile = path.join(file.client.root, file.container, file.name); + + const claimContainer = await ClaimContainer.container(pathHash); + const dstFile = path.join(claimContainer.client.root, pathHash, newDms.file); + + await fs.move(srcFile, dstFile, { + overwrite: true + }); + + addedDms.push(newDms); + } + + addedDms.forEach(dms => { const newClaimDms = models.ClaimDms.create({ claimFk: id, dmsFk: dms.id @@ -86,4 +122,27 @@ module.exports = Self => { throw e; } }; + + async function createDms(ctx, file, myOptions) { + const models = Self.app.models; + const myUserId = ctx.req.accessToken.userId; + const args = ctx.args; + + const newDms = await models.Dms.create({ + workerFk: myUserId, + dmsTypeFk: args.dmsTypeId, + companyFk: args.companyId, + warehouseFk: args.warehouseId, + reference: args.reference, + description: args.description, + contentType: file.type, + hasFile: args.hasFile + }, myOptions); + + let fileName = file.name; + const extension = models.DmsContainer.getFileExtension(fileName); + fileName = `${newDms.id}.${extension}`; + + return newDms.updateAttribute('file', fileName, myOptions); + } }; diff --git a/modules/claim/back/models/claim-container.json b/modules/claim/back/models/claim-container.json deleted file mode 100644 index 446be77b9..000000000 --- a/modules/claim/back/models/claim-container.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "ClaimContainer", - "base": "Container", - "acls": [{ - "accessType": "READ", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - }] -} \ No newline at end of file diff --git a/modules/claim/back/models/claim.js b/modules/claim/back/models/claim.js index fba11cfb6..18b9b3c87 100644 --- a/modules/claim/back/models/claim.js +++ b/modules/claim/back/models/claim.js @@ -7,4 +7,5 @@ module.exports = Self => { require('../methods/claim/uploadFile')(Self); require('../methods/claim/updateClaimAction')(Self); require('../methods/claim/isEditable')(Self); + require('../methods/claim/downloadFile')(Self); }; diff --git a/modules/claim/front/photos/index.html b/modules/claim/front/photos/index.html index a3288f008..907e0852b 100644 --- a/modules/claim/front/photos/index.html +++ b/modules/claim/front/photos/index.html @@ -40,7 +40,7 @@ diff --git a/modules/claim/front/photos/index.js b/modules/claim/front/photos/index.js index b8d8650af..62e439a91 100644 --- a/modules/claim/front/photos/index.js +++ b/modules/claim/front/photos/index.js @@ -20,7 +20,7 @@ class Controller extends Section { return this.$http.post(`ClaimDms/${dmsFk}/removeFile`) .then(() => { this.$.model.remove(index); - this.vnApp.showSuccess(this.$t('Photo deleted')); + this.vnApp.showSuccess(this.$t('File deleted')); }); } @@ -88,13 +88,13 @@ class Controller extends Section { data: this.dms.files }; this.$http(options).then(() => { - this.vnApp.showSuccess(this.$t('Photo uploaded!')); + this.vnApp.showSuccess(this.$t('File uploaded!')); this.$.model.refresh(); }); } getImagePath(dmsId) { - return this.vnFile.getPath(`/api/claim/${dmsId}/downloadFile`); + return this.vnFile.getPath(`/api/Claims/${dmsId}/downloadFile`); } } diff --git a/modules/claim/front/photos/locale/es.yml b/modules/claim/front/photos/locale/es.yml index 8ccc1dba4..d2ee9ffbd 100644 --- a/modules/claim/front/photos/locale/es.yml +++ b/modules/claim/front/photos/locale/es.yml @@ -1,5 +1,5 @@ Are you sure you want to continue?: ¿Seguro que quieres continuar? Drag & Drop photos here...: Arrastra y suelta fotos aquí... -Photo deleted: Foto eliminada -Photo uploaded!: Foto subida! -Select photo: Seleccionar foto \ No newline at end of file +File deleted: Archivo eliminado +File uploaded!: Archivo subido! +Select file: Seleccionar fichero \ No newline at end of file From ea4266ef8ce9f06b68710d4b3bb4c39b3a7895b7 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 8 Apr 2022 12:20:39 +0200 Subject: [PATCH 004/141] feat: add deleteOldFiles --- .../back/methods/claim/deleteOldFiles.js | 61 +++++++++++++++++++ .../claim/back/methods/claim/uploadFile.js | 4 ++ .../claim/back/models/claim-container.json | 10 +++ modules/claim/back/models/claim.js | 1 + 4 files changed, 76 insertions(+) create mode 100644 modules/claim/back/methods/claim/deleteOldFiles.js create mode 100644 modules/claim/back/models/claim-container.json diff --git a/modules/claim/back/methods/claim/deleteOldFiles.js b/modules/claim/back/methods/claim/deleteOldFiles.js new file mode 100644 index 000000000..9a789eeb5 --- /dev/null +++ b/modules/claim/back/methods/claim/deleteOldFiles.js @@ -0,0 +1,61 @@ +const fs = require('fs-extra'); +const path = require('path'); + +module.exports = Self => { + Self.remoteMethodCtx('deleteOldFiles', { + description: 'Upload and attach a document', + accessType: 'WRITE', + returns: { + type: 'object', + root: true + }, + http: { + path: `/deleteOldFiles`, + verb: 'POST' + } + }); + + Self.deleteOldFiles = async options => { + let tx; + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) { + tx = await Self.beginTransaction({}); + myOptions.transaction = tx; + } + + try { + const claimContainer = './storage/claim'; + const folders = fs.readdirSync(claimContainer); + let file; + let srcFile; + + for (let i in folders) { + const srcFoulder = path.join(claimContainer, folders[i]); + [file] = fs.readdirSync(srcFoulder); + if (!file) file = ''; + srcFile = path.join(srcFoulder, file); + const {birthtime} = fs.statSync(srcFile); + const sixMonthsAgo = new Date(); + sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); + + if (birthtime < sixMonthsAgo) + fs.rmdir(srcFoulder, {recursive: true}); + } + + if (tx) await tx.commit(); + + return claimContainer; + } catch (e) { + if (tx) await tx.rollback(); + + if (fs.existsSync(srcFile)) + await fs.unlink(srcFile); + + throw e; + } + }; +}; diff --git a/modules/claim/back/methods/claim/uploadFile.js b/modules/claim/back/methods/claim/uploadFile.js index 263ccff80..a7951b677 100644 --- a/modules/claim/back/methods/claim/uploadFile.js +++ b/modules/claim/back/methods/claim/uploadFile.js @@ -119,6 +119,10 @@ module.exports = Self => { return resolvedPromises; } catch (e) { if (tx) await tx.rollback(); + + if (fs.existsSync(srcFile)) + await fs.unlink(srcFile); + throw e; } }; diff --git a/modules/claim/back/models/claim-container.json b/modules/claim/back/models/claim-container.json new file mode 100644 index 000000000..446be77b9 --- /dev/null +++ b/modules/claim/back/models/claim-container.json @@ -0,0 +1,10 @@ +{ + "name": "ClaimContainer", + "base": "Container", + "acls": [{ + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} \ No newline at end of file diff --git a/modules/claim/back/models/claim.js b/modules/claim/back/models/claim.js index 18b9b3c87..339eb6051 100644 --- a/modules/claim/back/models/claim.js +++ b/modules/claim/back/models/claim.js @@ -8,4 +8,5 @@ module.exports = Self => { require('../methods/claim/updateClaimAction')(Self); require('../methods/claim/isEditable')(Self); require('../methods/claim/downloadFile')(Self); + require('../methods/claim/deleteOldFiles')(Self); }; From 90b079a0ac89cc1706a3ff90dad9d7b6374fc091 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 8 Apr 2022 12:25:06 +0200 Subject: [PATCH 005/141] refactor: description back routes --- modules/claim/back/methods/claim/deleteOldFiles.js | 2 +- modules/claim/back/methods/claim/downloadFile.js | 2 +- modules/claim/back/methods/claim/uploadFile.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/claim/back/methods/claim/deleteOldFiles.js b/modules/claim/back/methods/claim/deleteOldFiles.js index 9a789eeb5..292d980e3 100644 --- a/modules/claim/back/methods/claim/deleteOldFiles.js +++ b/modules/claim/back/methods/claim/deleteOldFiles.js @@ -3,7 +3,7 @@ const path = require('path'); module.exports = Self => { Self.remoteMethodCtx('deleteOldFiles', { - description: 'Upload and attach a document', + description: 'Delete files that are 6 months old from "./storage/claim"', accessType: 'WRITE', returns: { type: 'object', diff --git a/modules/claim/back/methods/claim/downloadFile.js b/modules/claim/back/methods/claim/downloadFile.js index b7af03715..750356b0b 100644 --- a/modules/claim/back/methods/claim/downloadFile.js +++ b/modules/claim/back/methods/claim/downloadFile.js @@ -2,7 +2,7 @@ const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('downloadFile', { - description: 'Get the user image', + description: 'Get the claim file', accessType: 'READ', accepts: [ { diff --git a/modules/claim/back/methods/claim/uploadFile.js b/modules/claim/back/methods/claim/uploadFile.js index a7951b677..90ab9c078 100644 --- a/modules/claim/back/methods/claim/uploadFile.js +++ b/modules/claim/back/methods/claim/uploadFile.js @@ -4,7 +4,7 @@ const path = require('path'); module.exports = Self => { Self.remoteMethodCtx('uploadFile', { - description: 'Upload and attach a document', + description: 'Upload and attach a file', accessType: 'WRITE', accepts: [{ arg: 'id', From c00be015ab0b814e26f980943dc7d69b9b7cfbdb Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 8 Apr 2022 13:53:25 +0200 Subject: [PATCH 006/141] feat(claim_photo): add fixtures and backTest --- db/dump/fixtures.sql | 18 ++++++++++++------ .../methods/claim/specs/downloadFile.spec.js | 13 +++++++++++++ .../methods/claim/specs/uploadFile.spec.js | 18 ++++++++++++++++++ modules/claim/back/methods/claim/uploadFile.js | 1 + 4 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 modules/claim/back/methods/claim/specs/downloadFile.spec.js create mode 100644 modules/claim/back/methods/claim/specs/uploadFile.spec.js diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index e8302b1a2..05ca8c512 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2240,13 +2240,19 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `c INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) VALUES - (1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()), - (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()), - (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE()), - (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()), - (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', CURDATE()), - (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', CURDATE()); + (1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()), + (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()), + (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE()), + (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()), + (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', CURDATE()), + (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', CURDATE()), + (7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', CURDATE()), + (8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', CURDATE()); +INSERT INTO `vn`.`claimDms`(`claimFk`, `dmsFk`) + VALUES + (1, 7), + (1, 8); INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`) VALUES diff --git a/modules/claim/back/methods/claim/specs/downloadFile.spec.js b/modules/claim/back/methods/claim/specs/downloadFile.spec.js new file mode 100644 index 000000000..44a54db63 --- /dev/null +++ b/modules/claim/back/methods/claim/specs/downloadFile.spec.js @@ -0,0 +1,13 @@ +const app = require('vn-loopback/server/server'); + +describe('claim downloadFile()', () => { + let dmsId = 7; + + it('should return a response for an employee with image content-type', async() => { + let workerId = 1107; + let ctx = {req: {accessToken: {userId: workerId}}}; + const result = await app.models.Claim.downloadFile(ctx, dmsId); + + expect(result[1]).toEqual('image/jpeg'); + }); +}); diff --git a/modules/claim/back/methods/claim/specs/uploadFile.spec.js b/modules/claim/back/methods/claim/specs/uploadFile.spec.js new file mode 100644 index 000000000..02852ed80 --- /dev/null +++ b/modules/claim/back/methods/claim/specs/uploadFile.spec.js @@ -0,0 +1,18 @@ +const app = require('vn-loopback/server/server'); + +describe('claim uploadFile()', () => { + it(`should return an error for a user without enough privileges`, async() => { + let clientId = 1101; + let ticketDmsTypeId = 14; + let ctx = {req: {accessToken: {userId: clientId}}, args: {dmsTypeId: ticketDmsTypeId}}; + + let error; + await app.models.Claim.uploadFile(ctx).catch(e => { + error = e; + }).finally(() => { + expect(error.message).toEqual(`You don't have enough privileges`); + }); + + expect(error).toBeDefined(); + }); +}); diff --git a/modules/claim/back/methods/claim/uploadFile.js b/modules/claim/back/methods/claim/uploadFile.js index 90ab9c078..e5071afaa 100644 --- a/modules/claim/back/methods/claim/uploadFile.js +++ b/modules/claim/back/methods/claim/uploadFile.js @@ -74,6 +74,7 @@ module.exports = Self => { const fileOptions = {}; const args = ctx.args; + let srcFile; try { const hasWriteRole = await models.DmsType.hasWriteRole(ctx, args.dmsTypeId, myOptions); if (!hasWriteRole) From 20494e8c0b515084db57b583388135878e6a2b21 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 8 Apr 2022 13:53:56 +0200 Subject: [PATCH 007/141] feat(claim_photos): add files in storage/claim --- storage/claim/8f1/7.jpg | Bin 0 -> 249806 bytes storage/claim/c9f/8.mp4 | Bin 0 -> 1570024 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 storage/claim/8f1/7.jpg create mode 100644 storage/claim/c9f/8.mp4 diff --git a/storage/claim/8f1/7.jpg b/storage/claim/8f1/7.jpg new file mode 100644 index 0000000000000000000000000000000000000000..421dde8f538663c9f18d4303b3177d10ceba7e97 GIT binary patch literal 249806 zcmb5Vd0bNY_dkBMoGF{Kv}|fh%e2f~rj*PLtjWr7OH0MI$&^V=QZxern`*|&l*x_U zpj>lY&@9OfYD`TLNKwgAVT=@!+*ni)?0e_^`7Xcj^3U(;1q0?UoH2wis>S zw%zFe_wn^FVA}>A;M?2lv`hf)ZCdNLX?=YM>;WJ3zaPMVKeV*htp}fS19*4$|9KCT z>OXhC{tbM$P7Bc9x^63YX$=-}VyM^ak-uY1UIljST86}l1IgV`8?)Q1P}IyxcD#}o z)tQAvgkdBPxOv!5D1!?nI|J-(gF3UzJK2sQ2y#BtDsghO!f{E&<#j~QGLP*3&8i@> zX4Hz6|1{9Lp&F9FPKt+{(tMGgeUMtde~ZJ2W7th3+H%yC)g0yT=VEIaZ4ubilXNv> zIKI|D9&4}@>lIMKj%#8E)OvXhd)c-l~9wYS@E z&3K5mexOb$d%zJ{RT&#off zk2O5Eay{uf#L9L@NZHxcMuQ6`kK2YFQ4|juzcEA(|08c~#1WPEQ9=(cT1H1%Xzj@G z7(>R>(FrjIXBw|(S?qoQN$49FJr@ho2t`;0sII92ujWQb;+?VV56d(Aef!hxU1#*R1c zyeZo0-$#pOo@PdD9(*@lmt5lI_cF}yB}<0UsP__(*)teWQ&8{P&zycGVp)b&Q_l;I z^%NoAs7Jb$K%CDOMH^2~dtlL_aK7sX{_45K9Z%*)> zHDQ!PrD5J-D+(Sd`S_=2R=uy{{m{qjtRqECno(#oGDLYZGH))n;G{3}IxDN}@DB6d zTGsQ2+ud>|$@!8mT}g%eO_6MaeF4(%84VcVa%MQwCg6g^17ZZ%!8HBX=p9=Q96lLXpKInxx!uL&i zga4ZscE_Hx9nZ9dg;!3IDfuE*k;5t!39Eb{m=aBQdsFa(3xWi1BTW#poAT_QlAl^W z#VHj@moOq~W^RAv)v|OTaEB!T-~J!u*uKO3&Ycf7UMczVWa$z)H9XwrI;NHH*w)ez zJN=g^z>apD73qa*P3ZR8lX7EnI;y8%|AJZlGc>l}})Xf!(H!7t=SA)vGDDB4{oi zhfVr=PV<$CZL5jGW@dRV+rrl0s@E}wTwz~xJ>$|7B<2wd>DX6Q^WZW|d)w(~iA$`Q zM+x^XEO(S%dJ*&@IJR%_euHb%#io$XJQgA@DZW+|#C}zLzB!*C*_E8%2G4K)E;{I7 zMV17T5#tnDlRxS>INVrWScM3>s(;Vtxz)WYpP)eN#@MpP07KS(i=ca?6XLu!HNHrM zGQvOU4!6cXrkW|D!jI$q?0;{)C?tA2w?V_7O_CXusbvg$PAaN1`U5z>FR=c6;QEro zSMCE_f%De@;JLY>#3^6QBOW=8K(((MS)`f`Rn~Dc+Ie5lCYmy(NO6U zvpb4u;&-I&B40TZQP(_@(X%ZtzS@*sW47U>pIhHp@aSIbq97zuexsbfJFhpm@UZ>^ zyTB%om-nAvOUn0j%doGzDJmCL75D7tgpB6fe#i>G5gKAp(JZ#7VHmYx*pGV8jPb%t@Ao2?b`&ffnp&^?i%_b%l z7-S{$vqFiUlgY$Al5cMR>U)3thI#-nGqf~$qqQ4+VfS!1yYWA=FuYtsj`v0+=aL#T zsAtsU$xLt&;1VtK`CcI|dzzP}5ey@v`|f28SK;O9(WXPacC7P%44x|a`+b#OZBbae ztec)FmC2=H2Dk22ndKJ8IHDzWp*Aid!#7#%=s*O##+0v&MwS+MM%udDCYglVUTq4j zM%&h+FomdoW)O+y5+XrdD7>^WcKZ(9KVD||qm%5ist;WJZMb=i{e+z`tbe_5cg8Ow zY&1Ja9EXvlG>h8jWL=8tN0Ok|tiOehz#s5mv`hyP7lEz6RUPoyY-=`{AKKi<&(;qW zZL95bPwYb1<+G!j-jUE*G1d2HGjA2pQ~pvNot&NGQ1c+^;(8w+lQ)2t>v{eA_1cz! zCE7bKYn{52XDX%#Kbhxo`k7_%9;bccY zlSr@)6n%W`%Y1(L^7Dr|&jFK~^m8r+(j+n7o)m1`%{bmRwkk~&`EGyG!iq={RTqPR zWY=RKUj<1xe}CvN&#`Dr+l{uM#;)?bg5M2SEEakSgD2@~Rm=~w9M8~*o!4!z*+%CD z8zQW73#+PgE#VfPaJ1!cMbe|0_w3xO8RDX_f?*85Wf&7yO-`<9+!^FCHzRZ$iiAHr zRpM*%&SI09uP%sceh2)Hh4#7M6q$_{6^I@B#`}7b4x(#&vJqJ^en*q?^J|YDta%r6 ziygJhaUN|$9l|XLj!eI+9s;&+&^ot$>vruo8|t+WUoEjT$+Ps)z6U{HmDB}Alz#FM8T=G4 zEO<KB&x71`u}2WJ(p~(x zhT@*K@o3xHXrUv2`4K9J=RD4Qa_WAQ(K z0FR#7Y{wU726kq5OkQNw_V%DHV~%}_I}?@vb1N(D?D4&o_D;iBgrTRS-@2azeaH+% zY2EcN?&#-P>OZgwso4bhRM!j+xP!7*l^di?Ho5F|9xqCfO6VlyG&w9y zLh=Tf&pm_Q4;%>CVQ&K0|Kruqc)h6POh?I~U9^%UA!oEZl%A@GB3eExxW{iO8*Yq) zL|)Ca@GZ+e$HcPo%lhE^Y{7s&Qdcm=UcNOw&tr zV=}pBDA&+br|PQhmTYtGk2JIT9Ft22+>bi$EG%<@!1dwMXF7JhuurEqbc?9%%0soi<6gJ>M*;qp;-RUu+!gnblp zDpn&h9b=l>T4`LWb&(5R4JCSW6cSQuK;E2O!ra26LLFwAShkJBz@%-zl(j0xj>OBok+H~w}O z9tp3xRvZH=7E(Mm6ZOFCSPN-aOF@1vT7LqafedZTOKv}HmowhgX!m}oGqYgw`E+OB zuy4(IxRzl_Z62iVnp2VtbwYkqI!`f1hU5Gzfy<$>~@U7?x4kgvECrUH!ytgG`sf~-6WsWnV+5Mfa-T{7BS9R zJ2xkZAE75^dCurb$ro7!sbnU&DdKKt@qL){#$(>c258vKFvTCTtb*E4@y z(9NMiAZS02!58n~J9M(T9rf1|A>BMN!xvv&-K? zr&?_&X|S^!A04gAm_JN(6LE1dRQKrx;k1y_C{ofXlz=Jpl9URW&370*64X_Zgsz#I ziP<$gwa5+?+Bz>YL!Y!Qe}K6DX674wmFe@)D$g#Y{ND4RoZ-fr-oSjm2NU9dp=Jh- zj_~*>@G^A41y|3D| z?Sj>*{_VhqKW}f>ePG2}ul)f4bRJl2LVFK2U~Z5JzNTzC!2WGnnS%Ra*DMOM$|C@b)34#a*O_{n2)$e9+0UWr3yq426=X<>qClu#)Y8ygw}bg$J_(Y@gowx3t?6s_zt_*<8q#jiWh_q$N+ z*-*?1K_<)_U_xHy>X-pdh(GQ(zqB%g)ZIi@Z-kh+6&POJVF>Ex)Ft@V9hO?r+kW<0 zfAP${^}#^SsoT%(-h&0uCX>-^v0A!!{`%GRzk&;RUMK%yG2D2I8YANlahapL=0t5b zK*nQ1p>ihF@x4Yxqcn>3-%q5R7`?)OR*jE9ImJ^7Wq81jq}H|=2fk9WON<#~O-0G` z2ZyqKOSlgF=-q~K+j}A3i4Y$Q#|8)QKeul13@Pq)J+H89uHlq)IQ&fm$`+}0q ze0JpfJ1V3z$Wd-*n^MDjm#`GU%;)xVGWV+3epm@PdhA_YwhmYSW$&MxLq_cK-V8_G z91=N3jUmfo3NbMT@iirNAw99w1^UM39FJ3zJ$F|E=uIK7^Tpa}NMC;eM z?f2PeSaQ$8u;li(Xx-ady0@+Vrwaakp%+s~-22{s^!FF?d1f6(G0)`fSykauz))5y zN^yZ2Cx_d|k)e%y8Y%X@OSn0hAG3pcXeix!_TEshXUIr&;P&(S4>CU88I39%Kd?}UZmoTF@!xP5Ok01C!@u+ zeZEhhTW;6=_3{uaYHV;I^h!ld-&l<&v&OTlp}4aPd#1i09lh_~ixJD0Iys1n>mf}4 zt7R7NOSb3g-`2igY7z}Mgy+?qHx0`A`(eG-IZFW8TK}*2|8IxO0pixfn~ymvWb+OR z35QG3Lsg5C1=->xWeX3?vD(_uTmqs4s@%jsHQ+k{_usVdY0h@G~^0IHB@9!%AlEHKn z_`yc&s42^q$JX~idG>Y+! zy&n$)wuQyEkxk`xd4{LDt~Y%1;!pQexA&P=+gf?Bf^&xNzXWYyGncwobBL<|V?JtV z`6~ch{0ew>pHP2$cPZ7Ndx3t^0atj%GcfC8hU@yLT9Nm)&iU-qxi{c{J#R|lID9Sc z>cFw`zJ4@0Kg4sg4qXu}BIge`+94_)S5@T}^fiUlHC9)4=xTF zK7XtPzS9;FV}L;wjiGkJBe%J4&l-swVle|8Pg-ArSXd66=k7Nx$ZrM(o70~LHb(0J z+kAlkmuN1AVIg^@Pl0;v`!vVXx_Lk^Gp;;qCgx~VSq=~pGW*lT9VMrm*EhWZ%&#^c z8;^p=T^)L1W%2>I^TFcc2JNo^d=0s3Yh?8XyMNKNf_B ztkGjb&G6HpyuiMvKIVUXEBOlSS8=?#8qxGuKu5D~WT}#)3iDV|^Sz%Hqo$N=zuS*? zPN_md*TO%grt)&uTvv^ar`Ehab|3i}G+~vimbRtOZQyA}$VHG`kG(kh&CQ+|llQ(m zHl2H!@`|D7-TGx#0X;;UPHDvx99LbitI&W#dFpY6I<-fG{7g?4#%7a#+ch+p^~w|i zwi)o%(<_Y20wkfo``;&TE|n_U?rJsS-3SX;AjwVeOP)X2&SInLTurTk7mQ zwkmHKl#eZn94F~**b#~z%%dH*2mgduIr$YhxYn<3?UB+g8#@<$@6!ugRbTMbQsQHMh+Hll%YOLH>t8|MhpX3H)b^0|ADfjlN?U zA%Uaj1NtC2_&iHUV6R{Q?v8$pr-u<%pCW*ECxDOJn3uRz4) z67Pd10Lo=9sN3*3NF8RnMcQhu#At9RFPz3%F)btLE%R$))C(F|*8)y&GykY)V?hq$ z${U2MmKn&6*8?^$_^AVUO2x8<2=gj-!mfz=yU>#^A+zu1B3Lea*o5j~G^^<#_GS#T zE9Jb7DC(xkS)Ga8khXl#D-` z!l3XC*}e_-h4B#Ur%!zp(;z^tfLE-?g)vLPAETB^jqR6AW*;inv%K!DPuRz8v7?qIB0WavJ{6Ywi@6&~6&aRae8=h+WfTR@g^tSeGZNzEaod2ZMTBi+7?$4_y|umf0oYF}hA6dEzDD^HFBp{L!`W)$ z_)5d4wPfa!-~eY4x~>um`*AC%%k?Gy2KBVY_gu}k=@nSYG(I+74wq>56gxAFAMvmE zi48#@&rY*BV=wsqCNCI?paz87f0v;A3Y=FA7vJDm$z}5VFVfYD^Pw2tMi@@bn?*f9d=F^)&E!YVrm|r3*fRJO0&U z;3kWb`+>m4TwlBUWe)>O%$o;mYHnKvMqkUV(!F2NXh$UR>&#`HEXh9ILUZ$OY&;oGOEf7y|;4HLfLC@Q3~b^Q;10VE>s*m#cJ7J$iZUWx5Az5^WiH#6KDymGA4C_c7O^ ztZ9tZVQ}N!z?jI-AHH*TjRG2Xb}fxBM~)Ja0wtM}qoPdP$O2TxL(|JioG|(t#d}f{7Z&oW z=*I7)BUeQkb!x^Ti5g0uPi+;d;=n#>A;-Gl9b`Dl=2M&?I^8J8U0xM?cPsJ@H&LV+m zO*uVVF!fQn7B{X+!OnD(h!jlGS76%;te=q5sr(og(g@iA&}@CWuu-Ty?9bdHaUr*e z@2~yqsiY-Md&*jJuf}*PJEvylGT^h@9qe8m0~wMRANu-hSf@NsfyuIt?=O+AVBjzv zH0jj2M&?hM(+BQ6TeTmWsaun^az5dZ~q9L`L4MwE&e( zR^r;BPiqruVK-Q3TUiPxv<>e7hzpvumF2k<)T(viy!@7iN>ns(FoU8=R<&E^O(wNa z*4nb#oD|JoLhZSJ%~JFwy?C)`p89=Obd-TUc9V{ZBV*Si=>D2Cc_dJ)SHg1FE#LewrP{^a5J)>7H&u&ri^~#G;;|=Hp6>{m->E5 zL!pKdJMi8ga7;-Nc0s@p;p$#X32@ya)AC$jtAn{_P43ZARv|Bsl{3Kv@jJ*7+Z(-k z<{29=nSo(TTfg?ATn&u(58>|6EQiJ# zbyRpdC>tXY*N%!5w@~4Qj%<3Bz{QqHaj)9je34$4!hwcmhW4@d#?`IJ;oX#~w)ihJ zqw8oMfj~8`rDFNvFsqAQ_UVX$(c&{v%6QZe^epS9#zRf4O7)yt^H%Or!TPaava}`% zUL#Sy{eT9!$)X{k=b&*dToUg2ug;A;Y)5;W8VLLPqN=qT=g}-{WGT%M| z)$8MRajFEg?}RC1*c}^eGS7Q( z`d8OGp#V6!FiNqLm7wz=gt!5xXpyHG;7D<&`& zjUyx&Rf@yXl8ue&lKi!jNBiMK#I!PBCO88jc_h7_JOO>hS*8Yo*j)LL*E0sD|_1&G4+i8qBD$w% z`QC;ahC?0WS0Rc!F-r@cP%^5Nl%1jkZqFjx?#HnZugCGp-!*vznLK)~ZGQ5k>kiXW zD+_pl#q)Z&q2+DFDf65^X~#VE&Cl<%)YAQ}9w&QuQ9{4-BV@WeFHk zuBg8P&n8gRYL__Yw&h-d(YTdbKpOutD_%^L&oWtp)4bv#=Wz|f+a}!Kw4>HplX6KG z!;9#qkXGpAuRyahY^@y+#XBwYU@+3C(g>(Ym|fR;9Q|x$gNpeXh)1qh~#qbZ;itsH7od6M8mn6M0Obm7H+`d zA$Xw}7YN<|CW?4H+MD)8-OUyLqX63(dC1S4a^aXXVzfZ1hF0!PR-f(HY{5u1^tjg; zn@XmHZOT1SP?*gGOSv@syCG4He?t;mGCC=-C7!j!BHAWxd6{$h-6`~6j0l!LPU_&hznhiKyxr6_7Q!XtZb zipyd-#%B{JTcduQ&rXY5=yK5yL496BRyN9ExnTl7k;-Wvk8A9=Wh471IeL#*KnEpF z5rQ(Im+o{LZqj~uK7?s<{#ZFUL3dlrbv+!oSg)<~>vOOX_GhK}%ZH{PIxfW9Tfb4Tuis%g3Zp4_ zq#uLz(T<)Ap- z;>`F7QU`5csWb9!klJ`}(Fkk^nVf(J4j4M4Cp;i+{BBQs5{ae2g?mMe@Hjl9)KV4Y z9ibyF9WhEOG`N_X)1_dKDOVR-yRAE*df_f?zm#zyxm~z>xWeJuPEsk&&Qoo5Qx*Pg z<|-a$Upo5Fuv+aX6NK4^pvf+%C=B7yEa6D^!utjFZ9w}e?ZCM|f7{Uemo`W_`sjmK zEVV8NZrEYz1FUO6?)Q0h;567x@yZ&r-)Z$IbWoIhU~|X!k~}36)BYo*7Ex7<`r!#8 z3eX0rYOSi0wMyx@6KIX3&yx97;}=R;GV?801!E{-ph><0BO)}3Lr3|KsrR(|N<=8` z=eiaSq8QnP&cukBp%AA)sj8XT%Jq%R92*rWpt$g=F1cuO0lmEPkwfW!xVTm+gYvuw z4AMx$-5&8QJ^Qrj75h==<-*o?EiAV6Dl!Tc<{Qb~QL`+wE>^!#ET=f9?#}=*<|jsL zX3Iqx$^{|F=CSf8me8n53jGPlNI#7*J|Iy-Mv1Id#sPdgNcTO)!ww1FOBJ&Nk`Ata zi0YOKAx|vqHlmcR7)Oxws*Z3by4{-Dj?yr4SerFH#-xo%HqP>3~n&3`c+PlAHh4f%=gfe>WugZGPW35MsZR>;z6p zW)>-U$5^N!c4INh5gmNcRo@a^8;CRI$e@Bj1z~i-7(OCrpg$`VDp;iwOjW2Twts4tU?OlW^A1w+uz(_wsjg4VPJH1Q=gvx#TPaTcf?(+i zzxd{YLL~QQYf$-$R}4z?ZuAoR=&Ve25X&djNN45hu(c3ET{78dvyCabZ9ev|F-X;e z&vNCmt<81Y{;nu_UqAq}RgTL5dG4P$Wcny~Z?PmIaz4d)-so%TFb;E|O^*;JjngB4t)?C#jlLIgi9a>qI+NgjZ(DJk*!3^&`zUdwhHRR z>n7(5QtbwLVJV%*B`o40T8}tUnu2Ssna7QG7c!vjs}Xdh5kjuCl63UvbeeKJF*q2}1?( z!w}t-hRrqYX#0wUwq3HBL~(Fi)DKq7G`65(lw0{{!p$dLDx5O2U?Czba}6hN$8krj z)z;w1#|q_d%oJ?rl%^Z%4AT>V?wOYa)o#O1}2WK~3XJdpF5N>V3V{&1(Jvp5l zk`Xmr85ZP-V^F)lS3VgVZYGqo}A;jXkhtE7|d*2^8&{T&fEQgbb%Ze zoQ#C0KbpHTvob5FW{%RW7nyb0yCgiD?aK+YUd52q35QQqIj7o7m%nII?=IRB1Op&+ zlR`D*l;723_+MmUQ*FylSA}5qb%;oUIeO~}|FoR|cLo?fEz{4^vefeJ-4OV%mA1RO zZ91j@X45A8MRK%$xrJ|ebCpGp*$a=Eo=cHg^N!geDNz{zw!0Dkp z5^1!M(T_)oV5K6VO5>!&U>uWW3ihsfR+MaKQR zH;9MWs|*O$7Hc8qOVo;n97Ut!r*H(KO-k*pwY1+`)PiJ6Fw*F5CpV4T z4oxj3$2IaQA*6~jZ|}oovH(WgLmghkZ-Isp@Ivz;n!S7eXTE)Wt*3`=`andJg2(3X z?!KP*WCDKzNp@x!5GVsHup?3|NHm2mv=xJ+Q~XpyGU!?Jy%C)5@m|69<;0c+5K({y@D{ zzzACou-M3fW0T zbBBYX;T4LW^4AtUc0Uf%Hp9`=6W|QMQw?eg*1U}8P&xe_REA?06`b^)&sXxp36NTxH+*|gte-i69vjb)C~Fj1Y@uT z3p>kUK*Nvj&1O0!w7aw{q}XP#qLCDq%47bYR%y#5uh3D0td_#cCO+{fyly{MH#jwp zA?G({w6+Sx!U6BSTxw}eVv%Ws!_2i?OI;(Ps4|)AL>%AQg>Z!G(Z%HmHc?F#n7DR^ ztr*9h#<*ZeL_+9X+xWq`265NH)`5RiL%QYTZ#1e#; z%LrcBRi|4nU|(pVbv{Ts|KW)=+-nN=!!jm@J@$%2t?+_Em--SUJNL9q%_w7AWMM^x z!q4KBEif4McWA0;*!EuicOU=VI+qJJeRN#SHo$d&Uvv$2+Xq`K^bKv_A zU-AuVs6rro6C^!#Au2T1))GYpfy=rblh|gz|M$3{tn#e#f;>pnlVMqP#wET<4VbAx z43Tbq!*OMUh&E>GwdGXO8k4sKl@HA-;z!ex_y_Bnh1AWU_tQiF!)E@VBEw+g|0tRl z*G^6^;i%za*mFGNpRYiz49A(~rNydQqH9Da>XA_%Z)&wMb8PvMh|;~v58>n%Yl>os zIH|hZQv>5@wxCDAuH2B)meXY2JTrKBs1Cm@Z*DUXi$Xxs&``E%G zj=VL%#kFAYVNO&esjecvQ_}7{-niR4JQo}B;R@s`k4mEMX}uX{^ou)*tW=>8+>|F$ z^{i@*(I>qrk;q&Mht=bF0;W3+T8rY4$?5cv<(Z-qPw6*u-6L zrF&cPkyE6*RcC|AovIyiu1||n;$z76X}E7xNs|K!5-xdu@BSxl`W8DPtR&<*ELfpt zlE?~!{p(@xUqf~(p=Pk}>eg(qg@VmzfWBTSrJbbcL(W*hV zE>coKVvG>3GX4aPGUUn_XFv0}%G5HYkwa<)Uhs)T;jE1kKNI)_lo+Gl`6p6k#4uPw ze_joxdpCk3@``TJ;^GNTH-1ZzBx98%(io4b`#fDvbi`m-wcW;Nk8snx@Q#VY$0N2k zxp_Gicw0iaf$R!oA)`RPbgMOpQ%bBnv8Z}2Z?~nKH4}GSN^0h#g`L{XRcX8Ps^Canh{o8Acy_`WYGd5d*T@m}y@-zLDQ5+dPCtKe*%0h~f-3^P z9h_Hvx-I(BuZG)!K;Y@~(!oc{X+vH8a&5N@kqwb2-F=E$q^Ld14@OPqE4@;RT2Mc< zC9QWoo#VDGsV;H0?h>bIWj;_`haI-Nr@hVRV*SGq*6zMpnm6jpS3qlKUJgs4=rI_> zd}ZBou_ERzo`6pl^E!s8ul^AZ)01r~yBXE2&nkQ|%&FsxkU%7fR?m7rAkuPIcw#BL z&1JQtvbB@zOi%luo=4fh{=TVpo0!s6PQyqkA*mH8C8L#^woF?LV-r#by?-4>uYSLX zJ<74CI@Ka?ii&3cs>|~_euS0bDW3rMHQtg?LQ$0Jv~w@U4DMR~mE3|%a}fr2rC{dj zXQ#t(?MBzg0XVxNmGV;NnAIdsz;2jaWjxC6Ud-xC$ZrP6+6tq(9$dOSxOM$@t$(L| z%=Y>ES^^-^2=?lq0-H{|xTD`jx>{UBoZtE^((PWA>mj4D;BJ?xo1NAziQum9ip6TC z`>uwAHLh+^ou)D6qS*O5r?%FZygJ8*>WpKa?w6oxrG&4*W3g(E;y1aha+1s~EH5SU zDmzCTgJj-b-yyjMWQ75DlvP0>QvW$HE1JYskJMp_r4Ix(3z7<&pp!FmD^5fi=LU$_ zt?efkSB+wYp9QqZ)&&%!UWr)R$-&C=W!~Wk%414p(8980CcnF}r-~_V+9KlR{B^RMWstfxWd+U04_zL(~h236?pcTPD6pv5*l);RMfnXi=THTa&Uli(10L zY}Z)ki{WQ?(-iw#N zo=)EY+y=B<|J^?Q6dZ87>#7ZyjDlll9NnBM-}3W!K3cKB$(jq1uHeRjgNwyc$*kOD zE_rOZEm}Hg`m2wACpgj7MLJHaxkfG!)uP39NyQ^e_5$Y88fQ?kMv@V$J7|MaPV#T$ zC*A%I{NjW0$C39W!`|O$Lcnd92ZJX9`Y}nK%mf*#DS$DZdO&Us`)NW2jcX+81yDjO zVb^J_4#o$sWRAE*nG*k(GZud#L+ci*9QeCnWW(TEYT*DP@y?J-d+G>~{JWx2&!_pIopg zcwt#qby<6>&qi1MH^A1HRvR_|=PjQC+g#UuAUR)Wy(qUZ9nk-1cdu#F&*rX2IhFQa zXhd;iWDNdjrFCAkbVIuKU!HFNg8P~B^DQh-a8nh&nLwkKQfBQ10u_Nk2)nLwvE@8e zpv6%Ro)Z*nm(_e__O!Be5A6Yj`@jWUSd@{6zAvp~fOp@EiodtDj%Ctko$ReF8!ieyqFn%W9F-ppz@I*E9%)bBmQog!^-u5G)NRP5!fdD}ps)67}}Nj&0!VKmo#1D@p5TyL8JJ zzg}K{I|rO&0SS(m=KJwXLoyuusng^Y7fFbasB$^j$k) zhr!xkvU1z6wJl=f%&V35%t!p!Wr`{E$fFTu`qXtjvrs(K|9wVX=`{I=A z&wDE}Rwh~>4cqaf#v8$**yn>wQk?iHji{qzRDAS;z<74HO1V#?x4XY&1OTrupQSz# z4_Ngx8TPjCUl?6#_VL;mIu!S-?Qf6A_^sA%q3$kk9k{Ex?Vr2y-M2fiaBI&!F|9ao zKDm05F?T$h%pkXUzf1t7{dQ||XRzE3+n?u>I_do69<>1R6)CxHQ`Qs+)me->UzYOEVxG|Z#o(E_PmN^4E% z?4>JL^9 zc~dipV@8n&O_YW}f@Nfb2q=nknLBPvt3V)s*||8bjZVUpn$bi(3}S%CkMeTsb5Dki zKaAZG%W!Ym-j9X8e=!35%OMrl%vHBRE!QG@38@i3shl&0qHkE&O|07?acn`9Kq)gYsqYO$?ESc1Y5(PUwr%wrXwDH;FR?{qt66S_iIn=LhQ zz>nH_yMKOeKg1V%-0!eI(ex|D$X4`J%zNc<_we+N_xzyOY2DAFbi>M`wcSf~KXGp# z$Agtk!*UnF}Gn?%t~9k%5KB&y-WT8)9Ts!ZwDX&ewOx$&}g@Q5%kC;%bx=I zwpE~iG#bQ7(z+{?{rTccMkR#;J%=aHz5Myw=_Oj+(a8}TF6pOPPSuNT*(3qUw>0ia z<*%fHXH7Pb)7(X+q=^$qWPZFSSrOnghRQzjMDVp9OpDU;YC`g;X%MmoDWi?TgfG>>;ML==!KgQpn{_;xg(D{S2+@mslL9=-1mDQ`?cC^(^1sM@(8o zRz(v+fh#q}RJ3u$jtw*&`@1-cK6CUwaseAAi(kItX^qEjyTD&d!5(J>DDu?71E6OC z#!htJg}#kH;L+&5fiX6XP!R*ZT zw`KSoV?>S`7t)PiqT|_X#oL_9M9~^T0oofrqF!+CV{}sEVVkn`^z>@R!MMbOgIai# zz4+VqY>*x?xO~a515Tm?El+3819%ik0}B@V$ET+^hCNHZj<&8^4N5pRn*4G+$d+qz z78p;iZJ<5C`u*}~IyiGmH+CXPZ{D9zZ(bW(7gxWa<6k}6%@khUYZY%ZX-miKE|}7` zcpZ5+3cF&Rm-{PcFHrOWQXBfGo|v=UO9^ysD@YMAy(PLByVe^gvNK>RmA$@WaB}4Y zqBesUsQF#gyVHxyz@fFp6Ah<$N!604xiV_fAdQYpCr?HH87l%{VmJVpl#%fnJ{g3d z>M!kvmX$oYE)JJ=Xg+HaMK{*L4Iuhix6+R*=p0KO%AGxD< zE*Fxv&KOG0jQv`Lw&y*^hDDC{8V`oPxb>x=^ZhbfAMS6v?64gS4xup9lJ;|<`_>cU z#=Zy22x|k(toS#H2N@?0NtIFw_8W&6s07o=h3->2shqbLBy@r9YZtn$?bcYSTNn)b z$l!EA{p3)@&3Ut()WhFI@)9nzn3;y++>8sLk8bYvkDE90Ve|Dqj7pVc|KoQN`0CU& z3VU%OC1Qnsc((K1Ug*4m^xZMv-|=`2>oRbFZ!#x(#{M|dwbgMm9GzYIcCsPUvyjy~ zKHm@dw!g^u!oTUQ6XMeENu8*(bpXkEtKXI5uN@~re|l?s)M&5Qg8a}vh(O4>AM9e0 z*geZR@XTnDfGu~gI-k8-S;8E(NfnLHZe7y)@~`eKx6?Zb`YKgQ`irQ0ZGGKyM~gQ2 zPWrVu`DX>9PNZy2G}a_FFyBzgr|D;;@$`Yc?XUyu>?MJWeSB%)NHO;ksF1PVmL^I9 z2!03=ei$P}Su{cbUk3)$#IXX1El%@HkmFkiMpa@<*8RwdWw=6M@oHx_-6RkC{Sdm0dPdUm)!D8V-X-?$f1wB|>S8Ro5a zx`pO4Qm<8;_ZzQNzhgPw&hQE~jxzMV2w*5UA>8viDc?I`9*_aHP7Cq_dYh^Wp9sPU zVdTC>zju%%S|lYUaj4)1gGrj!(o+zM@;(3?A%SEy?An+sW;|P^--AaqQiWPge%PI@ zS_n~_9u0QYf!tYHs0DwGm1MBp_&cAyyim5ab6M!QxzNyE`O5e7(#Q4Zv5%ywZTF@% z$~t{KKx$A*e{hdM@bEHw@Z{<78NGyi^UD0{kOd}{6R^rCwJf=AqUuxjP0l}sOL&X_ z^7ng`f?-Kkj(ch2gi6ge)c{aw3GtaeF?C;%AKeZ`k-piz$nd^GuLM}%UnK8sQSw|v zKVIL7L1HHwzb#wMObr|_&PAWMckZ{ggDmca+?}1H)0X+R%vMU&I;L#nz8Ny*s5ejceZV{i3<)N+^2k+s!~On$VO{ov*#e}?nU z+HiHNK=Ilan}r0|?3X_KO=oi(Amk!LnpLXPDSrgLO)N8vTC-ws{T$v+1i zui;mw*u&YgvPFNCV*7M=M1JAnI4$?i&^lUC(zj`Cb0yQ*rwA3VE_!nBXU1E!hUt^1 z+sCN1ol!AwxPJhtlrLJ`$IZ_7Dp1vBte{N#IA9Ge2=_<5%nUUTZ(HHQM(VC>i(xS}*+K&&sZy$Vnub z!Gk->1bI041S*UW=3WRlkum`U5Xe=dguZ07{Ax847=H&tn|w8wgK1e&>)hrv2Ww|a zQ8J^j8W=d_!v$5hj59DfyQ3hHcbp#vOGgxm4gCyvQi@I=37b6K5ab9Ss%3k&kod9im2Y-BCLoYfl2Cvqp|=W0PDIV( z3|?Jdqu^>)@Dy!gY}A|9?oTHJFRj5OUgA@H<(M-!;-)2K*m-??3dP&pA3rm02_V7?K95VQFhKU8$ zRyBYRN16GDb{)>Cw*f+(TH6&fU{5p8{$|<`_yFurGDQwsxL-vX);u8$XIEge223-Kl&|D$xElo3 zTm3HCB`?L#U9k3HE$81pmH$aDbVfArCKu)R^Eg#*U92qB9%i;PZDRgja-Ym^&$lb8 z+8cw}97ZX$q^s9pge3^$?)eUTS&k1|Ct}!K=7vRDAE0=I)Y~7^N+y3lxez&N2=TV) zx;B^z2m?s}lZ>6*^2q}MgcYL11+DJu3VZG2y-A`f3FFb5}HSA+K812s=uOesd8rJ95=dF%Z zs`!*-(zp^;kuuD7=(TS@w%jrsVq%DjMa}iE`eByO0~k{I4kYNkvLLQZZ*cIcwR=_Y z6YF1b8^e_!O(2vF_%&_F?~-XkqH(CGNV4KgGF-Mc`i;B*4%PKw@9-^V_DBEEev|S$ zb|Jd*iCPet_OzB&O%y+>NTkhslHJzIz6dD14|Z+bNB~|zWi5;bzLZf`gdqE?(B>K{ zZpiI6pHE*_47R*J|6NiaeqM(7JWDmI1y6;2hFLb$t_h&G&)c~$8<(LM4fz4tqZ-i* z#%=MYq$!9B;?ZmF*6_SA=&X;%>o~X5z%j5Rb`21{!^~Q^c28n+lG67Qd3vRRqlHghmRQRDD_hiIOFLb^c%b?61@Jr?qLEn+ubr8tAr$4+(#nrUU7ztk zgTcd$;iW4AgiwS^>gO7pFdTDeRW73rH6*M-Ow3ojt<9+Q)qvlnGFseaE7R#mKf3Qs zT+jGSr;6y2=3Ul0eCbl1e#wl3Hm`Yh+j5ML`^qFZ3(qz_-BO7)4|8?($fz6e9EQ2y z2AfQXK>|ql(P!}i%o8meu1&+KbuexvJ=qVRV~M{;Ju4Bw%j2MWuUg0b>BYdHMK5C& zOn^8n0pYSageF7VW?H3NMO%IHNgCEs8AlX3VAsmeo>Uj+u+=me_L{_OzCxv=SK5p{ z_bZcs?cPI+_skRG%1A3G8mQn`K@60`2v`AfT(gP^s$~bgO_qnR%p8vBeWKk3aM;ka zgua3>11=&myee|-UfiRVS^kDf)W*U7rnCDJ#ejrX2KK@j<0eGBk#yh)SE{`kkdd9n^S2;*Frdf1cNdV!Wr;U>KY zdb)6xmqJ=Z%t5k|fJOy3Qkw%gQLkq8dcvq2oKPq9Dg%bQ+h~qfGi8H<)X4%@Y5cjh zM$FuBkp+>8<6gnf@VYhZ+ZOLzAcGC^Z$7oQ7CzGp2m%7BBY<#y(1LIP$P(C)yeG3Z z7?Nv#4ZuMLPzV{Bj^RRpWEN}(vw|M#vlj|bZxAZth7T!0=iB%^v58eWTr!%aFfF-U z9PfP$O2RpI$=&Ip=+W}z?iL_mAzn60%h=&u&)5;tc@ixBZ?{0d1j@H!HymATOTs|E zba1FxaWu7cnLmS!hK9!+c=CXg;6XxCnn9JdmPOZF>|6JqTH{R@y#s(j^CI|LM;oE(j`Z zj2`#Ku&ulsG^EW)O&z4d<*tQ%;53aWb{BZAuR>oUxVfA#tjKMT@ z--8o+m3vu2C_3j%tDm56ZYyJZnDV+|mj!lJ*9DP#C(D4OX3{pX_CvB<=)1Px>gJ3e|bQIm1H%;a6xoAq^G`zi#n$m#|-bf zeKO_&in2`HHU{)z>u#DiD|^OiojNZmp=&8QA7zYoLMe z0e=<_NPj0c10c>syej-?<_;np{3M7LSErKfZ3rP$>n`9I!7&3z0@Rv`LGP5zrEeI2 zI~w*k*|}9o&+uH-JFolCy@rt_C0!g4U#Hd#SzYBr`5nwY?N`_v6>4$Zn{;&Ni*?O( zjkOxPW~sU^*AiKSrxuFNNzA1|AoB$mcu`xIMGGGcCD4-hMx`)dv&)B)0k~qE%cyt& z;Vls$HY*`==42u=>B^mmR&`4aIf$l)61<`cqT*z=T1PucSqJEN;Y)MKNK*t60oo=A zGe-gfil>RkNhMA7o=Fbp1s74GjHdQ&GXpNbi-JQ0A^QxLfU*1XxbUIp-eG_C>}>zK zw{I_+CoZ{YM2m|^HmBqcV|l*P9jkjZldforz8!U6_4K~Vhw1N866WatE}DtugL?`9&$U#M6S$tG}h%q^uv$qBe(7Z0@O( zo1(F9{YsHvToYnSUQfWD!8npY61!}W%!@otNEI+~xE${zs{l(VHNG?%zHF%Gqk>>L z&=W=`xiYIDVC<@L01hxm6Gz%WXm+S&d3JsGj6Ho8{bTyiDMHlOVThXI`zw5AE}T33 zcUI+78&NQ*F<>!Hz8$-m4u4|&=zk42?xvu1;pw(zVRZ>gUlcwKt1HxnadkzOzDMGa zzme?(ZQ>^~GUAgN5b8qk3I^(6)qV-cGsoI*fHtV`(YTST5OK-tG5b6B_%+`bf96P( zk;Z5KK#<4HB#nb-DBA@ETPy^Tj9Cs76(`sV17cVlIVdg%r&Sn01FLXAasVe3NDn7^ zSLwu~x;!`AIq6*!yZxb<3->lY8M&Qo55gLju0lQaY+%SdUF-ksGVV0ov&AiCvam?3 z;9Ffucwt?tTrT8MvKDg=xm+~90hH){F&A02G%#H68OilH-jBwvno|7OXa-4Zj{Zh@ zbpssl4S>}0-Ol_11f|M2_^gCFiE_Cd5P1U#uEF~tDn=#kD6RyAaxpb7^eaKNMXw4D zm9h$_xt^BQhs0|>6Y@7;eyIT9(m>QHEcGzDBT+`XBS}dHqK&8Ynk~mrhGI57U3LWA zbX~3m1{rd3>HSLmdQL`@Fz(?BeHPWc8pLNVC3ogJW-b7rF6O}FC<6jR5}6~bWkU+x zQ~gxfE3kbBLJJYrPwV=q1`q|IAlUwBqPz}of;mW29xo^H8dO-25QIz7OIFOqN|whw zpu!2&DG1gcP{FH~)2W$K#>a=j2te)yMK4fDX$S!jht!bX*Ng&s7Xqkzg5(=(p0X7r zeWp;!)T#bIiE+xOfsJj9YZU>0=4MtUH^BertKI=L!mwE+OQgA8aRGw{ zK>${(n$MH)7VRIKXjLcf%XMnN z2^QqVXQ*t~#IwI0`0}*KRux>lq5pQ;ib=_Ed`G!TGs)0pGyQft4!x(dDF`(+f zRSwDf3PQZl+t(=VlFSu9*rau>zld8m;M`>=_jOJPl0}YCbaI**;8o!Oa$cYjWOvOz zt8l2WMiV|W3eW2Z=}A=4gOF)MG^;s)xcB(Ar?@o+2G` z0_jMAVgZ|yK`;}VP(o`c|KPZr%QDSR7YN>Smres_4h9?xTp)16K^oRt~Seo09*e*AnR*cZ;V1w%*BX- z$a*HL7lZ=$9s`#qSVrbi%{154|2hlT3jBJqx+L@0bgU5uQTtg}Slwg3p=tNZhAp_BCqDp~+xCJ}S5a%dhHjK~s;P{4eg zz%c~4A6X&Np#=%aj~^f>4HH&gSC>3-kg+2Q=_ob~9cNLxjgN~1B9=tKGSWa)9DsQQ zg;W|vRc2O-z?DzL;Ydgpnb%W!fRC53rVG{l`tJ?b7a|1U(-W{77P2xgfd90z1rG;J zX{I+2C?f}i%K-KUrk#_^jp(R0Gq^v=)?zTvzXkTO{9-$Fv{s_0O9&tsIaH_qQQ7M% z6{;Et>_r~T0(Onq2Y5e5@&~}{1LTH=AoZwL0Fg`G0UR7$uACB!4vwJr#dtL%*RB8r z7>DbEWf3oa!NDAa9}>cmIh1XI$EW@N+-3pVFs?!mD_8p~-tfcIXj>n0`4o?pwQRtJKI=nBGzy)O8G zm#4x(4gJ@DB9!}ACXn?j%QqYf!6(bXQPO1-wW@H1ISFu+sc?tFxHva(@$m6*ZvfJNFbTMj8{~KtOk{lc zl*~^Vd8K7ES@>nmZoZ|u`~2A>Iq(Gl1mHFteB3jpeT^{!#R!! z{`1pZJTjRBq|{gsnanAzUyQ0-PrvH_U)*|n%xM(JL(LzqELrY#5is|@TVv>s?}}u6 zw>On?O0yXSN?gij96+>y-zh1e+E8;^1u|?;ProK3<-dg?hD`q58jbk{$GcV15^}SP z!fSaX)9DCeSO~hF_8DluNrz9@JEX&>sIM<_%nW@5j3K0H=HU$8H}?A{A{j3nMVBlr zEDI&8A_wnVLLU>UeR@4D2rjdNL$z;aiTcPQ18EqeZw>QypE#c|;gJPuGxLU-8|Z=h z{;m1?Vs6mI8^d&A6GHNCHO2g_dq3iLC|Tf3-bguS@_(xlM5@)k>FHtS1#*pCL1pk5 z#QP#PkWx^Y6C6B-pQPGsY@(Jxc+r&6e1(X;5CTc)#V2B$fHJbENW}pLUVoZ(DcrzZ zn!W#h7mNDN+kI#dD$5k{C%%$Q=7ji4L&9|zZoQ1;%U6gcU6x~@_JI>fvJg9!^8$I$ zq#bLk%Q*}|D3Fzp$&Tjd=jTmPwXuADGK$A=6Am{6FGvxF(*TAOoN$InHwHtg8`;tS z8D&Z`0yf4A6LYgjlw~pBn<5)UG7)CFzYbmy`LS~O*+0xAWCB%vC9IsUx!oR=BW60l#~qmS&gY@ zpwez)-mBNrW^miYhPOY=CNlBXXcAr+`yjzyiX6_t8 z$}(N_!QlZ4lEi*3SE?6m3@8Fgr3j1%Qf9;r=$XIQW@=UtmVrc4+#SjOX`Ek*T6D=W z=Y*gCL>wsQD1A}xdY~vHFAeGBRyv%Gkqp`cRPBNclR|te=UvXaB!#(cR#+h>EA`!C z|92$nw=*9fSecXz&~DN$ANq(hGBBKe$ma*ueB)#Uc+9*A#S0GJ`%RANIlT8%|1Bx1 z$T`B)4Pr7s;gkzWHc_B*Y@#%(NH)jxLQHCEimKF2xDSmFO<>OI4V=`}({P6LNS|OT zS(ZVTtB2RKbzNH_rp+n6aNQ7$DnCx@I`K=K5CS$frifjy(?@;0DMPnq$KB?Hq``%s zpYZfn?o~u;YBs_=Vs(2nlDT_&xt}2%2@06+>$?7}unA1jjolkmy}UHUsKo=&5-7K2 zN7MLaN4|0ksg1kc0T-Yf07d<#10Dd2SPx|r_gZ4;dH0`t`T6(WjYtDUxN`$c9`dk% z0@Mhz2R(F_U8p8M?sxH-kDxp1r&QhUdB( zB%A@t{)gW{lSRtS63I#l zGxEw^>q!&bF*P-WKy*1b^tzXGgkgoC8VzaCb5N@#SV)ARV`sGgHUKw|IJ;sKy`PnH z*wgb^u&Wwz_w?PO1nH98O)&W2{-JTu1u~flAX91+B~Xae)X)nNaOpA!E7qK!f0tqN zBqdx(X2J~?RZkVFU@$0%RQ3C~OA~lMHRZv7G$b{smrwO2&blgSy$cRL#1Du8$bLO|!>sbPh1xDWUM93D6_of?Yl+>NY~ z8K-PxIff2_m!xj`tX+~eIi`m8@(OiaFAl=%hsf*t zXHp0xFjp5b*AoL&FcnxpYyfD4fEanxItO%+nlLKTs?Wgk`Kb{SdGQO39`YYZq3eGZ z8C8dwZORVRW>x6V0Z^We7Gx(sKhArL>oHnx@rX132jUt@eCGzxA#TEm%K=H^e`ilf z^~%k~ek|BH&60rSi~yX_GJHV|?VbtMFg_hX*m2x^^-?cziha*eXCE`JQbxWp&r?LH zC8KeKbD@{&xk1tLBvaxE6SnqqTgyZ2$lg_()cf(whT>o362dq0Bs@6DCROWO)Z}qH zHgo{l6X{a&+@iy(?TGpNpyMYD4@+$@&@ze*y-|Ojmw}Cnfj4TYmkb(XS}KXxpDI47 z-dGuTv48eO>0&H5_Ql=6Qn&iM9Gx4(Rwa>&Um_m)pggsp6#{n2Hm z)nh;FbS!hKK_vEd=GOk<#t;61u7qp<^?&QtA(OsO2k-uhMoE4xcXBa4!_y2>+{~8{7}SQu}M3G=rnN z{IW;|Gl`ki@LVRRTX}$MVY^x3ZB1{qpQpoIeuIo{`Kx&c6FO5jKzD&FX~F9Gt&7l` zwU+|F`$2GHus^(wD2@OVFCR@1tiTuflI+Sb%8JEx(Nu|ba(4!-{iVz z49okKcaw?~S;*S{uO=1%uoMPK&EFk#OkC&8v7~$>5Lq`=6?xO*$t^ZEzIp#tbK1LM zF75(p6{kc`-F|KPnhdc8BK!R`ZcZ>7R*cEVT zej=-6GAF0D5T{MlW`|DoOMknAbX>5t8032O6)D)zTljhA%*XX{rFpSWi+6QCU>H4N zTFA=@NDA1ZbX1@u!-^}?`q!UTqYhYDPqX-Qj2)9E^8Nj7hUf1tn#(e3Qd`pTQK_$0 zN!0hqh~ZI^d9qoKjl?Tabi62=Th{fKWZ4~kX*lEa_A3)vWOVA4?8223cH!j5aN0-8 ze<1nKtv6EiV|-M%`MToxA}!;!JKsIq`uYzfab3Jwvgy6y+Aiw0Ve*^Xe8jhh=ba(h zesG6K7Q&-`95zS{o;lGT!Mkt(imZGPAM#mHFdE@nzUTK_t4h$-#3{my*Wn0@pj@cS?i7`1;O zaU#YJjHmS^bT88QGsXKKxzz5&zvO|a$o2f)*)Sx`;>>^0#9fehs`d5oS*<)YujkBP zg4;cdGRKhXc3hBiBwUmxPfAsumL?BB+piM|d?zWd?pO!e9a0HDA+>sa6Xhq&1peA} zcT6;rmr>0^WbL`Zli!=4hh}=VPgHTGV2i zDc?^VyYPo^nmxE^3!lH*-s5jJ-6uWMkhe}MRoCl`zITNEQoS}6N3cpCWMR~MIbn`H81KoC8Cfi`;8nW z8L1ARFOAP~5L1k>I&{xGo?^sy=m>)$;@c=;k$0GU8;mCZ2ja52;CbfSxpm+t`TfIy zx_!1KDSRsq;j3sJVj!Z1#1ZfH?+PXpTxx+6libB!3V423o!jlNNnhK$4OF;% zP=lIEAW*kE6s&Ml^!|m<@jBiPjVsl2GPgeKDFQfCxPN4Lpwxrn_Sp4jKXk=j1Uo;b zI0);TK59Xc1@b6f9=*?+{09=rnr5%#?{xB|G3RPvcd~qUkkBM$BmW)r4+#pg7*R}o z_jgS+#o5u_r#*?bhRgDIM}-c0tdvSev`W)jxznucOSd1i6EPaZMEn8za^hUKDP1Oc zux-BX%W>_5XM0_q<3Pd*#-K1U3;vERC4F{kNi3z_+a36!ZGq(K zyeRO=pTZ)2wJ%mS`*ROv38Zwdgq)Hq)$LeF%?@n?HDJWNZU%C^B(!haCbvgL2s_c5 zG~}F>K4Y~z9T7DXO0GfJ)~|DKfW~cE2$Fw0q{`tY(0TOZly; z>N?`dA7eps&?tcijuA>Iw~qLA;k_lE6s)pl*4k4Q*)P1Uofj^08&4I_i^A<5e0$LP zTr%5U0M}R=vAz;{m|Z+N{b%EAk-OSfZEIG#981x{wpfFFJmt*zmMNaPU>&TABc*fe z)@PiQp~!d6j}#vkMcO1xaE5pEN1j+1@|2VY22(Wyv$uXTE10zND57W{=V38Hh_-$i8>JVJugps>g(gZbI2lrTO z>MEt+nyTq5?AD{A0^?hMRF2N(H&>q22hG}X&`APUVzi0=T?P9*!LFOu1A+i@;)(W@ z4dzOQUd6n=eM~Md|3(1mRfn3dciKW?V7YaC`3UUeJaNhRW~wfcDYW>b|3kHzw|YAy zh;b`LOknr+5QF8+>1UB~tQ3ieIkiYffsey|8$2>svD9D7xUb;%)W6*i+Rhpgj-c%E z<561@I9Uj@6MuS|ms|G$a5&zP%qHt#q{Hjy-#Nk@VU8nm-&OBSJRjdG^{<;u(NX2y ziJEq|=F$H~3%-X&@OU4)uue3UKRLU3gWu7jc5=qwr)sADR%JHFGoK?hjc~NtgzZ*t zTl|IgTo!W+(#Poax|IDQo#ZNyZ`>VTSN@wSQtW@#f2y<4vLZcNtHxN5J(;^K`r=6$Nu^>y$|Y&& z?4Og^w?`7#?8eUUKP=nz}Q5zG+H% zQ86D-LY`3>(U9y8ufO^(EPC7TEa-q_JfV4YoM_3mE*Z0$wIRSV!1bosaxm`O0~Ar| zc`z0cC#E|@Vi{6%ZVaybl8kgpUdo*x(n;=O$(t^l?(bB42}kp7NbIfJ5u__7zYAZj zk&Ttl0-U4Dj`ws8Ydqx59qjS zuOw=_vW8-NwzwZ!{oM6kb`#i&411`!l)?yo{K>(O>VDJvZH>FT(QfTx7ouBP%%i@- zSitZ{ALsde?&gG6SVP0~3B*jOq#36}rWNJMKa-#9pDRr4GS>a@Q~qj2#Ns)Y*N>SY zs1ul8pZm65dB2y(@3l!7MivVRx>^@De~W+M7DJX{S?FcepL79Q4FwpAX^?Mr}g94Ek+`?_>?pT=K;DDdvXQ@sxfb zs@gnSXWFzq2c-=s zy}#n% z;*rPGcY7phSsgx8Z{_}$3KrFonVTkfr4n({-J9GVuR=-{&lNtkZgQlUheuEE(TLV^ z#Fva0J5h~51L;OW!~^9Kdnl5-_WwY>y9*gx)f?DMn5wM%1^i5t@JQFmZ#;<+&u}A$ z7pH1C9sz}J79O)WuJ|f#&bBO3q6b3N>}{5`eaKlsY2h1*X+CS=C#iIbu9MxtM-mbBj{*#0 ztFG4OQ9eUz`5K=eRqMhN*DGsu7n33rC#rPDe?%MHcnG)1<<*aBfanZ~CsEpUwFC>k z9mE&82Q$8F?_O_bpoe3YtF-(o;NbFIm%!uFF`~XZ{5BPA{U$Q>f6ILi$Z9B&0*SHF z?EAViKYvR^;@xiZ%^@i`#`!LYPAVl1%h&!nFkp~#7jCdlFtJ|aSHogkR%5zI^|ifg zr$WLp0sxXp+Xwb^*Cm#h#cKkljyW>7Ua$;zM#>eF-LL;*Ap|wYeo=|+C-bOA(tQ!W z*-0Cv{kNm+Dw$>KBl&)FX{3Gi;_V9t_cb^1?^!rQ>eh+kxRf-qsK2!Z&FM4bLhx z*%6R0{`i44oW06Af7$vfs``~vqrCZ%Km|vclJX?(2f4GKgsd71Sug% z8iOrC>i3^g?iKP&o-==*jS8`>nG~4k!gDwlxEp4inlb}@8|@xGC{^uc(lo@~MCV|b zJDaOYQ5M3sBziZySM?3KS&!t0W!stioML5tlT{8vJd`wHFxt#7bxM6C*#;JO-6(qE zJ`~5ay!rE)^JDpL+MBd5_}KebLdE|;J}sJB&R05VjV;VxJ>HT;3xDxl6BOySYu26O zcE3|%9+|`A!Plx-b3{BHjk))Xh3_xK@Fa^;eZZ-a%UC^cNL4=0KTdg$pBd+2whiTWPQpDhHZx6j@64)<-b!}ITW`gzGe4B;_Vm4=NlDwGDl93kzkK<{ zHc2y*?UzCplgIH@|BOwgxwufT{Ws6ln5=TbdWYY{UCkS zvqwmq%YLiBBHujO{ZErz41W8{2;Z&fWzYB%L}hR;J+Jm<x-T`#)!9`iQJ<*wU zy18LlhdYvp%C^y~beQK-6dxY?jjE#Q=y6eciPcR#smn+B&z@jBw+yO$W5zOwgS~Fr zGWbi7y3YQcAEoD5yv#QL8_;FkYvz!-X1g6~;qd5vPzGUxr!289?z0#7%+(Y{H+ME>ffq={?JziD+` zpsHFFQT+lza?hUIHA#@o!YYh5vvw;=p(vb|oFL{KXfK#X_M`q_qX?e!)P-og`BC3- z_FUj>;*n(?mvQk$XOD@}jwy7FHAbdNtn-x$X#(_30%NTe-FLO_<5iEm%p{#pMjD9L ziifts`xP$(^8SI$wK%rZVyJ4DV|gtF?o(l8_8l}#p6aSkEArd$iHK6;&3r8eM^TcjY()2WS z8XHEdfvq8Y%y^~IAl8a!@rw6>Ugvm9*WL9la=wocLEO&z7u`lkgFARz`jjyC3RKt(VH=^#<;{6hrmKU{h?UAo-1gK%&|2 z$dR~E**uRl#aZha{oM_TqPb&QE>aC&)8h!AMoXkPUd+_pGyPxEzh?9HQ5mchJ-A|U zdbVFGyh(ov4QLxm7hLTna^SC$3@LAy(mNLP_5Sp6`^9b8ZX9~QSS$}m03ujF4wU8V zl$2V3X{GMh^G`J2?-a2=t3Qi5C#c=_x*JD(mG7IraFi^~wCdm7OSUJt*CUTS_l&K( zr&Y@TM#ti9QbZ@zgonIudY=5#lviQ?kIJ*)vyVL^rmKacv}R$*k&}WM=g*U)B`^7K zR+3q0B2qRxjZkl2etU^=GOryQetPfYmaiT!@_FOqrPt+-YY!E4CeQN;^qzL|(K@FV z)*{Qc#V+ohYqXyTZFwZgiTJ9|gls8$a}Pe>tc$S}yR}VRybX7b)$N;(l(A_2d-%$! ziXfxr`Q`+A8mDF=jYk&|JNasJV(Z6Zi?k(|kR8tb0{OJo7fZiAvab;LefX-SPG2Ah zO{v%8*Pl;$gwQLAXE|*95Y9DYhb@@MdW@b^Sr>VGp$-p^Von895I^7nAg z`Lf5@Y^!XmL*`?nG6Uv}QsNk&W>s>o+PD3W-VT_>un^|dI%HDqO)fa?OAboZGicN| zDLk(I=|2>vRn0{{i<>wN6HYqv?5ZSMB~{*d!y|~Y{Yzz``y)W@DlKHGOnu<%;CoMp z(!?(Nask_~B{fMam{p|nXULeBF>kLY*j6ajDnoox+(l~0%i@R67G3jLCVs_Vex;LK zqL1ETW4GLr=s;u;PEnGXQSj!$J=fPLhGYP-8rkcl5)GDzxhwI!@_*u31n>3KN&08c zKAWr))W+DwYfrDgcRAAiX1mp_1dr&!v{?rCn5T3^%^L`&?R_AK7=IxAOJY5>TSYkL z2A9u=xBcPn-|2H&WceQZbup3Gusa_=eug-$lRJSP`J=X4Y(2O9F{|AhO~@2q2IFDN zvy_a^P55t3!UxgJh0JTj!p`3|{DY+lks|ia$v>^)_r3;XTG+Xq<#`liM+?4J9L*|Z zSZb6#(r*|qAA|+rvrM$tX%wlvWk%2#na5L--`cS8U$~(t9NTMMeXMFG<^G!wDUVCv zVVy%eSYfzaD}KL2dz6}15BE>QhGOcEZG)90Ik>i;r9SGAW#m#XLer-1g;nL7rWi8j zxHpA1EebOa)k-V&G8D*SG~BGRb|aYE)!vQukNo9Tr1;*|TB(gz!c0vjedyc>2uHS8WNwPrx(s$wJSRChW}G{sU?7 zb}C&JXH4|a>NvCmUq+A`)lo$1djK!{$tMuu`Wv^stb}DOyKISA7#v79{sW15Ic|1y zTP;8R{NqqkoE!b}Z0_H+$w24kPbd`<$SVDM3T7ToVr}b@=O8kpdf$b&YD>NoUOUm& zq0pP`u`1Gal2xt+6Oo#T;k`7C*t~P=VWLp(q!6DoRNitEboeDXR9}yhywCiW2y*dL zG#CBn%6ehG)7WsG6%|GRz-ZAibH(fLd$y)YXtQj!AQ3~C+wsgBIOD^(6F@d z?~+MQ#?}7n{kILKQU@8c&To|$wXzy@4!e(J&`l?cDc&5KvFPfhH{QE`3&stA` z@!?^ARN;61rB(=b_fxId4_TWH_>l1 z_LFbCbVFxUXXZSruM*6|>GL^}2t9XWMuP?NZ@U zOrzZDQ%0OG=5T})=JfK{?E4(V+X}(Sd?G2UR!+?>Jqg3Oty$e(8Lz)ww02V3=Ux@< z@;+uBYqtwfNhL=~*v+^Za@?1;^lyblC5NXfN(X+A2rue!bI&?$|dLzC`ZwG-rkqbpyTyzqL)l9PX6`G+Pr>FCz_@i}FJI8FNjo&&?p zB3MFohKA_F*_)fh2hez{a0#T{Rh;>H0L~#jdHEdC-k>!9_`{r@Y9cCZCTUd1b58Qm zmyxX2_Pz!_rVn2wNNh-GSy#tB&76HV&tvwKIV0RCnyTd7zs#d_AVV~F(@6nj+_wVq zc#PzEJjvT95Hw{(13h{>Tkba|>fyF?p$L#h* z_9)9}`BD&X+okN9AcL5}T*~3L!` z+1REdyNt~!rN)SP56NV1jlX-hn6~qbcO}_{UKZ&XsZ)agMqoS5-?#}rwqZY!uVC=u z;NHZyU$?$cld3Q%ISX^Ot!Ay5FwyaCfOPyq1wjO+pn1^z7PIg`_v|Tpn*l7-TGxR5 zsqWhbbM7r%v8CPa2%qvBNhVU*9f$dawYL-~vnBRMF(J{9Gu5fZ*zqEUg1N2LzMT@* zO8Oxli??ayJWgY`>x`TxNY;g5G1K~`=Mpl_#j7NvG3;^O4;39lf75Hon*H6XCqsG+ zk7xFy1-oj=g4n(5-^6KIoozfuoOB}^UX|7OOqEuPd1E7QeC?j*WzuFEhGg5$+woi_ z&XH>2F=)qVwMZE>g%a!CMR+m_(+<0Q-mZQg+}8X|6g#1+NFxH$E`--;9QVAVdlv6B ze16cVTWr|*fkc}AOO;1vFNVb00v>l#R7RqDUgREi-Vso8f5O0u<*v(Q)?vWRIr>+A zSkzAK@vS!0uK;VSvZDx!EVW;H@5W1igl;MK-^i5yGa)o>JF8v6HR)rME2y*Vz8{D5 zz-$;NPOwU*K@KPREqv|nd-dPgIi_vU7uo2;i8OQwrw8*_Z(;G431P=s0b7b>ZDT5_ zYuD?Le=K+!W{1Q&9@6Mj4wCEp349`R;64lcsL327!Y#O0GU0fYbYx?`0g|aoN@f~H zHxzOo*OE^VEZYX^YzLi2;EECqM&+SDyjZR#S07Vg-gO>yCS}p-9niny_vY~N)JG#q ziS8Y-=TFqlDZh>xf8)g1tXo{ISdQzv?U)M94bbCD4qE-vHHeZ5TI4$NY(CAtieK}* z3&CwCl)e=6joO}={_!`FbgZ%77TfJ$m``E4IblX<%JvUrb~-BX%R-nr#w#=Veg6%0 zQ3JETUMI9`Ib>K7Ug)`hP|7+}NAjlaiz~LNX04Jcv(y#158mttu3uM^|Bt1!4r}uL z-#!9LcXx*{Vjx{gr$~?P?i7#^snG&5hLns{a-%^&y1Tm(aG)R{AnNs1lV*d$o0aO8i-cx**`ir<+h8e5^ISV9$| zc{~(j0b58%X%bb7L92|m-D{@)%JijX6}xg>pGNFDB^j1| z3tdO+M(b0SHUHSsAQLaU{`jlh6%>-9`9F-Qj?bbmiPP4o$WrLo9+#_GIFhB6_tBH*)3NY^NvS2j~zMRVY#$!t&yrs6Vka1#J z2KJ}2o5!>87~>=0a)BzDiNm7w8w@v=w(s3&;yfg)`SOsDj94yB6Blq^TfhRU14A?Y zBXtyT0qY$qm%e<)4K|%_w<{|3cE@<1zPkh5$p|+QDM!W692@9AivEiBO?c4ns@!IN z>PWrd$IylGr_c#FJv4u7f}1BKJe+WXD~P@z7ppc{Ibvy#Ok9muGm_L)2+~_TSaNs2Zn|fo+4>$|XtqNW-}|&v#9Z`GhM+H_={?i-nxA$adaD zCMIiAOI<_maB`qBbb*INACu_CcQG+^!{O9+jgGIAvCmCY=RPaKgyh5!Jn(MG`+;3o zSynSWqbhgv(GK3sD2d(13Y2tE-1R+iSp}dD#e=?@TgoO8yCd^5*SU@d?rT zVrbT;c*2NyHbfwaa<_c-F0SKNg5oYRgxUr(T;;hx>Brj}D} zCN77o=^n^cqARbaLQQfZTOxKy92Fp!EkH}Q-rH>d6S+};HT!n$*z0P=_Z6*H>Po{X zs#4Bmmq7Q}+O=O@eDSoSW9}C2H}7Z8ZJ$LKNU`*^L@1@;F)gyv+^};t#)Jhkn7=p$HtEyDTtUg};e)hVICq6i}_<5K@ z|FgE%l}N#RVO!`behyqsi^8t}@2GsWZtwZklcO|~)$6oXbmOmNk%g<5-}cp7*@LY8 zfH?8ujlxgjtBA{vc(;3F(^1R6k>P3;BO$O`1I@xx=L#f->mZ`Hsg%LZ771>oXzOD% zmZ$dWh!1i6Y*BAGU^n1dXN^z%(F|{Yv-_6ITJFBpNsX?U_?}n&YLSFD_Z!VMwAA z;jESGvn3|`&}?&46R|w9gzW+`PXpaRlR0TSvI*{>ekn|5_MD1J(S}*+6J*D0%(|5U zSI;rwiwA}7zsk{YN&Zu-&9OJx8|huIZzN8ko1L4jORo1_x2xloYrntLooEKvnq*?$ z8o*i{BnZ5P?%J282r)#SUqdeX?BD*WYWl(KIrjXM$1oQ7IaYQ-Y_6Z~vDCJY$6FsX zKbPtHWTlH?H61)}6z^41l>H6c^A~@oa}qd48Dd|kvg)OgpMgmf=CuE1Pu}NNSY4VZ z;wZm|jPf+6Z-S#Dcv_e417w~_?uXqk=cE}4vSU;y_$g||Tx-`X@u0B(!dP?N(%x5o zzG)zTD`~9r69cP>>*&+nnb|Byw(RnyAaFYwJw(`f?axDawY7i5_8*DUTENmZy=J0Ud~qMr>rFT#gLkE_r}&QzT}}TYmR66kHknvioiJuLm7Z0_0+8)y=3!cx}87 zO{vWC2wbg4zvz|g=Yx4Vq_Rcy9lZzQGgAn&lUm`|DH=wmJEqkw#BxnS`4eSl8Stqb z$M}_%D9J6yRJLD_Vvyz+xViOG`3F?x{GtgP zSP3sbC46~q?y%aS_j<65{$4xpMpfi}&}APc3D~&9=?hBM#FVDrbG7Wu2h|Z6BtYL* z$^C88>I(wV7xm$e#s1p~2_b9YK=-Y4M|#KLA2rAOk%LdSo68~n3UA`BA^@ek_Ek83 zyM9&uGQH%w%TL|rwcQSPz}xu77f%2i>-9@)`Onbeu)mO?w^Fi?Efj+u>(s-df`iz( zY>BEH*ctsD&`j^}=SCTgDHXK_!hiAcbyYd)g{k##a~2-Qu_T9ML?4DV7w7vkhJMSReT)Eh$Sc!<$xvf5}RHEJk*O{Ei@21~@Sjy}p z_B5;;Tj#n2UQ6(_hRkg)s}YJ;)NPXml}1#`Uj}i2lhLFqj)x098gah30)zwXe%kw= zQkUSXG8nA1ROi<7GlP9EP*SV>`h%{1lxi}Dc=j=gvUMgt3STq`h&ASqU1k<*7tOzT z9}lp+4ImA-!R{_^!pGLs7YKgWl#5OEDc0D7jspu&JgrQ^KPw#2e*7}F)gy|_k1=MP zEa`}C$R0{Gj~0yk*3o45lt{L*Eutg2d95WXO+r2Tw zr)4Qsgi!CT6rYGrlIc3sbOkpEDwC?Q^N3+lGEsIQbtzGtcf7r+5w^c1#q)ir{hb~L!fgw0~uW-iQMWEamd0-^BO zvGW{bt)LY?AijPQ%Dn{6Q{qc^b=eDIG|yJ;nHWt^3p_-7=IJJIut zsY)BBbs{wz@Mm@&(VTs%SgN;=ZD?a3q?0CA?#aY6Lv1>y|pmh%KENz?S+^UEr z#NFG$fvMHybMp>Nxoa{ct1svM4A#r(U~LBa*Kzq24`XqW6dm#Ruv(TY`cIMH-9*A( zo>BDEQl4oh{D)CDE2~z$#rHOUd?koSY5>PYq!K#COM3e$bycxO`VEw^mD`3DE8C9s zRZ;4^5ocy6FFw=Nc&p$PQC*8EG~Dj*5u%Ii%sh}~A+1Ng<_jL>f-#XG2IDUhx;_sq zB;ksG!(024T(cnA?j~OeT<{d_^IQ%=uGePiVp=W2jTmd6PU>H^1H*nQ=!GqFjSSXtCEag1doCf#m7+t-72ei1mKqM zVS~ieuWN44~)0s`88=# zZq_3x4??LaH!$TycZ>NYj@vx+bLO9AxpXw-XM=-nCR`; z8n$9IMrD)wW#`ju>^AQ5_mhXXG&s11YZ&GGTwCI6*X+o9Z#?1j%W6h6eQw!tP56-5M7Y@ltabAqn>S7ODpC zjr*8?E;r868Q3IfoS!(5j~VxACRA@ADP}AQ=+&Dl`POI_l5StBRq7sBGN*OICPiR> z+#9j`Fg-DB;37^(%_ObLcn$4)XhDm)%*!#&cd5JfbbFwFwvN8ICnLi|s!s-$O3o~e zo}|&wnmC&p*uvjBkwcO}m{Q!lm=sXNn*+&-!=MH642vk*^S$qVVdlDJAIFVW z+JT%`JvaTTppj$bt{+hVV$Cp|aN=R74f@94J+|XP){>k#FJbp2n&OSFMy?Z>AtwqP z^)=zhb&QrgSGJN0HgW?N)mvPE2#%|0Wzfm?Ysu~fnq;+dclS3|50})zd&!~{47sx3!f5X0C4XS?!pRT%=ww_Eum#hV|`lxNO=R8$;Y+}@xQmMMv ze|-{PIpl)kXhn?&e3A9e+uUmXdJ9+|7)LRdRr~q+F*+``^jyG&a}j!O%Jo~aV_HJx86(4Mvq?qxtzk-u%Y55C zcVr1X0(=pQPaqB)g2};1v^Q{So(A4ov2_qeP~`DZiOwsePK)~;e`y0Vv9h=!GgC?TsoV;a>oIYtnTafBC(rg}s%1I2$4RT2oJx==}uNUj# zy6;KLO+Q@lqL=OQ`vfR#-9ndq5mY%?V_JST&Y&4+7OuQo#4Y-mzL2a+%M&&5hp3+H zc#Zxmi=dpQ?M$WCvxV}@Vv=vtX^0tvgU(D{B!h>Pi<@6dfCmLF_^_&nn0*tAUprJO z?`>e@u?bc3rmho@$UxrQi=}iMCZtuybJwXygQe1(I404)sG^B*Z z^3Ml;AI+IA`I$|ZQo6gL{LJ5dpL;DR#Ys4TL}&3KGLKh>A3d>JKB{1vq#tTb&Ke7% zdR#MT^y(7|54HQ4v-LUgvin?S#FedYl3H0$|6Q?wvAW2U*>}KJu7+~!DuluA6)=GM zmLt6z(OeAPFdtXaqZYs{N(5m54J?py34uzgmXzHjv;cbT>`LJxj^2e>(d%C)!d2dM z-|~wD@(#TCUasO~a2Oi?gq!5O6VZf`3X^(*>sY&G6I$zhr&42IzCcG_fXFEu zoMM4nd8JIx_4#$$t?p-iExuzu?PonpZT<%WU$ko`#iXi^-xn9hsot+lrn~md`r=3P z+u0Sk$iFP=i&Uv1oMq7>{L*xM#4%CdSlD)Q`vDr5R1-k!n6oN5VmleqKADqZoAfQn z>|HHav!aS`a~)&yKEN=QO`{ zcDt?VxNz|8PDhKwow!1CkF$akX<^e2OU^Lx8h+0x<*pm2Z-)UNkg56fzVN6Uh4sfjFHT1n!7q63l+c&dV4yR1Q+Dqw~tDkwuB@1t} z-?w&wrHQ$OU#{OeY%lb@khFDKdy4e*PpLiq< z#GwW$ah{^-Sp2Hr@IKPj8(`6fygcukcF#^a{_R?NH?ldi+4LP7ki~RX<4R6!)19(s zD||#%sTw&hs$?pqXxtXTY{%1w+!Ji>O1(uO@w~I9 z*Vbkje@Ey`h_VhGPAbUi|71oy9Yd1cCIK#95a;{}lag+ggsi4Y>B}e8#Uo%;K^A)z z99J0}=7{Mm71lpt2dhpDG(U4=#B98p{cTkjN=zpp2}>2jB4`iS?H;l%@tE5CIp-&4 z#if?Jv$!587daRhVFc`b^JCO}NtL8bm#l?~GOIs{k~2*n`4TRcu&w?+K^(R z?XlSbS_ggH=$Z0uZDGWnfZ^>Ie^*?v=QO`EtnQK0v&ZgOW3F|yjbD-(@C>WOGDkT( z9|;3OZ+WGB#HX6V{y^R)chExOoQbiOX`4MO-@v-?tUFy@!cf$AOb1f8s`#0BSg@m$ zMC>YP#*H+K3{PUN;~MMY1fEs>SN#*1=Ty$)Unc~-Yp1I+J%(v zysGf;U8)p^@!F#hpWIE~<_O@FF)5!fCovV}tdM@eqGrJGaFRhMyh;Iqrm0?GZ;YD? z?C;30?T~U0kv~58*t}d`VFU~A2}d+NFSkEkJyjmYxJ)5P={eg4 z73~ItVI=;}e;CAb#<+tQqQ8K>=ilk{89>h~Mno~dA-T}lk6!%L`^KP}0t3FbC$T{> z&%e9J@z&WrrdyWtF{@`lK-FZZJz{Ne2+Pd9ax@l?s97jx2hJcsv4Jn8n+q#!UWPU1 z;*T-Dfu6?Cp^5kjX)c~VFdvDE=PV2|mq0;80?t+U5yZ7gP z8$?N{lkkA1F3X^@C2jfKM(ViQt=W|e^P+j~vKsW@{8!^F5&@>B7|S|;=2`w)2V@pj zc8FOhD4+s=<992iXw`4#Aq)&vWVPFoQ7#mk0&|?mI zzIw1Y`Y#&T!zt`H!V2$OmU*sCjNNQr@tPqS5Gc6N^@da0aL zg@u=oKJaHn;SrW-!wI>Zrkrr|c7Ja8)j^bXUb430jWqn0ve8!wPzr4Cir3u7%WTnee!QIz1f$(-gaE06Y% z$C%C{KNNM6XF*e_g;J{-aYXXc5W?E8%B&k^hS5A;_joBvr;e(|Hb05IX8rV((r=o~ zF(s}B!37iGn*T|B1mPVgvPzskulR&q2XPO~e0h~tF(&TcT10JQco5>-hm#(~)YL;) z2By?O{^B8^8}OSANqo5m<=f>;s_NjYH2DI^JP4MU02YPQkEmE#Tck;{Ug9MXS$k^A zY<#p==M165wZb6O@8Nojv4aIyd@kicB(BN;XmuqO%R5!}ZjB31w3r1X;YTe2ThA_g zlLcIQM}gfB-33mASm`2hl$Z2})<609{{F-@#WMo~Mv zuq-`0yKi7_y%&qOa@67(FLsa4Uwa5OfhY-lI=+0$)}XC{UCv;n2MOQxE{BdcQ6o!( z@j;uE`6YB!Z5>>p)hZv86#iFQYMIY&E03fV7}y$CJ_cfa?b(}~ssvpUSN3FMn%2&m zfX?2~F4rv7+2`aDojgJB?XC2Axzr|PiH?$efYLs9g6L}SOTaxKpPnrzjEo)FB(!eJ z5wdYJ;E2u&+i>bW8!L*Y@Xal9(VjbAXbr4&4-;4+PGML*GaXqtF~4>~Rcqc1y~lC| zQAPT_DbA|KY-ghk>~&n7TRgsuhv=&{U!oCi?)roWvTn$%lOl=4md8pi8^31efz~D z`c={Cn)Vq|d1Glvl$B|~iKunQtB&c1M3rn0y-3wE*d{OFz*c+Z_x$YZmyS(~hI8)B zlkX#NQckWr2Mp|uoa2A+&#?tZgDQ!>Rx2{ww&?m|fzg^nRqf=TD8AN+HzAB$gd8-_ zy#h7%>(%&(o+j8Qo2XH@ym}3hg5}rinuuGFQ?3n67-_S7rb%!G85wc=Gf;T^O{O&* zPfBS?^30rU(EMrHb4%|*7`f|EX<{MHV2jVe2=n2o7*Do)rHqg<;!}5vgwq_ z#MKIxBqsIvA8Idtrwy>aBQE+RO6n`|+vi){C$ekL)l2J@_hH)jkX@$U%j@ea0q?%GvH*z(ySlPo)Wif!OjE#mxe!u!OqH$c>il8##?PA zdX{qG-nkbzW5Rdo*rZ`}eH%8mIC9{zNm*^>pxn9fHRn7`{BJap!QwgZ>UjuI;>siG z8MbfX8qsv4+BxkMp>$2H(HY|sJ0VFacNcR%Fh`lz?#iwSy<-BI&>tf{5`~lzRElyT zpg{=-GzHow+_q)&kcE_Pf95sr1-mQHcc}d;GJcS0WtB)ScTmz=dkr-s=c`GgBnz|U zkE@DAwGNZK9Ha0#pgq_8;D!a0vFXG46sk5h4% z+KNMlWe~Rx0Bz9P-rCOrzLVc1BY^qD;*Rd!BB>i|Q&aR4T<*2*mghG9lA`kxpdDej z0d5#3+p4e=wZAA-e1H+tmfH&g7Peg%v2_}Nbmw?B&WX{NH6L{KY~mivbhQ;hrCl3I z%Imd0|2~#?<;@zujxtRhQ*AZ&6fe|_^T#}aN%=RAVhPDnF+zS*6$v$oihkqX#f-@< z7^=t`Z2d^c%2gMPOWPfj;!g)eNtWs{9drhW1|GX6kDbW;79mlBmf(&#**}vSmK_X$ z+(IGEyL}LBy{TS81qf^OQ6FiTR8G#dh_a9aL&|OmDxg7Kh@`xxFbLJl`=atkv-vHoG73qsJAi0G9;0|MV zd&mXu>OM;&C$4YfHwBqe6g*{4r+IieE#m{u`RAiXDs5;j0aWh=PxI;?NmM8_f_NrB z2=UptUB^MEMTSSxWEBYn$O#I^d)cS+lwM;!pe9g38H!J-+#hRs42M;loxVQ@b9;{3%i zFv)?CDkq(j%oIZZRfKTik@H?!k^*NK$>#01B+5V*V_QI`50oS12JUK}!{ymfxJ)M( z(z|qGiFtveM507;F?#_pgOuxUhZ1nM`bYzXFNE)H?vlcyE->*{OA8mU$^L;ujwgG7 zZaxmE>ggNm8?3|ji-^qyYzk3PIZ>QBc*LWrKmhA94^?<3AAD`ze3=KdhHo~}Kl+#e zc+908$*@FZayV|GKf~(1JAmC$NxI}Iy2km}fWEMN0FD#T*Hs0ieoM&vaE%+D&$mdN zz0IyZ`L|&LCl77xFD`j@SnwV`-EZBNT}4`uD!=W%H~^CW3m#eC6^vl{?CpFxO^x*^ z`e<@g;gy2$`W8B(hgRST_9chug!j?j59Y6+r84 z#L@RI3W9IKFi9@oAF|$62Fc;Pct8QY<$f;mP@3cteh6HZ_5$1bk9m+BHd*Al_sJn^ z(&qi#!^S&Yg>~=Mis<_Q1@`qcy$7_n>mh6O{Q_|LG;rP01W z_5dcD|6SV#B8?0MAY-Cr{|6a+jQt233j-4iz>ht`B*P*lXTt^{W30k2*hQY}y`ogK zvE|VBrLvXiQP#{lNE zDyPZbvsVo+8H}3KWD$wHwFY!7-NmjAFnPS^88iP%t6h^{r8Ff~DLvvNZ>nHIPu2xCx_kNy7cnw1ilpTk+hls?BVTveO z2V^dOk;o{+rK#hQ>U1@wF6excHyC<;%e`TR_jXN# z9opt38^d(VQu>2T=$kLI2*d-12|3IFHKR)%eAD|vIQl{eQ`wp13THWP13=h5Q;7dn z85QDztf;SuJ#i-S0$l8}qcWZFH-X?+g|DiGu@)BdlMvAPAQ@tmoRS2T%0W#onT{kO zmo2hW28fO;CP*cv=|}<4hQ+a zL@h_GQ{Cl4&oWXdlvBQcw8?dl0kUket7iqPD&UuWCrSD#-OL0DJQR@=4Vv8APU_^^ zdLBnxD!w;HXgw9GQ&Y$6yWgA%--5M+rNBL1AAslJX0U8_R53P!=nYkAD7bqMHWzsY zDUiOAE=Ub#*Yj+I8UTFA=2!!01W4`;eKjuvXt=*N@e0fc1iZUMMJL@u+G5!&;58elE zqBL$iOy*K(q?Kh6f9cqr)bne5|6DcOR&%0@BrB)Zn7AOMw28C0aTe%Aj<}kindX4t zF-M7t>2yhK3jw1QDK&eDoudaLN@I8^XgOjoU;~G0!dQ{k=L}m*^4#=*EPZEP{4T=o z`ZAcA2;SV4*@q~e8|mt`Iaco%Yd9{dXA8qu{aG={&%x&my=eM6^uVG!J*i+{e&}oW zz4d@=sUXOkD>GdOJWQJ2sv%kbxp&{e_aY!%W-?ucc4m+Yw?L%pd)Keig4Zdc)hUBM za5z*GIx^;U?QAmp)!+_0HT%;8`rXIGlBcOyU zJ7eGc2S1?dOvB3i*J-Nt8M*n+)U|_E_At&c9g_tIj9RyBm?f&LV=gx!HMb1%@cA{@ z`+A=PZcRJJiZw6F)JE@qgmG}B8gl`|{vYatv9Em6iy?*Aua$(#pxVd9O?Hl{7VpE} zr>Cr$2|KJ@sTUB6{!P#B@zq5;c@vLAeciiISy$3w{N&AR{u21AJ2#*kkl%OZ@&3~k zlGg2fs>o4M&N10=RaZL8aUidWhAZIu8Wa7Q3*8KoOorR!g@QdL@qN3IkgtAD;oR0= zhqn{MwzG1Cbt!JMYs>pSHOudnNR*}|q$)Zd<~Z%}sLh1rNN6FSP8HnfamZ^%+rPfM zAotTq>+u~?&=S3lu&~B5I^BXTzfVv1?wbx3Axzp!+WT-q`@PA~($8sV?{F(sjphO+ zXDn6SN?hD)*jc4~rp53%R65LhZD16njYN`9caS;4YhK2_GS_=bo2BNndLxZ4JOf6U zq?;~+V~O3>^M=W3+wot4%ru!S;C&*K)|7R!>~GhhWh&=_I{_)5JNHmw94*sAljK1f zr~ufU5oOTUaAGT1&A|gTSejj$KJPv=uR;Ac+O`l8qN7Q0+HG`dSio9xbdf2_KsZLGP~&rR6(^9N3{8(GkM zMScKrX7G|cV&q~u%45*!hfoHImxyJs|_gsvSuFjOMkPvbq;8)M}1Ar8c&bE`I zcK#LlBKJZ*lkb|15x(D+O!sx@GsDo>8$Z7E-0}}0Z|k28gF>?B0+}cV$HIfx)jNrc zQ4#QPz65pDz!BMf%4sM^7q)f{@+cx{{`OO|H0O^f5f;Pb%udob72?{k?PcoER; z+-r{M{YdOE84iwZ>n59DYd)_9wd><}P3N3LoFjn2`C@aYR_Ri$b$TaJF>$&+8rhPn z6kImeVw?LPhQ@9IHK@$0KuRisx1}wjLPq&vQ&oQdT;pgxV?QHuCGmRpMA5;{@jr}9 zw}vv1UwArmn#>8gC9}()gtXqDIU*5s3jbjga-NM4mvk^m9}J_$+=?8Qv8oGa&Gd+~ zIsdXV)1=>z#m9EPb_iu8*hyhpAX3wW6n0Gc`kew-ALIKkfV2teQSDe31 zpV?0u$ocBWIC@W%o6FgemQh!KD%byMy72H+4ZKOm>p8CLO#fre_SflbdsA5 zNQS_~hPi{Yjek05{hLXhd33pkvefq80=r66GW?>89Pe|h+8E=O?J1$!24&v&bl^du zhs;5ccLrUE>_BX~j-SI3coLaiS|Cbs08Q&`X(uXtOmb|$KOH2ficWhX7FJIzzPzA2 zKB^}jkswsbMmJL&j523LYp*+Ym zO%#@VxOrd1==OduFkd$dQ>WS69MrXCQgl08{ArT8hJou3halebb*1zc)F=Z&1cgqn z@GBabr}GKxOYVFEM?F*G$_WkDIECiO-}W|r2s33VHC@Jg1;8!w$kN7=$$m54QDnZV zfS)Ph*bM^DK-9$h(qB@)q<$-9p>9CATkER9Cpk%fN)wH~A;PjJ+AH?|fYvxjRAlo; zqiJ-LXl%#)dBmtZj@#ltzP=;+;Rq8_x)MHs(S24vl5V*auCF*Wyor(=W&EO!8kHeL ztA;*hij@|z*WagJB+TFdW);Kq>4L^}Cx}xmB<~#y+Oq0h&5rR&l6MHLh!@&hA}rA& zJ?PM{S@mQFthuLZ4$nsk?s1!nhvhrG0S7V6evPq$SvA@9g7TAt!8?1u^Kt@`Q2Me; zU%C(q->B8(iP)~WG&zL|KhBs3mNC34)4+@k?{aR{K zj({&a-Ybua{w87|qcW>UdLFhqF=rnrmlgLg{vnefb~c&|(fbd>KIrE)KL~XRZHyQ% zU|GBoSrzQ_yDM_MQPmDUzaQ{|`TU2`?OS>X-yF85DE9qR?A^;3Gpw2;Rt9!u?rX8z z5r3hN3OT zyVaj6IlQ-GwKKkkmm^XkFgBjGm({gnCqO%T^;Mx}`9im@aG1`Nj_wvR3C~RabgXDU zb8#ApI!wdyt>&BNy>m^rys%7P%Qzv|TxVKlrb24vQpl5hqygo%lDB4uW&Bj`Jf_$b z`7<#Z=n$-2+Rd$VFRi9EofT@|-JU~K@|ngWK?-R@EvW`fPjZm&Go6nX zS&$qx%(zzBA$8wjnr0|1g}t3DtC`Iw*;hn6iJ~IqSIiB#3qULY#icwrma@K_6tkxk zBR^l#KF#eA#=_39*plg$j?4R+ag{=VfbHOYoOXVCTG8-*U#O%Y8e$WJNco(rr+(a) z94_mnX0o7F5&7fyk6CH~P7N5(k^Ms7;o)t6x<|IJCcMNFU*n5t!2G3>D$f9XyLAe= zYeCUH-shGyO%|4Oc2|s~DgUW^BJYyi2^$uKjiPMx{4N({xy_oR6Ig z%*y~!V*(SWmNJ{mz`dr?h_qGhn33Qfr^r=$dUpBdn1)~g+QxXDIAAa{I_Q*6%qsP8 zG_{reFiD;yF353)W=Vc0jKX30m&8T>5k(mCjOhzSIit^l4eu-yhs3E; zwo2f0N_%9mO}_~5<49$3qkgepKc>1H&M-cXujp*PScRYM&kZbDk0Oc4rPX0jvnGij zFWZ@f49ol4(_!x;vAG@k8M|(E8KTR}mH0-|NPCJe*}%Ve+~B(^3oxHC_!SDI56WaY zY-|X>NN2lZ=_YAW+Ryd}zxJbXSC|4isUS_|Jsy=L^#N#)0owjZ{Jzh^cA11{RCaRd zT<@UCf6cE*nu21lYr5t5?uGr1-0=AL>H{-pK)L`;QQFeW)aSEPD489Sc5J?yY2fl&MpLsh;&8)8fRJy-4H-cw?we3sWj8oFC2LtP#!xfyCkJ1nb@ z+JD|DtCYka7a=-gCbFw)%N!g-Rh1z}Uz{u$Le$h?+p4l({j{EdI;OL`cOC{5@P=8^ zFX$qbZ)K;idEz2@6Fq0e?|GOW2;VRB&GZe)Yqdq(rqqXfHJid-0W92 z1K(D-xVSH5Qa|mAE*s8eA@Wf*ZqTPpV*Ox=5T!P=8=I8;o!&v6!@C_moyknon{Y2k z?R3Z{VnuW7@KuJLMeY50Im^4BD#e^)J^V-X`|PqKLsu+^nb!)-9A2k=KBa4h@$82m zDy)BMb?R)g-y{7;84tC8j>?>y7FMPT66QFjug*u3k-4(nuF%u-D<{h{6$&{3`_%5y z@o_fs-|Fns9Q2>Mb~kbN8K@)%cxk7qf)U6N(?Bt{6;#x zM>Rc7;$p}=O$b<*e|cCKQ+}mBKJC=ks%Q;DM;@)UGp4hw%A5}l77GUNihPFwgt9?p zGX=+^nTw1`zH6{uD(wjrVVpXCa1tUxQ=PG$sJ(vQzakOoE>MHt*vin1Z;csA7+I$J zh6&72=p+$_|GK*!SSlRf#O8}XduY;B%1?K6r6Za`fx+TxLg?WcoAGhFFm`u1Fl#~W z{+%9L%6hG^%0OoC%J1~@^A+^w=UtdGIBmH%VIMXZaLth@^QuJvCRwzJ81Mhlg0jfV zjrnoJH+acT$Dd)X#Uh)qg8V%!<~HWnG96TvjlSt%4GfW7vAeZN-&E!qc5jz}yf4_; z^Ru?ajd_nM8WHewIP}>&O}G|$7|`uO4K{OY)7h@ODhrP&9?b`FP4!qmu_gfGw3(lV z$+`!-&XA-)P%5_68b@j7M!0!RjSJS`%h?!e+OmcCk962q z12#6zQBXTN2&9|(*vKP%k zz`*h@oLD_o;PnHuv^o&yN+9&|N}t|_6sx#~r6dOm?iJn2Fx!4zgABUsq+C(sbw%H5 zC#NY1!33ishOWaD>t-UwNt-$%wLP&){4Ko<= zfOi2|7K{oLv1FVE>8C|*?Un#arqbiJftJ~KdMFc$F^TLFL?_M@C1TSsg5ttI1SN^5 zlN@yWyVj43eOo-%yk!@>QNf5|TgFI7NV{J9yO2-Wpx?E~rxL}PW}iKsq{H9^wiLqtkBOjhZe!$A7n zp2o}r9@%u-OoOUC;uZKhuXvsIPLqNy_qDyBOy)p5$yD8ha;R$>%z15Z*nO`v<)YsDP7;9rVx&F$~SoRC5 z*Dme7-*?awOj!`0P${>YZm~$9eCF^mQF@~70UjZi@E4kz98scdCL*V*ZSBsn^V@Pd zy1#DpbSuuoR0ixh4`Uyw^5qRhjgS2%8uDXI&>o(Pi08gkoG}|pvuC_Q(NUnysD{v7 ze;H){u-DcV-;&?Ej-q)_BvQ=xEMo>a9Pd9I(B(_>=h5G^yZ1RcdLJXek$J@pk0s}D+Ga?a8B8ZOW*?HZ;~U^)0PJL zFN!OyblFE*s$eV4#((ksuR@AFJ^dg1Vy+VPzg3xZ5tmeG`wIol zEYgCXs@BcFe{9$*C5W94s%ohhy{S$~c~F&qh(CUr93tVKi++%fOYTGm*w3(EEiEl= zZfzpdx{7X3lTABmlQ*5u&?6mvYN}weKXhzI*6Gm9YDe_$xaC;Axk8!);-&lwM=@>e zDHsUp=J_G~nycF1nA}Ax?`X=8Qwq>2D*mxP5O7|-X;p?Pct%jL?AP2*PDhS;-YtOt zQeA6xwkiym(Jp+@Q;FdFS@UuOh)hu0E2&VL?AGke@_3(>#UE#9+n@xYvM6T6 z595FF*?(^!Vy_Y|%GvSz@C8AoB_D5rO6EVo?Y3*=*{ikLsZ6}+B`C< zSqtw^=_)>m#G?&RSGZ#W3^Yu#A+N{UR+$CJBr}QppZ}-h0P|uip$)|Ouu#zTS5;-F zrwmCy^b}QRT~(;&|3ybe`_Hm@ZW=sLNi35|@M&!& zR+^LT*8YvB?Jtq27>r0{RKv2_k^G>Xwp<=RXEppmGD|H-IWV?LKwp&NYb(jC(C9gy zijWjozo@Sx1mVe_PbrzJ480GuJ9A7(qe&X2UACiXbny{qfaI#?p<|M`M9g9ub)T(` zpb~ijWk;)Qx}hjMZfCqdJ$S_!q)TYuvmeHy4^&|6;m{b6jJ#L|AUC`#dWx2Ae^ntR zs&;hE1hG`PKmq7A0LgpVUq7G74YY#VX?`MNjszNIE86~PtDgUB1;F1ntqbuKgd^)hW6N9v_() z^lpRg4OFy0m<8PLL_25vxCrH~DF>+S?3yt=`IcPIGzFw1w)r`>_xiUFUlkP_%Q%jI z`RmX+trFP4q(fmGnPxw}$~34y{u$=oW2r{a(u4ECXosoE1?ueN_|$niA^8|LWvc}X6u)mk$ny5~ zhc#~-uIx9C)P-=0$rmD>f=;O7=l4F;(j2|LIfv19#Q$D{aOiha3w%3hNn-cZ;?Vi_ z(I2nvcO#slyfe2(k7P)4_)%DCc3}_P=xD%B-yrSRCD{~GZr3tr9^2ONC`qKdI)QPQ%lb$TG=&jM@Q^3)@=tAO}mXZ&Ha&k2*VO)kxR2FQ-h4u|R3uf}% z_2d~+hxZp2g!f3baEiyf5hRWR$Bi=zofaHe5~H!wn8(MqL(gVoaE7-&Kiwm5%F*18 zEnh3%ML$jm@5ApQV3OwF+%8@&hN&KXLx}W{gb!sGzpypkxP{Jq`TpsZCWz0v&rAf? zcBu1wbC_+d)Y3cI%hPWWchLf93wg-2z;0!d^iIQaBtZX#o>V!h?PS@TlX<36q6B4$Ks9;~ElROH5;!hxFe@a4Verb#6zFS7 z&)>=5`I+EjXjP*NFc7hV2}{iM?2!G?W~9;CxTNAk!@7)+5vz737@z9h0q={ymP%$X z=9CCYnQWcLdF`O3=303~EcK2q&nR4S45MHFpM^-%tm;&AlL3WDWBTf|tTvvl`AofM zK+cxRc0%m;rA!>1-o0y^!~v<=dHh(VAh3v6YFb~gGfynq+v0xSg=TWjR?L$G>zTcK zCC7gz68gYe&E%Z|p#u66lb^eJvT#B>9!Yt)7DV5%{Ua@HS}yLg6M{22#p_ty{X>w^ zzHDn3`ua~;3mQqtU6iqM6%>k@^P}nc<6c1BH5;|N>Jw(~lKGr5Ba80Vf^hyLCmBx! zQz^Gpzna!uc`UUdgU`rRooI_VX7*MtQN^`@T5{!t7=4qnlk?i7y6k?&Bb{ngD zTTB05)dRu%=FW>^XFH%-`Z^vzg(Za>+)jpL^NfLsRk&!%ww(7RfBtm| z^6`n4ci-sZ-h-7Yk&ldSRxD49P!RQbw?s(WgZ6t=np<Fi`S0;dnVKTP=;$IM%<$sxedjL3aZ|a_)Th_=M38vXJUzA>~W3>B}e*IKa=sN zD}_!gH&@jAf@|QR$s*uwOc1*&eGz+m7*@`~;GbmHlyG=E@$Q>^yFNE+g{i zH?J=S57W$lI!1i;9{0M)I5*}D$HvRf(wIG_$@CkY27k2?l6trAEE>@-V^sxVE)4o; zRUIrP;NsBM@mxF*@HhEfF3V1zx>o37()&=C7pw2UmWiL$lPZ(99gUZc@P}(#>pLML zoZJmA$2>h;7+~_Gya7W4GdX4)5x*{#Wb1+|YT~ea*L^f+Z8^HVwW03_c9j;zM=t6a zA=L7HMEE~moUcX1&Qwi|T@cDjqD>bKuN{nuC-nVsPhY7$=IQfqRh5+4q;;P0Gpv@< zoQu#OK60-of=}sJ>2HQ*ZrI33V(5}o1P3C(-xLQdBGbMj#547?HKCEyQUjh@!z#uJ zY3BYWMalVPT^x@1NSY9!h~F-33>WQcOLa|IE0%FHqv{7JMSvd&rPB%6j~vpB{eSMyV;iO91Wo&UX?_&$B)Kc4u9ZYubS}Pqzp~S@iu%E1SLrY#i(*a z7c71Y4FIAG2G;NU8~^v)!O5S$F8RT)GF2(ar7u$DSfzIOkilQ)wy93?U>QYylf*%@ zaS!+{I#x8%GzKoHrGb`;Mwe9<#aO^z4vIq;7^iYoQfsYR@Q2k?!^(xAWfJgieMFbt zccsDxki6E`Bv~begK_$TnP-ImB@0(oK@E%F#=~W#b)laE9|X3n+<*A5b+eu2&Ng!d zb1)lznMlpE0EW~DAqjb6V=~of9}D1(1PM_kOXWSW^rLFa33e2IKr~^%8pu8WsX{~9 z(G&z=E&}Y>Z8S$T{|P5Gy`$35)0|@2a4Q_lGOWiUhb|dnmlc%cLsZQIfw^j zRv#4MCdyIv^!A?Ic(JF=DI%31c^_9igA=hN=4&!-YBjl%GyfgA53dJ%IVb0&(X-*! zwBD0y!V&H@R%2iLI*qwHC#V#n)IJ?K8~JiVwCh=q3guvc>O=MA^7?-<(%oJ6@c8QvEvBxzqU*dl+uowaLzi z|2lp9|M$A}>ryla%bRgr9{=^*?^iGXe)S5+>hZU090SMSc<%kqtM;elBhb?zKEU6& ze;a|N{`wDsM7^y3f6szne0Y*My2Y(U`*rE;-zQR$ zfuf!CUza*s=JL7tNha{qDZI`tI*4RaiRt}uI+-jUeAi3UIt?D+XBha8mBgxmh6ZmG zsep@CUfF;#{73Jv`McsX{4@3#i(#U<>OT)YE-I$fGBX0!GlT3E>Tcb>&{^(kghpVS zOKWo~A?~FU%pft(m6)5OJMq0col+U9Kdpq7?*GFhFjetRKGrf_*&#^XWIKM_dJ-#avuzOmP>xUp>s&`*kU0-8gCmueD}}H1+M}EYNKMN98peo)<4% z4eKLtd^Ji6>~Ul`?NlxzWY7KOuS-dr^!lG}Tqc_FS1kRT8PD7^z80J0Utc;K8a~yw z2@(i2R-8I0ZE9u%ZHGUk^FrWTb;?5EW`g|nx(wT-zLds{uPxWR32^qDL~wq>*HPF5 zXYskUaip%__M3Nvyo=k99bHmrRY%^mdC{pw8I;BCO)u%kFOkQS&ba;2 zkEYzT^nP9XqTb#A>(WA75w}gld&gTCmk8n zz1CHq6YG;g#lBtKR<1$_&hsj|9ye6gr{_iQuVWmi=n4W!5+}Q5~9%hp)WGLxdGze6bKYZFU6~HW-D^lV8DYX3E z^*c3I4T27&*)^;sOS?`|o>+AKb&;+in=R9u;9(y2KrQwn)U|RtM9D6Y)FE*BxM-O3 ztb7cr`>}1q_Am}sM=HZkN`NhDfX@q+++E=;kSKme8`k#`G;NnbsSpPTr_A3lIWI^y0N0$uBP2cGWw3 znfy!B4r{K-$Gl;G{nf_Y{&h){E`eHiv%6cj+qq zib~eY_$dLI_jc)dzCtF*3rWKblNRz3yW^S&%9Y4TQ1K)yv+)ztQr{I)7JRsy@2@9 z{~&^2wej=F9A<4mNh7Qyydte#aK66_oT$UDWw0mQ=-G^S{JdrRgZM8!pqNinIXUy7 z*0bKLT)!?EZmbK~X%xR+23_2*Vl&KLgQBV?=FAO}AY?t^n4@^B1d~s?eH)dZ4a0tQ4m^u*XB(HXVpQQjG9Ee!$m)wY7eX-=`Z1NTX`4uUDkyO$j_S<{VCJ(e!;7* z!3wNlv^BAa$X>HUe@0;Trz`pgRirES<6%=x4^#5bGr*7Smg8S7?_nzRA-fh`<4%B4 z{ZhZ^uHsVM3bn5Llfp8tXS7IdSCF`BlAN^_#K&qc4Y+9?MSR_Qo+$Sf02tjC$#hCn zeq?(qlr0y}TYC|9u^OQ%XQ24EI{-Mni1?s6vHk3Dt1GZGo6|`^OH9-~5+|Qx3Z@u) ze^OWsP!KP`pLJGcO>}HiY^rm#L)n2l;%k3wSt2l#82K=bJ10CQ>M%d+`S`A#dWJV` zM^i&TWz>(ERHYJ=IyUXdnV$~i)qbr(tyGG%*7AXZtqVAwR8o`hk!J_$FLn+$Tom^8lv|FTDcINc4#U@~u;@Fr)%EZ=M!n9dc%oiLb~5SjGXRIYOB{!lM$Nb#JYlS?!>7Q5M~Q+@k55I0fQzcVv_@Y zbF&m!WjQt^E$tmCIm>t|NPyb7Vni!@^E5h#kO$A@`8^Ahlm9LQ)IAc2x@&m5x7EHT zIjglAT9yO`Mv88?1gFi$aPP1{r8^_rIuEV3$5-WY*ZTfY-nnJ7j3BtKH8z4e)oS8dbo7Jx3F{PKES*>1(O=zI?% z8owQ6xT<>pJnn~vSXQ$u6i$z_+=PFS4}Qz>G4oI*LEaZ?bnPvI-c_|Jaflp{tGQ^7 z*K&x0mlvQe5YWH=&R8Q^)+6;*<$npyWDHTNZ0U}}d9gN(F)~y$Qeh2>yTWZ%O;MM% zhmH-~$x?Ca@3$r2QR=`IQ)i5iX%+9=BQ{W$t?EW;KFOy7pOiZHbc29)m2wUu_QBns zQ3oR0zE=bOIgpoY+&YR;b2lPCj9V&;t=UmPt;&V)DmZK~h=tW8qgBtUX?F!B2U_cn zYQ>!$7hkLm>!4|!n1we>T)<_vKjhX!W^Ti6QZpNlp&RaDZ zhaJO%ql&F285T*};^hO}g~T6l-sf!0H$$VGh`6@UX(vI&_ahswBNdLWy1TD(LG6O>KaJRO?6Z3M!@09~JR{`Xe917iuR&n6bpuL$MZ` zLaXb*T`9z=l0A9GEnCISf5Yu(8^{E{xOqV_kj_(&7P_;%XZ-rigw__U?RQj@<*Ade zh4i9K8zm7GjeFAbfto)!d2FG#!U~MJ3 znAudd8{{Frlv(#8vnBUIrm9Fy4&akHGOj4NcZlg3^7iB|G<&ETOdh>BGD*?+d!eITvc+ma(8%%rKliZG|Bw8rW1G0`Y^>O3pgm}eXP5masqu62N;s(EbPfPF@K{@y$Yd!1P z`+33|ijGgxeIQx)Sm7jf>)Q$(ZNIgW?FEgP$tj{J(l%$gg+F^5HR$~u_^=ic*O%PA zqVI4)+1a`q;S*u&aLQlG?t0Xh@w>LT98(zt4=K9}8zv28?Jx-+#*qikE2FLtr-Rkv zU-nwd2X>!d{7k`!J}CNDugbg|u5at#KBKp-$M51oD&3yk<)a4=RF_xAV(?Lw+zhaw z{}k!y8F^usJNBB(3J}f< z9oirF<7m0TzW>dQO*g8o99}4UkCP7(S*O`n@kiqMA$L2t1m&#>3VU+Uk)|&LMX37v zsDL}MH@uJ-K3ptb3_`rPU&)U%|I8~vb(N3u>!O?1R~(a3<1aV$YQHCTL+iDbAAhU+ zodS3lsvFOe?}lA*$l01F8D$<$6NGF~WyaQ7$RVJXv0x$O(3@WZ*vKS;>mcQCkJ)v< zmBu3yc_zkIkX5?0n%P~~XK5{*PY-lIYGr_!nNqoc@|j)nn_)zxhh0Hx=L=4kYrMO? zwZ5s?eIrCoy3>;eZk$>+Ns#(f=9?ZP`qyVW9)YD-l`{J=s*CPxav4*lj2J;>THR7L z=BYv_(o=GcvkiIj{w~qIYtx;#pxf26Zpm=)LM7yT$i)kI?hB;iY#!+S{P9k2-xR&W zWT7U5kTO+#@#_0*< zQE6iHm!&`Lwuxm3It<=prd{tVr11Krrb|rFdE2WIJjtY6kK4EosT<+=xNBQaFdKH| z1g&s6?RRC}aBSo!*Njq8bxSv1J)%`fgTkKr>CLUBL&#DQSHLWnrhk#ALf<+9d#Z0^ zyU;Y`qAMKd7!j~HPR;Dd;0Y%#0S^>et#c{gh8cF45!U`P(&h`LxN$RxI(x>nd!)I7 z?Bp_hk&)iF{ob#FXHT*P?y>#w%B?7NMNZXZ0oO)0V+-hm!cPxKVwtB|OCa8u2=48P zK~|~(7X4>8TwM<2t9&!%Z0pCMi_j&*NELrAeB{#N%5Ir%s zd~t70Zw)^9dN#GCrf~*LW^-^n`^ix&ei}lfd#nXOhqWALaJgarYr6e)6LwhnO=#Jb zddXepHq5+@LMmlgAH6yU9Rzo&JWy~QX&Opibyk0^xET?ni8WL_zk=>YLr=I|BZ!1- z=Yoc*A}J+2^*oYk|krX`nIMCP{;jxhO$gS@g#fE!QhF55HO zU-*u!VNU++UU-*&DuW$N2`M30PzTpV@7>9n_4qjjTBz+`+)A4s6*xiY-Et(q{VIn* zC`*>h^jeW5`qO(VdQIe~P!dOg{7#v>8BN1G(Y{Sse;9*J)($vu`{auGL|YBrhC%&pRLVtA*+!ZDv{ z?n@Dq_}Ajr0_5e}MHb_%KWN|7+=ugnR*eKLr8{USbTA$~?1;Nrw|bgkjct)^PXzO< z1W~2bm$cxl&A$7(Oh=R+M$ysk?`#A3EO|*cRwhb__PA`{d#b-JttK-DC;nMp?G_jfE*VY$`K#o6ncm9-RMNBrxRU`uB%#3+)@RdX*N zhLZ^K?H+I8GNbOridRISDGB%MQt`IX$*a;@2La#WbgH0qtX2PJ7*I!DZ{KjXgE)?q zspahW3EK>bmW-h1@+=bC&`52iowFTpak1Z$y3-k3>51^)d$Ow;m=05eDB;KgOh~AF z|1hhBBYer{xv5$)i^{jS6XCnurr@w85cax4%jE9ODknWI>AwgW+O}?SRfG(t)r)Cuf{cxuPDEE(S@QGh(=7s?xThx08fS8kUmzi1E0Ik2L>`K+KQZtyU^7u8# z%X;--J+;Mc6WEoAhxkLlR+NATes^FrOV3V0&c!%UJ#RLCW>=uNADxYQ@V z;216@BpA1ZH0nN-Yvf(p3=221Bz}=@dj+>(F;rv`;8jMabje<&UuvvnPEPJz0>lFM z0d7!|s;?4oDj~-&y2!65UY6YJ$j>8Y0Fi9XjJE=QN`QbS2;KZqJZKo4L#(ZD+1;KU zqqzspmP%wXxg)6NgbLuwIWw{_QKw$vGnz2F!75yZb~O;z9DW>iOSfn2sRO68vWuvu zo1h;o3kQ^=<8A8eJA>C8ww%YD!_>QBa_8wK66Fi~#>sEXdi98eFxuIz)ORFj*R>~g zeBjg;d%M6yRqL!H%7#jx7cp{*onYYxyi)yDOUVEdE!OOn+J`n&*EfG45LK_~SB=?P zKv<5LNViZ!MR|>J1snfRJAsbXU80#qq%pN=**%3@kBdK52Rx?21wjuwuD>rEOYix< z7H$%t9wyZCMN;BDZcR&<|LDZOWgPdBvJ6r%Jp_~mx8EGLQ-b}&=OSE`)8S+}ah$X+ zIYwdYGLQ1F&IgS}+~&+coVc*9H@$%WImfXnOU{JR$6-ksQ#)P$O{pDSd`CLz!zSP+ z0F{2i51{1=0PW;g2m)J>*~*>%!A;MUvRl7pS!{VGv!C;K3{TaG-w!mUB}N3Pl5Ah( zDP*u3kDxtKcT&4EDhPR^yfP|(QXyo{k8bKHE%(fs2qM;Mi7vUkcp$K<8_Xj+kr0*Q zTY<khqbtr~2Vm;A-Z9m%S7@g6`5%VH zBY}&r^|BOcSY({YBfmrJ%R5F|+AlPzo)mEDJt_I~1n(fX zdfw+6fAQ_trN8D|&So7!w!B5l&-NWO%RC}iHY0-ZkfpGfSc|P6v|P2)RGMlXAZ_Mv zt0qN3`psAaiUtfxtKg2Q+XI{mizn&;@})yPq1jVg=a{V}?+P4V@jYXxyq4ilA_^1U zH{A=DxiF3)KRrc`RIJ5fFdM53)@kr`^>2 zjIz!wdccDQ_RjD_ME_8^re6Ym(~vkffH=8VQuX#t%2O4kQ1;XAi7Kg0({g%aM)R@# z&+T!40o+K5irp-Ehg=7{(l`yqtUP2$QUbv%E~$q7o%c}zeY_@{y!)PvjvGs6yXI#i zG5lvB2b4!q-XWjWFgFMu*6-5|SIdq|{dK7=9U3_D)gj{!zB?{YbipGowTw4|g-yTB z!fZPiNJD19>80+fRG3^PphG;_9%X6*S)%NmS-GK~t4WZ)NJESjKG`JxVZcLmsG`Z4 zh*$fLuoKL8><#HWmRKQo?ywo%>l`hSJ?khfrShHxNRsCh0XZ;SJAg1G7C7-Y^T4fp zE%{#1BwJkbJMl*OU%B{~pSbu>{U9Oo6hdc!TX18`9Zk9F<}(3Lqh34`DV@ePo#uY} z)TQD(b5tM<$*Zy%DH>~W?B&oEoZFc=YMm=Ioh^aMBCn0&zaTrJFrZO9+5x4(o-1{V zY*u@gd2Tfa>9^}H&?^+bzp469Jqb<}&MtM=QEIngi6SS$y*Sqtk z(3S}fR|l3tLhq0@=~JM`Pi@K&(7ILW6CSjDr_9l;`B{0LWc$Uf8O6f~B}{=OyYwN; zKyWoB*MNDelfu+f0jbKn&R4fe5`*c_fX<|qtW0J5R{jQy4!x|TjgvICrGO(ES_u@M zQAY?DQHj&SPglMlQEl|dUD~`Ewo`-MXopZonPx*onrqqZDW*&uQe&C^^33w*!V!-_g3RI{9vqO)IpI(a-N6ODwNF8Qgc}fIiU8 zSjL{v(=gHHBvbOktI}F3#Sk!Mtz3>BysABdiNa-oi=`M#oe5N3Vg%zOTFlV#;q}E@ z$&~qt-XmIm(+rZ!zw85~X%$fif3Z?REb_dJwPxFE42^Q?Pnv*A5;+fb8h8MBG#cby z>TGNh4u!I^&rq`fi*@M4-)8$jW*0zy{=E zddbwdj!(J)&|z`owg@emEf1W0s1*v>k{c?oASD0B+2|sg8q?XHCQmk+>=x@dLEfnf zb~~_fGpmItSG~n?NQSiVDDfAvvz~7l*O6DK%<^fx51rqXJ1F{rU;at0j;IJ?wvQs^TuAQbf@eEqfN`?0W3L^BHYMj|trkNIeu@lZ3BO4}`@}rRLr5WDj9I z%}BKB;5A9Lm7oD)%WPIc#{fco|AEAt`Lfy1{^=#*pZq0pPDEePu~;m$7Ph*&yUJkv zBua(qn$6i~Tm~x?*(tCyc*8TUV@jcsI+%BWM+&>kx(=W7)HTC(m-Ix3aL$r7j;=ff zb8sr&;9Ci=bAPe_?fLC&FEx$LI1dm8Fu{DN1E`u5rjQsW9PMGt2sojf!xgUgz~xQs zIklYL9Y7fu&xhV@KiL2}hZFy5huqTx@y!reQ54XgP8LniM|h$OMeM9I{CigCYC~iM9{&4O(>q2tf`@Y(si|+) zn5}j*o~V6|QbxL;78`?dbpB|J$oSX+_VYMaxT^`ZtcUEj77*+;<>8 zn~xMc)YmyFxH&wseg9ocFn|s}5Gzni3 zgQsH4Du4yFw#hs%F0SMs*NW}$CZW>gj>wsNNOnX- zT|-moG+JCkql-`J`Bo95hoV$}f~2)yh$lY8ocYL3H@Mc#%AK;`^xD-9Jm*=baSpY& z*#oVik_j#7Ka<@u32OKy6N8dHljl9bOVTcma->d2F)aSbdut;A8en~z*ZCcs%b%v# zK`h~1zH4i{g{Z;#l(2$KP@Y965J_C@G$)q~EZOXwW9qw;+JTonUQ{m!8nA6Fn2#10 zed#-ZswNOXgx~XHp~nGavBIcCn8*+46g_zQ>SPnY^b}uH?|QG%p3& z`;N$tgMik@r6q2uRsD?$Y#ed@{Ycd}vN{I~d{k{yECwxEp35<6SWKaCutI6x@MC?~ zKy}5P9eo|`N#eiXrM|L&X6)&{Tg5q-cULUNbN%cEax`@gK5_^>%R>cB6&`*jRvb^Y zckqF+I*X{m)O}#%QWI*`B;U_GianU9`)Cibji3tEs~U3e;Mz0}oYyGw-Dv+TIo7NW z`lA*yAkD{Z6b}YM-X~He6BC~EJ-jw~Go3!;(Z)N41_ZCrz^ih*(TaOherD?eG`l@9 zBBZLt#u+~i$FPfeo)g(*pc`XNRuNxuY#5>xDwo0Sy$irThBFc{zOtO>)MFk1=z#)A z_|C6O!6{_OG8`rgyS}ZaUA(6-Ied$wLZH6B^({%XYf$plJ}So3OiE$)BV6^{%1wBP zhI7oQy`%okI=gcWrBbDQ@Rk?Yc7myB7Bl+Pa&}#^kgmg?&8JM~b@f>70uN0N_=UUv zd(Qk0OWw`glogAJCQ_t74J9EeSAr?}`b=+g>6;&??ubckI?qmL-@<)U;2#avKBVeAtvgg-V$xR5 z|65$grzHw>M}=uO8g8ysGlJwL=`|dgq`TsrYr+!SoLgAD^e~6=?i7D)>DpRGhYp;m zKNpYtzN;>byv*>hD3LKSuwoVCB3*YS2V*(<$!4PXl92!F=_?b+%PlyfK4vDD2@8k5SVB60&KXVkYsqJ-oK*hnl2Og%h2f6n z)Q);T>V@Z**nI3DbdsM_bPd0jf1s||(iTSBkF`PG9nGmUpv zFTFl$k81-p&kl$0RVlav)o_%_1BOUuM*8+Rp^7RjP6-66)ud)z86I%p37(1060$~P zJx){H{v_!5p`6)szk%FY`msOvRCj-FyiW`9Q;})((w|#OfVtZ=EMPkMFA+ zIcVec@;(FqvjGpouYyP)=8_X-Jy-b2)%&~$0A{#Xu=BPCMRj!*9JlJs0|usBIeiO2 zgqc84b_`9<3fT{?HARLRluXd5rq2BMZ>(y!mb`V*I)KtY{hw#&O&Sz(K0m}s(PDcn zsZ*~{o=nT{B9^oJ3=kPt!d={W9zETiSW6vtgy8H{`Luag&auRjimBD1cB^(lMwh}g zuwsx_J*Z5Kvv+YLx<`t9vULnmx3rV?Yo^MvSuCmpj`$BkU8B8spD?Dg7|-IMA0K^v z?lYSho+4fw@M%-ah3a6+w-;SnoxK~`s!mSP5*BAoDg{8=U@pOd9a%n%=Wtxvra7xY z8HiyuiW0Q#P+ks?rD)?8f6#ei8u>G(wpP4@0G1;^KA+ zofOn_wFCKxQ7fwTokRF@K#yf4O4&g<9%asBM{$=3ymFA@58l) zHd@WTGhWAaw1e~vtTLr&ZU@$xvMRya#f0*#5L>FOm_)c;cel2bXsCfb9l}N4O0*jL z09m<*>drJI+N>^9Y*su_8ZC4hTH&J4F$9SpD$!w+N67M33i}F-4z7CXa0oivz`bhP z$p@K~&oDLmf{!Bp)xj{?Sz<(%M&zVYzGg`2uac6wVBOsxYXxtssCIp;-i^F>n)NXw z`MB}5_R_h9iCpOdJ410#rDN1nM#+4#BFfnyDiJ=6wk1qA+40RP*Qm$Zp3v_y0o&p#MRGk!e z<3hmn`v*d%RsM0`)E}ZPV}M6N+RfW2AD4=jYxBm-Hi;Y=`O`5ja=MucUEN42-TNZZ z9%)p`?>0DXH*w*W^@eCJFK-|_z0})Ibe^anp7@a`*~J!jEjlb{2QGkaF!q13CN`t6 zudddsStbbLPcQYXF#Dp$mdHG7c<5GrGeyC3P zsF55V{IM->%sj#OZ}@J;kF+mikvQ9%#g$m07W)wPlU3OLAF2}W;UjRx5v01p4k zr~??eP~sXx-cQrc~4zIC#&`wXTc%@lak^yqxKAEy{mThbtAiC3#Ikz z>>(>iH$XqNAX2=%&WPGT4$hp|zPEw-G`55!6 z@en&e>yqmha-9}?pd==)SD$yz{WYSVJsGdo8>((&Z^CwEjdz!!?6?eQit%i3Aa}YD#8eP1eI`2MS$AjoOXc z@Rs&+r_xxN$!L*(9+zE>K*zuO{P5bDfh;GYoHsje(nbp}7uf9(Bh)_@wljU-Kg%R7 zA|fU5Z0M^=0TYvIR>pwx)n@hX>?)%S;}21Waye90{4~CVxWHtbmF@rrXI?56XQ$5X zDqA&{aII^Wmmhj;>U0QayY65*QkZDr=(LcQ#i#2%rFezOW|^LOAH{X$Ha-=hGx|(c zYu4*v!exin{;y8!H9gylS1MhE{KnLCu8UVNm=jqORn5}~TqKrd8*@1%fT9DTV11KAf?ZNb}=;rpmzc1--9{zg$w zyNIG7wzniUjXy)tq{QJ?{BoeFe2e1UC^05SVWntH9KeL~!JLF)Rr`Q0#S!S+-S?H^ zV(tBP!*_2s6yq3{k9r-mEY9fH67`O7oNnifcl`3ebo~gSiN<0~)?j;s>gp)bZM5cT znR__8ie#Cd%0NZYXSXS3EP3EGCPu^KbA{Mr8;wuPgp>51QJ6|E3dNCT%nqtP5L?-F zbfGS!^ZZTtBfbW0^ng`d;xJMsL^j!Fid%vk`ZMYekw{k)S7uT@^G&;x-42Dl;BDge znFw7Rpd80y^u(P74TgfTYq7=dnkPj*`ND9PuA5+6I!He`x9wV)C{-e?1)1(;mi_uMsxh>8CE$DeeltD*D53n-Y4~Z=-ih zJ(m)qMXcbXR8f*QGa@0pN3acU*}DeVhZ-jO{R*EbOEpMNt~M8Z_-ZPL0lLjkQ(? zR^epPOq*Ff;m?(;j;d$SMVZ+xwTBYwdOP)RsO~FKm>|vB_|iUM#X`{?OPj<-j_P$% zSUfcX{7DKc9v}$#)bm#6eT|0t*f2PKEkZSk(>tZZsz8YI-!i3JDl>nGyjoW~;1{e; z75bg8nX>P?E&A)yR78d?Ui`k4`p{QhfmVRrYLPTVcyebUP$)7=68(e|f5SLe&%CnV zm6VN|Gufy#De;opLH{1+o$t5~^y^}av2)9MC5ehNCee*|6>EKx&+Rn9m>d$-R`V2R zT|~z+5dZ0Q%V@Ccj`?E16anljIa)1a+sjJ@cNMi|Pemk0HKOGuS#ua|q|Hk3WSoX$ z#!zIj7j8b6|18ULTGtEn45Ym5xk%5W>Hn^MTx|f!us;mI7$J%Ts?LT zx9{xEiY@_I?It1ut@moJVEQk4^n|ZEL`tl2L}Gi$@E=*dCW(0+|f@d1I>+dZ@1YM$B zS!1Ef(C&StVCgA&S!dByn~ln^>dE3Hf9y ztn#9Gxx@NbRuj_Yks?@TqGPNg&?71w&HA)b#rsOB(=PfJy#iV8$&G;%DA`Rt8g% zoG+{-TRHOV)i+guoX%PONQLlLI8sM#Q9B~jwf4Td?5zEw6nB^>qJGrJQc&D}EzvsN zu{Pz&0)AK!=CBMzBGBWvizbjsNmhozuV7?zhYp@4cekB|v>C~h`q-5W$yZdT0CJ8< ztkriFWYArnUL6!0tcU;yB>v?d06+#&)%jCFj>GcdgNma93_^%T0rV&0!1b0)h&W{H zi-Rli;8mG@z*4W(vNvpn$2TA2mTNk(wNhGMYE97gHG2Kgc28TzW@Yi{ot8{<_E$6^ z!-!S(`*~$Buz0>Av^W+JZ#Gu7Itpc%D1HVXV^KP_^w1yRoyrXu-A-=Q{iWQ2(?siZ zPa~5&So{52y)|JP^~@Ke$eHv*9VbZjyr_ofO7?x60ApLeJqqk&wO}Hmup$N}4&(Z| zydSf3$>kex2bAgEXZ4Eg2(+6MksN`AVjh$48^t?dPIx~qzE9{ZF`mfqtp9cCTEfLA z-*~b(e?wsbeHKx7qfp{Of8DLC4rk3jCYYj93Js3cUmf-JrSrSowexuLKFeRpH4bi1 z+Ze}XDr&R{Q%fKpo&lA>c^|Xy=cj2X4Bx)uuPSk@p!4@DSVvyVVMlQvz{f1%sz7l9U*X2Oz2j^m?vA*iHO7$M- zh)V`5QD^QZ2Y@p7)J;JM(_y}fykx!}7^K3KqA%P@hu<}S3MbikkcPeoLpeBorxowk zZ)nWDlg;@2>(bwg@mH*@Z0lZ#t!_*U*Vz5FO{kdnC~kcH=IvWf!;gNQjN7TPRHEuD zX&?$8f33!GgZ4Jm{%FlEV;@qi0+U@`sk8q7tIcGW>R^#&`Ws$&mAa~EkvIBw=hOW? zcU9x(8rB0J2p^H-XaC2!Hc^y$3mt-U63O}s+?M)vN&Y(~7Q0+zkD9Yz2M?d8+3IQ7 zsrra1jx@rJlFvsP&;6Wr;TnNpW3yJJAy2n=%95u_)2xv;vpG8YjBz5`?4Ok`20~G$ zMaKy(;m@Win$0CibBLUVO$axgqM<6Th}&Q6{Owx;hv&h+yBZPV;F+|UoOs{CM_xrQ zEkq_!<@XJJ-8PE!$X2J@lhMgL`Rc9~5?)J3qCe%%6_+aO<>tTi4N^^7>$N5G;W=B+ z8kdf_{*=R`j&6a&0^NvVc?&3dJ97=0T%}wQZ>Pe!HU!EIsF%Y$sMpxz^uGoCPTh1K zFJrw~gRrZvI;$ve22Ebp&f;-x(h~WEn8zCYrr;2R%M+N~xhwZ-B6Kw{IvrezZmxC= zNLmkO`rl10EnF>a&>7iqn*A{`DK!|72yDd-_)YAJi1;nIQJDYRu#C^%qM4bSsRQ!0 ziJZBvrnmH(A|j$klJDj-z$f0=kE!xA{c5~??JPv6Mqp*TzF%ZWDV+Zuaugpa+JNpz3s~JFnt~6MrcuKWOo=1A z@dvp*b7>G`LTEt4AWzK$Vwb(IqoXn~i&1_g+Q_5}lUcNSU2`uMtpVe8B8;r$r&L>z z%p+fwJhc(`BIbc&p=X8-=NR)b#TPT+BCek9P%p5}8AP(ZLC842Fj=<)*lQJxUq*3g zinWzfq4s84^@$^+BT|@J-I)b?%$ja4Z^?E*p^zW;an7HB|E@g7Y96BY{$z z5b&!xWRNOn`T?d1*M?-xe$E-2BS_ZF?F0(h~1_;(qR2<5HS!%h@;=SmV1^q0W+H;lB_3~i0FHttU~g?N(~U# zZM$uS(s9a&biY#1&3M4qGz3$!u_Yp#%zkFCP+9B2J(gddK-;u{2YRm*&g^7bqzP^)cSfw!L&7s7N2zxFi6c_qUGRD z@aykn`L^V#L0w&gz<&hq^HI)OQ-QHQEy6k5u=bnd6N9SiialFf=T2=Ktha57tJ$n( zOZD^AqYRCfZ278X&z=Ka$-}k4%|6`Ya_r>eHIMH0)Ty>HKwEuQq!87m_bPO%je#8* zMwdxB3zYEmGm{;Uv+YsDlKxude|NrC`cKu!Ao?lDg-GCylUEU0-Bs_@JzEkVB`#pvd!j4boI0+Ew zPvBXR+ny@l@#4@zTX#ap-*jUY`#2%&8rif}KB}QpciXwIqE5_$ZzrW|N z+~kjYbI*L8^FD*82DQNC$BZxd^TdJHLNXc&|y9Lo*&r!@7QDH zyi<7CZpsFV3iS4ULSsu;L%posGsQ;=1Y`YSsvS~gQI>5ED4^h8ciQWU`33GW#K*vG zd&w%OmyXQC10A1+)FX~imi)rFbTwl-x8*@mj_2t?C?V9fPV;me$+ZjD_sz%M6Wz{S z*9q(6t3`~}4w(03^xALRRktp;JkomDz_J_V>qy7lCdF0yXp_)H@0PY72;5X<%o5V<)SOb(`#F8g`ykdw5j~aK1|$uTxFa&Qr_``BeEVtwZ~D-S8&5 zBeyba!*;6mPsWe&II(HXJ?AhXuUcQWVf|{lQn;m6F1o%?`Y(x~jTtojJP~Xnv&nrR|w{!zBB&Ihl3u zmgjk}uJGLn+1+nyW{+phtrhQBA+W)EPaYUwcskPEj$J1}xW3y@nP6rf(-0pXPF(tn zqbeu5!iUoyo?|)@8q;EfQx6-(AR|KIY%}$;D|M(+()&W+gzN=h+Z7buKG>29NV<*d z5>l7jP5*%qV~PF}Jd_y?z33`%iLmN!5snHGhe+XalL|ubC|239ZFnYMwT|XIY@C(| zms8u~G_O}Rwu#lZ{go9GcF+5G!y~@s4WQwXueruCtMRdIFG{TN;n8JgwMmj(H`fME zT$TJ15VaBsDWW;g*RYUZ!0}ikZuz$EwyNg_zRO%_dDt#=fnO8n(p0=_O^)oT3E~8;^`<>*cRl$Tkur&TSbDDYb{L5Ev`qDB|(Y; z>o`&aIx30gs$M)QvG%r_WXmxYHbFdXKA|=X^G2n$PMj&a{@nxG%H8)E zw#=RhxGbt$cla4CBwtsCD$vtS16Eo=vv!S_>&4i%N5w$vq!FLnJ>2&l3ZxHAM0|?s zhhNoP8|o|~wgcx?)233(vuukHj=P3FEOFIXdr{J;!rPE2J~rgPrXD|kLL z%2jMrRdTo)X_oYwxnL`8`F5n(mwB3AX|GY{pBqxA+9Ut0&0H1TXTmK}O#SCf-3l88 zYuOkW^eeoPpXoLzEdJ)#I;#THZ{(%ds}-<{fmXLPrdt8rQ6szU_K$eJ z*~=Su`(cg+7c@?lxGKy)#3tR|je6-+0;n%2qLH#ZF({V&eB9MdSgLdv>O@GXRO^Q5 zuU3c37v$Xrp=X=r%D_=<;c1FiV|_;R!VO)SI*Z?A^J7{R>Nm^*>mIc@!C3>rJywOX z+GebcxM$AKKfLZa_4l;bQ9{w1Fpq`1IWasDz5&f42Z!G>{T7!}S~e=S{XV4K3r!Pq zGe-EPOP#5(*~uxYnG;O^p?xc!G6&uf^Fge3Y$ zYyBT{MY+d|zbrvZs91zw$XJTbSQbSA``c3m&(!L@50Gefk2fa^;6fg1_JZ!dZ$8(r zK6q~gRt2>A?FSnCXq)RQ3r&#sKK_uPnj(ZQ@UDsiXXiIxatVz^F#z@cSkPG=i!0mQ zP9DToi)yoNq`Ua6ju3z_So`fpee|7B9IW?jUL4pDk|=Gl zPX8)|{yDtZPWR)Zy%>AZ&FH*wALsMknVI7Xw2ktHXY-FK<6mh8CB^Cg5e@sLD6+&z z4Cq8NJJnu|MOrGlm*O*Bd)WQUClwy9UhYoyecKv|E=4!H?f&hX*iiV<{|)^}aPJ8r zJH*sSC4`>X;6odr_M;~2JOQ;$u1m(R?n-<)U^YlL1j+=Tw`bNWp6=!`In z;|-zqqlEh9wW$+fRDlE|@&A^^kdl%S_P-GSTNOjZBp{>3Xy(En94DPqrfJ$TIJxrI z`7r4Jk0T(~5Wvc=55goFx1;IHdHM9TnAHH;T391=r?dwOhQSGn8aU8b8|_SJO+1B7 zt)pN|pstYLH^Kp!s3B4>8a(PWjsF1TvJV5+em^qv;nP*DUI8snCMhB_Nhc6&SN0s z&Y==+c`|w%)PWcRb>h}AxCuijDI91?$p$1Q@sK|hho_}jM!&v_zMnCtvn{Nxp(z~B zENW4Pr#QLA>Of*i$s2`>!j6`uOI7eyUdz=PLa_q$2{T#=`C3Sowff173BxVN4`n+> zuu-F}kSm-p>Ldmo-VfXAhhh6mW!Gv>qAe>0;hInqvRackEQNMA(6X}Dffb6;^K`+i z%q>se^)NCDvurls0106jTg<)cW`!zT<{DK-4qf^a@f7fi|?S?~xeXUIA# zVG3W&r{$z`0<@{?qYdV>9ZVyzGeId~JGT8MiQEYhO+k2<3^$g^2?LB~9MFat5msxe zVkz1&X_AdmnFUL1;M$}&w=Z@`DQdS~8lYpl=%G9uaDq&N&SBX`a~)-PubCRb=w>*M z@uXO)43koZ@4>O`EF10Q>vU-I0%bCy)j*$cjL`gu9i*D5A&$A*Z6;i$q&oq57|tDo zi;14im|}d6d)~)Lso|?eJeWWkrk;QiQBT1|Vi|QII|8hxv2m2zyiPgJ~N-L^nl5|4v3|7G_P8Wpc%i^8jrO%74=!Ku>LRbAKA5v(M zG3rokmtq)kq;M2$GGt{dnwEtSpf=aO)WQPd)N}62815qLcO2$P7L-1@ zd78jeD9{hfygpoyLE#n&S~Xmj&zw(?&y?DQ=8nlOFh$Ktr|kL&3<3$pPOLSqAwK(I z-A=!5Q5Ypm2F0Z~F;~z^<4Yf3i*JD?g%WD$tDCwR(-@Kc&6O~6+Ri?{iehbP{$$E% z`V>qP6ay9i9^^9V24f;9^ayMwMVpL1Zf3JF3Qv1Dbv&1qZ6YwW{`Mk06SXHv7?}nW zyDia=K*2ae@Bl$U9Q$cGlL5gHB$%cr-YvsMlL25`AdhSA>=QDMI0&B^efqX~8H^y* zU{0{46I^Zpk5;w1Wd!>RFaNg6u)p?@A$bUdW#=uL_+`BmwwpL4oXL#C_4x80~&{Uyd z?)d~2$NopOu(cGr(-k^k1e@9ibq+8S2y$;jg79?A=W-ObzuF7_WAz%0pCgw{8o}D) zsGmqwloNi`3FO~3BxJYrVlZR ztBla^?@rVLK%Iu@rZNgMM->uF`d4v4a$!ThK>gB%Sn7>5`!Sj!6%~ zr=##F9RG;V=+cE;49rgWDPfx$)G3pV9o`Ypqld? zHfAN9lQyqOO4&B5aGMz(#!G}1L@?(uiY3-AGQn)$oB{X zHh7A2vZ?r<$Uj{7bwY1eU6^2@Yj?A?;hOJGTw_&au%lq0Wvy+pDSx8*tq7<%LCon1 ztbAdFwgbm{sYwwG&OE3qnDD9#h=1=s87&dXfr8zZux)W2!I+Jn9wSb`LhO&UwgM}W zkS!;@lYZDvQx&6EVzdyB!RjXd_YiHTG*&B-L)+EWvSAELpz~)B{4G>g1sQ2H}xu5>AWF^;iLl zGA*QLy3sRDX%nfuJbZ&Ngkbw&Qds}*<2I^hTam_U20BL ztnk00f&Q|Vqta+Rc41a$i!o(p6~v*1EO$v{b@_3lQnO+^n&I(TP1g5*iAg$)L~K7ZLJ zgK}N~IOm|Np;f(6JlDn?OnOHpQ;5$SwEg|v3i{%zGk}aSdifECdN2X739FBamXdL^ zVisby6!~hpSmWF6H*MZU@T0Zna95jHm_(j-Suu{PDOnn;THWn8b$s$t^~m_}IMEy) z1~5HX^_R4hY6FF-t#Kw25~{1QYBk^txR8Pubs~bPn^Ii zxIz`OIQSkNUz0jKF=Md6wBVM@e-D9rhn)2Ay4^0f5R4hzTa)O1 z#z!=0VW$ckh~q1$YP9(Gka&-GOju?UpTC!*fNs>(i_LDJ%e%8FK+OXD4JCg9JY1Vx zVp{#x&2-SU?O*~cC-}C63sxFWHc%FO%otvQ_7R94tmHG{cp>oa5q%l$scOkWq9#Vu(gxc%R3<{CLeB> zDX*?^D9+eRdSomCpK=V8%dVeLs>CH-e+3Q9fV#l!k`l3*1PlfOyh<2t;LQ=-sV+qa zGFuS1RffSaCf0Bg6ivMX%V*N7i>$J2wjE*$yWQkoA4mU1y%AnUEm@Zs%&wQmrHk2uAb+==>TX5dV~{Mvt6EB=i^? z6AVy6yHU}nXfyIBuGM>wVrQD5(+-qj;5!0y=x9ro*E>O26%w`S*!U2|yXg{G*8WUh z^=18Eyc|6l5*EGI|H2Q6k56mtf-~I2w@OkfzH9xnt+n_aLIce@>biqX{X3t5bc&fw z*4KDAI!l!A3B3xN7J-adVVoLm)4OPh15maKOi`gm0Dc;fko9o_j|&bYV-Sd{UsUKv zyWu=?wxgvLApaT1w^IcCa{x#}Wma&EL6~Lxb8wGB2%!*G!|tX1M)b1H>BuCtNC26r zG?ua3l?UXI6@QBDXG-giXT*j}N|%Ut`I(h~agN2$dR)hJ}<9kj5%fJF5tGEFp0CZ9qOp3vO4Y{Vc2^$S{!2JwLiI2kK zW%G5){+9eW|11p1PZS^rb+(+H^Z^0M>P4_^6-OCKkll+xm@cdl29FDhtdLe_CkJ_Mn2nlx#)*&1k7C&aIVyc7-E^uo)Pd;E#K(+e`mkha(Y z3{3JVdt-R5St3#Z>ozC7^U?&r0V24j+FNP6 zXddbcNTQO#T8VF6t~~-D%Hr7YS#ir)UOp|#Xqla8Mm!fx(o@3Ye}6ER;GpoJfghaa z2!lpL=xn!!E;f90i;vKButq8Ex?}6r1Gik(itb9$wyBoOIB{`I!1gKQmMcQhkyEQE z*AdtW1BS1z)`8#*oQzYpIfJurl(a!AqA(*`yPeU7t%YVaKsqEg>n~yCXJ8{L{Whqx zPioeb#^G`E`YQ8sA1^$6M*Zzc3j-mvjJCy3SY%f_h*tm_ULH|s6F|4*3w*(Zh1!c~ zhUDPE%um6biE#vARV->1mYN}wYyqg@=7fiRm+n0Knz6)k&OQ=yPI zuo~OUhY-Nv6~w3TCe=EPIIsfFS|VEGf@WJyYC2?nw3Z&WrTz*V&2bG-`8k;`wIkg_ zdd#Ljvd4hVdG)l_PuWVyD4;!E}<#5L_u zdhmA2pRi^as2BY_(vb8o$N@g_!)GN)i%Q|Hg+bzOifC}^a z;5M$mLkh70>O^JVXr7clOjL2hgt_7P?64l63F3#p=Xi9ztMNB<+@h)wHbfT!q8jo^x% zDqB28u4TGf1S^;YKXVLa9kcqbtIg$e(9$f)FeJ@P$?l7W`F6Nlgga&bNXBRMXB%x_ zOFcsuyOJYOwa+<{o$GC$W
-
Date: Mon, 11 Apr 2022 07:58:23 +0200 Subject: [PATCH 009/141] fix(claim_photos): consider other image types in html --- modules/claim/front/photos/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/claim/front/photos/index.html b/modules/claim/front/photos/index.html index 90691a95d..9e00ee02f 100644 --- a/modules/claim/front/photos/index.html +++ b/modules/claim/front/photos/index.html @@ -16,7 +16,7 @@
+ ng-if="photo.dms.contentType != 'video/mp4'">
Date: Tue, 12 Apr 2022 12:32:48 +0200 Subject: [PATCH 016/141] fix: frontTest --- modules/claim/front/action/index.spec.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js index ab104f93a..458d5e831 100644 --- a/modules/claim/front/action/index.spec.js +++ b/modules/claim/front/action/index.spec.js @@ -156,12 +156,8 @@ describe('claim', () => { it('should perform a post query and show a success message', () => { jest.spyOn(controller.vnApp, 'showSuccess'); - const data = { - rows: {id: 1}, - claimDestinationFk: 1 - }; - $httpBackend.expect('POST', `Claims/updateClaimDestination`, data).respond({}); - controller.save(data); + $httpBackend.expect('POST', `Claims/updateClaimDestination`).respond({}); + controller.onResponse(); $httpBackend.flush(); expect(controller.vnApp.showSuccess).toHaveBeenCalled(); From ad3b3c44d623208cfcd11686a92ae103aa57ba07 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 12 Apr 2022 12:44:46 +0200 Subject: [PATCH 017/141] refactor: replace let for const --- modules/claim/back/methods/claim-end/deleteSalesClaimed.js | 6 ++---- modules/claim/back/methods/claim/updateClaimDestination.js | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/claim/back/methods/claim-end/deleteSalesClaimed.js b/modules/claim/back/methods/claim-end/deleteSalesClaimed.js index 722e3058b..d716f650d 100644 --- a/modules/claim/back/methods/claim-end/deleteSalesClaimed.js +++ b/modules/claim/back/methods/claim-end/deleteSalesClaimed.js @@ -21,15 +21,13 @@ module.exports = Self => { Self.deleteSalesClaimed = async(ctx, sales, options) => { const models = Self.app.models; const myOptions = {}; - let tx; + const tx = await Self.beginTransaction({}); if (typeof options == 'object') Object.assign(myOptions, options); - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); + if (!myOptions.transaction) myOptions.transaction = tx; - } try { const promises = []; diff --git a/modules/claim/back/methods/claim/updateClaimDestination.js b/modules/claim/back/methods/claim/updateClaimDestination.js index 104fbaf0b..a4f823827 100644 --- a/modules/claim/back/methods/claim/updateClaimDestination.js +++ b/modules/claim/back/methods/claim/updateClaimDestination.js @@ -24,16 +24,14 @@ module.exports = Self => { }); Self.updateClaimDestination = async(rows, claimDestinationFk, options) => { - let tx; + const tx = await Self.beginTransaction({}); const myOptions = {}; if (typeof options == 'object') Object.assign(myOptions, options); - if (!myOptions.transaction) { - tx = await Self.beginTransaction({}); + if (!myOptions.transaction) myOptions.transaction = tx; - } try { const models = Self.app.models; From 9a171d5202153bb02ec330c5d1a633300212a5bc Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 12 Apr 2022 12:45:07 +0200 Subject: [PATCH 018/141] refactor --- modules/claim/back/methods/claim-end/filter.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/claim/back/methods/claim-end/filter.js b/modules/claim/back/methods/claim-end/filter.js index 8bf06a1b1..0dda16a3a 100644 --- a/modules/claim/back/methods/claim-end/filter.js +++ b/modules/claim/back/methods/claim-end/filter.js @@ -1,7 +1,5 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; -const buildFilter = require('vn-loopback/util/filter').buildFilter; -const mergeFilters = require('vn-loopback/util/filter').mergeFilters; module.exports = Self => { Self.remoteMethodCtx('filter', { From c1edb8206ee1d32b397516d67831bfb4836244f9 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 12 Apr 2022 12:46:26 +0200 Subject: [PATCH 019/141] refactor --- modules/claim/front/action/index.html | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/claim/front/action/index.html b/modules/claim/front/action/index.html index 70b0ef0fb..059764ae2 100644 --- a/modules/claim/front/action/index.html +++ b/modules/claim/front/action/index.html @@ -114,10 +114,7 @@ {{::saleClaimed.concept}} {{::saleClaimed.price | currency: 'EUR':2}} {{::saleClaimed.discount}} % - - {{saleClaimed.quantity * saleClaimed.price * - ((100 - saleClaimed.discount) / 100) | currency: 'EUR':2}} - + {{saleClaimed.total | currency: 'EUR':2}} Date: Tue, 12 Apr 2022 13:01:34 +0200 Subject: [PATCH 020/141] Notify to group with for user with busy status --- back/methods/chat/sendCheckingPresence.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 5c27d72fd..c9254aeb8 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -46,7 +46,7 @@ module.exports = Self => { const {data} = await Self.getUserStatus(recipient.name); if (data) { - if (data.status === 'offline') { + if (data.status === 'offline' || data.status === 'busy') { // Send message to department room const workerDepartment = await models.WorkerDepartment.findById(recipientId, { include: { From 73ee790f8d20ddf11b013ed2ce7e9f09c1a369e9 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 12 Apr 2022 14:27:06 +0200 Subject: [PATCH 021/141] removed isFarmer property --- modules/supplier/back/methods/supplier/getSummary.js | 7 +------ .../back/methods/supplier/specs/getSummary.spec.js | 8 -------- modules/supplier/front/summary/index.html | 5 ----- 3 files changed, 1 insertion(+), 19 deletions(-) diff --git a/modules/supplier/back/methods/supplier/getSummary.js b/modules/supplier/back/methods/supplier/getSummary.js index 67f5267b6..c29a2a058 100644 --- a/modules/supplier/back/methods/supplier/getSummary.js +++ b/modules/supplier/back/methods/supplier/getSummary.js @@ -100,12 +100,7 @@ module.exports = Self => { }, ] }; - let supplier = await Self.app.models.Supplier.findOne(filter); - const farmerCode = 2; - if (supplier.sageWithholdingFk == farmerCode) - supplier.isFarmer = true; - - return supplier; + return Self.app.models.Supplier.findOne(filter); }; }; diff --git a/modules/supplier/back/methods/supplier/specs/getSummary.spec.js b/modules/supplier/back/methods/supplier/specs/getSummary.spec.js index 21e56882f..30713f517 100644 --- a/modules/supplier/back/methods/supplier/specs/getSummary.spec.js +++ b/modules/supplier/back/methods/supplier/specs/getSummary.spec.js @@ -25,12 +25,4 @@ describe('Supplier getSummary()', () => { expect(payMethod.name).toEqual('PayMethod one'); }); - - it(`should get if supplier is farmer by sageWithholdingFk`, async() => { - const supplier = await app.models.Supplier.findById(2); - const supplierSummary = await app.models.Supplier.getSummary(2); - - expect(supplier.isFarmer).toBeUndefined(); - expect(supplierSummary.isFarmer).toEqual(true); - }); }); diff --git a/modules/supplier/front/summary/index.html b/modules/supplier/front/summary/index.html index 51ebde695..086cd844d 100644 --- a/modules/supplier/front/summary/index.html +++ b/modules/supplier/front/summary/index.html @@ -83,11 +83,6 @@ label="Account" value="{{::$ctrl.summary.account}}"> - - From 8e87ab62a879554c6d5a6b53202d3fe9e692d415 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 12 Apr 2022 14:40:25 +0200 Subject: [PATCH 022/141] feat(entry_latest-buys): add multi-check-dummy --- .../core/components/multi-check/locale/en.yml | 1 + .../core/components/multi-check/locale/es.yml | 3 +++ .../components/multi-check/multi-check.html | 21 +++++++++++++++- .../components/multi-check/multi-check.js | 25 ++++++++++++++++++- front/core/components/multi-check/style.scss | 12 +++++++++ .../back/methods/entry/editLatestBuys.js | 21 +++++++++++++--- modules/entry/front/latest-buys/index.html | 4 ++- modules/entry/front/latest-buys/index.js | 14 ++++++++--- 8 files changed, 91 insertions(+), 10 deletions(-) create mode 100644 front/core/components/multi-check/locale/en.yml create mode 100644 front/core/components/multi-check/locale/es.yml diff --git a/front/core/components/multi-check/locale/en.yml b/front/core/components/multi-check/locale/en.yml new file mode 100644 index 000000000..ea52dcf8f --- /dev/null +++ b/front/core/components/multi-check/locale/en.yml @@ -0,0 +1 @@ +SelectAllRows: Select the {{rows}} row(s) \ No newline at end of file diff --git a/front/core/components/multi-check/locale/es.yml b/front/core/components/multi-check/locale/es.yml new file mode 100644 index 000000000..5365c3392 --- /dev/null +++ b/front/core/components/multi-check/locale/es.yml @@ -0,0 +1,3 @@ +SelectAllRows: Seleccionar las {{rows}} fila(s) +All: Se han seleccionado +row(s) have been selected.: fila(s). \ No newline at end of file diff --git a/front/core/components/multi-check/multi-check.html b/front/core/components/multi-check/multi-check.html index fb950aaff..17b7598c3 100644 --- a/front/core/components/multi-check/multi-check.html +++ b/front/core/components/multi-check/multi-check.html @@ -2,4 +2,23 @@ ng-model="$ctrl.checked" indeterminate="$ctrl.isIndeterminate" translate-attr="{title: 'Check all'}"> - \ No newline at end of file + + + + + + All + + {{$ctrl.rows}} + + row(s) have been selected. + + {{$ctrl.AllRowsCount}} + + + \ No newline at end of file diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index afa1bc3c4..42ceb1887 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -138,6 +138,27 @@ export default class MultiCheck extends FormInput { }); } + countRows() { + if (!this.model || !this.model.data) return; + const data = this.model.data; + const params = { + filter: { + where: this.model.userParams, + limit: null + } + }; + + this.$http.get(this.model.url, {params}) + .then(res => { + this.AllRows = res.data; + this.AllRowsCount = this.$t('SelectAllRows', { + rows: res.data.length + }); + }); + this.rows = data.length; + this.checkedDummy = data.length; + } + /** * Toggles checked property on * all instances @@ -158,7 +179,9 @@ ngModule.vnComponent('vnMultiCheck', { checkField: '@?', checkAll: '=?', checked: '=?', - disabled: ' { type: ['Object'], required: true, description: `the buys which will be modified` + }, + { + arg: 'filter', + type: ['object'], + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string' }], returns: { type: 'Object', @@ -30,8 +35,9 @@ module.exports = Self => { } }); - Self.editLatestBuys = async(field, newValue, lines, options) => { + Self.editLatestBuys = async(field, newValue, lines, filter, options) => { let tx; + console.log(filter); const myOptions = {}; if (typeof options == 'object') @@ -64,8 +70,16 @@ module.exports = Self => { const models = Self.app.models; const model = models[modelName]; - try { + let result; + console.log(filter); + + if (filter) { + result = await model.upsertWithWhere(filter, value, myOptions); + if (tx) await tx.commit(); + return result; + } + const promises = []; const targets = lines.map(line => { @@ -74,11 +88,10 @@ module.exports = Self => { const value = {}; value[field] = newValue; - for (let target of targets) promises.push(model.upsertWithWhere({id: target}, value, myOptions)); - const result = await Promise.all(promises); + result = await Promise.all(promises); if (tx) await tx.commit(); diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index 4eeeeedce..3b9c12860 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -31,7 +31,9 @@ + check-field="$checked" + check-dummy="$ctrl.checkDummy" + checked-dummy="$ctrl.checkedDummy"> Picture diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js index 385e7e4b6..477aa6ad7 100644 --- a/modules/entry/front/latest-buys/index.js +++ b/modules/entry/front/latest-buys/index.js @@ -89,11 +89,13 @@ export default class Controller extends Section { get checked() { const buys = this.$.model.data || []; - const checkedBuys = []; + let checkedBuys = []; for (let buy of buys) { if (buy.$checked) checkedBuys.push(buy); } + if (this.checkedDummy) + checkedBuys = this.checkedDummy; return checkedBuys; } @@ -149,11 +151,12 @@ export default class Controller extends Section { const rowsToEdit = []; for (let row of this.checked) rowsToEdit.push({id: row.id, itemFk: row.itemFk}); - + console.log(this.editFilter); const data = { field: this.editedColumn.field, newValue: this.editedColumn.newValue, - lines: rowsToEdit + lines: rowsToEdit, + filter: this.editFilter }; return this.$http.post('Buys/editLatestBuys', data) @@ -162,6 +165,11 @@ export default class Controller extends Section { this.$.model.refresh(); }); } + + checkDummy() { + console.log('editFilter', this.model.userParams); + this.editFilter = this.model.userParams; + } } ngModule.component('vnEntryLatestBuys', { From 62daa6b38dd4e3d025cacb304c54b445ae2ebee5 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 12 Apr 2022 14:44:32 +0200 Subject: [PATCH 023/141] Send to user when no department channel is specified --- back/methods/chat/sendCheckingPresence.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index c9254aeb8..6560240c6 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -58,6 +58,8 @@ module.exports = Self => { if (channelName) return Self.send(ctx, `#${channelName}`, `@${recipient.name} ➔ ${message}`); + else + return Self.send(ctx, `@${recipient.name}`, message); } else return Self.send(ctx, `@${recipient.name}`, message); } From f2ee987dec9924f261159d55302c956ce9c4c0ca Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 13 Apr 2022 08:15:47 +0200 Subject: [PATCH 024/141] fix multi-check --- .../components/multi-check/multi-check.html | 6 +++--- .../components/multi-check/multi-check.js | 15 +++++++++++--- .../back/methods/entry/editLatestBuys.js | 16 +++++++-------- modules/entry/front/latest-buys/index.html | 4 ++-- modules/entry/front/latest-buys/index.js | 20 +++++++++---------- 5 files changed, 34 insertions(+), 27 deletions(-) diff --git a/front/core/components/multi-check/multi-check.html b/front/core/components/multi-check/multi-check.html index 17b7598c3..2c83d08e1 100644 --- a/front/core/components/multi-check/multi-check.html +++ b/front/core/components/multi-check/multi-check.html @@ -5,19 +5,19 @@ - + All {{$ctrl.rows}} row(s) have been selected. - + {{$ctrl.AllRowsCount}} diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index 42ceb1887..21f403838 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -106,6 +106,9 @@ export default class MultiCheck extends FormInput { this.toggle(); this.emit('change', value); + + if (!value) + this.checkedDummyCount = null; } /** @@ -156,7 +159,13 @@ export default class MultiCheck extends FormInput { }); }); this.rows = data.length; - this.checkedDummy = data.length; + } + + checkDummy() { + if (this.checkedDummyCount) + return this.checkedDummyCount = null; + + this.checkedDummyCount = 15; // console.log } /** @@ -180,8 +189,8 @@ ngModule.vnComponent('vnMultiCheck', { checkAll: '=?', checked: '=?', disabled: ' { }, { arg: 'filter', - type: ['object'], + type: 'object', description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string' }], returns: { @@ -37,7 +37,7 @@ module.exports = Self => { Self.editLatestBuys = async(field, newValue, lines, filter, options) => { let tx; - console.log(filter); + console.log('filter', filter); const myOptions = {}; if (typeof options == 'object') @@ -72,22 +72,22 @@ module.exports = Self => { const model = models[modelName]; try { let result; - console.log(filter); + + const promises = []; + const value = {}; + value[field] = newValue; if (filter) { - result = await model.upsertWithWhere(filter, value, myOptions); + promises.push(model.upsertWithWhere(filter, value, myOptions)); + result = await Promise.all(promises); if (tx) await tx.commit(); return result; } - const promises = []; - const targets = lines.map(line => { return line[identifier]; }); - const value = {}; - value[field] = newValue; for (let target of targets) promises.push(model.upsertWithWhere({id: target}, value, myOptions)); diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index 3b9c12860..b5773b04b 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -32,8 +32,8 @@ checked="$ctrl.checkAll" model="model" check-field="$checked" - check-dummy="$ctrl.checkDummy" - checked-dummy="$ctrl.checkedDummy"> + check-dummy-enabled="true" + checked-dummy-count="$ctrl.checkedDummyCount"> Picture diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js index 477aa6ad7..7210649aa 100644 --- a/modules/entry/front/latest-buys/index.js +++ b/modules/entry/front/latest-buys/index.js @@ -89,13 +89,11 @@ export default class Controller extends Section { get checked() { const buys = this.$.model.data || []; - let checkedBuys = []; + const checkedBuys = []; for (let buy of buys) { if (buy.$checked) checkedBuys.push(buy); } - if (this.checkedDummy) - checkedBuys = this.checkedDummy; return checkedBuys; } @@ -144,6 +142,9 @@ export default class Controller extends Section { } get totalChecked() { + if (this.checkedDummyCount) + return this.checkedDummyCount; + return this.checked.length; } @@ -151,25 +152,22 @@ export default class Controller extends Section { const rowsToEdit = []; for (let row of this.checked) rowsToEdit.push({id: row.id, itemFk: row.itemFk}); - console.log(this.editFilter); + const data = { field: this.editedColumn.field, newValue: this.editedColumn.newValue, - lines: rowsToEdit, - filter: this.editFilter + lines: rowsToEdit }; + if (this.checkedDummyCount && this.checkedDummyCount > 0) + data.filter = this.$.model.userParams; + return this.$http.post('Buys/editLatestBuys', data) .then(() => { this.uncheck(); this.$.model.refresh(); }); } - - checkDummy() { - console.log('editFilter', this.model.userParams); - this.editFilter = this.model.userParams; - } } ngModule.component('vnEntryLatestBuys', { From 36addcdb6c9da73eef8a2d20f21fea59af048f6e Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 13 Apr 2022 13:05:20 +0200 Subject: [PATCH 025/141] fix name tests --- e2e/paths/02-client/12_lock_of_verified_data.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index 6bf6bd80b..b6b74b262 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -123,13 +123,13 @@ describe('Client lock verified data path', () => { await page.accessToSection('client.card.fiscalData'); }, 20000); - it('should confirm verified data button is enabled for salesAssistant', async() => { + it('should confirm verified data button is disabled for salesAssistant', async() => { const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); expect(isDisabled).toBeTruthy(); }); - it('should now edit the social name', async() => { + it('should return error when edit the social name', async() => { await page.clearInput(selectors.clientFiscalData.socialName); await page.write(selectors.clientFiscalData.socialName, 'new social name edition'); await page.waitToClick(selectors.clientFiscalData.saveButton); From 04f993e227694802cd919d6b664f0e4a34b779c3 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 13 Apr 2022 13:55:18 +0200 Subject: [PATCH 026/141] fix --- back/methods/collection/setSaleQuantity.js | 2 +- front/core/components/multi-check/multi-check.js | 2 +- modules/entry/back/methods/entry/editLatestBuys.js | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/back/methods/collection/setSaleQuantity.js b/back/methods/collection/setSaleQuantity.js index 82451b8be..95145e9a0 100644 --- a/back/methods/collection/setSaleQuantity.js +++ b/back/methods/collection/setSaleQuantity.js @@ -28,7 +28,7 @@ module.exports = Self => { const args = ctx.args; const models = Self.app.models; - const sale = await models.Sale.findById(args.saleId,); + const sale = await models.Sale.findById(args.saleId); return await sale.updateAttribute('quantity', args.quantity); }; }; diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index 21f403838..9e709d4e1 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -165,7 +165,7 @@ export default class MultiCheck extends FormInput { if (this.checkedDummyCount) return this.checkedDummyCount = null; - this.checkedDummyCount = 15; // console.log + this.checkedDummyCount = this.rows; } /** diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js index 08e84fd1f..636efb8b4 100644 --- a/modules/entry/back/methods/entry/editLatestBuys.js +++ b/modules/entry/back/methods/entry/editLatestBuys.js @@ -37,7 +37,6 @@ module.exports = Self => { Self.editLatestBuys = async(field, newValue, lines, filter, options) => { let tx; - console.log('filter', filter); const myOptions = {}; if (typeof options == 'object') @@ -78,9 +77,11 @@ module.exports = Self => { value[field] = newValue; if (filter) { - promises.push(model.upsertWithWhere(filter, value, myOptions)); - result = await Promise.all(promises); + const valueData = await model.find(filter, myOptions); + result = await valueData.updateAttribute(field, newValue, myOptions); + if (tx) await tx.commit(); + return result; } From 8432815cb7d780b51c1bceb823173fcf7fcbc862 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 13 Apr 2022 14:58:46 +0200 Subject: [PATCH 027/141] refactor --- modules/entry/back/methods/entry/editLatestBuys.js | 13 ++++--------- .../entry/back/methods/entry/latestBuysFilter.js | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js index 636efb8b4..58d33e183 100644 --- a/modules/entry/back/methods/entry/editLatestBuys.js +++ b/modules/entry/back/methods/entry/editLatestBuys.js @@ -76,19 +76,14 @@ module.exports = Self => { const value = {}; value[field] = newValue; - if (filter) { - const valueData = await model.find(filter, myOptions); - result = await valueData.updateAttribute(field, newValue, myOptions); - - if (tx) await tx.commit(); - - return result; - } + if (filter) + lines = await models.Entry.latestBuysFilter(null, filter, myOptions);// ctx? + // get lines + console.log(lines.length); const targets = lines.map(line => { return line[identifier]; }); - for (let target of targets) promises.push(model.upsertWithWhere({id: target}, value, myOptions)); diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 04570533c..6399faa52 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -86,7 +86,7 @@ module.exports = Self => { } ], returns: { - type: ['Object'], + type: ['object'], root: true }, http: { From 7cecf1584bb53aa7ce4c8a91fdf8e5ebc1d49eff Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 19 Apr 2022 12:04:06 +0200 Subject: [PATCH 028/141] feat(ticket): change isAvailable to itemShortage --- modules/monitor/back/methods/sales-monitor/salesFilter.js | 4 ++-- modules/monitor/front/index/tickets/index.html | 4 ++-- modules/ticket/back/methods/ticket/filter.js | 4 ++-- modules/ticket/back/methods/ticket/getSales.js | 2 +- modules/ticket/back/methods/ticket/specs/filter.spec.js | 2 +- modules/ticket/front/index/index.html | 4 ++-- modules/ticket/front/index/locale/es.yml | 1 + modules/ticket/front/sale/index.html | 4 ++-- modules/ticket/front/summary/index.html | 4 ++-- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js index d67c5c3fc..4521b2351 100644 --- a/modules/monitor/back/methods/sales-monitor/salesFilter.js +++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js @@ -304,7 +304,7 @@ module.exports = Self => { {'tp.hasTicketRequest': true}, {'tp.hasComponentLack': true}, {'tp.isTaxDataChecked': false}, - {'tp.isAvailable': false} + {'tp.itemShortage': {neq: null}} ]}; } else if (hasProblems === false) { whereProblems = {and: [ @@ -313,7 +313,7 @@ module.exports = Self => { {'tp.hasTicketRequest': false}, {'tp.hasComponentLack': false}, {'tp.isTaxDataChecked': true}, - {'tp.isAvailable': true} + {'tp.itemShortage': null} ]}; } diff --git a/modules/monitor/front/index/tickets/index.html b/modules/monitor/front/index/tickets/index.html index 76b9219ee..968215e67 100644 --- a/modules/monitor/front/index/tickets/index.html +++ b/modules/monitor/front/index/tickets/index.html @@ -98,8 +98,8 @@ icon="icon-buyrequest"> diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 58c440e95..902831d99 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -324,7 +324,7 @@ module.exports = Self => { case true: condition = `or`; hasProblem = true; - range = 0; + range = {neq: null}; hasWhere = true; break; @@ -340,7 +340,7 @@ module.exports = Self => { {'tp.isFreezed': hasProblem}, {'tp.risk': hasProblem}, {'tp.hasTicketRequest': hasProblem}, - {'tp.isAvailable': range} + {'tp.itemShortage': range} ]}; if (hasWhere) diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js index 6dfee5dfa..3e45b3fb5 100644 --- a/modules/ticket/back/methods/ticket/getSales.js +++ b/modules/ticket/back/methods/ticket/getSales.js @@ -94,7 +94,7 @@ module.exports = Self => { sale.visible = itemStock.visible; sale.claim = claimedSales.get(sale.id); if (problems) { - sale.isAvailable = problems.isAvailable; + sale.itemShortage = problems.itemShortage; sale.hasTicketRequest = problems.hasTicketRequest; sale.hasComponentLack = problems.hasComponentLack; } diff --git a/modules/ticket/back/methods/ticket/specs/filter.spec.js b/modules/ticket/back/methods/ticket/specs/filter.spec.js index b251d5335..4b583fc87 100644 --- a/modules/ticket/back/methods/ticket/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket/specs/filter.spec.js @@ -39,7 +39,7 @@ describe('ticket filter()', () => { const filter = {}; const result = await models.Ticket.filter(ctx, filter, options); - expect(result.length).toEqual(4); + expect(result.length).toEqual(6); await tx.rollback(); } catch (e) { diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 36af86001..1e18ce284 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -52,8 +52,8 @@ icon="icon-buyrequest"> diff --git a/modules/ticket/front/index/locale/es.yml b/modules/ticket/front/index/locale/es.yml index eac0084f6..74b17b0f3 100644 --- a/modules/ticket/front/index/locale/es.yml +++ b/modules/ticket/front/index/locale/es.yml @@ -1,6 +1,7 @@ Weekly tickets: Tickets programados Go to lines: Ir a lineas Not available: No disponible +Not visible: No visible Payment on account...: Pago a cuenta... Set as delivered and open delivery note(s): Marcar como servido/s y abrir albarán/es Closure: Cierre diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index 836fadb9b..f4e5840f3 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -95,8 +95,8 @@ translate-attr="{title: 'Reserved'}"> diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index 99fb949b6..fe49a301f 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -157,8 +157,8 @@ translate-attr="{title: 'Reserved'}"> From 69530d3019375f1826943a9edceff856d24c87c9 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 19 Apr 2022 14:12:31 +0200 Subject: [PATCH 029/141] fix filter --- front/core/components/multi-check/multi-check.html | 2 +- front/core/components/multi-check/multi-check.js | 11 ++++++----- modules/entry/back/methods/entry/editLatestBuys.js | 13 +++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/front/core/components/multi-check/multi-check.html b/front/core/components/multi-check/multi-check.html index 2c83d08e1..8954a9b77 100644 --- a/front/core/components/multi-check/multi-check.html +++ b/front/core/components/multi-check/multi-check.html @@ -18,7 +18,7 @@ row(s) have been selected. - {{$ctrl.AllRowsCount}} + {{$ctrl.AllRowsText}} \ No newline at end of file diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index 9e709d4e1..841e98b2a 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -151,21 +151,22 @@ export default class MultiCheck extends FormInput { } }; + this.rows = data.length; + this.$http.get(this.model.url, {params}) .then(res => { - this.AllRows = res.data; - this.AllRowsCount = this.$t('SelectAllRows', { - rows: res.data.length + this.AllRowsCount = res.data.length; + this.AllRowsText = this.$t('SelectAllRows', { + rows: this.AllRowsCount }); }); - this.rows = data.length; } checkDummy() { if (this.checkedDummyCount) return this.checkedDummyCount = null; - this.checkedDummyCount = this.rows; + this.checkedDummyCount = this.AllRowsCount; } /** diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js index 58d33e183..cae4c1d10 100644 --- a/modules/entry/back/methods/entry/editLatestBuys.js +++ b/modules/entry/back/methods/entry/editLatestBuys.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethod('editLatestBuys', { + Self.remoteMethodCtx('editLatestBuys', { description: 'Updates a column for one or more buys', accessType: 'WRITE', accepts: [{ @@ -35,7 +35,7 @@ module.exports = Self => { } }); - Self.editLatestBuys = async(field, newValue, lines, filter, options) => { + Self.editLatestBuys = async(ctx, field, newValue, lines, filter, options) => { let tx; const myOptions = {}; @@ -76,11 +76,12 @@ module.exports = Self => { const value = {}; value[field] = newValue; - if (filter) - lines = await models.Entry.latestBuysFilter(null, filter, myOptions);// ctx? - // get lines + if (filter) { + ctx.args.filter = {where: filter, limit: null}; + lines = await models.Buy.latestBuysFilter(ctx, null, myOptions);// ctx? + } + // get lines - console.log(lines.length); const targets = lines.map(line => { return line[identifier]; }); From 433afb8fe8dee54cd44c0cbd28eb5c3bb2576633 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 19 Apr 2022 15:21:28 +0200 Subject: [PATCH 030/141] change tooltip client descriptor btnFive --- modules/client/front/descriptor/index.html | 2 +- modules/client/front/descriptor/locale/es.yml | 1 + .../back/methods/entry/editLatestBuys.js | 7 ++-- .../entry/specs/editLatestBuys.spec.js | 32 +++++++++++++++++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index de7a86d3b..cad226416 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -105,7 +105,7 @@
diff --git a/modules/client/front/descriptor/locale/es.yml b/modules/client/front/descriptor/locale/es.yml index e6aca9665..71723e654 100644 --- a/modules/client/front/descriptor/locale/es.yml +++ b/modules/client/front/descriptor/locale/es.yml @@ -3,5 +3,6 @@ View consumer report: Ver informe de consumo From date: Fecha desde To date: Fecha hasta Go to user: Ir al usuario +Go to supplier: Ir al proveedor Client invoices list: Listado de facturas del cliente Pay method: Forma de pago \ No newline at end of file diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js index cae4c1d10..90f1454b4 100644 --- a/modules/entry/back/methods/entry/editLatestBuys.js +++ b/modules/entry/back/methods/entry/editLatestBuys.js @@ -70,17 +70,14 @@ module.exports = Self => { const models = Self.app.models; const model = models[modelName]; try { - let result; - const promises = []; const value = {}; value[field] = newValue; if (filter) { ctx.args.filter = {where: filter, limit: null}; - lines = await models.Buy.latestBuysFilter(ctx, null, myOptions);// ctx? + lines = await models.Buy.latestBuysFilter(ctx, null, myOptions); } - // get lines const targets = lines.map(line => { return line[identifier]; @@ -88,7 +85,7 @@ module.exports = Self => { for (let target of targets) promises.push(model.upsertWithWhere({id: target}, value, myOptions)); - result = await Promise.all(promises); + const result = await Promise.all(promises); if (tx) await tx.commit(); diff --git a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js index b17b0ab21..2413c18f6 100644 --- a/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js +++ b/modules/entry/back/methods/entry/specs/editLatestBuys.spec.js @@ -6,7 +6,7 @@ describe('Buy editLatestsBuys()', () => { const options = {transaction: tx}; try { - let ctx = { + const ctx = { args: { search: 'Ranged weapon longbow 2m' } @@ -18,7 +18,35 @@ describe('Buy editLatestsBuys()', () => { const newValue = 99; const lines = [{itemFk: original.itemFk, id: original.id}]; - await models.Buy.editLatestBuys(field, newValue, lines, options); + await models.Buy.editLatestBuys(ctx, field, newValue, lines, null, options); + + const [result] = await models.Buy.latestBuysFilter(ctx, null, options); + + expect(result[field]).toEqual(newValue); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); + + it('should change the value of a given column for filter', async() => { + const tx = await models.Buy.beginTransaction({}); + const options = {transaction: tx}; + + try { + const filter = {typeFk: 1}; + const ctx = { + args: { + filter: filter + } + }; + + const field = 'size'; + const newValue = 88; + + await models.Buy.editLatestBuys(ctx, field, newValue, null, filter, options); const [result] = await models.Buy.latestBuysFilter(ctx, null, options); From ea2e38af4eb45697061372da7ca8973778855b34 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 20 Apr 2022 08:24:12 +0200 Subject: [PATCH 031/141] support front filter and front test for component --- .../components/multi-check/multi-check.html | 2 +- .../components/multi-check/multi-check.js | 12 +++-- .../multi-check/multi-check.spec.js | 53 ++++++++++++++++++- .../back/methods/entry/latestBuysFilter.js | 3 ++ 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/front/core/components/multi-check/multi-check.html b/front/core/components/multi-check/multi-check.html index 8954a9b77..eaa4577f0 100644 --- a/front/core/components/multi-check/multi-check.html +++ b/front/core/components/multi-check/multi-check.html @@ -18,7 +18,7 @@ row(s) have been selected. - {{$ctrl.AllRowsText}} + {{$ctrl.allRowsText}} \ No newline at end of file diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index 841e98b2a..ba40acd06 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -143,10 +143,12 @@ export default class MultiCheck extends FormInput { countRows() { if (!this.model || !this.model.data) return; + const data = this.model.data; + const modelParams = this.model.userParams; const params = { filter: { - where: this.model.userParams, + modelParams: modelParams, limit: null } }; @@ -155,9 +157,9 @@ export default class MultiCheck extends FormInput { this.$http.get(this.model.url, {params}) .then(res => { - this.AllRowsCount = res.data.length; - this.AllRowsText = this.$t('SelectAllRows', { - rows: this.AllRowsCount + this.allRowsCount = res.data.length; + this.allRowsText = this.$t('SelectAllRows', { + rows: this.allRowsCount }); }); } @@ -166,7 +168,7 @@ export default class MultiCheck extends FormInput { if (this.checkedDummyCount) return this.checkedDummyCount = null; - this.checkedDummyCount = this.AllRowsCount; + this.checkedDummyCount = this.allRowsCount; } /** diff --git a/front/core/components/multi-check/multi-check.spec.js b/front/core/components/multi-check/multi-check.spec.js index c8069da3c..ee8a95c88 100644 --- a/front/core/components/multi-check/multi-check.spec.js +++ b/front/core/components/multi-check/multi-check.spec.js @@ -4,10 +4,12 @@ import crudModel from 'core/mocks/crud-model'; describe('Component vnMultiCheck', () => { let controller; let $element; + let $httpBackend; beforeEach(ngModule('vnCore')); - beforeEach(inject($componentController => { + beforeEach(inject(($componentController, _$httpBackend_) => { + $httpBackend = _$httpBackend_; $element = angular.element(`
`); controller = $componentController('vnMultiCheck', {$element: $element}); controller._model = crudModel; @@ -26,6 +28,14 @@ describe('Component vnMultiCheck', () => { expect(controller._checked).toEqual(crudModel); expect(controller.toggle).toHaveBeenCalledWith(); }); + + it(`should set checkedDummyCount to null`, () => { + jest.spyOn(controller, 'toggle'); + controller.checkedDummyCount = 12; + controller.checked = null; + + expect(controller.checkedDummyCount).toBeNull(); + }); }); describe('toggle()', () => { @@ -132,4 +142,45 @@ describe('Component vnMultiCheck', () => { expect(thirdRow.checked).toBeTruthy(); }); }); + + describe('countRows()', () => { + it(`should count visible rows and all rows of model`, () => { + const data = controller.model.data; + controller.model.url = 'modelUrl/filter'; + const response = { + data: [ + {id: 1, name: 'My item 1'}, + {id: 2, name: 'My item 2'}, + {id: 3, name: 'My item 3'}, + {id: 4, name: 'My item 4'}, + {id: 5, name: 'My item 5'}, + {id: 6, name: 'My item 6'} + ] + }; + + controller.countRows(); + + $httpBackend.expectGET('modelUrl/filter').respond(response); + + expect(controller.rows).toEqual(data.length); + expect(controller.AllRowsCount).toEqual(response.length); + }); + }); + + describe('checkDummy()', () => { + it(`should set checkedDummyCount allRowsCount`, () => { + controller.checkedDummyCount = null; + controller.allRowsCount = 123; + controller.checkDummy(); + + expect(controller.checkedDummyCount).toEqual(controller.allRowsCount); + }); + + it(`should set checkedDummyCount to null`, () => { + controller.checkedDummyCount = 123; + controller.checkDummy(); + + expect(controller.checkedDummyCount).toBeNull(); + }); + }); }); diff --git a/modules/entry/back/methods/entry/latestBuysFilter.js b/modules/entry/back/methods/entry/latestBuysFilter.js index 6399faa52..9693670c8 100644 --- a/modules/entry/back/methods/entry/latestBuysFilter.js +++ b/modules/entry/back/methods/entry/latestBuysFilter.js @@ -98,6 +98,9 @@ module.exports = Self => { Self.latestBuysFilter = async(ctx, filter, options) => { const myOptions = {}; + if (filter && filter.modelParams) + ctx.args = filter.modelParams; + if (typeof options == 'object') Object.assign(myOptions, options); From 62f7b80ed4f3590067db4a1b53b5ff4e67eabc2d Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 20 Apr 2022 08:55:43 +0200 Subject: [PATCH 032/141] quit $ --- e2e/helpers/selectors.js | 2 +- front/core/components/multi-check/multi-check.js | 1 + modules/entry/back/methods/entry/editLatestBuys.js | 8 ++++---- modules/entry/front/latest-buys/index.html | 6 +++--- modules/entry/front/latest-buys/index.js | 4 ++-- modules/entry/front/latest-buys/index.spec.js | 8 ++++---- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 799eb8fe7..8cbc91f6f 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -1133,7 +1133,7 @@ export default { entryLatestBuys: { firstBuy: 'vn-entry-latest-buys tbody > tr:nth-child(1)', allBuysCheckBox: 'vn-entry-latest-buys thead vn-check', - secondBuyCheckBox: 'vn-entry-latest-buys tbody tr:nth-child(2) vn-check[ng-model="buy.$checked"]', + secondBuyCheckBox: 'vn-entry-latest-buys tbody tr:nth-child(2) vn-check[ng-model="buy.checked"]', editBuysButton: 'vn-entry-latest-buys vn-button[icon="edit"]', fieldAutocomplete: 'vn-autocomplete[ng-model="$ctrl.editedColumn.field"]', newValueInput: 'vn-textfield[ng-model="$ctrl.editedColumn.newValue"]', diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index ba40acd06..e60d16519 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -135,6 +135,7 @@ export default class MultiCheck extends FormInput { areAllUnchecked() { if (!this.model || !this.model.data) return; + this.checkedDummyCount = null; const data = this.model.data; return data.every(item => { return item[this.checkField] === false; diff --git a/modules/entry/back/methods/entry/editLatestBuys.js b/modules/entry/back/methods/entry/editLatestBuys.js index 90f1454b4..72bee98ae 100644 --- a/modules/entry/back/methods/entry/editLatestBuys.js +++ b/modules/entry/back/methods/entry/editLatestBuys.js @@ -4,19 +4,19 @@ module.exports = Self => { accessType: 'WRITE', accepts: [{ arg: 'field', - type: 'String', + type: 'string', required: true, description: `the column to edit` }, { arg: 'newValue', - type: 'Any', + type: 'any', required: true, description: `The new value to save` }, { arg: 'lines', - type: ['Object'], + type: ['object'], required: true, description: `the buys which will be modified` }, @@ -26,7 +26,7 @@ module.exports = Self => { description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string' }], returns: { - type: 'Object', + type: 'object', root: true }, http: { diff --git a/modules/entry/front/latest-buys/index.html b/modules/entry/front/latest-buys/index.html index b5773b04b..a4d6f7e83 100644 --- a/modules/entry/front/latest-buys/index.html +++ b/modules/entry/front/latest-buys/index.html @@ -29,9 +29,9 @@ @@ -128,7 +128,7 @@ }"> diff --git a/modules/entry/front/latest-buys/index.js b/modules/entry/front/latest-buys/index.js index 7210649aa..44c29cb11 100644 --- a/modules/entry/front/latest-buys/index.js +++ b/modules/entry/front/latest-buys/index.js @@ -6,7 +6,7 @@ export default class Controller extends Section { constructor($element, $) { super($element, $); this.editedColumn; - this.$checkAll = false; + this.checkAll = false; this.smartTableOptions = { activeButtons: { @@ -91,7 +91,7 @@ export default class Controller extends Section { const buys = this.$.model.data || []; const checkedBuys = []; for (let buy of buys) { - if (buy.$checked) + if (buy.checked) checkedBuys.push(buy); } diff --git a/modules/entry/front/latest-buys/index.spec.js b/modules/entry/front/latest-buys/index.spec.js index e9392a797..76e122d80 100644 --- a/modules/entry/front/latest-buys/index.spec.js +++ b/modules/entry/front/latest-buys/index.spec.js @@ -31,10 +31,10 @@ describe('Entry', () => { describe('get checked', () => { it(`should return a set of checked lines`, () => { controller.$.model.data = [ - {$checked: true, id: 1}, - {$checked: true, id: 2}, - {$checked: true, id: 3}, - {$checked: false, id: 4}, + {checked: true, id: 1}, + {checked: true, id: 2}, + {checked: true, id: 3}, + {checked: false, id: 4}, ]; let result = controller.checked; From 5db20ee3e22ce69659c239c1556b13a9098fe054 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 20 Apr 2022 14:46:37 +0200 Subject: [PATCH 033/141] refactor: deleteOldFiles in claim --- loopback/server/datasources.json | 2 +- .../back/methods/claim/deleteOldFiles.js | 40 ++++++++++--------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json index f0940dd81..c1f9fc8c0 100644 --- a/loopback/server/datasources.json +++ b/loopback/server/datasources.json @@ -89,7 +89,7 @@ "name": "claimStorage", "connector": "loopback-component-storage", "provider": "filesystem", - "root": "./storage/claim", + "root": "./storage/dms", "maxFileSize": "31457280", "allowedContentTypes": [ "image/png", diff --git a/modules/claim/back/methods/claim/deleteOldFiles.js b/modules/claim/back/methods/claim/deleteOldFiles.js index 410742c77..6beb99c88 100644 --- a/modules/claim/back/methods/claim/deleteOldFiles.js +++ b/modules/claim/back/methods/claim/deleteOldFiles.js @@ -3,7 +3,7 @@ const path = require('path'); module.exports = Self => { Self.remoteMethodCtx('deleteOldFiles', { - description: 'Delete files that are 6 months old from "./storage/claim"', + description: 'Delete files that are 6 months old from dms', accessType: 'WRITE', returns: { type: 'object', @@ -15,7 +15,7 @@ module.exports = Self => { } }); - Self.deleteOldFiles = async options => { + Self.deleteOldFiles = async(ctx, options) => { const tx = await Self.beginTransaction({}); const myOptions = {}; @@ -26,27 +26,31 @@ module.exports = Self => { myOptions.transaction = tx; try { - const claimContainer = './storage/claim'; - const folders = fs.readdirSync(claimContainer); - let file; - let srcFile; + const models = Self.app.models; + const sixMonthsAgo = new Date(); + sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); - for (let i in folders) { - const srcFoulder = path.join(claimContainer, folders[i]); - [file] = fs.readdirSync(srcFoulder); - if (!file) file = ''; - srcFile = path.join(srcFoulder, file); - const {birthtime} = fs.statSync(srcFile); - const sixMonthsAgo = new Date(); - sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); + const claimDmsType = await models.DmsType.findOne({where: {code: 'claim'}}, myOptions); + const oldDms = await models.Dms.find({ + where: { + and: [{ + created: {lt: sixMonthsAgo}}, { + dmsTypeFk: claimDmsType.id + }] + } + }); - if (birthtime < sixMonthsAgo) - fs.rmdir(srcFoulder, {recursive: true}); + for (let dms of oldDms) { + const ClaimContainer = models.ClaimContainer; + const pathHash = await ClaimContainer.getHash(dms.id); + const claimContainer = await ClaimContainer.container(pathHash); + const dstFile = path.join(claimContainer.client.root, pathHash, dms.file); + await fs.unlink(dstFile); + await models.ClaimDms.removeFile(ctx, dms.id); } - if (tx) await tx.commit(); - return claimContainer; + return oldDms; } catch (e) { if (tx) await tx.rollback(); From de7a992480798d472b83a9c7aa04d9ef9beed795 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 20 Apr 2022 15:18:52 +0200 Subject: [PATCH 034/141] change folder files --- storage/claim/8f1/7.jpg | Bin 249806 -> 0 bytes storage/dms/8f1/7.jpg | Bin 0 -> 439101 bytes storage/{claim => dms}/c9f/8.mp4 | Bin 3 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 storage/claim/8f1/7.jpg create mode 100644 storage/dms/8f1/7.jpg rename storage/{claim => dms}/c9f/8.mp4 (100%) diff --git a/storage/claim/8f1/7.jpg b/storage/claim/8f1/7.jpg deleted file mode 100644 index 421dde8f538663c9f18d4303b3177d10ceba7e97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 249806 zcmb5Vd0bNY_dkBMoGF{Kv}|fh%e2f~rj*PLtjWr7OH0MI$&^V=QZxern`*|&l*x_U zpj>lY&@9OfYD`TLNKwgAVT=@!+*ni)?0e_^`7Xcj^3U(;1q0?UoH2wis>S zw%zFe_wn^FVA}>A;M?2lv`hf)ZCdNLX?=YM>;WJ3zaPMVKeV*htp}fS19*4$|9KCT z>OXhC{tbM$P7Bc9x^63YX$=-}VyM^ak-uY1UIljST86}l1IgV`8?)Q1P}IyxcD#}o z)tQAvgkdBPxOv!5D1!?nI|J-(gF3UzJK2sQ2y#BtDsghO!f{E&<#j~QGLP*3&8i@> zX4Hz6|1{9Lp&F9FPKt+{(tMGgeUMtde~ZJ2W7th3+H%yC)g0yT=VEIaZ4ubilXNv> zIKI|D9&4}@>lIMKj%#8E)OvXhd)c-l~9wYS@E z&3K5mexOb$d%zJ{RT&#off zk2O5Eay{uf#L9L@NZHxcMuQ6`kK2YFQ4|juzcEA(|08c~#1WPEQ9=(cT1H1%Xzj@G z7(>R>(FrjIXBw|(S?qoQN$49FJr@ho2t`;0sII92ujWQb;+?VV56d(Aef!hxU1#*R1c zyeZo0-$#pOo@PdD9(*@lmt5lI_cF}yB}<0UsP__(*)teWQ&8{P&zycGVp)b&Q_l;I z^%NoAs7Jb$K%CDOMH^2~dtlL_aK7sX{_45K9Z%*)> zHDQ!PrD5J-D+(Sd`S_=2R=uy{{m{qjtRqECno(#oGDLYZGH))n;G{3}IxDN}@DB6d zTGsQ2+ud>|$@!8mT}g%eO_6MaeF4(%84VcVa%MQwCg6g^17ZZ%!8HBX=p9=Q96lLXpKInxx!uL&i zga4ZscE_Hx9nZ9dg;!3IDfuE*k;5t!39Eb{m=aBQdsFa(3xWi1BTW#poAT_QlAl^W z#VHj@moOq~W^RAv)v|OTaEB!T-~J!u*uKO3&Ycf7UMczVWa$z)H9XwrI;NHH*w)ez zJN=g^z>apD73qa*P3ZR8lX7EnI;y8%|AJZlGc>l}})Xf!(H!7t=SA)vGDDB4{oi zhfVr=PV<$CZL5jGW@dRV+rrl0s@E}wTwz~xJ>$|7B<2wd>DX6Q^WZW|d)w(~iA$`Q zM+x^XEO(S%dJ*&@IJR%_euHb%#io$XJQgA@DZW+|#C}zLzB!*C*_E8%2G4K)E;{I7 zMV17T5#tnDlRxS>INVrWScM3>s(;Vtxz)WYpP)eN#@MpP07KS(i=ca?6XLu!HNHrM zGQvOU4!6cXrkW|D!jI$q?0;{)C?tA2w?V_7O_CXusbvg$PAaN1`U5z>FR=c6;QEro zSMCE_f%De@;JLY>#3^6QBOW=8K(((MS)`f`Rn~Dc+Ie5lCYmy(NO6U zvpb4u;&-I&B40TZQP(_@(X%ZtzS@*sW47U>pIhHp@aSIbq97zuexsbfJFhpm@UZ>^ zyTB%om-nAvOUn0j%doGzDJmCL75D7tgpB6fe#i>G5gKAp(JZ#7VHmYx*pGV8jPb%t@Ao2?b`&ffnp&^?i%_b%l z7-S{$vqFiUlgY$Al5cMR>U)3thI#-nGqf~$qqQ4+VfS!1yYWA=FuYtsj`v0+=aL#T zsAtsU$xLt&;1VtK`CcI|dzzP}5ey@v`|f28SK;O9(WXPacC7P%44x|a`+b#OZBbae ztec)FmC2=H2Dk22ndKJ8IHDzWp*Aid!#7#%=s*O##+0v&MwS+MM%udDCYglVUTq4j zM%&h+FomdoW)O+y5+XrdD7>^WcKZ(9KVD||qm%5ist;WJZMb=i{e+z`tbe_5cg8Ow zY&1Ja9EXvlG>h8jWL=8tN0Ok|tiOehz#s5mv`hyP7lEz6RUPoyY-=`{AKKi<&(;qW zZL95bPwYb1<+G!j-jUE*G1d2HGjA2pQ~pvNot&NGQ1c+^;(8w+lQ)2t>v{eA_1cz! zCE7bKYn{52XDX%#Kbhxo`k7_%9;bccY zlSr@)6n%W`%Y1(L^7Dr|&jFK~^m8r+(j+n7o)m1`%{bmRwkk~&`EGyG!iq={RTqPR zWY=RKUj<1xe}CvN&#`Dr+l{uM#;)?bg5M2SEEakSgD2@~Rm=~w9M8~*o!4!z*+%CD z8zQW73#+PgE#VfPaJ1!cMbe|0_w3xO8RDX_f?*85Wf&7yO-`<9+!^FCHzRZ$iiAHr zRpM*%&SI09uP%sceh2)Hh4#7M6q$_{6^I@B#`}7b4x(#&vJqJ^en*q?^J|YDta%r6 ziygJhaUN|$9l|XLj!eI+9s;&+&^ot$>vruo8|t+WUoEjT$+Ps)z6U{HmDB}Alz#FM8T=G4 zEO<KB&x71`u}2WJ(p~(x zhT@*K@o3xHXrUv2`4K9J=RD4Qa_WAQ(K z0FR#7Y{wU726kq5OkQNw_V%DHV~%}_I}?@vb1N(D?D4&o_D;iBgrTRS-@2azeaH+% zY2EcN?&#-P>OZgwso4bhRM!j+xP!7*l^di?Ho5F|9xqCfO6VlyG&w9y zLh=Tf&pm_Q4;%>CVQ&K0|Kruqc)h6POh?I~U9^%UA!oEZl%A@GB3eExxW{iO8*Yq) zL|)Ca@GZ+e$HcPo%lhE^Y{7s&Qdcm=UcNOw&tr zV=}pBDA&+br|PQhmTYtGk2JIT9Ft22+>bi$EG%<@!1dwMXF7JhuurEqbc?9%%0soi<6gJ>M*;qp;-RUu+!gnblp zDpn&h9b=l>T4`LWb&(5R4JCSW6cSQuK;E2O!ra26LLFwAShkJBz@%-zl(j0xj>OBok+H~w}O z9tp3xRvZH=7E(Mm6ZOFCSPN-aOF@1vT7LqafedZTOKv}HmowhgX!m}oGqYgw`E+OB zuy4(IxRzl_Z62iVnp2VtbwYkqI!`f1hU5Gzfy<$>~@U7?x4kgvECrUH!ytgG`sf~-6WsWnV+5Mfa-T{7BS9R zJ2xkZAE75^dCurb$ro7!sbnU&DdKKt@qL){#$(>c258vKFvTCTtb*E4@y z(9NMiAZS02!58n~J9M(T9rf1|A>BMN!xvv&-K? zr&?_&X|S^!A04gAm_JN(6LE1dRQKrx;k1y_C{ofXlz=Jpl9URW&370*64X_Zgsz#I ziP<$gwa5+?+Bz>YL!Y!Qe}K6DX674wmFe@)D$g#Y{ND4RoZ-fr-oSjm2NU9dp=Jh- zj_~*>@G^A41y|3D| z?Sj>*{_VhqKW}f>ePG2}ul)f4bRJl2LVFK2U~Z5JzNTzC!2WGnnS%Ra*DMOM$|C@b)34#a*O_{n2)$e9+0UWr3yq426=X<>qClu#)Y8ygw}bg$J_(Y@gowx3t?6s_zt_*<8q#jiWh_q$N+ z*-*?1K_<)_U_xHy>X-pdh(GQ(zqB%g)ZIi@Z-kh+6&POJVF>Ex)Ft@V9hO?r+kW<0 zfAP${^}#^SsoT%(-h&0uCX>-^v0A!!{`%GRzk&;RUMK%yG2D2I8YANlahapL=0t5b zK*nQ1p>ihF@x4Yxqcn>3-%q5R7`?)OR*jE9ImJ^7Wq81jq}H|=2fk9WON<#~O-0G` z2ZyqKOSlgF=-q~K+j}A3i4Y$Q#|8)QKeul13@Pq)J+H89uHlq)IQ&fm$`+}0q ze0JpfJ1V3z$Wd-*n^MDjm#`GU%;)xVGWV+3epm@PdhA_YwhmYSW$&MxLq_cK-V8_G z91=N3jUmfo3NbMT@iirNAw99w1^UM39FJ3zJ$F|E=uIK7^Tpa}NMC;eM z?f2PeSaQ$8u;li(Xx-ady0@+Vrwaakp%+s~-22{s^!FF?d1f6(G0)`fSykauz))5y zN^yZ2Cx_d|k)e%y8Y%X@OSn0hAG3pcXeix!_TEshXUIr&;P&(S4>CU88I39%Kd?}UZmoTF@!xP5Ok01C!@u+ zeZEhhTW;6=_3{uaYHV;I^h!ld-&l<&v&OTlp}4aPd#1i09lh_~ixJD0Iys1n>mf}4 zt7R7NOSb3g-`2igY7z}Mgy+?qHx0`A`(eG-IZFW8TK}*2|8IxO0pixfn~ymvWb+OR z35QG3Lsg5C1=->xWeX3?vD(_uTmqs4s@%jsHQ+k{_usVdY0h@G~^0IHB@9!%AlEHKn z_`yc&s42^q$JX~idG>Y+! zy&n$)wuQyEkxk`xd4{LDt~Y%1;!pQexA&P=+gf?Bf^&xNzXWYyGncwobBL<|V?JtV z`6~ch{0ew>pHP2$cPZ7Ndx3t^0atj%GcfC8hU@yLT9Nm)&iU-qxi{c{J#R|lID9Sc z>cFw`zJ4@0Kg4sg4qXu}BIge`+94_)S5@T}^fiUlHC9)4=xTF zK7XtPzS9;FV}L;wjiGkJBe%J4&l-swVle|8Pg-ArSXd66=k7Nx$ZrM(o70~LHb(0J z+kAlkmuN1AVIg^@Pl0;v`!vVXx_Lk^Gp;;qCgx~VSq=~pGW*lT9VMrm*EhWZ%&#^c z8;^p=T^)L1W%2>I^TFcc2JNo^d=0s3Yh?8XyMNKNf_B ztkGjb&G6HpyuiMvKIVUXEBOlSS8=?#8qxGuKu5D~WT}#)3iDV|^Sz%Hqo$N=zuS*? zPN_md*TO%grt)&uTvv^ar`Ehab|3i}G+~vimbRtOZQyA}$VHG`kG(kh&CQ+|llQ(m zHl2H!@`|D7-TGx#0X;;UPHDvx99LbitI&W#dFpY6I<-fG{7g?4#%7a#+ch+p^~w|i zwi)o%(<_Y20wkfo``;&TE|n_U?rJsS-3SX;AjwVeOP)X2&SInLTurTk7mQ zwkmHKl#eZn94F~**b#~z%%dH*2mgduIr$YhxYn<3?UB+g8#@<$@6!ugRbTMbQsQHMh+Hll%YOLH>t8|MhpX3H)b^0|ADfjlN?U zA%Uaj1NtC2_&iHUV6R{Q?v8$pr-u<%pCW*ECxDOJn3uRz4) z67Pd10Lo=9sN3*3NF8RnMcQhu#At9RFPz3%F)btLE%R$))C(F|*8)y&GykY)V?hq$ z${U2MmKn&6*8?^$_^AVUO2x8<2=gj-!mfz=yU>#^A+zu1B3Lea*o5j~G^^<#_GS#T zE9Jb7DC(xkS)Ga8khXl#D-` z!l3XC*}e_-h4B#Ur%!zp(;z^tfLE-?g)vLPAETB^jqR6AW*;inv%K!DPuRz8v7?qIB0WavJ{6Ywi@6&~6&aRae8=h+WfTR@g^tSeGZNzEaod2ZMTBi+7?$4_y|umf0oYF}hA6dEzDD^HFBp{L!`W)$ z_)5d4wPfa!-~eY4x~>um`*AC%%k?Gy2KBVY_gu}k=@nSYG(I+74wq>56gxAFAMvmE zi48#@&rY*BV=wsqCNCI?paz87f0v;A3Y=FA7vJDm$z}5VFVfYD^Pw2tMi@@bn?*f9d=F^)&E!YVrm|r3*fRJO0&U z;3kWb`+>m4TwlBUWe)>O%$o;mYHnKvMqkUV(!F2NXh$UR>&#`HEXh9ILUZ$OY&;oGOEf7y|;4HLfLC@Q3~b^Q;10VE>s*m#cJ7J$iZUWx5Az5^WiH#6KDymGA4C_c7O^ ztZ9tZVQ}N!z?jI-AHH*TjRG2Xb}fxBM~)Ja0wtM}qoPdP$O2TxL(|JioG|(t#d}f{7Z&oW z=*I7)BUeQkb!x^Ti5g0uPi+;d;=n#>A;-Gl9b`Dl=2M&?I^8J8U0xM?cPsJ@H&LV+m zO*uVVF!fQn7B{X+!OnD(h!jlGS76%;te=q5sr(og(g@iA&}@CWuu-Ty?9bdHaUr*e z@2~yqsiY-Md&*jJuf}*PJEvylGT^h@9qe8m0~wMRANu-hSf@NsfyuIt?=O+AVBjzv zH0jj2M&?hM(+BQ6TeTmWsaun^az5dZ~q9L`L4MwE&e( zR^r;BPiqruVK-Q3TUiPxv<>e7hzpvumF2k<)T(viy!@7iN>ns(FoU8=R<&E^O(wNa z*4nb#oD|JoLhZSJ%~JFwy?C)`p89=Obd-TUc9V{ZBV*Si=>D2Cc_dJ)SHg1FE#LewrP{^a5J)>7H&u&ri^~#G;;|=Hp6>{m->E5 zL!pKdJMi8ga7;-Nc0s@p;p$#X32@ya)AC$jtAn{_P43ZARv|Bsl{3Kv@jJ*7+Z(-k z<{29=nSo(TTfg?ATn&u(58>|6EQiJ# zbyRpdC>tXY*N%!5w@~4Qj%<3Bz{QqHaj)9je34$4!hwcmhW4@d#?`IJ;oX#~w)ihJ zqw8oMfj~8`rDFNvFsqAQ_UVX$(c&{v%6QZe^epS9#zRf4O7)yt^H%Or!TPaava}`% zUL#Sy{eT9!$)X{k=b&*dToUg2ug;A;Y)5;W8VLLPqN=qT=g}-{WGT%M| z)$8MRajFEg?}RC1*c}^eGS7Q( z`d8OGp#V6!FiNqLm7wz=gt!5xXpyHG;7D<&`& zjUyx&Rf@yXl8ue&lKi!jNBiMK#I!PBCO88jc_h7_JOO>hS*8Yo*j)LL*E0sD|_1&G4+i8qBD$w% z`QC;ahC?0WS0Rc!F-r@cP%^5Nl%1jkZqFjx?#HnZugCGp-!*vznLK)~ZGQ5k>kiXW zD+_pl#q)Z&q2+DFDf65^X~#VE&Cl<%)YAQ}9w&QuQ9{4-BV@WeFHk zuBg8P&n8gRYL__Yw&h-d(YTdbKpOutD_%^L&oWtp)4bv#=Wz|f+a}!Kw4>HplX6KG z!;9#qkXGpAuRyahY^@y+#XBwYU@+3C(g>(Ym|fR;9Q|x$gNpeXh)1qh~#qbZ;itsH7od6M8mn6M0Obm7H+`d zA$Xw}7YN<|CW?4H+MD)8-OUyLqX63(dC1S4a^aXXVzfZ1hF0!PR-f(HY{5u1^tjg; zn@XmHZOT1SP?*gGOSv@syCG4He?t;mGCC=-C7!j!BHAWxd6{$h-6`~6j0l!LPU_&hznhiKyxr6_7Q!XtZb zipyd-#%B{JTcduQ&rXY5=yK5yL496BRyN9ExnTl7k;-Wvk8A9=Wh471IeL#*KnEpF z5rQ(Im+o{LZqj~uK7?s<{#ZFUL3dlrbv+!oSg)<~>vOOX_GhK}%ZH{PIxfW9Tfb4Tuis%g3Zp4_ zq#uLz(T<)Ap- z;>`F7QU`5csWb9!klJ`}(Fkk^nVf(J4j4M4Cp;i+{BBQs5{ae2g?mMe@Hjl9)KV4Y z9ibyF9WhEOG`N_X)1_dKDOVR-yRAE*df_f?zm#zyxm~z>xWeJuPEsk&&Qoo5Qx*Pg z<|-a$Upo5Fuv+aX6NK4^pvf+%C=B7yEa6D^!utjFZ9w}e?ZCM|f7{Uemo`W_`sjmK zEVV8NZrEYz1FUO6?)Q0h;567x@yZ&r-)Z$IbWoIhU~|X!k~}36)BYo*7Ex7<`r!#8 z3eX0rYOSi0wMyx@6KIX3&yx97;}=R;GV?801!E{-ph><0BO)}3Lr3|KsrR(|N<=8` z=eiaSq8QnP&cukBp%AA)sj8XT%Jq%R92*rWpt$g=F1cuO0lmEPkwfW!xVTm+gYvuw z4AMx$-5&8QJ^Qrj75h==<-*o?EiAV6Dl!Tc<{Qb~QL`+wE>^!#ET=f9?#}=*<|jsL zX3Iqx$^{|F=CSf8me8n53jGPlNI#7*J|Iy-Mv1Id#sPdgNcTO)!ww1FOBJ&Nk`Ata zi0YOKAx|vqHlmcR7)Oxws*Z3by4{-Dj?yr4SerFH#-xo%HqP>3~n&3`c+PlAHh4f%=gfe>WugZGPW35MsZR>;z6p zW)>-U$5^N!c4INh5gmNcRo@a^8;CRI$e@Bj1z~i-7(OCrpg$`VDp;iwOjW2Twts4tU?OlW^A1w+uz(_wsjg4VPJH1Q=gvx#TPaTcf?(+i zzxd{YLL~QQYf$-$R}4z?ZuAoR=&Ve25X&djNN45hu(c3ET{78dvyCabZ9ev|F-X;e z&vNCmt<81Y{;nu_UqAq}RgTL5dG4P$Wcny~Z?PmIaz4d)-so%TFb;E|O^*;JjngB4t)?C#jlLIgi9a>qI+NgjZ(DJk*!3^&`zUdwhHRR z>n7(5QtbwLVJV%*B`o40T8}tUnu2Ssna7QG7c!vjs}Xdh5kjuCl63UvbeeKJF*q2}1?( z!w}t-hRrqYX#0wUwq3HBL~(Fi)DKq7G`65(lw0{{!p$dLDx5O2U?Czba}6hN$8krj z)z;w1#|q_d%oJ?rl%^Z%4AT>V?wOYa)o#O1}2WK~3XJdpF5N>V3V{&1(Jvp5l zk`Xmr85ZP-V^F)lS3VgVZYGqo}A;jXkhtE7|d*2^8&{T&fEQgbb%Ze zoQ#C0KbpHTvob5FW{%RW7nyb0yCgiD?aK+YUd52q35QQqIj7o7m%nII?=IRB1Op&+ zlR`D*l;723_+MmUQ*FylSA}5qb%;oUIeO~}|FoR|cLo?fEz{4^vefeJ-4OV%mA1RO zZ91j@X45A8MRK%$xrJ|ebCpGp*$a=Eo=cHg^N!geDNz{zw!0Dkp z5^1!M(T_)oV5K6VO5>!&U>uWW3ihsfR+MaKQR zH;9MWs|*O$7Hc8qOVo;n97Ut!r*H(KO-k*pwY1+`)PiJ6Fw*F5CpV4T z4oxj3$2IaQA*6~jZ|}oovH(WgLmghkZ-Isp@Ivz;n!S7eXTE)Wt*3`=`andJg2(3X z?!KP*WCDKzNp@x!5GVsHup?3|NHm2mv=xJ+Q~XpyGU!?Jy%C)5@m|69<;0c+5K({y@D{ zzzACou-M3fW0T zbBBYX;T4LW^4AtUc0Uf%Hp9`=6W|QMQw?eg*1U}8P&xe_REA?06`b^)&sXxp36NTxH+*|gte-i69vjb)C~Fj1Y@uT z3p>kUK*Nvj&1O0!w7aw{q}XP#qLCDq%47bYR%y#5uh3D0td_#cCO+{fyly{MH#jwp zA?G({w6+Sx!U6BSTxw}eVv%Ws!_2i?OI;(Ps4|)AL>%AQg>Z!G(Z%HmHc?F#n7DR^ ztr*9h#<*ZeL_+9X+xWq`265NH)`5RiL%QYTZ#1e#; z%LrcBRi|4nU|(pVbv{Ts|KW)=+-nN=!!jm@J@$%2t?+_Em--SUJNL9q%_w7AWMM^x z!q4KBEif4McWA0;*!EuicOU=VI+qJJeRN#SHo$d&Uvv$2+Xq`K^bKv_A zU-AuVs6rro6C^!#Au2T1))GYpfy=rblh|gz|M$3{tn#e#f;>pnlVMqP#wET<4VbAx z43Tbq!*OMUh&E>GwdGXO8k4sKl@HA-;z!ex_y_Bnh1AWU_tQiF!)E@VBEw+g|0tRl z*G^6^;i%za*mFGNpRYiz49A(~rNydQqH9Da>XA_%Z)&wMb8PvMh|;~v58>n%Yl>os zIH|hZQv>5@wxCDAuH2B)meXY2JTrKBs1Cm@Z*DUXi$Xxs&``E%G zj=VL%#kFAYVNO&esjecvQ_}7{-niR4JQo}B;R@s`k4mEMX}uX{^ou)*tW=>8+>|F$ z^{i@*(I>qrk;q&Mht=bF0;W3+T8rY4$?5cv<(Z-qPw6*u-6L zrF&cPkyE6*RcC|AovIyiu1||n;$z76X}E7xNs|K!5-xdu@BSxl`W8DPtR&<*ELfpt zlE?~!{p(@xUqf~(p=Pk}>eg(qg@VmzfWBTSrJbbcL(W*hV zE>coKVvG>3GX4aPGUUn_XFv0}%G5HYkwa<)Uhs)T;jE1kKNI)_lo+Gl`6p6k#4uPw ze_joxdpCk3@``TJ;^GNTH-1ZzBx98%(io4b`#fDvbi`m-wcW;Nk8snx@Q#VY$0N2k zxp_Gicw0iaf$R!oA)`RPbgMOpQ%bBnv8Z}2Z?~nKH4}GSN^0h#g`L{XRcX8Ps^Canh{o8Acy_`WYGd5d*T@m}y@-zLDQ5+dPCtKe*%0h~f-3^P z9h_Hvx-I(BuZG)!K;Y@~(!oc{X+vH8a&5N@kqwb2-F=E$q^Ld14@OPqE4@;RT2Mc< zC9QWoo#VDGsV;H0?h>bIWj;_`haI-Nr@hVRV*SGq*6zMpnm6jpS3qlKUJgs4=rI_> zd}ZBou_ERzo`6pl^E!s8ul^AZ)01r~yBXE2&nkQ|%&FsxkU%7fR?m7rAkuPIcw#BL z&1JQtvbB@zOi%luo=4fh{=TVpo0!s6PQyqkA*mH8C8L#^woF?LV-r#by?-4>uYSLX zJ<74CI@Ka?ii&3cs>|~_euS0bDW3rMHQtg?LQ$0Jv~w@U4DMR~mE3|%a}fr2rC{dj zXQ#t(?MBzg0XVxNmGV;NnAIdsz;2jaWjxC6Ud-xC$ZrP6+6tq(9$dOSxOM$@t$(L| z%=Y>ES^^-^2=?lq0-H{|xTD`jx>{UBoZtE^((PWA>mj4D;BJ?xo1NAziQum9ip6TC z`>uwAHLh+^ou)D6qS*O5r?%FZygJ8*>WpKa?w6oxrG&4*W3g(E;y1aha+1s~EH5SU zDmzCTgJj-b-yyjMWQ75DlvP0>QvW$HE1JYskJMp_r4Ix(3z7<&pp!FmD^5fi=LU$_ zt?efkSB+wYp9QqZ)&&%!UWr)R$-&C=W!~Wk%414p(8980CcnF}r-~_V+9KlR{B^RMWstfxWd+U04_zL(~h236?pcTPD6pv5*l);RMfnXi=THTa&Uli(10L zY}Z)ki{WQ?(-iw#N zo=)EY+y=B<|J^?Q6dZ87>#7ZyjDlll9NnBM-}3W!K3cKB$(jq1uHeRjgNwyc$*kOD zE_rOZEm}Hg`m2wACpgj7MLJHaxkfG!)uP39NyQ^e_5$Y88fQ?kMv@V$J7|MaPV#T$ zC*A%I{NjW0$C39W!`|O$Lcnd92ZJX9`Y}nK%mf*#DS$DZdO&Us`)NW2jcX+81yDjO zVb^J_4#o$sWRAE*nG*k(GZud#L+ci*9QeCnWW(TEYT*DP@y?J-d+G>~{JWx2&!_pIopg zcwt#qby<6>&qi1MH^A1HRvR_|=PjQC+g#UuAUR)Wy(qUZ9nk-1cdu#F&*rX2IhFQa zXhd;iWDNdjrFCAkbVIuKU!HFNg8P~B^DQh-a8nh&nLwkKQfBQ10u_Nk2)nLwvE@8e zpv6%Ro)Z*nm(_e__O!Be5A6Yj`@jWUSd@{6zAvp~fOp@EiodtDj%Ctko$ReF8!ieyqFn%W9F-ppz@I*E9%)bBmQog!^-u5G)NRP5!fdD}ps)67}}Nj&0!VKmo#1D@p5TyL8JJ zzg}K{I|rO&0SS(m=KJwXLoyuusng^Y7fFbasB$^j$k) zhr!xkvU1z6wJl=f%&V35%t!p!Wr`{E$fFTu`qXtjvrs(K|9wVX=`{I=A z&wDE}Rwh~>4cqaf#v8$**yn>wQk?iHji{qzRDAS;z<74HO1V#?x4XY&1OTrupQSz# z4_Ngx8TPjCUl?6#_VL;mIu!S-?Qf6A_^sA%q3$kk9k{Ex?Vr2y-M2fiaBI&!F|9ao zKDm05F?T$h%pkXUzf1t7{dQ||XRzE3+n?u>I_do69<>1R6)CxHQ`Qs+)me->UzYOEVxG|Z#o(E_PmN^4E% z?4>JL^9 zc~dipV@8n&O_YW}f@Nfb2q=nknLBPvt3V)s*||8bjZVUpn$bi(3}S%CkMeTsb5Dki zKaAZG%W!Ym-j9X8e=!35%OMrl%vHBRE!QG@38@i3shl&0qHkE&O|07?acn`9Kq)gYsqYO$?ESc1Y5(PUwr%wrXwDH;FR?{qt66S_iIn=LhQ zz>nH_yMKOeKg1V%-0!eI(ex|D$X4`J%zNc<_we+N_xzyOY2DAFbi>M`wcSf~KXGp# z$Agtk!*UnF}Gn?%t~9k%5KB&y-WT8)9Ts!ZwDX&ewOx$&}g@Q5%kC;%bx=I zwpE~iG#bQ7(z+{?{rTccMkR#;J%=aHz5Myw=_Oj+(a8}TF6pOPPSuNT*(3qUw>0ia z<*%fHXH7Pb)7(X+q=^$qWPZFSSrOnghRQzjMDVp9OpDU;YC`g;X%MmoDWi?TgfG>>;ML==!KgQpn{_;xg(D{S2+@mslL9=-1mDQ`?cC^(^1sM@(8o zRz(v+fh#q}RJ3u$jtw*&`@1-cK6CUwaseAAi(kItX^qEjyTD&d!5(J>DDu?71E6OC z#!htJg}#kH;L+&5fiX6XP!R*ZT zw`KSoV?>S`7t)PiqT|_X#oL_9M9~^T0oofrqF!+CV{}sEVVkn`^z>@R!MMbOgIai# zz4+VqY>*x?xO~a515Tm?El+3819%ik0}B@V$ET+^hCNHZj<&8^4N5pRn*4G+$d+qz z78p;iZJ<5C`u*}~IyiGmH+CXPZ{D9zZ(bW(7gxWa<6k}6%@khUYZY%ZX-miKE|}7` zcpZ5+3cF&Rm-{PcFHrOWQXBfGo|v=UO9^ysD@YMAy(PLByVe^gvNK>RmA$@WaB}4Y zqBesUsQF#gyVHxyz@fFp6Ah<$N!604xiV_fAdQYpCr?HH87l%{VmJVpl#%fnJ{g3d z>M!kvmX$oYE)JJ=Xg+HaMK{*L4Iuhix6+R*=p0KO%AGxD< zE*Fxv&KOG0jQv`Lw&y*^hDDC{8V`oPxb>x=^ZhbfAMS6v?64gS4xup9lJ;|<`_>cU z#=Zy22x|k(toS#H2N@?0NtIFw_8W&6s07o=h3->2shqbLBy@r9YZtn$?bcYSTNn)b z$l!EA{p3)@&3Ut()WhFI@)9nzn3;y++>8sLk8bYvkDE90Ve|Dqj7pVc|KoQN`0CU& z3VU%OC1Qnsc((K1Ug*4m^xZMv-|=`2>oRbFZ!#x(#{M|dwbgMm9GzYIcCsPUvyjy~ zKHm@dw!g^u!oTUQ6XMeENu8*(bpXkEtKXI5uN@~re|l?s)M&5Qg8a}vh(O4>AM9e0 z*geZR@XTnDfGu~gI-k8-S;8E(NfnLHZe7y)@~`eKx6?Zb`YKgQ`irQ0ZGGKyM~gQ2 zPWrVu`DX>9PNZy2G}a_FFyBzgr|D;;@$`Yc?XUyu>?MJWeSB%)NHO;ksF1PVmL^I9 z2!03=ei$P}Su{cbUk3)$#IXX1El%@HkmFkiMpa@<*8RwdWw=6M@oHx_-6RkC{Sdm0dPdUm)!D8V-X-?$f1wB|>S8Ro5a zx`pO4Qm<8;_ZzQNzhgPw&hQE~jxzMV2w*5UA>8viDc?I`9*_aHP7Cq_dYh^Wp9sPU zVdTC>zju%%S|lYUaj4)1gGrj!(o+zM@;(3?A%SEy?An+sW;|P^--AaqQiWPge%PI@ zS_n~_9u0QYf!tYHs0DwGm1MBp_&cAyyim5ab6M!QxzNyE`O5e7(#Q4Zv5%ywZTF@% z$~t{KKx$A*e{hdM@bEHw@Z{<78NGyi^UD0{kOd}{6R^rCwJf=AqUuxjP0l}sOL&X_ z^7ng`f?-Kkj(ch2gi6ge)c{aw3GtaeF?C;%AKeZ`k-piz$nd^GuLM}%UnK8sQSw|v zKVIL7L1HHwzb#wMObr|_&PAWMckZ{ggDmca+?}1H)0X+R%vMU&I;L#nz8Ny*s5ejceZV{i3<)N+^2k+s!~On$VO{ov*#e}?nU z+HiHNK=Ilan}r0|?3X_KO=oi(Amk!LnpLXPDSrgLO)N8vTC-ws{T$v+1i zui;mw*u&YgvPFNCV*7M=M1JAnI4$?i&^lUC(zj`Cb0yQ*rwA3VE_!nBXU1E!hUt^1 z+sCN1ol!AwxPJhtlrLJ`$IZ_7Dp1vBte{N#IA9Ge2=_<5%nUUTZ(HHQM(VC>i(xS}*+K&&sZy$Vnub z!Gk->1bI041S*UW=3WRlkum`U5Xe=dguZ07{Ax847=H&tn|w8wgK1e&>)hrv2Ww|a zQ8J^j8W=d_!v$5hj59DfyQ3hHcbp#vOGgxm4gCyvQi@I=37b6K5ab9Ss%3k&kod9im2Y-BCLoYfl2Cvqp|=W0PDIV( z3|?Jdqu^>)@Dy!gY}A|9?oTHJFRj5OUgA@H<(M-!;-)2K*m-??3dP&pA3rm02_V7?K95VQFhKU8$ zRyBYRN16GDb{)>Cw*f+(TH6&fU{5p8{$|<`_yFurGDQwsxL-vX);u8$XIEge223-Kl&|D$xElo3 zTm3HCB`?L#U9k3HE$81pmH$aDbVfArCKu)R^Eg#*U92qB9%i;PZDRgja-Ym^&$lb8 z+8cw}97ZX$q^s9pge3^$?)eUTS&k1|Ct}!K=7vRDAE0=I)Y~7^N+y3lxez&N2=TV) zx;B^z2m?s}lZ>6*^2q}MgcYL11+DJu3VZG2y-A`f3FFb5}HSA+K812s=uOesd8rJ95=dF%Z zs`!*-(zp^;kuuD7=(TS@w%jrsVq%DjMa}iE`eByO0~k{I4kYNkvLLQZZ*cIcwR=_Y z6YF1b8^e_!O(2vF_%&_F?~-XkqH(CGNV4KgGF-Mc`i;B*4%PKw@9-^V_DBEEev|S$ zb|Jd*iCPet_OzB&O%y+>NTkhslHJzIz6dD14|Z+bNB~|zWi5;bzLZf`gdqE?(B>K{ zZpiI6pHE*_47R*J|6NiaeqM(7JWDmI1y6;2hFLb$t_h&G&)c~$8<(LM4fz4tqZ-i* z#%=MYq$!9B;?ZmF*6_SA=&X;%>o~X5z%j5Rb`21{!^~Q^c28n+lG67Qd3vRRqlHghmRQRDD_hiIOFLb^c%b?61@Jr?qLEn+ubr8tAr$4+(#nrUU7ztk zgTcd$;iW4AgiwS^>gO7pFdTDeRW73rH6*M-Ow3ojt<9+Q)qvlnGFseaE7R#mKf3Qs zT+jGSr;6y2=3Ul0eCbl1e#wl3Hm`Yh+j5ML`^qFZ3(qz_-BO7)4|8?($fz6e9EQ2y z2AfQXK>|ql(P!}i%o8meu1&+KbuexvJ=qVRV~M{;Ju4Bw%j2MWuUg0b>BYdHMK5C& zOn^8n0pYSageF7VW?H3NMO%IHNgCEs8AlX3VAsmeo>Uj+u+=me_L{_OzCxv=SK5p{ z_bZcs?cPI+_skRG%1A3G8mQn`K@60`2v`AfT(gP^s$~bgO_qnR%p8vBeWKk3aM;ka zgua3>11=&myee|-UfiRVS^kDf)W*U7rnCDJ#ejrX2KK@j<0eGBk#yh)SE{`kkdd9n^S2;*Frdf1cNdV!Wr;U>KY zdb)6xmqJ=Z%t5k|fJOy3Qkw%gQLkq8dcvq2oKPq9Dg%bQ+h~qfGi8H<)X4%@Y5cjh zM$FuBkp+>8<6gnf@VYhZ+ZOLzAcGC^Z$7oQ7CzGp2m%7BBY<#y(1LIP$P(C)yeG3Z z7?Nv#4ZuMLPzV{Bj^RRpWEN}(vw|M#vlj|bZxAZth7T!0=iB%^v58eWTr!%aFfF-U z9PfP$O2RpI$=&Ip=+W}z?iL_mAzn60%h=&u&)5;tc@ixBZ?{0d1j@H!HymATOTs|E zba1FxaWu7cnLmS!hK9!+c=CXg;6XxCnn9JdmPOZF>|6JqTH{R@y#s(j^CI|LM;oE(j`Z zj2`#Ku&ulsG^EW)O&z4d<*tQ%;53aWb{BZAuR>oUxVfA#tjKMT@ z--8o+m3vu2C_3j%tDm56ZYyJZnDV+|mj!lJ*9DP#C(D4OX3{pX_CvB<=)1Px>gJ3e|bQIm1H%;a6xoAq^G`zi#n$m#|-bf zeKO_&in2`HHU{)z>u#DiD|^OiojNZmp=&8QA7zYoLMe z0e=<_NPj0c10c>syej-?<_;np{3M7LSErKfZ3rP$>n`9I!7&3z0@Rv`LGP5zrEeI2 zI~w*k*|}9o&+uH-JFolCy@rt_C0!g4U#Hd#SzYBr`5nwY?N`_v6>4$Zn{;&Ni*?O( zjkOxPW~sU^*AiKSrxuFNNzA1|AoB$mcu`xIMGGGcCD4-hMx`)dv&)B)0k~qE%cyt& z;Vls$HY*`==42u=>B^mmR&`4aIf$l)61<`cqT*z=T1PucSqJEN;Y)MKNK*t60oo=A zGe-gfil>RkNhMA7o=Fbp1s74GjHdQ&GXpNbi-JQ0A^QxLfU*1XxbUIp-eG_C>}>zK zw{I_+CoZ{YM2m|^HmBqcV|l*P9jkjZldforz8!U6_4K~Vhw1N866WatE}DtugL?`9&$U#M6S$tG}h%q^uv$qBe(7Z0@O( zo1(F9{YsHvToYnSUQfWD!8npY61!}W%!@otNEI+~xE${zs{l(VHNG?%zHF%Gqk>>L z&=W=`xiYIDVC<@L01hxm6Gz%WXm+S&d3JsGj6Ho8{bTyiDMHlOVThXI`zw5AE}T33 zcUI+78&NQ*F<>!Hz8$-m4u4|&=zk42?xvu1;pw(zVRZ>gUlcwKt1HxnadkzOzDMGa zzme?(ZQ>^~GUAgN5b8qk3I^(6)qV-cGsoI*fHtV`(YTST5OK-tG5b6B_%+`bf96P( zk;Z5KK#<4HB#nb-DBA@ETPy^Tj9Cs76(`sV17cVlIVdg%r&Sn01FLXAasVe3NDn7^ zSLwu~x;!`AIq6*!yZxb<3->lY8M&Qo55gLju0lQaY+%SdUF-ksGVV0ov&AiCvam?3 z;9Ffucwt?tTrT8MvKDg=xm+~90hH){F&A02G%#H68OilH-jBwvno|7OXa-4Zj{Zh@ zbpssl4S>}0-Ol_11f|M2_^gCFiE_Cd5P1U#uEF~tDn=#kD6RyAaxpb7^eaKNMXw4D zm9h$_xt^BQhs0|>6Y@7;eyIT9(m>QHEcGzDBT+`XBS}dHqK&8Ynk~mrhGI57U3LWA zbX~3m1{rd3>HSLmdQL`@Fz(?BeHPWc8pLNVC3ogJW-b7rF6O}FC<6jR5}6~bWkU+x zQ~gxfE3kbBLJJYrPwV=q1`q|IAlUwBqPz}of;mW29xo^H8dO-25QIz7OIFOqN|whw zpu!2&DG1gcP{FH~)2W$K#>a=j2te)yMK4fDX$S!jht!bX*Ng&s7Xqkzg5(=(p0X7r zeWp;!)T#bIiE+xOfsJj9YZU>0=4MtUH^BertKI=L!mwE+OQgA8aRGw{ zK>${(n$MH)7VRIKXjLcf%XMnN z2^QqVXQ*t~#IwI0`0}*KRux>lq5pQ;ib=_Ed`G!TGs)0pGyQft4!x(dDF`(+f zRSwDf3PQZl+t(=VlFSu9*rau>zld8m;M`>=_jOJPl0}YCbaI**;8o!Oa$cYjWOvOz zt8l2WMiV|W3eW2Z=}A=4gOF)MG^;s)xcB(Ar?@o+2G` z0_jMAVgZ|yK`;}VP(o`c|KPZr%QDSR7YN>Smres_4h9?xTp)16K^oRt~Seo09*e*AnR*cZ;V1w%*BX- z$a*HL7lZ=$9s`#qSVrbi%{154|2hlT3jBJqx+L@0bgU5uQTtg}Slwg3p=tNZhAp_BCqDp~+xCJ}S5a%dhHjK~s;P{4eg zz%c~4A6X&Np#=%aj~^f>4HH&gSC>3-kg+2Q=_ob~9cNLxjgN~1B9=tKGSWa)9DsQQ zg;W|vRc2O-z?DzL;Ydgpnb%W!fRC53rVG{l`tJ?b7a|1U(-W{77P2xgfd90z1rG;J zX{I+2C?f}i%K-KUrk#_^jp(R0Gq^v=)?zTvzXkTO{9-$Fv{s_0O9&tsIaH_qQQ7M% z6{;Et>_r~T0(Onq2Y5e5@&~}{1LTH=AoZwL0Fg`G0UR7$uACB!4vwJr#dtL%*RB8r z7>DbEWf3oa!NDAa9}>cmIh1XI$EW@N+-3pVFs?!mD_8p~-tfcIXj>n0`4o?pwQRtJKI=nBGzy)O8G zm#4x(4gJ@DB9!}ACXn?j%QqYf!6(bXQPO1-wW@H1ISFu+sc?tFxHva(@$m6*ZvfJNFbTMj8{~KtOk{lc zl*~^Vd8K7ES@>nmZoZ|u`~2A>Iq(Gl1mHFteB3jpeT^{!#R!! z{`1pZJTjRBq|{gsnanAzUyQ0-PrvH_U)*|n%xM(JL(LzqELrY#5is|@TVv>s?}}u6 zw>On?O0yXSN?gij96+>y-zh1e+E8;^1u|?;ProK3<-dg?hD`q58jbk{$GcV15^}SP z!fSaX)9DCeSO~hF_8DluNrz9@JEX&>sIM<_%nW@5j3K0H=HU$8H}?A{A{j3nMVBlr zEDI&8A_wnVLLU>UeR@4D2rjdNL$z;aiTcPQ18EqeZw>QypE#c|;gJPuGxLU-8|Z=h z{;m1?Vs6mI8^d&A6GHNCHO2g_dq3iLC|Tf3-bguS@_(xlM5@)k>FHtS1#*pCL1pk5 z#QP#PkWx^Y6C6B-pQPGsY@(Jxc+r&6e1(X;5CTc)#V2B$fHJbENW}pLUVoZ(DcrzZ zn!W#h7mNDN+kI#dD$5k{C%%$Q=7ji4L&9|zZoQ1;%U6gcU6x~@_JI>fvJg9!^8$I$ zq#bLk%Q*}|D3Fzp$&Tjd=jTmPwXuADGK$A=6Am{6FGvxF(*TAOoN$InHwHtg8`;tS z8D&Z`0yf4A6LYgjlw~pBn<5)UG7)CFzYbmy`LS~O*+0xAWCB%vC9IsUx!oR=BW60l#~qmS&gY@ zpwez)-mBNrW^miYhPOY=CNlBXXcAr+`yjzyiX6_t8 z$}(N_!QlZ4lEi*3SE?6m3@8Fgr3j1%Qf9;r=$XIQW@=UtmVrc4+#SjOX`Ek*T6D=W z=Y*gCL>wsQD1A}xdY~vHFAeGBRyv%Gkqp`cRPBNclR|te=UvXaB!#(cR#+h>EA`!C z|92$nw=*9fSecXz&~DN$ANq(hGBBKe$ma*ueB)#Uc+9*A#S0GJ`%RANIlT8%|1Bx1 z$T`B)4Pr7s;gkzWHc_B*Y@#%(NH)jxLQHCEimKF2xDSmFO<>OI4V=`}({P6LNS|OT zS(ZVTtB2RKbzNH_rp+n6aNQ7$DnCx@I`K=K5CS$frifjy(?@;0DMPnq$KB?Hq``%s zpYZfn?o~u;YBs_=Vs(2nlDT_&xt}2%2@06+>$?7}unA1jjolkmy}UHUsKo=&5-7K2 zN7MLaN4|0ksg1kc0T-Yf07d<#10Dd2SPx|r_gZ4;dH0`t`T6(WjYtDUxN`$c9`dk% z0@Mhz2R(F_U8p8M?sxH-kDxp1r&QhUdB( zB%A@t{)gW{lSRtS63I#l zGxEw^>q!&bF*P-WKy*1b^tzXGgkgoC8VzaCb5N@#SV)ARV`sGgHUKw|IJ;sKy`PnH z*wgb^u&Wwz_w?PO1nH98O)&W2{-JTu1u~flAX91+B~Xae)X)nNaOpA!E7qK!f0tqN zBqdx(X2J~?RZkVFU@$0%RQ3C~OA~lMHRZv7G$b{smrwO2&blgSy$cRL#1Du8$bLO|!>sbPh1xDWUM93D6_of?Yl+>NY~ z8K-PxIff2_m!xj`tX+~eIi`m8@(OiaFAl=%hsf*t zXHp0xFjp5b*AoL&FcnxpYyfD4fEanxItO%+nlLKTs?Wgk`Kb{SdGQO39`YYZq3eGZ z8C8dwZORVRW>x6V0Z^We7Gx(sKhArL>oHnx@rX132jUt@eCGzxA#TEm%K=H^e`ilf z^~%k~ek|BH&60rSi~yX_GJHV|?VbtMFg_hX*m2x^^-?cziha*eXCE`JQbxWp&r?LH zC8KeKbD@{&xk1tLBvaxE6SnqqTgyZ2$lg_()cf(whT>o362dq0Bs@6DCROWO)Z}qH zHgo{l6X{a&+@iy(?TGpNpyMYD4@+$@&@ze*y-|Ojmw}Cnfj4TYmkb(XS}KXxpDI47 z-dGuTv48eO>0&H5_Ql=6Qn&iM9Gx4(Rwa>&Um_m)pggsp6#{n2Hm z)nh;FbS!hKK_vEd=GOk<#t;61u7qp<^?&QtA(OsO2k-uhMoE4xcXBa4!_y2>+{~8{7}SQu}M3G=rnN z{IW;|Gl`ki@LVRRTX}$MVY^x3ZB1{qpQpoIeuIo{`Kx&c6FO5jKzD&FX~F9Gt&7l` zwU+|F`$2GHus^(wD2@OVFCR@1tiTuflI+Sb%8JEx(Nu|ba(4!-{iVz z49okKcaw?~S;*S{uO=1%uoMPK&EFk#OkC&8v7~$>5Lq`=6?xO*$t^ZEzIp#tbK1LM zF75(p6{kc`-F|KPnhdc8BK!R`ZcZ>7R*cEVT zej=-6GAF0D5T{MlW`|DoOMknAbX>5t8032O6)D)zTljhA%*XX{rFpSWi+6QCU>H4N zTFA=@NDA1ZbX1@u!-^}?`q!UTqYhYDPqX-Qj2)9E^8Nj7hUf1tn#(e3Qd`pTQK_$0 zN!0hqh~ZI^d9qoKjl?Tabi62=Th{fKWZ4~kX*lEa_A3)vWOVA4?8223cH!j5aN0-8 ze<1nKtv6EiV|-M%`MToxA}!;!JKsIq`uYzfab3Jwvgy6y+Aiw0Ve*^Xe8jhh=ba(h zesG6K7Q&-`95zS{o;lGT!Mkt(imZGPAM#mHFdE@nzUTK_t4h$-#3{my*Wn0@pj@cS?i7`1;O zaU#YJjHmS^bT88QGsXKKxzz5&zvO|a$o2f)*)Sx`;>>^0#9fehs`d5oS*<)YujkBP zg4;cdGRKhXc3hBiBwUmxPfAsumL?BB+piM|d?zWd?pO!e9a0HDA+>sa6Xhq&1peA} zcT6;rmr>0^WbL`Zli!=4hh}=VPgHTGV2i zDc?^VyYPo^nmxE^3!lH*-s5jJ-6uWMkhe}MRoCl`zITNEQoS}6N3cpCWMR~MIbn`H81KoC8Cfi`;8nW z8L1ARFOAP~5L1k>I&{xGo?^sy=m>)$;@c=;k$0GU8;mCZ2ja52;CbfSxpm+t`TfIy zx_!1KDSRsq;j3sJVj!Z1#1ZfH?+PXpTxx+6libB!3V423o!jlNNnhK$4OF;% zP=lIEAW*kE6s&Ml^!|m<@jBiPjVsl2GPgeKDFQfCxPN4Lpwxrn_Sp4jKXk=j1Uo;b zI0);TK59Xc1@b6f9=*?+{09=rnr5%#?{xB|G3RPvcd~qUkkBM$BmW)r4+#pg7*R}o z_jgS+#o5u_r#*?bhRgDIM}-c0tdvSev`W)jxznucOSd1i6EPaZMEn8za^hUKDP1Oc zux-BX%W>_5XM0_q<3Pd*#-K1U3;vERC4F{kNi3z_+a36!ZGq(K zyeRO=pTZ)2wJ%mS`*ROv38Zwdgq)Hq)$LeF%?@n?HDJWNZU%C^B(!haCbvgL2s_c5 zG~}F>K4Y~z9T7DXO0GfJ)~|DKfW~cE2$Fw0q{`tY(0TOZly; z>N?`dA7eps&?tcijuA>Iw~qLA;k_lE6s)pl*4k4Q*)P1Uofj^08&4I_i^A<5e0$LP zTr%5U0M}R=vAz;{m|Z+N{b%EAk-OSfZEIG#981x{wpfFFJmt*zmMNaPU>&TABc*fe z)@PiQp~!d6j}#vkMcO1xaE5pEN1j+1@|2VY22(Wyv$uXTE10zND57W{=V38Hh_-$i8>JVJugps>g(gZbI2lrTO z>MEt+nyTq5?AD{A0^?hMRF2N(H&>q22hG}X&`APUVzi0=T?P9*!LFOu1A+i@;)(W@ z4dzOQUd6n=eM~Md|3(1mRfn3dciKW?V7YaC`3UUeJaNhRW~wfcDYW>b|3kHzw|YAy zh;b`LOknr+5QF8+>1UB~tQ3ieIkiYffsey|8$2>svD9D7xUb;%)W6*i+Rhpgj-c%E z<561@I9Uj@6MuS|ms|G$a5&zP%qHt#q{Hjy-#Nk@VU8nm-&OBSJRjdG^{<;u(NX2y ziJEq|=F$H~3%-X&@OU4)uue3UKRLU3gWu7jc5=qwr)sADR%JHFGoK?hjc~NtgzZ*t zTl|IgTo!W+(#Poax|IDQo#ZNyZ`>VTSN@wSQtW@#f2y<4vLZcNtHxN5J(;^K`r=6$Nu^>y$|Y&& z?4Og^w?`7#?8eUUKP=nz}Q5zG+H% zQ86D-LY`3>(U9y8ufO^(EPC7TEa-q_JfV4YoM_3mE*Z0$wIRSV!1bosaxm`O0~Ar| zc`z0cC#E|@Vi{6%ZVaybl8kgpUdo*x(n;=O$(t^l?(bB42}kp7NbIfJ5u__7zYAZj zk&Ttl0-U4Dj`ws8Ydqx59qjS zuOw=_vW8-NwzwZ!{oM6kb`#i&411`!l)?yo{K>(O>VDJvZH>FT(QfTx7ouBP%%i@- zSitZ{ALsde?&gG6SVP0~3B*jOq#36}rWNJMKa-#9pDRr4GS>a@Q~qj2#Ns)Y*N>SY zs1ul8pZm65dB2y(@3l!7MivVRx>^@De~W+M7DJX{S?FcepL79Q4FwpAX^?Mr}g94Ek+`?_>?pT=K;DDdvXQ@sxfb zs@gnSXWFzq2c-=s zy}#n% z;*rPGcY7phSsgx8Z{_}$3KrFonVTkfr4n({-J9GVuR=-{&lNtkZgQlUheuEE(TLV^ z#Fva0J5h~51L;OW!~^9Kdnl5-_WwY>y9*gx)f?DMn5wM%1^i5t@JQFmZ#;<+&u}A$ z7pH1C9sz}J79O)WuJ|f#&bBO3q6b3N>}{5`eaKlsY2h1*X+CS=C#iIbu9MxtM-mbBj{*#0 ztFG4OQ9eUz`5K=eRqMhN*DGsu7n33rC#rPDe?%MHcnG)1<<*aBfanZ~CsEpUwFC>k z9mE&82Q$8F?_O_bpoe3YtF-(o;NbFIm%!uFF`~XZ{5BPA{U$Q>f6ILi$Z9B&0*SHF z?EAViKYvR^;@xiZ%^@i`#`!LYPAVl1%h&!nFkp~#7jCdlFtJ|aSHogkR%5zI^|ifg zr$WLp0sxXp+Xwb^*Cm#h#cKkljyW>7Ua$;zM#>eF-LL;*Ap|wYeo=|+C-bOA(tQ!W z*-0Cv{kNm+Dw$>KBl&)FX{3Gi;_V9t_cb^1?^!rQ>eh+kxRf-qsK2!Z&FM4bLhx z*%6R0{`i44oW06Af7$vfs``~vqrCZ%Km|vclJX?(2f4GKgsd71Sug% z8iOrC>i3^g?iKP&o-==*jS8`>nG~4k!gDwlxEp4inlb}@8|@xGC{^uc(lo@~MCV|b zJDaOYQ5M3sBziZySM?3KS&!t0W!stioML5tlT{8vJd`wHFxt#7bxM6C*#;JO-6(qE zJ`~5ay!rE)^JDpL+MBd5_}KebLdE|;J}sJB&R05VjV;VxJ>HT;3xDxl6BOySYu26O zcE3|%9+|`A!Plx-b3{BHjk))Xh3_xK@Fa^;eZZ-a%UC^cNL4=0KTdg$pBd+2whiTWPQpDhHZx6j@64)<-b!}ITW`gzGe4B;_Vm4=NlDwGDl93kzkK<{ zHc2y*?UzCplgIH@|BOwgxwufT{Ws6ln5=TbdWYY{UCkS zvqwmq%YLiBBHujO{ZErz41W8{2;Z&fWzYB%L}hR;J+Jm<x-T`#)!9`iQJ<*wU zy18LlhdYvp%C^y~beQK-6dxY?jjE#Q=y6eciPcR#smn+B&z@jBw+yO$W5zOwgS~Fr zGWbi7y3YQcAEoD5yv#QL8_;FkYvz!-X1g6~;qd5vPzGUxr!289?z0#7%+(Y{H+ME>ffq={?JziD+` zpsHFFQT+lza?hUIHA#@o!YYh5vvw;=p(vb|oFL{KXfK#X_M`q_qX?e!)P-og`BC3- z_FUj>;*n(?mvQk$XOD@}jwy7FHAbdNtn-x$X#(_30%NTe-FLO_<5iEm%p{#pMjD9L ziifts`xP$(^8SI$wK%rZVyJ4DV|gtF?o(l8_8l}#p6aSkEArd$iHK6;&3r8eM^TcjY()2WS z8XHEdfvq8Y%y^~IAl8a!@rw6>Ugvm9*WL9la=wocLEO&z7u`lkgFARz`jjyC3RKt(VH=^#<;{6hrmKU{h?UAo-1gK%&|2 z$dR~E**uRl#aZha{oM_TqPb&QE>aC&)8h!AMoXkPUd+_pGyPxEzh?9HQ5mchJ-A|U zdbVFGyh(ov4QLxm7hLTna^SC$3@LAy(mNLP_5Sp6`^9b8ZX9~QSS$}m03ujF4wU8V zl$2V3X{GMh^G`J2?-a2=t3Qi5C#c=_x*JD(mG7IraFi^~wCdm7OSUJt*CUTS_l&K( zr&Y@TM#ti9QbZ@zgonIudY=5#lviQ?kIJ*)vyVL^rmKacv}R$*k&}WM=g*U)B`^7K zR+3q0B2qRxjZkl2etU^=GOryQetPfYmaiT!@_FOqrPt+-YY!E4CeQN;^qzL|(K@FV z)*{Qc#V+ohYqXyTZFwZgiTJ9|gls8$a}Pe>tc$S}yR}VRybX7b)$N;(l(A_2d-%$! ziXfxr`Q`+A8mDF=jYk&|JNasJV(Z6Zi?k(|kR8tb0{OJo7fZiAvab;LefX-SPG2Ah zO{v%8*Pl;$gwQLAXE|*95Y9DYhb@@MdW@b^Sr>VGp$-p^Von895I^7nAg z`Lf5@Y^!XmL*`?nG6Uv}QsNk&W>s>o+PD3W-VT_>un^|dI%HDqO)fa?OAboZGicN| zDLk(I=|2>vRn0{{i<>wN6HYqv?5ZSMB~{*d!y|~Y{Yzz``y)W@DlKHGOnu<%;CoMp z(!?(Nask_~B{fMam{p|nXULeBF>kLY*j6ajDnoox+(l~0%i@R67G3jLCVs_Vex;LK zqL1ETW4GLr=s;u;PEnGXQSj!$J=fPLhGYP-8rkcl5)GDzxhwI!@_*u31n>3KN&08c zKAWr))W+DwYfrDgcRAAiX1mp_1dr&!v{?rCn5T3^%^L`&?R_AK7=IxAOJY5>TSYkL z2A9u=xBcPn-|2H&WceQZbup3Gusa_=eug-$lRJSP`J=X4Y(2O9F{|AhO~@2q2IFDN zvy_a^P55t3!UxgJh0JTj!p`3|{DY+lks|ia$v>^)_r3;XTG+Xq<#`liM+?4J9L*|Z zSZb6#(r*|qAA|+rvrM$tX%wlvWk%2#na5L--`cS8U$~(t9NTMMeXMFG<^G!wDUVCv zVVy%eSYfzaD}KL2dz6}15BE>QhGOcEZG)90Ik>i;r9SGAW#m#XLer-1g;nL7rWi8j zxHpA1EebOa)k-V&G8D*SG~BGRb|aYE)!vQukNo9Tr1;*|TB(gz!c0vjedyc>2uHS8WNwPrx(s$wJSRChW}G{sU?7 zb}C&JXH4|a>NvCmUq+A`)lo$1djK!{$tMuu`Wv^stb}DOyKISA7#v79{sW15Ic|1y zTP;8R{NqqkoE!b}Z0_H+$w24kPbd`<$SVDM3T7ToVr}b@=O8kpdf$b&YD>NoUOUm& zq0pP`u`1Gal2xt+6Oo#T;k`7C*t~P=VWLp(q!6DoRNitEboeDXR9}yhywCiW2y*dL zG#CBn%6ehG)7WsG6%|GRz-ZAibH(fLd$y)YXtQj!AQ3~C+wsgBIOD^(6F@d z?~+MQ#?}7n{kILKQU@8c&To|$wXzy@4!e(J&`l?cDc&5KvFPfhH{QE`3&stA` z@!?^ARN;61rB(=b_fxId4_TWH_>l1 z_LFbCbVFxUXXZSruM*6|>GL^}2t9XWMuP?NZ@U zOrzZDQ%0OG=5T})=JfK{?E4(V+X}(Sd?G2UR!+?>Jqg3Oty$e(8Lz)ww02V3=Ux@< z@;+uBYqtwfNhL=~*v+^Za@?1;^lyblC5NXfN(X+A2rue!bI&?$|dLzC`ZwG-rkqbpyTyzqL)l9PX6`G+Pr>FCz_@i}FJI8FNjo&&?p zB3MFohKA_F*_)fh2hez{a0#T{Rh;>H0L~#jdHEdC-k>!9_`{r@Y9cCZCTUd1b58Qm zmyxX2_Pz!_rVn2wNNh-GSy#tB&76HV&tvwKIV0RCnyTd7zs#d_AVV~F(@6nj+_wVq zc#PzEJjvT95Hw{(13h{>Tkba|>fyF?p$L#h* z_9)9}`BD&X+okN9AcL5}T*~3L!` z+1REdyNt~!rN)SP56NV1jlX-hn6~qbcO}_{UKZ&XsZ)agMqoS5-?#}rwqZY!uVC=u z;NHZyU$?$cld3Q%ISX^Ot!Ay5FwyaCfOPyq1wjO+pn1^z7PIg`_v|Tpn*l7-TGxR5 zsqWhbbM7r%v8CPa2%qvBNhVU*9f$dawYL-~vnBRMF(J{9Gu5fZ*zqEUg1N2LzMT@* zO8Oxli??ayJWgY`>x`TxNY;g5G1K~`=Mpl_#j7NvG3;^O4;39lf75Hon*H6XCqsG+ zk7xFy1-oj=g4n(5-^6KIoozfuoOB}^UX|7OOqEuPd1E7QeC?j*WzuFEhGg5$+woi_ z&XH>2F=)qVwMZE>g%a!CMR+m_(+<0Q-mZQg+}8X|6g#1+NFxH$E`--;9QVAVdlv6B ze16cVTWr|*fkc}AOO;1vFNVb00v>l#R7RqDUgREi-Vso8f5O0u<*v(Q)?vWRIr>+A zSkzAK@vS!0uK;VSvZDx!EVW;H@5W1igl;MK-^i5yGa)o>JF8v6HR)rME2y*Vz8{D5 zz-$;NPOwU*K@KPREqv|nd-dPgIi_vU7uo2;i8OQwrw8*_Z(;G431P=s0b7b>ZDT5_ zYuD?Le=K+!W{1Q&9@6Mj4wCEp349`R;64lcsL327!Y#O0GU0fYbYx?`0g|aoN@f~H zHxzOo*OE^VEZYX^YzLi2;EECqM&+SDyjZR#S07Vg-gO>yCS}p-9niny_vY~N)JG#q ziS8Y-=TFqlDZh>xf8)g1tXo{ISdQzv?U)M94bbCD4qE-vHHeZ5TI4$NY(CAtieK}* z3&CwCl)e=6joO}={_!`FbgZ%77TfJ$m``E4IblX<%JvUrb~-BX%R-nr#w#=Veg6%0 zQ3JETUMI9`Ib>K7Ug)`hP|7+}NAjlaiz~LNX04Jcv(y#158mttu3uM^|Bt1!4r}uL z-#!9LcXx*{Vjx{gr$~?P?i7#^snG&5hLns{a-%^&y1Tm(aG)R{AnNs1lV*d$o0aO8i-cx**`ir<+h8e5^ISV9$| zc{~(j0b58%X%bb7L92|m-D{@)%JijX6}xg>pGNFDB^j1| z3tdO+M(b0SHUHSsAQLaU{`jlh6%>-9`9F-Qj?bbmiPP4o$WrLo9+#_GIFhB6_tBH*)3NY^NvS2j~zMRVY#$!t&yrs6Vka1#J z2KJ}2o5!>87~>=0a)BzDiNm7w8w@v=w(s3&;yfg)`SOsDj94yB6Blq^TfhRU14A?Y zBXtyT0qY$qm%e<)4K|%_w<{|3cE@<1zPkh5$p|+QDM!W692@9AivEiBO?c4ns@!IN z>PWrd$IylGr_c#FJv4u7f}1BKJe+WXD~P@z7ppc{Ibvy#Ok9muGm_L)2+~_TSaNs2Zn|fo+4>$|XtqNW-}|&v#9Z`GhM+H_={?i-nxA$adaD zCMIiAOI<_maB`qBbb*INACu_CcQG+^!{O9+jgGIAvCmCY=RPaKgyh5!Jn(MG`+;3o zSynSWqbhgv(GK3sD2d(13Y2tE-1R+iSp}dD#e=?@TgoO8yCd^5*SU@d?rT zVrbT;c*2NyHbfwaa<_c-F0SKNg5oYRgxUr(T;;hx>Brj}D} zCN77o=^n^cqARbaLQQfZTOxKy92Fp!EkH}Q-rH>d6S+};HT!n$*z0P=_Z6*H>Po{X zs#4Bmmq7Q}+O=O@eDSoSW9}C2H}7Z8ZJ$LKNU`*^L@1@;F)gyv+^};t#)Jhkn7=p$HtEyDTtUg};e)hVICq6i}_<5K@ z|FgE%l}N#RVO!`behyqsi^8t}@2GsWZtwZklcO|~)$6oXbmOmNk%g<5-}cp7*@LY8 zfH?8ujlxgjtBA{vc(;3F(^1R6k>P3;BO$O`1I@xx=L#f->mZ`Hsg%LZ771>oXzOD% zmZ$dWh!1i6Y*BAGU^n1dXN^z%(F|{Yv-_6ITJFBpNsX?U_?}n&YLSFD_Z!VMwAA z;jESGvn3|`&}?&46R|w9gzW+`PXpaRlR0TSvI*{>ekn|5_MD1J(S}*+6J*D0%(|5U zSI;rwiwA}7zsk{YN&Zu-&9OJx8|huIZzN8ko1L4jORo1_x2xloYrntLooEKvnq*?$ z8o*i{BnZ5P?%J282r)#SUqdeX?BD*WYWl(KIrjXM$1oQ7IaYQ-Y_6Z~vDCJY$6FsX zKbPtHWTlH?H61)}6z^41l>H6c^A~@oa}qd48Dd|kvg)OgpMgmf=CuE1Pu}NNSY4VZ z;wZm|jPf+6Z-S#Dcv_e417w~_?uXqk=cE}4vSU;y_$g||Tx-`X@u0B(!dP?N(%x5o zzG)zTD`~9r69cP>>*&+nnb|Byw(RnyAaFYwJw(`f?axDawY7i5_8*DUTENmZy=J0Ud~qMr>rFT#gLkE_r}&QzT}}TYmR66kHknvioiJuLm7Z0_0+8)y=3!cx}87 zO{vWC2wbg4zvz|g=Yx4Vq_Rcy9lZzQGgAn&lUm`|DH=wmJEqkw#BxnS`4eSl8Stqb z$M}_%D9J6yRJLD_Vvyz+xViOG`3F?x{GtgP zSP3sbC46~q?y%aS_j<65{$4xpMpfi}&}APc3D~&9=?hBM#FVDrbG7Wu2h|Z6BtYL* z$^C88>I(wV7xm$e#s1p~2_b9YK=-Y4M|#KLA2rAOk%LdSo68~n3UA`BA^@ek_Ek83 zyM9&uGQH%w%TL|rwcQSPz}xu77f%2i>-9@)`Onbeu)mO?w^Fi?Efj+u>(s-df`iz( zY>BEH*ctsD&`j^}=SCTgDHXK_!hiAcbyYd)g{k##a~2-Qu_T9ML?4DV7w7vkhJMSReT)Eh$Sc!<$xvf5}RHEJk*O{Ei@21~@Sjy}p z_B5;;Tj#n2UQ6(_hRkg)s}YJ;)NPXml}1#`Uj}i2lhLFqj)x098gah30)zwXe%kw= zQkUSXG8nA1ROi<7GlP9EP*SV>`h%{1lxi}Dc=j=gvUMgt3STq`h&ASqU1k<*7tOzT z9}lp+4ImA-!R{_^!pGLs7YKgWl#5OEDc0D7jspu&JgrQ^KPw#2e*7}F)gy|_k1=MP zEa`}C$R0{Gj~0yk*3o45lt{L*Eutg2d95WXO+r2Tw zr)4Qsgi!CT6rYGrlIc3sbOkpEDwC?Q^N3+lGEsIQbtzGtcf7r+5w^c1#q)ir{hb~L!fgw0~uW-iQMWEamd0-^BO zvGW{bt)LY?AijPQ%Dn{6Q{qc^b=eDIG|yJ;nHWt^3p_-7=IJJIut zsY)BBbs{wz@Mm@&(VTs%SgN;=ZD?a3q?0CA?#aY6Lv1>y|pmh%KENz?S+^UEr z#NFG$fvMHybMp>Nxoa{ct1svM4A#r(U~LBa*Kzq24`XqW6dm#Ruv(TY`cIMH-9*A( zo>BDEQl4oh{D)CDE2~z$#rHOUd?koSY5>PYq!K#COM3e$bycxO`VEw^mD`3DE8C9s zRZ;4^5ocy6FFw=Nc&p$PQC*8EG~Dj*5u%Ii%sh}~A+1Ng<_jL>f-#XG2IDUhx;_sq zB;ksG!(024T(cnA?j~OeT<{d_^IQ%=uGePiVp=W2jTmd6PU>H^1H*nQ=!GqFjSSXtCEag1doCf#m7+t-72ei1mKqM zVS~ieuWN44~)0s`88=# zZq_3x4??LaH!$TycZ>NYj@vx+bLO9AxpXw-XM=-nCR`; z8n$9IMrD)wW#`ju>^AQ5_mhXXG&s11YZ&GGTwCI6*X+o9Z#?1j%W6h6eQw!tP56-5M7Y@ltabAqn>S7ODpC zjr*8?E;r868Q3IfoS!(5j~VxACRA@ADP}AQ=+&Dl`POI_l5StBRq7sBGN*OICPiR> z+#9j`Fg-DB;37^(%_ObLcn$4)XhDm)%*!#&cd5JfbbFwFwvN8ICnLi|s!s-$O3o~e zo}|&wnmC&p*uvjBkwcO}m{Q!lm=sXNn*+&-!=MH642vk*^S$qVVdlDJAIFVW z+JT%`JvaTTppj$bt{+hVV$Cp|aN=R74f@94J+|XP){>k#FJbp2n&OSFMy?Z>AtwqP z^)=zhb&QrgSGJN0HgW?N)mvPE2#%|0Wzfm?Ysu~fnq;+dclS3|50})zd&!~{47sx3!f5X0C4XS?!pRT%=ww_Eum#hV|`lxNO=R8$;Y+}@xQmMMv ze|-{PIpl)kXhn?&e3A9e+uUmXdJ9+|7)LRdRr~q+F*+``^jyG&a}j!O%Jo~aV_HJx86(4Mvq?qxtzk-u%Y55C zcVr1X0(=pQPaqB)g2};1v^Q{So(A4ov2_qeP~`DZiOwsePK)~;e`y0Vv9h=!GgC?TsoV;a>oIYtnTafBC(rg}s%1I2$4RT2oJx==}uNUj# zy6;KLO+Q@lqL=OQ`vfR#-9ndq5mY%?V_JST&Y&4+7OuQo#4Y-mzL2a+%M&&5hp3+H zc#Zxmi=dpQ?M$WCvxV}@Vv=vtX^0tvgU(D{B!h>Pi<@6dfCmLF_^_&nn0*tAUprJO z?`>e@u?bc3rmho@$UxrQi=}iMCZtuybJwXygQe1(I404)sG^B*Z z^3Ml;AI+IA`I$|ZQo6gL{LJ5dpL;DR#Ys4TL}&3KGLKh>A3d>JKB{1vq#tTb&Ke7% zdR#MT^y(7|54HQ4v-LUgvin?S#FedYl3H0$|6Q?wvAW2U*>}KJu7+~!DuluA6)=GM zmLt6z(OeAPFdtXaqZYs{N(5m54J?py34uzgmXzHjv;cbT>`LJxj^2e>(d%C)!d2dM z-|~wD@(#TCUasO~a2Oi?gq!5O6VZf`3X^(*>sY&G6I$zhr&42IzCcG_fXFEu zoMM4nd8JIx_4#$$t?p-iExuzu?PonpZT<%WU$ko`#iXi^-xn9hsot+lrn~md`r=3P z+u0Sk$iFP=i&Uv1oMq7>{L*xM#4%CdSlD)Q`vDr5R1-k!n6oN5VmleqKADqZoAfQn z>|HHav!aS`a~)&yKEN=QO`{ zcDt?VxNz|8PDhKwow!1CkF$akX<^e2OU^Lx8h+0x<*pm2Z-)UNkg56fzVN6Uh4sfjFHT1n!7q63l+c&dV4yR1Q+Dqw~tDkwuB@1t} z-?w&wrHQ$OU#{OeY%lb@khFDKdy4e*PpLiq< z#GwW$ah{^-Sp2Hr@IKPj8(`6fygcukcF#^a{_R?NH?ldi+4LP7ki~RX<4R6!)19(s zD||#%sTw&hs$?pqXxtXTY{%1w+!Ji>O1(uO@w~I9 z*Vbkje@Ey`h_VhGPAbUi|71oy9Yd1cCIK#95a;{}lag+ggsi4Y>B}e8#Uo%;K^A)z z99J0}=7{Mm71lpt2dhpDG(U4=#B98p{cTkjN=zpp2}>2jB4`iS?H;l%@tE5CIp-&4 z#if?Jv$!587daRhVFc`b^JCO}NtL8bm#l?~GOIs{k~2*n`4TRcu&w?+K^(R z?XlSbS_ggH=$Z0uZDGWnfZ^>Ie^*?v=QO`EtnQK0v&ZgOW3F|yjbD-(@C>WOGDkT( z9|;3OZ+WGB#HX6V{y^R)chExOoQbiOX`4MO-@v-?tUFy@!cf$AOb1f8s`#0BSg@m$ zMC>YP#*H+K3{PUN;~MMY1fEs>SN#*1=Ty$)Unc~-Yp1I+J%(v zysGf;U8)p^@!F#hpWIE~<_O@FF)5!fCovV}tdM@eqGrJGaFRhMyh;Iqrm0?GZ;YD? z?C;30?T~U0kv~58*t}d`VFU~A2}d+NFSkEkJyjmYxJ)5P={eg4 z73~ItVI=;}e;CAb#<+tQqQ8K>=ilk{89>h~Mno~dA-T}lk6!%L`^KP}0t3FbC$T{> z&%e9J@z&WrrdyWtF{@`lK-FZZJz{Ne2+Pd9ax@l?s97jx2hJcsv4Jn8n+q#!UWPU1 z;*T-Dfu6?Cp^5kjX)c~VFdvDE=PV2|mq0;80?t+U5yZ7gP z8$?N{lkkA1F3X^@C2jfKM(ViQt=W|e^P+j~vKsW@{8!^F5&@>B7|S|;=2`w)2V@pj zc8FOhD4+s=<992iXw`4#Aq)&vWVPFoQ7#mk0&|?mI zzIw1Y`Y#&T!zt`H!V2$OmU*sCjNNQr@tPqS5Gc6N^@da0aL zg@u=oKJaHn;SrW-!wI>Zrkrr|c7Ja8)j^bXUb430jWqn0ve8!wPzr4Cir3u7%WTnee!QIz1f$(-gaE06Y% z$C%C{KNNM6XF*e_g;J{-aYXXc5W?E8%B&k^hS5A;_joBvr;e(|Hb05IX8rV((r=o~ zF(s}B!37iGn*T|B1mPVgvPzskulR&q2XPO~e0h~tF(&TcT10JQco5>-hm#(~)YL;) z2By?O{^B8^8}OSANqo5m<=f>;s_NjYH2DI^JP4MU02YPQkEmE#Tck;{Ug9MXS$k^A zY<#p==M165wZb6O@8Nojv4aIyd@kicB(BN;XmuqO%R5!}ZjB31w3r1X;YTe2ThA_g zlLcIQM}gfB-33mASm`2hl$Z2})<609{{F-@#WMo~Mv zuq-`0yKi7_y%&qOa@67(FLsa4Uwa5OfhY-lI=+0$)}XC{UCv;n2MOQxE{BdcQ6o!( z@j;uE`6YB!Z5>>p)hZv86#iFQYMIY&E03fV7}y$CJ_cfa?b(}~ssvpUSN3FMn%2&m zfX?2~F4rv7+2`aDojgJB?XC2Axzr|PiH?$efYLs9g6L}SOTaxKpPnrzjEo)FB(!eJ z5wdYJ;E2u&+i>bW8!L*Y@Xal9(VjbAXbr4&4-;4+PGML*GaXqtF~4>~Rcqc1y~lC| zQAPT_DbA|KY-ghk>~&n7TRgsuhv=&{U!oCi?)roWvTn$%lOl=4md8pi8^31efz~D z`c={Cn)Vq|d1Glvl$B|~iKunQtB&c1M3rn0y-3wE*d{OFz*c+Z_x$YZmyS(~hI8)B zlkX#NQckWr2Mp|uoa2A+&#?tZgDQ!>Rx2{ww&?m|fzg^nRqf=TD8AN+HzAB$gd8-_ zy#h7%>(%&(o+j8Qo2XH@ym}3hg5}rinuuGFQ?3n67-_S7rb%!G85wc=Gf;T^O{O&* zPfBS?^30rU(EMrHb4%|*7`f|EX<{MHV2jVe2=n2o7*Do)rHqg<;!}5vgwq_ z#MKIxBqsIvA8Idtrwy>aBQE+RO6n`|+vi){C$ekL)l2J@_hH)jkX@$U%j@ea0q?%GvH*z(ySlPo)Wif!OjE#mxe!u!OqH$c>il8##?PA zdX{qG-nkbzW5Rdo*rZ`}eH%8mIC9{zNm*^>pxn9fHRn7`{BJap!QwgZ>UjuI;>siG z8MbfX8qsv4+BxkMp>$2H(HY|sJ0VFacNcR%Fh`lz?#iwSy<-BI&>tf{5`~lzRElyT zpg{=-GzHow+_q)&kcE_Pf95sr1-mQHcc}d;GJcS0WtB)ScTmz=dkr-s=c`GgBnz|U zkE@DAwGNZK9Ha0#pgq_8;D!a0vFXG46sk5h4% z+KNMlWe~Rx0Bz9P-rCOrzLVc1BY^qD;*Rd!BB>i|Q&aR4T<*2*mghG9lA`kxpdDej z0d5#3+p4e=wZAA-e1H+tmfH&g7Peg%v2_}Nbmw?B&WX{NH6L{KY~mivbhQ;hrCl3I z%Imd0|2~#?<;@zujxtRhQ*AZ&6fe|_^T#}aN%=RAVhPDnF+zS*6$v$oihkqX#f-@< z7^=t`Z2d^c%2gMPOWPfj;!g)eNtWs{9drhW1|GX6kDbW;79mlBmf(&#**}vSmK_X$ z+(IGEyL}LBy{TS81qf^OQ6FiTR8G#dh_a9aL&|OmDxg7Kh@`xxFbLJl`=atkv-vHoG73qsJAi0G9;0|MV zd&mXu>OM;&C$4YfHwBqe6g*{4r+IieE#m{u`RAiXDs5;j0aWh=PxI;?NmM8_f_NrB z2=UptUB^MEMTSSxWEBYn$O#I^d)cS+lwM;!pe9g38H!J-+#hRs42M;loxVQ@b9;{3%i zFv)?CDkq(j%oIZZRfKTik@H?!k^*NK$>#01B+5V*V_QI`50oS12JUK}!{ymfxJ)M( z(z|qGiFtveM507;F?#_pgOuxUhZ1nM`bYzXFNE)H?vlcyE->*{OA8mU$^L;ujwgG7 zZaxmE>ggNm8?3|ji-^qyYzk3PIZ>QBc*LWrKmhA94^?<3AAD`ze3=KdhHo~}Kl+#e zc+908$*@FZayV|GKf~(1JAmC$NxI}Iy2km}fWEMN0FD#T*Hs0ieoM&vaE%+D&$mdN zz0IyZ`L|&LCl77xFD`j@SnwV`-EZBNT}4`uD!=W%H~^CW3m#eC6^vl{?CpFxO^x*^ z`e<@g;gy2$`W8B(hgRST_9chug!j?j59Y6+r84 z#L@RI3W9IKFi9@oAF|$62Fc;Pct8QY<$f;mP@3cteh6HZ_5$1bk9m+BHd*Al_sJn^ z(&qi#!^S&Yg>~=Mis<_Q1@`qcy$7_n>mh6O{Q_|LG;rP01W z_5dcD|6SV#B8?0MAY-Cr{|6a+jQt233j-4iz>ht`B*P*lXTt^{W30k2*hQY}y`ogK zvE|VBrLvXiQP#{lNE zDyPZbvsVo+8H}3KWD$wHwFY!7-NmjAFnPS^88iP%t6h^{r8Ff~DLvvNZ>nHIPu2xCx_kNy7cnw1ilpTk+hls?BVTveO z2V^dOk;o{+rK#hQ>U1@wF6excHyC<;%e`TR_jXN# z9opt38^d(VQu>2T=$kLI2*d-12|3IFHKR)%eAD|vIQl{eQ`wp13THWP13=h5Q;7dn z85QDztf;SuJ#i-S0$l8}qcWZFH-X?+g|DiGu@)BdlMvAPAQ@tmoRS2T%0W#onT{kO zmo2hW28fO;CP*cv=|}<4hQ+a zL@h_GQ{Cl4&oWXdlvBQcw8?dl0kUket7iqPD&UuWCrSD#-OL0DJQR@=4Vv8APU_^^ zdLBnxD!w;HXgw9GQ&Y$6yWgA%--5M+rNBL1AAslJX0U8_R53P!=nYkAD7bqMHWzsY zDUiOAE=Ub#*Yj+I8UTFA=2!!01W4`;eKjuvXt=*N@e0fc1iZUMMJL@u+G5!&;58elE zqBL$iOy*K(q?Kh6f9cqr)bne5|6DcOR&%0@BrB)Zn7AOMw28C0aTe%Aj<}kindX4t zF-M7t>2yhK3jw1QDK&eDoudaLN@I8^XgOjoU;~G0!dQ{k=L}m*^4#=*EPZEP{4T=o z`ZAcA2;SV4*@q~e8|mt`Iaco%Yd9{dXA8qu{aG={&%x&my=eM6^uVG!J*i+{e&}oW zz4d@=sUXOkD>GdOJWQJ2sv%kbxp&{e_aY!%W-?ucc4m+Yw?L%pd)Keig4Zdc)hUBM za5z*GIx^;U?QAmp)!+_0HT%;8`rXIGlBcOyU zJ7eGc2S1?dOvB3i*J-Nt8M*n+)U|_E_At&c9g_tIj9RyBm?f&LV=gx!HMb1%@cA{@ z`+A=PZcRJJiZw6F)JE@qgmG}B8gl`|{vYatv9Em6iy?*Aua$(#pxVd9O?Hl{7VpE} zr>Cr$2|KJ@sTUB6{!P#B@zq5;c@vLAeciiISy$3w{N&AR{u21AJ2#*kkl%OZ@&3~k zlGg2fs>o4M&N10=RaZL8aUidWhAZIu8Wa7Q3*8KoOorR!g@QdL@qN3IkgtAD;oR0= zhqn{MwzG1Cbt!JMYs>pSHOudnNR*}|q$)Zd<~Z%}sLh1rNN6FSP8HnfamZ^%+rPfM zAotTq>+u~?&=S3lu&~B5I^BXTzfVv1?wbx3Axzp!+WT-q`@PA~($8sV?{F(sjphO+ zXDn6SN?hD)*jc4~rp53%R65LhZD16njYN`9caS;4YhK2_GS_=bo2BNndLxZ4JOf6U zq?;~+V~O3>^M=W3+wot4%ru!S;C&*K)|7R!>~GhhWh&=_I{_)5JNHmw94*sAljK1f zr~ufU5oOTUaAGT1&A|gTSejj$KJPv=uR;Ac+O`l8qN7Q0+HG`dSio9xbdf2_KsZLGP~&rR6(^9N3{8(GkM zMScKrX7G|cV&q~u%45*!hfoHImxyJs|_gsvSuFjOMkPvbq;8)M}1Ar8c&bE`I zcK#LlBKJZ*lkb|15x(D+O!sx@GsDo>8$Z7E-0}}0Z|k28gF>?B0+}cV$HIfx)jNrc zQ4#QPz65pDz!BMf%4sM^7q)f{@+cx{{`OO|H0O^f5f;Pb%udob72?{k?PcoER; z+-r{M{YdOE84iwZ>n59DYd)_9wd><}P3N3LoFjn2`C@aYR_Ri$b$TaJF>$&+8rhPn z6kImeVw?LPhQ@9IHK@$0KuRisx1}wjLPq&vQ&oQdT;pgxV?QHuCGmRpMA5;{@jr}9 zw}vv1UwArmn#>8gC9}()gtXqDIU*5s3jbjga-NM4mvk^m9}J_$+=?8Qv8oGa&Gd+~ zIsdXV)1=>z#m9EPb_iu8*hyhpAX3wW6n0Gc`kew-ALIKkfV2teQSDe31 zpV?0u$ocBWIC@W%o6FgemQh!KD%byMy72H+4ZKOm>p8CLO#fre_SflbdsA5 zNQS_~hPi{Yjek05{hLXhd33pkvefq80=r66GW?>89Pe|h+8E=O?J1$!24&v&bl^du zhs;5ccLrUE>_BX~j-SI3coLaiS|Cbs08Q&`X(uXtOmb|$KOH2ficWhX7FJIzzPzA2 zKB^}jkswsbMmJL&j523LYp*+Ym zO%#@VxOrd1==OduFkd$dQ>WS69MrXCQgl08{ArT8hJou3halebb*1zc)F=Z&1cgqn z@GBabr}GKxOYVFEM?F*G$_WkDIECiO-}W|r2s33VHC@Jg1;8!w$kN7=$$m54QDnZV zfS)Ph*bM^DK-9$h(qB@)q<$-9p>9CATkER9Cpk%fN)wH~A;PjJ+AH?|fYvxjRAlo; zqiJ-LXl%#)dBmtZj@#ltzP=;+;Rq8_x)MHs(S24vl5V*auCF*Wyor(=W&EO!8kHeL ztA;*hij@|z*WagJB+TFdW);Kq>4L^}Cx}xmB<~#y+Oq0h&5rR&l6MHLh!@&hA}rA& zJ?PM{S@mQFthuLZ4$nsk?s1!nhvhrG0S7V6evPq$SvA@9g7TAt!8?1u^Kt@`Q2Me; zU%C(q->B8(iP)~WG&zL|KhBs3mNC34)4+@k?{aR{K zj({&a-Ybua{w87|qcW>UdLFhqF=rnrmlgLg{vnefb~c&|(fbd>KIrE)KL~XRZHyQ% zU|GBoSrzQ_yDM_MQPmDUzaQ{|`TU2`?OS>X-yF85DE9qR?A^;3Gpw2;Rt9!u?rX8z z5r3hN3OT zyVaj6IlQ-GwKKkkmm^XkFgBjGm({gnCqO%T^;Mx}`9im@aG1`Nj_wvR3C~RabgXDU zb8#ApI!wdyt>&BNy>m^rys%7P%Qzv|TxVKlrb24vQpl5hqygo%lDB4uW&Bj`Jf_$b z`7<#Z=n$-2+Rd$VFRi9EofT@|-JU~K@|ngWK?-R@EvW`fPjZm&Go6nX zS&$qx%(zzBA$8wjnr0|1g}t3DtC`Iw*;hn6iJ~IqSIiB#3qULY#icwrma@K_6tkxk zBR^l#KF#eA#=_39*plg$j?4R+ag{=VfbHOYoOXVCTG8-*U#O%Y8e$WJNco(rr+(a) z94_mnX0o7F5&7fyk6CH~P7N5(k^Ms7;o)t6x<|IJCcMNFU*n5t!2G3>D$f9XyLAe= zYeCUH-shGyO%|4Oc2|s~DgUW^BJYyi2^$uKjiPMx{4N({xy_oR6Ig z%*y~!V*(SWmNJ{mz`dr?h_qGhn33Qfr^r=$dUpBdn1)~g+QxXDIAAa{I_Q*6%qsP8 zG_{reFiD;yF353)W=Vc0jKX30m&8T>5k(mCjOhzSIit^l4eu-yhs3E; zwo2f0N_%9mO}_~5<49$3qkgepKc>1H&M-cXujp*PScRYM&kZbDk0Oc4rPX0jvnGij zFWZ@f49ol4(_!x;vAG@k8M|(E8KTR}mH0-|NPCJe*}%Ve+~B(^3oxHC_!SDI56WaY zY-|X>NN2lZ=_YAW+Ryd}zxJbXSC|4isUS_|Jsy=L^#N#)0owjZ{Jzh^cA11{RCaRd zT<@UCf6cE*nu21lYr5t5?uGr1-0=AL>H{-pK)L`;QQFeW)aSEPD489Sc5J?yY2fl&MpLsh;&8)8fRJy-4H-cw?we3sWj8oFC2LtP#!xfyCkJ1nb@ z+JD|DtCYka7a=-gCbFw)%N!g-Rh1z}Uz{u$Le$h?+p4l({j{EdI;OL`cOC{5@P=8^ zFX$qbZ)K;idEz2@6Fq0e?|GOW2;VRB&GZe)Yqdq(rqqXfHJid-0W92 z1K(D-xVSH5Qa|mAE*s8eA@Wf*ZqTPpV*Ox=5T!P=8=I8;o!&v6!@C_moyknon{Y2k z?R3Z{VnuW7@KuJLMeY50Im^4BD#e^)J^V-X`|PqKLsu+^nb!)-9A2k=KBa4h@$82m zDy)BMb?R)g-y{7;84tC8j>?>y7FMPT66QFjug*u3k-4(nuF%u-D<{h{6$&{3`_%5y z@o_fs-|Fns9Q2>Mb~kbN8K@)%cxk7qf)U6N(?Bt{6;#x zM>Rc7;$p}=O$b<*e|cCKQ+}mBKJC=ks%Q;DM;@)UGp4hw%A5}l77GUNihPFwgt9?p zGX=+^nTw1`zH6{uD(wjrVVpXCa1tUxQ=PG$sJ(vQzakOoE>MHt*vin1Z;csA7+I$J zh6&72=p+$_|GK*!SSlRf#O8}XduY;B%1?K6r6Za`fx+TxLg?WcoAGhFFm`u1Fl#~W z{+%9L%6hG^%0OoC%J1~@^A+^w=UtdGIBmH%VIMXZaLth@^QuJvCRwzJ81Mhlg0jfV zjrnoJH+acT$Dd)X#Uh)qg8V%!<~HWnG96TvjlSt%4GfW7vAeZN-&E!qc5jz}yf4_; z^Ru?ajd_nM8WHewIP}>&O}G|$7|`uO4K{OY)7h@ODhrP&9?b`FP4!qmu_gfGw3(lV z$+`!-&XA-)P%5_68b@j7M!0!RjSJS`%h?!e+OmcCk962q z12#6zQBXTN2&9|(*vKP%k zz`*h@oLD_o;PnHuv^o&yN+9&|N}t|_6sx#~r6dOm?iJn2Fx!4zgABUsq+C(sbw%H5 zC#NY1!33ishOWaD>t-UwNt-$%wLP&){4Ko<= zfOi2|7K{oLv1FVE>8C|*?Un#arqbiJftJ~KdMFc$F^TLFL?_M@C1TSsg5ttI1SN^5 zlN@yWyVj43eOo-%yk!@>QNf5|TgFI7NV{J9yO2-Wpx?E~rxL}PW}iKsq{H9^wiLqtkBOjhZe!$A7n zp2o}r9@%u-OoOUC;uZKhuXvsIPLqNy_qDyBOy)p5$yD8ha;R$>%z15Z*nO`v<)YsDP7;9rVx&F$~SoRC5 z*Dme7-*?awOj!`0P${>YZm~$9eCF^mQF@~70UjZi@E4kz98scdCL*V*ZSBsn^V@Pd zy1#DpbSuuoR0ixh4`Uyw^5qRhjgS2%8uDXI&>o(Pi08gkoG}|pvuC_Q(NUnysD{v7 ze;H){u-DcV-;&?Ej-q)_BvQ=xEMo>a9Pd9I(B(_>=h5G^yZ1RcdLJXek$J@pk0s}D+Ga?a8B8ZOW*?HZ;~U^)0PJL zFN!OyblFE*s$eV4#((ksuR@AFJ^dg1Vy+VPzg3xZ5tmeG`wIol zEYgCXs@BcFe{9$*C5W94s%ohhy{S$~c~F&qh(CUr93tVKi++%fOYTGm*w3(EEiEl= zZfzpdx{7X3lTABmlQ*5u&?6mvYN}weKXhzI*6Gm9YDe_$xaC;Axk8!);-&lwM=@>e zDHsUp=J_G~nycF1nA}Ax?`X=8Qwq>2D*mxP5O7|-X;p?Pct%jL?AP2*PDhS;-YtOt zQeA6xwkiym(Jp+@Q;FdFS@UuOh)hu0E2&VL?AGke@_3(>#UE#9+n@xYvM6T6 z595FF*?(^!Vy_Y|%GvSz@C8AoB_D5rO6EVo?Y3*=*{ikLsZ6}+B`C< zSqtw^=_)>m#G?&RSGZ#W3^Yu#A+N{UR+$CJBr}QppZ}-h0P|uip$)|Ouu#zTS5;-F zrwmCy^b}QRT~(;&|3ybe`_Hm@ZW=sLNi35|@M&!& zR+^LT*8YvB?Jtq27>r0{RKv2_k^G>Xwp<=RXEppmGD|H-IWV?LKwp&NYb(jC(C9gy zijWjozo@Sx1mVe_PbrzJ480GuJ9A7(qe&X2UACiXbny{qfaI#?p<|M`M9g9ub)T(` zpb~ijWk;)Qx}hjMZfCqdJ$S_!q)TYuvmeHy4^&|6;m{b6jJ#L|AUC`#dWx2Ae^ntR zs&;hE1hG`PKmq7A0LgpVUq7G74YY#VX?`MNjszNIE86~PtDgUB1;F1ntqbuKgd^)hW6N9v_() z^lpRg4OFy0m<8PLL_25vxCrH~DF>+S?3yt=`IcPIGzFw1w)r`>_xiUFUlkP_%Q%jI z`RmX+trFP4q(fmGnPxw}$~34y{u$=oW2r{a(u4ECXosoE1?ueN_|$niA^8|LWvc}X6u)mk$ny5~ zhc#~-uIx9C)P-=0$rmD>f=;O7=l4F;(j2|LIfv19#Q$D{aOiha3w%3hNn-cZ;?Vi_ z(I2nvcO#slyfe2(k7P)4_)%DCc3}_P=xD%B-yrSRCD{~GZr3tr9^2ONC`qKdI)QPQ%lb$TG=&jM@Q^3)@=tAO}mXZ&Ha&k2*VO)kxR2FQ-h4u|R3uf}% z_2d~+hxZp2g!f3baEiyf5hRWR$Bi=zofaHe5~H!wn8(MqL(gVoaE7-&Kiwm5%F*18 zEnh3%ML$jm@5ApQV3OwF+%8@&hN&KXLx}W{gb!sGzpypkxP{Jq`TpsZCWz0v&rAf? zcBu1wbC_+d)Y3cI%hPWWchLf93wg-2z;0!d^iIQaBtZX#o>V!h?PS@TlX<36q6B4$Ks9;~ElROH5;!hxFe@a4Verb#6zFS7 z&)>=5`I+EjXjP*NFc7hV2}{iM?2!G?W~9;CxTNAk!@7)+5vz737@z9h0q={ymP%$X z=9CCYnQWcLdF`O3=303~EcK2q&nR4S45MHFpM^-%tm;&AlL3WDWBTf|tTvvl`AofM zK+cxRc0%m;rA!>1-o0y^!~v<=dHh(VAh3v6YFb~gGfynq+v0xSg=TWjR?L$G>zTcK zCC7gz68gYe&E%Z|p#u66lb^eJvT#B>9!Yt)7DV5%{Ua@HS}yLg6M{22#p_ty{X>w^ zzHDn3`ua~;3mQqtU6iqM6%>k@^P}nc<6c1BH5;|N>Jw(~lKGr5Ba80Vf^hyLCmBx! zQz^Gpzna!uc`UUdgU`rRooI_VX7*MtQN^`@T5{!t7=4qnlk?i7y6k?&Bb{ngD zTTB05)dRu%=FW>^XFH%-`Z^vzg(Za>+)jpL^NfLsRk&!%ww(7RfBtm| z^6`n4ci-sZ-h-7Yk&ldSRxD49P!RQbw?s(WgZ6t=np<Fi`S0;dnVKTP=;$IM%<$sxedjL3aZ|a_)Th_=M38vXJUzA>~W3>B}e*IKa=sN zD}_!gH&@jAf@|QR$s*uwOc1*&eGz+m7*@`~;GbmHlyG=E@$Q>^yFNE+g{i zH?J=S57W$lI!1i;9{0M)I5*}D$HvRf(wIG_$@CkY27k2?l6trAEE>@-V^sxVE)4o; zRUIrP;NsBM@mxF*@HhEfF3V1zx>o37()&=C7pw2UmWiL$lPZ(99gUZc@P}(#>pLML zoZJmA$2>h;7+~_Gya7W4GdX4)5x*{#Wb1+|YT~ea*L^f+Z8^HVwW03_c9j;zM=t6a zA=L7HMEE~moUcX1&Qwi|T@cDjqD>bKuN{nuC-nVsPhY7$=IQfqRh5+4q;;P0Gpv@< zoQu#OK60-of=}sJ>2HQ*ZrI33V(5}o1P3C(-xLQdBGbMj#547?HKCEyQUjh@!z#uJ zY3BYWMalVPT^x@1NSY9!h~F-33>WQcOLa|IE0%FHqv{7JMSvd&rPB%6j~vpB{eSMyV;iO91Wo&UX?_&$B)Kc4u9ZYubS}Pqzp~S@iu%E1SLrY#i(*a z7c71Y4FIAG2G;NU8~^v)!O5S$F8RT)GF2(ar7u$DSfzIOkilQ)wy93?U>QYylf*%@ zaS!+{I#x8%GzKoHrGb`;Mwe9<#aO^z4vIq;7^iYoQfsYR@Q2k?!^(xAWfJgieMFbt zccsDxki6E`Bv~begK_$TnP-ImB@0(oK@E%F#=~W#b)laE9|X3n+<*A5b+eu2&Ng!d zb1)lznMlpE0EW~DAqjb6V=~of9}D1(1PM_kOXWSW^rLFa33e2IKr~^%8pu8WsX{~9 z(G&z=E&}Y>Z8S$T{|P5Gy`$35)0|@2a4Q_lGOWiUhb|dnmlc%cLsZQIfw^j zRv#4MCdyIv^!A?Ic(JF=DI%31c^_9igA=hN=4&!-YBjl%GyfgA53dJ%IVb0&(X-*! zwBD0y!V&H@R%2iLI*qwHC#V#n)IJ?K8~JiVwCh=q3guvc>O=MA^7?-<(%oJ6@c8QvEvBxzqU*dl+uowaLzi z|2lp9|M$A}>ryla%bRgr9{=^*?^iGXe)S5+>hZU090SMSc<%kqtM;elBhb?zKEU6& ze;a|N{`wDsM7^y3f6szne0Y*My2Y(U`*rE;-zQR$ zfuf!CUza*s=JL7tNha{qDZI`tI*4RaiRt}uI+-jUeAi3UIt?D+XBha8mBgxmh6ZmG zsep@CUfF;#{73Jv`McsX{4@3#i(#U<>OT)YE-I$fGBX0!GlT3E>Tcb>&{^(kghpVS zOKWo~A?~FU%pft(m6)5OJMq0col+U9Kdpq7?*GFhFjetRKGrf_*&#^XWIKM_dJ-#avuzOmP>xUp>s&`*kU0-8gCmueD}}H1+M}EYNKMN98peo)<4% z4eKLtd^Ji6>~Ul`?NlxzWY7KOuS-dr^!lG}Tqc_FS1kRT8PD7^z80J0Utc;K8a~yw z2@(i2R-8I0ZE9u%ZHGUk^FrWTb;?5EW`g|nx(wT-zLds{uPxWR32^qDL~wq>*HPF5 zXYskUaip%__M3Nvyo=k99bHmrRY%^mdC{pw8I;BCO)u%kFOkQS&ba;2 zkEYzT^nP9XqTb#A>(WA75w}gld&gTCmk8n zz1CHq6YG;g#lBtKR<1$_&hsj|9ye6gr{_iQuVWmi=n4W!5+}Q5~9%hp)WGLxdGze6bKYZFU6~HW-D^lV8DYX3E z^*c3I4T27&*)^;sOS?`|o>+AKb&;+in=R9u;9(y2KrQwn)U|RtM9D6Y)FE*BxM-O3 ztb7cr`>}1q_Am}sM=HZkN`NhDfX@q+++E=;kSKme8`k#`G;NnbsSpPTr_A3lIWI^y0N0$uBP2cGWw3 znfy!B4r{K-$Gl;G{nf_Y{&h){E`eHiv%6cj+qq zib~eY_$dLI_jc)dzCtF*3rWKblNRz3yW^S&%9Y4TQ1K)yv+)ztQr{I)7JRsy@2@9 z{~&^2wej=F9A<4mNh7Qyydte#aK66_oT$UDWw0mQ=-G^S{JdrRgZM8!pqNinIXUy7 z*0bKLT)!?EZmbK~X%xR+23_2*Vl&KLgQBV?=FAO}AY?t^n4@^B1d~s?eH)dZ4a0tQ4m^u*XB(HXVpQQjG9Ee!$m)wY7eX-=`Z1NTX`4uUDkyO$j_S<{VCJ(e!;7* z!3wNlv^BAa$X>HUe@0;Trz`pgRirES<6%=x4^#5bGr*7Smg8S7?_nzRA-fh`<4%B4 z{ZhZ^uHsVM3bn5Llfp8tXS7IdSCF`BlAN^_#K&qc4Y+9?MSR_Qo+$Sf02tjC$#hCn zeq?(qlr0y}TYC|9u^OQ%XQ24EI{-Mni1?s6vHk3Dt1GZGo6|`^OH9-~5+|Qx3Z@u) ze^OWsP!KP`pLJGcO>}HiY^rm#L)n2l;%k3wSt2l#82K=bJ10CQ>M%d+`S`A#dWJV` zM^i&TWz>(ERHYJ=IyUXdnV$~i)qbr(tyGG%*7AXZtqVAwR8o`hk!J_$FLn+$Tom^8lv|FTDcINc4#U@~u;@Fr)%EZ=M!n9dc%oiLb~5SjGXRIYOB{!lM$Nb#JYlS?!>7Q5M~Q+@k55I0fQzcVv_@Y zbF&m!WjQt^E$tmCIm>t|NPyb7Vni!@^E5h#kO$A@`8^Ahlm9LQ)IAc2x@&m5x7EHT zIjglAT9yO`Mv88?1gFi$aPP1{r8^_rIuEV3$5-WY*ZTfY-nnJ7j3BtKH8z4e)oS8dbo7Jx3F{PKES*>1(O=zI?% z8owQ6xT<>pJnn~vSXQ$u6i$z_+=PFS4}Qz>G4oI*LEaZ?bnPvI-c_|Jaflp{tGQ^7 z*K&x0mlvQe5YWH=&R8Q^)+6;*<$npyWDHTNZ0U}}d9gN(F)~y$Qeh2>yTWZ%O;MM% zhmH-~$x?Ca@3$r2QR=`IQ)i5iX%+9=BQ{W$t?EW;KFOy7pOiZHbc29)m2wUu_QBns zQ3oR0zE=bOIgpoY+&YR;b2lPCj9V&;t=UmPt;&V)DmZK~h=tW8qgBtUX?F!B2U_cn zYQ>!$7hkLm>!4|!n1we>T)<_vKjhX!W^Ti6QZpNlp&RaDZ zhaJO%ql&F285T*};^hO}g~T6l-sf!0H$$VGh`6@UX(vI&_ahswBNdLWy1TD(LG6O>KaJRO?6Z3M!@09~JR{`Xe917iuR&n6bpuL$MZ` zLaXb*T`9z=l0A9GEnCISf5Yu(8^{E{xOqV_kj_(&7P_;%XZ-rigw__U?RQj@<*Ade zh4i9K8zm7GjeFAbfto)!d2FG#!U~MJ3 znAudd8{{Frlv(#8vnBUIrm9Fy4&akHGOj4NcZlg3^7iB|G<&ETOdh>BGD*?+d!eITvc+ma(8%%rKliZG|Bw8rW1G0`Y^>O3pgm}eXP5masqu62N;s(EbPfPF@K{@y$Yd!1P z`+33|ijGgxeIQx)Sm7jf>)Q$(ZNIgW?FEgP$tj{J(l%$gg+F^5HR$~u_^=ic*O%PA zqVI4)+1a`q;S*u&aLQlG?t0Xh@w>LT98(zt4=K9}8zv28?Jx-+#*qikE2FLtr-Rkv zU-nwd2X>!d{7k`!J}CNDugbg|u5at#KBKp-$M51oD&3yk<)a4=RF_xAV(?Lw+zhaw z{}k!y8F^usJNBB(3J}f< z9oirF<7m0TzW>dQO*g8o99}4UkCP7(S*O`n@kiqMA$L2t1m&#>3VU+Uk)|&LMX37v zsDL}MH@uJ-K3ptb3_`rPU&)U%|I8~vb(N3u>!O?1R~(a3<1aV$YQHCTL+iDbAAhU+ zodS3lsvFOe?}lA*$l01F8D$<$6NGF~WyaQ7$RVJXv0x$O(3@WZ*vKS;>mcQCkJ)v< zmBu3yc_zkIkX5?0n%P~~XK5{*PY-lIYGr_!nNqoc@|j)nn_)zxhh0Hx=L=4kYrMO? zwZ5s?eIrCoy3>;eZk$>+Ns#(f=9?ZP`qyVW9)YD-l`{J=s*CPxav4*lj2J;>THR7L z=BYv_(o=GcvkiIj{w~qIYtx;#pxf26Zpm=)LM7yT$i)kI?hB;iY#!+S{P9k2-xR&W zWT7U5kTO+#@#_0*< zQE6iHm!&`Lwuxm3It<=prd{tVr11Krrb|rFdE2WIJjtY6kK4EosT<+=xNBQaFdKH| z1g&s6?RRC}aBSo!*Njq8bxSv1J)%`fgTkKr>CLUBL&#DQSHLWnrhk#ALf<+9d#Z0^ zyU;Y`qAMKd7!j~HPR;Dd;0Y%#0S^>et#c{gh8cF45!U`P(&h`LxN$RxI(x>nd!)I7 z?Bp_hk&)iF{ob#FXHT*P?y>#w%B?7NMNZXZ0oO)0V+-hm!cPxKVwtB|OCa8u2=48P zK~|~(7X4>8TwM<2t9&!%Z0pCMi_j&*NELrAeB{#N%5Ir%s zd~t70Zw)^9dN#GCrf~*LW^-^n`^ix&ei}lfd#nXOhqWALaJgarYr6e)6LwhnO=#Jb zddXepHq5+@LMmlgAH6yU9Rzo&JWy~QX&Opibyk0^xET?ni8WL_zk=>YLr=I|BZ!1- z=Yoc*A}J+2^*oYk|krX`nIMCP{;jxhO$gS@g#fE!QhF55HO zU-*u!VNU++UU-*&DuW$N2`M30PzTpV@7>9n_4qjjTBz+`+)A4s6*xiY-Et(q{VIn* zC`*>h^jeW5`qO(VdQIe~P!dOg{7#v>8BN1G(Y{Sse;9*J)($vu`{auGL|YBrhC%&pRLVtA*+!ZDv{ z?n@Dq_}Ajr0_5e}MHb_%KWN|7+=ugnR*eKLr8{USbTA$~?1;Nrw|bgkjct)^PXzO< z1W~2bm$cxl&A$7(Oh=R+M$ysk?`#A3EO|*cRwhb__PA`{d#b-JttK-DC;nMp?G_jfE*VY$`K#o6ncm9-RMNBrxRU`uB%#3+)@RdX*N zhLZ^K?H+I8GNbOridRISDGB%MQt`IX$*a;@2La#WbgH0qtX2PJ7*I!DZ{KjXgE)?q zspahW3EK>bmW-h1@+=bC&`52iowFTpak1Z$y3-k3>51^)d$Ow;m=05eDB;KgOh~AF z|1hhBBYer{xv5$)i^{jS6XCnurr@w85cax4%jE9ODknWI>AwgW+O}?SRfG(t)r)Cuf{cxuPDEE(S@QGh(=7s?xThx08fS8kUmzi1E0Ik2L>`K+KQZtyU^7u8# z%X;--J+;Mc6WEoAhxkLlR+NATes^FrOV3V0&c!%UJ#RLCW>=uNADxYQ@V z;216@BpA1ZH0nN-Yvf(p3=221Bz}=@dj+>(F;rv`;8jMabje<&UuvvnPEPJz0>lFM z0d7!|s;?4oDj~-&y2!65UY6YJ$j>8Y0Fi9XjJE=QN`QbS2;KZqJZKo4L#(ZD+1;KU zqqzspmP%wXxg)6NgbLuwIWw{_QKw$vGnz2F!75yZb~O;z9DW>iOSfn2sRO68vWuvu zo1h;o3kQ^=<8A8eJA>C8ww%YD!_>QBa_8wK66Fi~#>sEXdi98eFxuIz)ORFj*R>~g zeBjg;d%M6yRqL!H%7#jx7cp{*onYYxyi)yDOUVEdE!OOn+J`n&*EfG45LK_~SB=?P zKv<5LNViZ!MR|>J1snfRJAsbXU80#qq%pN=**%3@kBdK52Rx?21wjuwuD>rEOYix< z7H$%t9wyZCMN;BDZcR&<|LDZOWgPdBvJ6r%Jp_~mx8EGLQ-b}&=OSE`)8S+}ah$X+ zIYwdYGLQ1F&IgS}+~&+coVc*9H@$%WImfXnOU{JR$6-ksQ#)P$O{pDSd`CLz!zSP+ z0F{2i51{1=0PW;g2m)J>*~*>%!A;MUvRl7pS!{VGv!C;K3{TaG-w!mUB}N3Pl5Ah( zDP*u3kDxtKcT&4EDhPR^yfP|(QXyo{k8bKHE%(fs2qM;Mi7vUkcp$K<8_Xj+kr0*Q zTY<khqbtr~2Vm;A-Z9m%S7@g6`5%VH zBY}&r^|BOcSY({YBfmrJ%R5F|+AlPzo)mEDJt_I~1n(fX zdfw+6fAQ_trN8D|&So7!w!B5l&-NWO%RC}iHY0-ZkfpGfSc|P6v|P2)RGMlXAZ_Mv zt0qN3`psAaiUtfxtKg2Q+XI{mizn&;@})yPq1jVg=a{V}?+P4V@jYXxyq4ilA_^1U zH{A=DxiF3)KRrc`RIJ5fFdM53)@kr`^>2 zjIz!wdccDQ_RjD_ME_8^re6Ym(~vkffH=8VQuX#t%2O4kQ1;XAi7Kg0({g%aM)R@# z&+T!40o+K5irp-Ehg=7{(l`yqtUP2$QUbv%E~$q7o%c}zeY_@{y!)PvjvGs6yXI#i zG5lvB2b4!q-XWjWFgFMu*6-5|SIdq|{dK7=9U3_D)gj{!zB?{YbipGowTw4|g-yTB z!fZPiNJD19>80+fRG3^PphG;_9%X6*S)%NmS-GK~t4WZ)NJESjKG`JxVZcLmsG`Z4 zh*$fLuoKL8><#HWmRKQo?ywo%>l`hSJ?khfrShHxNRsCh0XZ;SJAg1G7C7-Y^T4fp zE%{#1BwJkbJMl*OU%B{~pSbu>{U9Oo6hdc!TX18`9Zk9F<}(3Lqh34`DV@ePo#uY} z)TQD(b5tM<$*Zy%DH>~W?B&oEoZFc=YMm=Ioh^aMBCn0&zaTrJFrZO9+5x4(o-1{V zY*u@gd2Tfa>9^}H&?^+bzp469Jqb<}&MtM=QEIngi6SS$y*Sqtk z(3S}fR|l3tLhq0@=~JM`Pi@K&(7ILW6CSjDr_9l;`B{0LWc$Uf8O6f~B}{=OyYwN; zKyWoB*MNDelfu+f0jbKn&R4fe5`*c_fX<|qtW0J5R{jQy4!x|TjgvICrGO(ES_u@M zQAY?DQHj&SPglMlQEl|dUD~`Ewo`-MXopZonPx*onrqqZDW*&uQe&C^^33w*!V!-_g3RI{9vqO)IpI(a-N6ODwNF8Qgc}fIiU8 zSjL{v(=gHHBvbOktI}F3#Sk!Mtz3>BysABdiNa-oi=`M#oe5N3Vg%zOTFlV#;q}E@ z$&~qt-XmIm(+rZ!zw85~X%$fif3Z?REb_dJwPxFE42^Q?Pnv*A5;+fb8h8MBG#cby z>TGNh4u!I^&rq`fi*@M4-)8$jW*0zy{=E zddbwdj!(J)&|z`owg@emEf1W0s1*v>k{c?oASD0B+2|sg8q?XHCQmk+>=x@dLEfnf zb~~_fGpmItSG~n?NQSiVDDfAvvz~7l*O6DK%<^fx51rqXJ1F{rU;at0j;IJ?wvQs^TuAQbf@eEqfN`?0W3L^BHYMj|trkNIeu@lZ3BO4}`@}rRLr5WDj9I z%}BKB;5A9Lm7oD)%WPIc#{fco|AEAt`Lfy1{^=#*pZq0pPDEePu~;m$7Ph*&yUJkv zBua(qn$6i~Tm~x?*(tCyc*8TUV@jcsI+%BWM+&>kx(=W7)HTC(m-Ix3aL$r7j;=ff zb8sr&;9Ci=bAPe_?fLC&FEx$LI1dm8Fu{DN1E`u5rjQsW9PMGt2sojf!xgUgz~xQs zIklYL9Y7fu&xhV@KiL2}hZFy5huqTx@y!reQ54XgP8LniM|h$OMeM9I{CigCYC~iM9{&4O(>q2tf`@Y(si|+) zn5}j*o~V6|QbxL;78`?dbpB|J$oSX+_VYMaxT^`ZtcUEj77*+;<>8 zn~xMc)YmyFxH&wseg9ocFn|s}5Gzni3 zgQsH4Du4yFw#hs%F0SMs*NW}$CZW>gj>wsNNOnX- zT|-moG+JCkql-`J`Bo95hoV$}f~2)yh$lY8ocYL3H@Mc#%AK;`^xD-9Jm*=baSpY& z*#oVik_j#7Ka<@u32OKy6N8dHljl9bOVTcma->d2F)aSbdut;A8en~z*ZCcs%b%v# zK`h~1zH4i{g{Z;#l(2$KP@Y965J_C@G$)q~EZOXwW9qw;+JTonUQ{m!8nA6Fn2#10 zed#-ZswNOXgx~XHp~nGavBIcCn8*+46g_zQ>SPnY^b}uH?|QG%p3& z`;N$tgMik@r6q2uRsD?$Y#ed@{Ycd}vN{I~d{k{yECwxEp35<6SWKaCutI6x@MC?~ zKy}5P9eo|`N#eiXrM|L&X6)&{Tg5q-cULUNbN%cEax`@gK5_^>%R>cB6&`*jRvb^Y zckqF+I*X{m)O}#%QWI*`B;U_GianU9`)Cibji3tEs~U3e;Mz0}oYyGw-Dv+TIo7NW z`lA*yAkD{Z6b}YM-X~He6BC~EJ-jw~Go3!;(Z)N41_ZCrz^ih*(TaOherD?eG`l@9 zBBZLt#u+~i$FPfeo)g(*pc`XNRuNxuY#5>xDwo0Sy$irThBFc{zOtO>)MFk1=z#)A z_|C6O!6{_OG8`rgyS}ZaUA(6-Ied$wLZH6B^({%XYf$plJ}So3OiE$)BV6^{%1wBP zhI7oQy`%okI=gcWrBbDQ@Rk?Yc7myB7Bl+Pa&}#^kgmg?&8JM~b@f>70uN0N_=UUv zd(Qk0OWw`glogAJCQ_t74J9EeSAr?}`b=+g>6;&??ubckI?qmL-@<)U;2#avKBVeAtvgg-V$xR5 z|65$grzHw>M}=uO8g8ysGlJwL=`|dgq`TsrYr+!SoLgAD^e~6=?i7D)>DpRGhYp;m zKNpYtzN;>byv*>hD3LKSuwoVCB3*YS2V*(<$!4PXl92!F=_?b+%PlyfK4vDD2@8k5SVB60&KXVkYsqJ-oK*hnl2Og%h2f6n z)Q);T>V@Z**nI3DbdsM_bPd0jf1s||(iTSBkF`PG9nGmUpv zFTFl$k81-p&kl$0RVlav)o_%_1BOUuM*8+Rp^7RjP6-66)ud)z86I%p37(1060$~P zJx){H{v_!5p`6)szk%FY`msOvRCj-FyiW`9Q;})((w|#OfVtZ=EMPkMFA+ zIcVec@;(FqvjGpouYyP)=8_X-Jy-b2)%&~$0A{#Xu=BPCMRj!*9JlJs0|usBIeiO2 zgqc84b_`9<3fT{?HARLRluXd5rq2BMZ>(y!mb`V*I)KtY{hw#&O&Sz(K0m}s(PDcn zsZ*~{o=nT{B9^oJ3=kPt!d={W9zETiSW6vtgy8H{`Luag&auRjimBD1cB^(lMwh}g zuwsx_J*Z5Kvv+YLx<`t9vULnmx3rV?Yo^MvSuCmpj`$BkU8B8spD?Dg7|-IMA0K^v z?lYSho+4fw@M%-ah3a6+w-;SnoxK~`s!mSP5*BAoDg{8=U@pOd9a%n%=Wtxvra7xY z8HiyuiW0Q#P+ks?rD)?8f6#ei8u>G(wpP4@0G1;^KA+ zofOn_wFCKxQ7fwTokRF@K#yf4O4&g<9%asBM{$=3ymFA@58l) zHd@WTGhWAaw1e~vtTLr&ZU@$xvMRya#f0*#5L>FOm_)c;cel2bXsCfb9l}N4O0*jL z09m<*>drJI+N>^9Y*su_8ZC4hTH&J4F$9SpD$!w+N67M33i}F-4z7CXa0oivz`bhP z$p@K~&oDLmf{!Bp)xj{?Sz<(%M&zVYzGg`2uac6wVBOsxYXxtssCIp;-i^F>n)NXw z`MB}5_R_h9iCpOdJ410#rDN1nM#+4#BFfnyDiJ=6wk1qA+40RP*Qm$Zp3v_y0o&p#MRGk!e z<3hmn`v*d%RsM0`)E}ZPV}M6N+RfW2AD4=jYxBm-Hi;Y=`O`5ja=MucUEN42-TNZZ z9%)p`?>0DXH*w*W^@eCJFK-|_z0})Ibe^anp7@a`*~J!jEjlb{2QGkaF!q13CN`t6 zudddsStbbLPcQYXF#Dp$mdHG7c<5GrGeyC3P zsF55V{IM->%sj#OZ}@J;kF+mikvQ9%#g$m07W)wPlU3OLAF2}W;UjRx5v01p4k zr~??eP~sXx-cQrc~4zIC#&`wXTc%@lak^yqxKAEy{mThbtAiC3#Ikz z>>(>iH$XqNAX2=%&WPGT4$hp|zPEw-G`55!6 z@en&e>yqmha-9}?pd==)SD$yz{WYSVJsGdo8>((&Z^CwEjdz!!?6?eQit%i3Aa}YD#8eP1eI`2MS$AjoOXc z@Rs&+r_xxN$!L*(9+zE>K*zuO{P5bDfh;GYoHsje(nbp}7uf9(Bh)_@wljU-Kg%R7 zA|fU5Z0M^=0TYvIR>pwx)n@hX>?)%S;}21Waye90{4~CVxWHtbmF@rrXI?56XQ$5X zDqA&{aII^Wmmhj;>U0QayY65*QkZDr=(LcQ#i#2%rFezOW|^LOAH{X$Ha-=hGx|(c zYu4*v!exin{;y8!H9gylS1MhE{KnLCu8UVNm=jqORn5}~TqKrd8*@1%fT9DTV11KAf?ZNb}=;rpmzc1--9{zg$w zyNIG7wzniUjXy)tq{QJ?{BoeFe2e1UC^05SVWntH9KeL~!JLF)Rr`Q0#S!S+-S?H^ zV(tBP!*_2s6yq3{k9r-mEY9fH67`O7oNnifcl`3ebo~gSiN<0~)?j;s>gp)bZM5cT znR__8ie#Cd%0NZYXSXS3EP3EGCPu^KbA{Mr8;wuPgp>51QJ6|E3dNCT%nqtP5L?-F zbfGS!^ZZTtBfbW0^ng`d;xJMsL^j!Fid%vk`ZMYekw{k)S7uT@^G&;x-42Dl;BDge znFw7Rpd80y^u(P74TgfTYq7=dnkPj*`ND9PuA5+6I!He`x9wV)C{-e?1)1(;mi_uMsxh>8CE$DeeltD*D53n-Y4~Z=-ih zJ(m)qMXcbXR8f*QGa@0pN3acU*}DeVhZ-jO{R*EbOEpMNt~M8Z_-ZPL0lLjkQ(? zR^epPOq*Ff;m?(;j;d$SMVZ+xwTBYwdOP)RsO~FKm>|vB_|iUM#X`{?OPj<-j_P$% zSUfcX{7DKc9v}$#)bm#6eT|0t*f2PKEkZSk(>tZZsz8YI-!i3JDl>nGyjoW~;1{e; z75bg8nX>P?E&A)yR78d?Ui`k4`p{QhfmVRrYLPTVcyebUP$)7=68(e|f5SLe&%CnV zm6VN|Gufy#De;opLH{1+o$t5~^y^}av2)9MC5ehNCee*|6>EKx&+Rn9m>d$-R`V2R zT|~z+5dZ0Q%V@Ccj`?E16anljIa)1a+sjJ@cNMi|Pemk0HKOGuS#ua|q|Hk3WSoX$ z#!zIj7j8b6|18ULTGtEn45Ym5xk%5W>Hn^MTx|f!us;mI7$J%Ts?LT zx9{xEiY@_I?It1ut@moJVEQk4^n|ZEL`tl2L}Gi$@E=*dCW(0+|f@d1I>+dZ@1YM$B zS!1Ef(C&StVCgA&S!dByn~ln^>dE3Hf9y ztn#9Gxx@NbRuj_Yks?@TqGPNg&?71w&HA)b#rsOB(=PfJy#iV8$&G;%DA`Rt8g% zoG+{-TRHOV)i+guoX%PONQLlLI8sM#Q9B~jwf4Td?5zEw6nB^>qJGrJQc&D}EzvsN zu{Pz&0)AK!=CBMzBGBWvizbjsNmhozuV7?zhYp@4cekB|v>C~h`q-5W$yZdT0CJ8< ztkriFWYArnUL6!0tcU;yB>v?d06+#&)%jCFj>GcdgNma93_^%T0rV&0!1b0)h&W{H zi-Rli;8mG@z*4W(vNvpn$2TA2mTNk(wNhGMYE97gHG2Kgc28TzW@Yi{ot8{<_E$6^ z!-!S(`*~$Buz0>Av^W+JZ#Gu7Itpc%D1HVXV^KP_^w1yRoyrXu-A-=Q{iWQ2(?siZ zPa~5&So{52y)|JP^~@Ke$eHv*9VbZjyr_ofO7?x60ApLeJqqk&wO}Hmup$N}4&(Z| zydSf3$>kex2bAgEXZ4Eg2(+6MksN`AVjh$48^t?dPIx~qzE9{ZF`mfqtp9cCTEfLA z-*~b(e?wsbeHKx7qfp{Of8DLC4rk3jCYYj93Js3cUmf-JrSrSowexuLKFeRpH4bi1 z+Ze}XDr&R{Q%fKpo&lA>c^|Xy=cj2X4Bx)uuPSk@p!4@DSVvyVVMlQvz{f1%sz7l9U*X2Oz2j^m?vA*iHO7$M- zh)V`5QD^QZ2Y@p7)J;JM(_y}fykx!}7^K3KqA%P@hu<}S3MbikkcPeoLpeBorxowk zZ)nWDlg;@2>(bwg@mH*@Z0lZ#t!_*U*Vz5FO{kdnC~kcH=IvWf!;gNQjN7TPRHEuD zX&?$8f33!GgZ4Jm{%FlEV;@qi0+U@`sk8q7tIcGW>R^#&`Ws$&mAa~EkvIBw=hOW? zcU9x(8rB0J2p^H-XaC2!Hc^y$3mt-U63O}s+?M)vN&Y(~7Q0+zkD9Yz2M?d8+3IQ7 zsrra1jx@rJlFvsP&;6Wr;TnNpW3yJJAy2n=%95u_)2xv;vpG8YjBz5`?4Ok`20~G$ zMaKy(;m@Win$0CibBLUVO$axgqM<6Th}&Q6{Owx;hv&h+yBZPV;F+|UoOs{CM_xrQ zEkq_!<@XJJ-8PE!$X2J@lhMgL`Rc9~5?)J3qCe%%6_+aO<>tTi4N^^7>$N5G;W=B+ z8kdf_{*=R`j&6a&0^NvVc?&3dJ97=0T%}wQZ>Pe!HU!EIsF%Y$sMpxz^uGoCPTh1K zFJrw~gRrZvI;$ve22Ebp&f;-x(h~WEn8zCYrr;2R%M+N~xhwZ-B6Kw{IvrezZmxC= zNLmkO`rl10EnF>a&>7iqn*A{`DK!|72yDd-_)YAJi1;nIQJDYRu#C^%qM4bSsRQ!0 ziJZBvrnmH(A|j$klJDj-z$f0=kE!xA{c5~??JPv6Mqp*TzF%ZWDV+Zuaugpa+JNpz3s~JFnt~6MrcuKWOo=1A z@dvp*b7>G`LTEt4AWzK$Vwb(IqoXn~i&1_g+Q_5}lUcNSU2`uMtpVe8B8;r$r&L>z z%p+fwJhc(`BIbc&p=X8-=NR)b#TPT+BCek9P%p5}8AP(ZLC842Fj=<)*lQJxUq*3g zinWzfq4s84^@$^+BT|@J-I)b?%$ja4Z^?E*p^zW;an7HB|E@g7Y96BY{$z z5b&!xWRNOn`T?d1*M?-xe$E-2BS_ZF?F0(h~1_;(qR2<5HS!%h@;=SmV1^q0W+H;lB_3~i0FHttU~g?N(~U# zZM$uS(s9a&biY#1&3M4qGz3$!u_Yp#%zkFCP+9B2J(gddK-;u{2YRm*&g^7bqzP^)cSfw!L&7s7N2zxFi6c_qUGRD z@aykn`L^V#L0w&gz<&hq^HI)OQ-QHQEy6k5u=bnd6N9SiialFf=T2=Ktha57tJ$n( zOZD^AqYRCfZ278X&z=Ka$-}k4%|6`Ya_r>eHIMH0)Ty>HKwEuQq!87m_bPO%je#8* zMwdxB3zYEmGm{;Uv+YsDlKxude|NrC`cKu!Ao?lDg-GCylUEU0-Bs_@JzEkVB`#pvd!j4boI0+Ew zPvBXR+ny@l@#4@zTX#ap-*jUY`#2%&8rif}KB}QpciXwIqE5_$ZzrW|N z+~kjYbI*L8^FD*82DQNC$BZxd^TdJHLNXc&|y9Lo*&r!@7QDH zyi<7CZpsFV3iS4ULSsu;L%posGsQ;=1Y`YSsvS~gQI>5ED4^h8ciQWU`33GW#K*vG zd&w%OmyXQC10A1+)FX~imi)rFbTwl-x8*@mj_2t?C?V9fPV;me$+ZjD_sz%M6Wz{S z*9q(6t3`~}4w(03^xALRRktp;JkomDz_J_V>qy7lCdF0yXp_)H@0PY72;5X<%o5V<)SOb(`#F8g`ykdw5j~aK1|$uTxFa&Qr_``BeEVtwZ~D-S8&5 zBeyba!*;6mPsWe&II(HXJ?AhXuUcQWVf|{lQn;m6F1o%?`Y(x~jTtojJP~Xnv&nrR|w{!zBB&Ihl3u zmgjk}uJGLn+1+nyW{+phtrhQBA+W)EPaYUwcskPEj$J1}xW3y@nP6rf(-0pXPF(tn zqbeu5!iUoyo?|)@8q;EfQx6-(AR|KIY%}$;D|M(+()&W+gzN=h+Z7buKG>29NV<*d z5>l7jP5*%qV~PF}Jd_y?z33`%iLmN!5snHGhe+XalL|ubC|239ZFnYMwT|XIY@C(| zms8u~G_O}Rwu#lZ{go9GcF+5G!y~@s4WQwXueruCtMRdIFG{TN;n8JgwMmj(H`fME zT$TJ15VaBsDWW;g*RYUZ!0}ikZuz$EwyNg_zRO%_dDt#=fnO8n(p0=_O^)oT3E~8;^`<>*cRl$Tkur&TSbDDYb{L5Ev`qDB|(Y; z>o`&aIx30gs$M)QvG%r_WXmxYHbFdXKA|=X^G2n$PMj&a{@nxG%H8)E zw#=RhxGbt$cla4CBwtsCD$vtS16Eo=vv!S_>&4i%N5w$vq!FLnJ>2&l3ZxHAM0|?s zhhNoP8|o|~wgcx?)233(vuukHj=P3FEOFIXdr{J;!rPE2J~rgPrXD|kLL z%2jMrRdTo)X_oYwxnL`8`F5n(mwB3AX|GY{pBqxA+9Ut0&0H1TXTmK}O#SCf-3l88 zYuOkW^eeoPpXoLzEdJ)#I;#THZ{(%ds}-<{fmXLPrdt8rQ6szU_K$eJ z*~=Su`(cg+7c@?lxGKy)#3tR|je6-+0;n%2qLH#ZF({V&eB9MdSgLdv>O@GXRO^Q5 zuU3c37v$Xrp=X=r%D_=<;c1FiV|_;R!VO)SI*Z?A^J7{R>Nm^*>mIc@!C3>rJywOX z+GebcxM$AKKfLZa_4l;bQ9{w1Fpq`1IWasDz5&f42Z!G>{T7!}S~e=S{XV4K3r!Pq zGe-EPOP#5(*~uxYnG;O^p?xc!G6&uf^Fge3Y$ zYyBT{MY+d|zbrvZs91zw$XJTbSQbSA``c3m&(!L@50Gefk2fa^;6fg1_JZ!dZ$8(r zK6q~gRt2>A?FSnCXq)RQ3r&#sKK_uPnj(ZQ@UDsiXXiIxatVz^F#z@cSkPG=i!0mQ zP9DToi)yoNq`Ua6ju3z_So`fpee|7B9IW?jUL4pDk|=Gl zPX8)|{yDtZPWR)Zy%>AZ&FH*wALsMknVI7Xw2ktHXY-FK<6mh8CB^Cg5e@sLD6+&z z4Cq8NJJnu|MOrGlm*O*Bd)WQUClwy9UhYoyecKv|E=4!H?f&hX*iiV<{|)^}aPJ8r zJH*sSC4`>X;6odr_M;~2JOQ;$u1m(R?n-<)U^YlL1j+=Tw`bNWp6=!`In z;|-zqqlEh9wW$+fRDlE|@&A^^kdl%S_P-GSTNOjZBp{>3Xy(En94DPqrfJ$TIJxrI z`7r4Jk0T(~5Wvc=55goFx1;IHdHM9TnAHH;T391=r?dwOhQSGn8aU8b8|_SJO+1B7 zt)pN|pstYLH^Kp!s3B4>8a(PWjsF1TvJV5+em^qv;nP*DUI8snCMhB_Nhc6&SN0s z&Y==+c`|w%)PWcRb>h}AxCuijDI91?$p$1Q@sK|hho_}jM!&v_zMnCtvn{Nxp(z~B zENW4Pr#QLA>Of*i$s2`>!j6`uOI7eyUdz=PLa_q$2{T#=`C3Sowff173BxVN4`n+> zuu-F}kSm-p>Ldmo-VfXAhhh6mW!Gv>qAe>0;hInqvRackEQNMA(6X}Dffb6;^K`+i z%q>se^)NCDvurls0106jTg<)cW`!zT<{DK-4qf^a@f7fi|?S?~xeXUIA# zVG3W&r{$z`0<@{?qYdV>9ZVyzGeId~JGT8MiQEYhO+k2<3^$g^2?LB~9MFat5msxe zVkz1&X_AdmnFUL1;M$}&w=Z@`DQdS~8lYpl=%G9uaDq&N&SBX`a~)-PubCRb=w>*M z@uXO)43koZ@4>O`EF10Q>vU-I0%bCy)j*$cjL`gu9i*D5A&$A*Z6;i$q&oq57|tDo zi;14im|}d6d)~)Lso|?eJeWWkrk;QiQBT1|Vi|QII|8hxv2m2zyiPgJ~N-L^nl5|4v3|7G_P8Wpc%i^8jrO%74=!Ku>LRbAKA5v(M zG3rokmtq)kq;M2$GGt{dnwEtSpf=aO)WQPd)N}62815qLcO2$P7L-1@ zd78jeD9{hfygpoyLE#n&S~Xmj&zw(?&y?DQ=8nlOFh$Ktr|kL&3<3$pPOLSqAwK(I z-A=!5Q5Ypm2F0Z~F;~z^<4Yf3i*JD?g%WD$tDCwR(-@Kc&6O~6+Ri?{iehbP{$$E% z`V>qP6ay9i9^^9V24f;9^ayMwMVpL1Zf3JF3Qv1Dbv&1qZ6YwW{`Mk06SXHv7?}nW zyDia=K*2ae@Bl$U9Q$cGlL5gHB$%cr-YvsMlL25`AdhSA>=QDMI0&B^efqX~8H^y* zU{0{46I^Zpk5;w1Wd!>RFaNg6u)p?@A$bUdW#=uL_+`BmwwpL4oXL#C_4x80~&{Uyd z?)d~2$NopOu(cGr(-k^k1e@9ibq+8S2y$;jg79?A=W-ObzuF7_WAz%0pCgw{8o}D) zsGmqwloNi`3FO~3BxJYrVlZR ztBla^?@rVLK%Iu@rZNgMM->uF`d4v4a$!ThK>gB%Sn7>5`!Sj!6%~ zr=##F9RG;V=+cE;49rgWDPfx$)G3pV9o`Ypqld? zHfAN9lQyqOO4&B5aGMz(#!G}1L@?(uiY3-AGQn)$oB{X zHh7A2vZ?r<$Uj{7bwY1eU6^2@Yj?A?;hOJGTw_&au%lq0Wvy+pDSx8*tq7<%LCon1 ztbAdFwgbm{sYwwG&OE3qnDD9#h=1=s87&dXfr8zZux)W2!I+Jn9wSb`LhO&UwgM}W zkS!;@lYZDvQx&6EVzdyB!RjXd_YiHTG*&B-L)+EWvSAELpz~)B{4G>g1sQ2H}xu5>AWF^;iLl zGA*QLy3sRDX%nfuJbZ&Ngkbw&Qds}*<2I^hTam_U20BL ztnk00f&Q|Vqta+Rc41a$i!o(p6~v*1EO$v{b@_3lQnO+^n&I(TP1g5*iAg$)L~K7ZLJ zgK}N~IOm|Np;f(6JlDn?OnOHpQ;5$SwEg|v3i{%zGk}aSdifECdN2X739FBamXdL^ zVisby6!~hpSmWF6H*MZU@T0Zna95jHm_(j-Suu{PDOnn;THWn8b$s$t^~m_}IMEy) z1~5HX^_R4hY6FF-t#Kw25~{1QYBk^txR8Pubs~bPn^Ii zxIz`OIQSkNUz0jKF=Md6wBVM@e-D9rhn)2Ay4^0f5R4hzTa)O1 z#z!=0VW$ckh~q1$YP9(Gka&-GOju?UpTC!*fNs>(i_LDJ%e%8FK+OXD4JCg9JY1Vx zVp{#x&2-SU?O*~cC-}C63sxFWHc%FO%otvQ_7R94tmHG{cp>oa5q%l$scOkWq9#Vu(gxc%R3<{CLeB> zDX*?^D9+eRdSomCpK=V8%dVeLs>CH-e+3Q9fV#l!k`l3*1PlfOyh<2t;LQ=-sV+qa zGFuS1RffSaCf0Bg6ivMX%V*N7i>$J2wjE*$yWQkoA4mU1y%AnUEm@Zs%&wQmrHk2uAb+==>TX5dV~{Mvt6EB=i^? z6AVy6yHU}nXfyIBuGM>wVrQD5(+-qj;5!0y=x9ro*E>O26%w`S*!U2|yXg{G*8WUh z^=18Eyc|6l5*EGI|H2Q6k56mtf-~I2w@OkfzH9xnt+n_aLIce@>biqX{X3t5bc&fw z*4KDAI!l!A3B3xN7J-adVVoLm)4OPh15maKOi`gm0Dc;fko9o_j|&bYV-Sd{UsUKv zyWu=?wxgvLApaT1w^IcCa{x#}Wma&EL6~Lxb8wGB2%!*G!|tX1M)b1H>BuCtNC26r zG?ua3l?UXI6@QBDXG-giXT*j}N|%Ut`I(h~agN2$dR)hJ}<9kj5%fJF5tGEFp0CZ9qOp3vO4Y{Vc2^$S{!2JwLiI2kK zW%G5){+9eW|11p1PZS^rb+(+H^Z^0M>P4_^6-OCKkll+xm@cdl29FDhtdLe_CkJ_Mn2nlx#)*&1k7C&aIVyc7-E^uo)Pd;E#K(+e`mkha(Y z3{3JVdt-R5St3#Z>ozC7^U?&r0V24j+FNP6 zXddbcNTQO#T8VF6t~~-D%Hr7YS#ir)UOp|#Xqla8Mm!fx(o@3Ye}6ER;GpoJfghaa z2!lpL=xn!!E;f90i;vKButq8Ex?}6r1Gik(itb9$wyBoOIB{`I!1gKQmMcQhkyEQE z*AdtW1BS1z)`8#*oQzYpIfJurl(a!AqA(*`yPeU7t%YVaKsqEg>n~yCXJ8{L{Whqx zPioeb#^G`E`YQ8sA1^$6M*Zzc3j-mvjJCy3SY%f_h*tm_ULH|s6F|4*3w*(Zh1!c~ zhUDPE%um6biE#vARV->1mYN}wYyqg@=7fiRm+n0Knz6)k&OQ=yPI zuo~OUhY-Nv6~w3TCe=EPIIsfFS|VEGf@WJyYC2?nw3Z&WrTz*V&2bG-`8k;`wIkg_ zdd#Ljvd4hVdG)l_PuWVyD4;!E}<#5L_u zdhmA2pRi^as2BY_(vb8o$N@g_!)GN)i%Q|Hg+bzOifC}^a z;5M$mLkh70>O^JVXr7clOjL2hgt_7P?64l63F3#p=Xi9ztMNB<+@h)wHbfT!q8jo^x% zDqB28u4TGf1S^;YKXVLa9kcqbtIg$e(9$f)FeJ@P$?l7W`F6Nlgga&bNXBRMXB%x_ zOFcsuyOJYOwa+<{o$GC$W
@@ -66,5 +66,5 @@ - + \ No newline at end of file diff --git a/modules/invoiceOut/front/index/global-invoicing/locale/es.yml b/modules/invoiceOut/front/index/global-invoicing/locale/es.yml index 51e165e2a..1a6e15656 100644 --- a/modules/invoiceOut/front/index/global-invoicing/locale/es.yml +++ b/modules/invoiceOut/front/index/global-invoicing/locale/es.yml @@ -1,7 +1,7 @@ Create global invoice: Crear factura global Some fields are required: Algunos campos son obligatorios Max date: Fecha límite -Invoicing in progress...: Facturación en progreso... +Adding invoices to queue...: Añadiendo facturas a la cola... Invoice date: Fecha de factura From client: Desde el cliente To client: Hasta el cliente diff --git a/print/core/router.js b/print/core/router.js index cd64ba07e..99f2b3ed6 100644 --- a/print/core/router.js +++ b/print/core/router.js @@ -15,6 +15,7 @@ module.exports = app => { WHERE at.id = ?`; const auth = await db.findOne(query, [token]); + console.log(auth); if (!auth || isTokenExpired(auth.created, auth.ttl)) throw new Error('Invalid authorization token'); @@ -31,6 +32,8 @@ module.exports = app => { locale: auth.lang }; + console.log(response.locals.auth); + next(); } catch (error) { next(error); diff --git a/print/methods/schedule/invoice.js b/print/methods/schedule/invoice.js index d27557d34..df4fe17b0 100644 --- a/print/methods/schedule/invoice.js +++ b/print/methods/schedule/invoice.js @@ -5,8 +5,6 @@ const storage = require('vn-print/core/storage'); module.exports = async function(request, response, next) { try { - const reqArgs = request.body; - response.status(200).json({ message: 'Success' }); @@ -29,17 +27,18 @@ module.exports = async function(request, response, next) { JOIN province p ON p.id = c.provinceFk JOIN country co ON co.id = p.countryFk LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk - WHERE status = ''`); + let invoiceId; for (const invoiceOut of invoices) { try { + invoiceId = invoiceOut.id; const args = Object.assign({ invoiceId: invoiceOut.id, recipientId: invoiceOut.clientFk, recipient: invoiceOut.recipient, replyTo: invoiceOut.salesPersonEmail - }, reqArgs); + }, response.locals); const invoiceReport = new Report('invoice', args); const stream = await invoiceReport.toPdfStream(); @@ -89,29 +88,19 @@ module.exports = async function(request, response, next) { const email = new Email('invoice', args); await email.send(mailOptions); } + // Update queue status + sql = `UPDATE invoiceOut_queue + SET status = "printed", + printed = NOW() + WHERE invoiceFk = ?`; + await db.rawSql(sql, [invoiceOut.id]); } catch (error) { - console.log(error); + sql = `UPDATE invoiceOut_queue + SET status = ? + WHERE invoiceFk = ?`; + await db.rawSql(sql, [error.message, invoiceId]); } } - - // const clientData = new Map(); - // for (const client of clients) - // clientData.set(client.id, client); - - // for (const clientId of reqArgs.clientIds) { - // const client = clientData.get(clientId); - - // if (client) { - // const args = Object.assign({ - // recipientId: clientId, - // recipient: client.email, - // replyTo: client.salesPersonEmail - // }, response.locals); - - // const email = new Email('campaign-metrics', args); - // await email.send(); - // } - // } } catch (error) { next(error); } From 6bdcdbb13ca48e3508c7b94faca9a133aa4d9a9e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 2 May 2022 10:57:13 +0200 Subject: [PATCH 055/141] DB structure & data export Hedera tables added to data export --- db/dump/dumpedFixtures.sql | 168 +- db/dump/structure.sql | 5027 +++++++++++++++++------------------- db/export-data.sh | 14 +- 3 files changed, 2542 insertions(+), 2667 deletions(-) diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 60e568e8d..64c048142 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -22,9 +22,29 @@ USE `util`; LOCK TABLES `config` WRITE; /*!40000 ALTER TABLE `config` DISABLE KEYS */; -INSERT INTO `config` VALUES (1,'10411',0,'production',NULL); +INSERT INTO `config` VALUES (1,'10450',0,'production',NULL); /*!40000 ALTER TABLE `config` ENABLE KEYS */; UNLOCK TABLES; + +-- +-- Dumping data for table `version` +-- + +LOCK TABLES `version` WRITE; +/*!40000 ALTER TABLE `version` DISABLE KEYS */; +INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10118','1d6101514fea3d96a8a91de884f3ad978e230fe6','2022-05-01 10:54:59','10126'); +/*!40000 ALTER TABLE `version` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `versionLog` +-- + +LOCK TABLES `versionLog` WRITE; +/*!40000 ALTER TABLE `versionLog` DISABLE KEYS */; +INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL); +/*!40000 ALTER TABLE `versionLog` ENABLE KEYS */; +UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -34,7 +54,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:13 +-- Dump completed on 2022-05-02 10:56:20 USE `account`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -120,7 +140,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:14 +-- Dump completed on 2022-05-02 10:56:20 USE `salix`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -144,7 +164,7 @@ USE `salix`; LOCK TABLES `ACL` WRITE; /*!40000 ALTER TABLE `ACL` DISABLE KEYS */; -INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','claimManager'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','claimManager'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(103,'ClaimEnd','importTicketSales','WRITE','ALLOW','ROLE','claimManager'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','*','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','deliveryBoss'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','claimManager'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(219,'Account','acl','READ','ALLOW','ROLE','account'),(220,'Account','getCurrentUserData','READ','ALLOW','ROLE','account'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','*','READ','ALLOW','ROLE','salesAssistant'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'),(237,'WorkerDms','filter','*','ALLOW','ROLE','employee'),(238,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(239,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(240,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative'),(242,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(244,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(246,'Account','changePassword','*','ALLOW','ROLE','account'),(247,'UserAccount','exists','*','ALLOW','ROLE','account'),(248,'RoleMapping','*','READ','ALLOW','ROLE','account'),(249,'UserPassword','*','READ','ALLOW','ROLE','account'),(250,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(251,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(252,'Supplier','*','READ','ALLOW','ROLE','employee'),(253,'Supplier','*','WRITE','ALLOW','ROLE','administrative'),(254,'SupplierLog','*','READ','ALLOW','ROLE','employee'),(256,'Image','*','WRITE','ALLOW','ROLE','employee'),(257,'FixedPrice','*','*','ALLOW','ROLE','buyer'),(258,'PayDem','*','READ','ALLOW','ROLE','employee'),(259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant'),(260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'),(261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'),(262,'Entry','*','*','ALLOW','ROLE','administrative'),(263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'),(264,'StarredModule','*','*','ALLOW','ROLE','employee'),(265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'),(266,'ZoneLog','*','READ','ALLOW','ROLE','employee'),(267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss'),(268,'Specie','*','WRITE','ALLOW','ROLE','logisticBoss'),(269,'InvoiceOut','createPdf','WRITE','ALLOW','ROLE','employee'),(270,'SupplierAddress','*','*','ALLOW','ROLE','employee'),(271,'SalesMonitor','*','*','ALLOW','ROLE','employee'),(272,'InvoiceInLog','*','*','ALLOW','ROLE','employee'),(273,'InvoiceInTax','*','*','ALLOW','ROLE','administrative'),(274,'InvoiceInLog','*','READ','ALLOW','ROLE','administrative'),(275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'),(276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'),(277,'Role','*','*','ALLOW','ROLE','it'),(278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'),(279,'MailAlias','*','*','ALLOW','ROLE','marketing'),(282,'UserAccount','*','WRITE','ALLOW','ROLE','it'),(283,'EntryObservation','*','*','ALLOW','ROLE','buyer'),(284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'),(285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'),(286,'ACL','*','*','ALLOW','ROLE','developer'),(287,'AccessToken','*','*','ALLOW','ROLE','developer'),(288,'MailAliasAccount','*','*','ALLOW','ROLE','marketing'),(289,'MailAliasAccount','*','*','ALLOW','ROLE','hr'),(290,'MailAlias','*','*','ALLOW','ROLE','hr'),(291,'MailForward','*','*','ALLOW','ROLE','marketing'),(292,'MailForward','*','*','ALLOW','ROLE','hr'),(293,'RoleInherit','*','*','ALLOW','ROLE','it'),(294,'RoleRole','*','*','ALLOW','ROLE','it'),(295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'),(296,'Collection','*','READ','ALLOW','ROLE','employee'),(297,'Sale','payBack','WRITE','ALLOW','ROLE','employee'),(298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'); +INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','trainee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','trainee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','trainee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','trainee'),(30,'GreugeType','*','READ','ALLOW','ROLE','trainee'),(31,'Mandate','*','READ','ALLOW','ROLE','trainee'),(32,'MandateType','*','READ','ALLOW','ROLE','trainee'),(33,'Company','*','READ','ALLOW','ROLE','trainee'),(34,'Greuge','*','READ','ALLOW','ROLE','trainee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee'),(36,'ObservationType','*','*','ALLOW','ROLE','employee'),(37,'Greuge','*','WRITE','ALLOW','ROLE','employee'),(38,'AgencyMode','*','READ','ALLOW','ROLE','employee'),(39,'ItemTag','*','WRITE','ALLOW','ROLE','buyer'),(40,'ItemBotanical','*','WRITE','ALLOW','ROLE','buyer'),(41,'ItemBotanical','*','READ','ALLOW','ROLE','employee'),(42,'ItemPlacement','*','WRITE','ALLOW','ROLE','buyer'),(43,'ItemPlacement','*','WRITE','ALLOW','ROLE','replenisher'),(44,'ItemPlacement','*','READ','ALLOW','ROLE','employee'),(45,'ItemBarcode','*','READ','ALLOW','ROLE','employee'),(46,'ItemBarcode','*','WRITE','ALLOW','ROLE','buyer'),(47,'ItemBarcode','*','WRITE','ALLOW','ROLE','replenisher'),(51,'ItemTag','*','READ','ALLOW','ROLE','employee'),(53,'Item','*','READ','ALLOW','ROLE','employee'),(54,'Item','*','WRITE','ALLOW','ROLE','buyer'),(55,'Recovery','*','READ','ALLOW','ROLE','trainee'),(56,'Recovery','*','WRITE','ALLOW','ROLE','administrative'),(58,'CreditClassification','*','*','ALLOW','ROLE','insurance'),(60,'CreditInsurance','*','*','ALLOW','ROLE','insurance'),(61,'InvoiceOut','*','READ','ALLOW','ROLE','employee'),(62,'Ticket','*','*','ALLOW','ROLE','employee'),(63,'TicketObservation','*','*','ALLOW','ROLE','employee'),(64,'Route','*','READ','ALLOW','ROLE','employee'),(65,'Sale','*','READ','ALLOW','ROLE','employee'),(66,'TicketTracking','*','READ','ALLOW','ROLE','employee'),(68,'TicketPackaging','*','*','ALLOW','ROLE','employee'),(69,'Packaging','*','READ','ALLOW','ROLE','employee'),(70,'Packaging','*','WRITE','ALLOW','ROLE','logistic'),(71,'SaleChecked','*','READ','ALLOW','ROLE','employee'),(72,'SaleComponent','*','READ','ALLOW','ROLE','employee'),(73,'Expedition','*','READ','ALLOW','ROLE','employee'),(74,'Expedition','*','WRITE','ALLOW','ROLE','deliveryBoss'),(75,'Expedition','*','WRITE','ALLOW','ROLE','production'),(76,'AnnualAverageInvoiced','*','READ','ALLOW','ROLE','employee'),(77,'WorkerMana','*','READ','ALLOW','ROLE','employee'),(78,'TicketTracking','*','WRITE','ALLOW','ROLE','production'),(79,'TicketTracking','changeState','*','ALLOW','ROLE','employee'),(80,'Sale','deleteSales','*','ALLOW','ROLE','employee'),(81,'Sale','moveToTicket','*','ALLOW','ROLE','employee'),(82,'Sale','updateQuantity','*','ALLOW','ROLE','employee'),(83,'Sale','updatePrice','*','ALLOW','ROLE','employee'),(84,'Sale','updateDiscount','*','ALLOW','ROLE','employee'),(85,'SaleTracking','*','READ','ALLOW','ROLE','employee'),(86,'Order','*','*','ALLOW','ROLE','employee'),(87,'OrderRow','*','*','ALLOW','ROLE','employee'),(88,'ClientContact','*','*','ALLOW','ROLE','employee'),(89,'Sale','moveToNewTicket','*','ALLOW','ROLE','employee'),(90,'Sale','reserve','*','ALLOW','ROLE','employee'),(91,'TicketWeekly','*','READ','ALLOW','ROLE','employee'),(94,'Agency','landsThatDay','*','ALLOW','ROLE','employee'),(96,'ClaimEnd','*','READ','ALLOW','ROLE','employee'),(97,'ClaimEnd','*','WRITE','ALLOW','ROLE','claimManager'),(98,'ClaimBeginning','*','*','ALLOW','ROLE','employee'),(99,'ClaimDevelopment','*','READ','ALLOW','ROLE','employee'),(100,'ClaimDevelopment','*','WRITE','ALLOW','ROLE','claimManager'),(101,'Claim','*','*','ALLOW','ROLE','employee'),(102,'Claim','createFromSales','*','ALLOW','ROLE','employee'),(104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss'),(105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss'),(106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss'),(108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss'),(109,'UserConfig','*','*','ALLOW','ROLE','employee'),(110,'Bank','*','READ','ALLOW','ROLE','trainee'),(111,'ClientLog','*','READ','ALLOW','ROLE','trainee'),(112,'Defaulter','*','READ','ALLOW','ROLE','employee'),(113,'ClientRisk','*','READ','ALLOW','ROLE','trainee'),(114,'Receipt','*','READ','ALLOW','ROLE','trainee'),(115,'Receipt','*','WRITE','ALLOW','ROLE','administrative'),(116,'BankEntity','*','*','ALLOW','ROLE','employee'),(117,'ClientSample','*','*','ALLOW','ROLE','employee'),(118,'WorkerTeam','*','*','ALLOW','ROLE','salesPerson'),(119,'Travel','*','READ','ALLOW','ROLE','employee'),(120,'Travel','*','WRITE','ALLOW','ROLE','buyer'),(121,'Item','regularize','*','ALLOW','ROLE','employee'),(122,'TicketRequest','*','*','ALLOW','ROLE','employee'),(123,'Worker','*','*','ALLOW','ROLE','employee'),(124,'Client','confirmTransaction','WRITE','ALLOW','ROLE','administrative'),(125,'Agency','getAgenciesWithWarehouse','*','ALLOW','ROLE','employee'),(126,'Client','activeWorkersWithRole','*','ALLOW','ROLE','employee'),(127,'TicketLog','*','READ','ALLOW','ROLE','employee'),(129,'TicketService','*','*','ALLOW','ROLE','employee'),(130,'Expedition','*','WRITE','ALLOW','ROLE','packager'),(131,'CreditInsurance','*','READ','ALLOW','ROLE','trainee'),(132,'CreditClassification','*','READ','ALLOW','ROLE','trainee'),(133,'ItemTag','*','WRITE','ALLOW','ROLE','marketingBoss'),(135,'ZoneGeo','*','READ','ALLOW','ROLE','employee'),(136,'ZoneCalendar','*','READ','ALLOW','ROLE','employee'),(137,'ZoneIncluded','*','READ','ALLOW','ROLE','employee'),(138,'LabourHoliday','*','READ','ALLOW','ROLE','employee'),(139,'LabourHolidayLegend','*','READ','ALLOW','ROLE','employee'),(140,'LabourHolidayType','*','READ','ALLOW','ROLE','employee'),(141,'Zone','*','*','ALLOW','ROLE','deliveryBoss'),(142,'ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss'),(143,'ZoneIncluded','*','*','ALLOW','ROLE','deliveryBoss'),(144,'Stowaway','*','*','ALLOW','ROLE','employee'),(145,'Ticket','getPossibleStowaways','READ','ALLOW','ROLE','employee'),(147,'UserConfigView','*','*','ALLOW','ROLE','employee'),(148,'UserConfigView','*','*','ALLOW','ROLE','employee'),(149,'Sip','*','READ','ALLOW','ROLE','employee'),(150,'Sip','*','WRITE','ALLOW','ROLE','hr'),(151,'Department','*','READ','ALLOW','ROLE','employee'),(152,'Department','*','WRITE','ALLOW','ROLE','hr'),(153,'Route','*','READ','ALLOW','ROLE','employee'),(154,'Route','*','WRITE','ALLOW','ROLE','delivery'),(155,'Calendar','*','READ','ALLOW','ROLE','hr'),(156,'WorkerLabour','*','READ','ALLOW','ROLE','hr'),(157,'Calendar','absences','READ','ALLOW','ROLE','employee'),(158,'ItemTag','*','WRITE','ALLOW','ROLE','accessory'),(160,'TicketServiceType','*','READ','ALLOW','ROLE','employee'),(161,'TicketConfig','*','READ','ALLOW','ROLE','employee'),(162,'InvoiceOut','delete','WRITE','ALLOW','ROLE','invoicing'),(163,'InvoiceOut','book','WRITE','ALLOW','ROLE','invoicing'),(165,'TicketDms','*','*','ALLOW','ROLE','employee'),(167,'Worker','isSubordinate','READ','ALLOW','ROLE','employee'),(168,'Worker','mySubordinates','READ','ALLOW','ROLE','employee'),(169,'WorkerTimeControl','filter','READ','ALLOW','ROLE','employee'),(170,'WorkerTimeControl','addTime','WRITE','ALLOW','ROLE','employee'),(171,'TicketServiceType','*','WRITE','ALLOW','ROLE','administrative'),(172,'Sms','*','READ','ALLOW','ROLE','employee'),(173,'Sms','send','WRITE','ALLOW','ROLE','employee'),(174,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(175,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(176,'Device','*','*','ALLOW','ROLE','employee'),(177,'Device','*','*','ALLOW','ROLE','employee'),(178,'WorkerTimeControl','*','*','ALLOW','ROLE','employee'),(179,'ItemLog','*','READ','ALLOW','ROLE','employee'),(180,'RouteLog','*','READ','ALLOW','ROLE','employee'),(181,'Dms','removeFile','WRITE','ALLOW','ROLE','employee'),(182,'Dms','uploadFile','WRITE','ALLOW','ROLE','employee'),(183,'Dms','downloadFile','READ','ALLOW','ROLE','employee'),(184,'Client','uploadFile','WRITE','ALLOW','ROLE','employee'),(185,'ClientDms','removeFile','WRITE','ALLOW','ROLE','employee'),(186,'ClientDms','*','READ','ALLOW','ROLE','trainee'),(187,'Ticket','uploadFile','WRITE','ALLOW','ROLE','employee'),(190,'Route','updateVolume','WRITE','ALLOW','ROLE','deliveryBoss'),(191,'Agency','getLanded','READ','ALLOW','ROLE','employee'),(192,'Agency','getShipped','READ','ALLOW','ROLE','employee'),(194,'Postcode','*','WRITE','ALLOW','ROLE','deliveryBoss'),(195,'Ticket','addSale','WRITE','ALLOW','ROLE','employee'),(196,'Dms','updateFile','WRITE','ALLOW','ROLE','employee'),(197,'Dms','*','READ','ALLOW','ROLE','trainee'),(198,'ClaimDms','removeFile','WRITE','ALLOW','ROLE','employee'),(199,'ClaimDms','*','READ','ALLOW','ROLE','employee'),(200,'Claim','uploadFile','WRITE','ALLOW','ROLE','employee'),(201,'Sale','updateConcept','WRITE','ALLOW','ROLE','employee'),(202,'Claim','updateClaimAction','WRITE','ALLOW','ROLE','claimManager'),(203,'UserPhone','*','*','ALLOW','ROLE','employee'),(204,'WorkerDms','removeFile','WRITE','ALLOW','ROLE','hr'),(205,'WorkerDms','*','READ','ALLOW','ROLE','hr'),(206,'Chat','*','*','ALLOW','ROLE','employee'),(207,'Chat','sendMessage','*','ALLOW','ROLE','employee'),(208,'Sale','recalculatePrice','WRITE','ALLOW','ROLE','employee'),(209,'Ticket','recalculateComponents','WRITE','ALLOW','ROLE','employee'),(211,'TravelLog','*','READ','ALLOW','ROLE','buyer'),(212,'Thermograph','*','*','ALLOW','ROLE','buyer'),(213,'TravelThermograph','*','WRITE','ALLOW','ROLE','buyer'),(214,'Entry','*','*','ALLOW','ROLE','buyer'),(215,'TicketWeekly','*','WRITE','ALLOW','ROLE','buyer'),(216,'TravelThermograph','*','READ','ALLOW','ROLE','employee'),(218,'Intrastat','*','*','ALLOW','ROLE','buyer'),(219,'Account','acl','READ','ALLOW','ROLE','account'),(220,'Account','getCurrentUserData','READ','ALLOW','ROLE','account'),(221,'UserConfig','getUserConfig','READ','ALLOW','ROLE','account'),(222,'Client','*','READ','ALLOW','ROLE','trainee'),(226,'ClientObservation','*','READ','ALLOW','ROLE','trainee'),(227,'Address','*','READ','ALLOW','ROLE','trainee'),(228,'AddressObservation','*','READ','ALLOW','ROLE','trainee'),(230,'ClientCredit','*','READ','ALLOW','ROLE','trainee'),(231,'ClientContact','*','READ','ALLOW','ROLE','trainee'),(232,'ClientSample','*','READ','ALLOW','ROLE','trainee'),(233,'EntryLog','*','READ','ALLOW','ROLE','buyer'),(234,'WorkerLog','*','READ','ALLOW','ROLE','salesAssistant'),(235,'CustomsAgent','*','*','ALLOW','ROLE','employee'),(236,'Buy','*','*','ALLOW','ROLE','buyer'),(237,'WorkerDms','filter','*','ALLOW','ROLE','employee'),(238,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(239,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(240,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(241,'SupplierContact','*','WRITE','ALLOW','ROLE','administrative'),(242,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(244,'supplier','*','WRITE','ALLOW','ROLE','administrative'),(246,'Account','changePassword','*','ALLOW','ROLE','account'),(247,'UserAccount','exists','*','ALLOW','ROLE','account'),(248,'RoleMapping','*','READ','ALLOW','ROLE','account'),(249,'UserPassword','*','READ','ALLOW','ROLE','account'),(250,'Town','*','WRITE','ALLOW','ROLE','deliveryBoss'),(251,'Province','*','WRITE','ALLOW','ROLE','deliveryBoss'),(252,'Supplier','*','READ','ALLOW','ROLE','employee'),(253,'Supplier','*','WRITE','ALLOW','ROLE','administrative'),(254,'SupplierLog','*','READ','ALLOW','ROLE','employee'),(256,'Image','*','WRITE','ALLOW','ROLE','employee'),(257,'FixedPrice','*','*','ALLOW','ROLE','buyer'),(258,'PayDem','*','READ','ALLOW','ROLE','employee'),(259,'Client','createReceipt','*','ALLOW','ROLE','salesAssistant'),(260,'PrintServerQueue','*','WRITE','ALLOW','ROLE','employee'),(261,'SupplierAccount','*','*','ALLOW','ROLE','administrative'),(262,'Entry','*','*','ALLOW','ROLE','administrative'),(263,'InvoiceIn','*','*','ALLOW','ROLE','administrative'),(264,'StarredModule','*','*','ALLOW','ROLE','employee'),(265,'ItemBotanical','*','WRITE','ALLOW','ROLE','logisticBoss'),(266,'ZoneLog','*','READ','ALLOW','ROLE','employee'),(267,'Genus','*','WRITE','ALLOW','ROLE','logisticBoss'),(268,'Specie','*','WRITE','ALLOW','ROLE','logisticBoss'),(269,'InvoiceOut','createPdf','WRITE','ALLOW','ROLE','employee'),(270,'SupplierAddress','*','*','ALLOW','ROLE','employee'),(271,'SalesMonitor','*','*','ALLOW','ROLE','employee'),(272,'InvoiceInLog','*','*','ALLOW','ROLE','employee'),(273,'InvoiceInTax','*','*','ALLOW','ROLE','administrative'),(274,'InvoiceInLog','*','READ','ALLOW','ROLE','administrative'),(275,'InvoiceOut','createManualInvoice','WRITE','ALLOW','ROLE','invoicing'),(276,'InvoiceOut','globalInvoicing','WRITE','ALLOW','ROLE','invoicing'),(277,'Role','*','*','ALLOW','ROLE','it'),(278,'RoleInherit','*','WRITE','ALLOW','ROLE','grant'),(279,'MailAlias','*','*','ALLOW','ROLE','marketing'),(282,'UserAccount','*','WRITE','ALLOW','ROLE','it'),(283,'EntryObservation','*','*','ALLOW','ROLE','buyer'),(284,'LdapConfig','*','*','ALLOW','ROLE','sysadmin'),(285,'SambaConfig','*','*','ALLOW','ROLE','sysadmin'),(286,'ACL','*','*','ALLOW','ROLE','developer'),(287,'AccessToken','*','*','ALLOW','ROLE','developer'),(288,'MailAliasAccount','*','*','ALLOW','ROLE','marketing'),(289,'MailAliasAccount','*','*','ALLOW','ROLE','hr'),(290,'MailAlias','*','*','ALLOW','ROLE','hr'),(291,'MailForward','*','*','ALLOW','ROLE','marketing'),(292,'MailForward','*','*','ALLOW','ROLE','hr'),(293,'RoleInherit','*','*','ALLOW','ROLE','it'),(294,'RoleRole','*','*','ALLOW','ROLE','it'),(295,'AccountConfig','*','*','ALLOW','ROLE','sysadmin'),(296,'Collection','*','READ','ALLOW','ROLE','employee'),(297,'Sale','payBack','WRITE','ALLOW','ROLE','employee'),(298,'InvoiceInDueDay','*','*','ALLOW','ROLE','administrative'),(299,'Collection','setSaleQuantity','*','ALLOW','ROLE','employee'),(300,'Docuware','*','*','ALLOW','ROLE','employee'),(301,'Agency','*','READ','ALLOW','ROLE','employee'),(302,'AgencyTerm','*','*','ALLOW','ROLE','administrative'),(303,'ClaimLog','*','READ','ALLOW','ROLE','claimManager'),(304,'Edi','updateData','WRITE','ALLOW','ROLE','employee'),(305,'EducationLevel','*','*','ALLOW','ROLE','employee'),(306,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'),(307,'SupplierAgencyTerm','*','*','ALLOW','ROLE','administrative'),(308,'InvoiceInIntrastat','*','*','ALLOW','ROLE','employee'); /*!40000 ALTER TABLE `ACL` ENABLE KEYS */; UNLOCK TABLES; @@ -174,7 +194,7 @@ UNLOCK TABLES; LOCK TABLES `defaultViewConfig` WRITE; /*!40000 ALTER TABLE `defaultViewConfig` DISABLE KEYS */; -INSERT INTO `defaultViewConfig` VALUES ('itemsIndex','{\"intrastat\":false,\"stemMultiplier\":false,\"landed\":false}'),('latestBuys','{\"intrastat\":false,\"description\":false,\"density\":false,\"isActive\":false,\n \"freightValue\":false,\"packageValue\":false,\"isIgnored\":false,\"price2\":false,\"ektFk\":false,\"weight\":false,\n \"size\":false,\"comissionValue\":false,\"landing\":false}'),('ticketsMonitor','{\"id\":false}'); +INSERT INTO `defaultViewConfig` VALUES ('itemsIndex','{\"intrastat\":false,\"stemMultiplier\":false,\"landed\":false,\"producer\":false}'),('latestBuys','{\"intrastat\":false,\"description\":false,\"density\":false,\"isActive\":false,\n \"freightValue\":false,\"packageValue\":false,\"isIgnored\":false,\"price2\":false,\"ektFk\":false,\"weight\":false,\n \"size\":false,\"comissionValue\":false,\"landing\":false}'),('ticketsMonitor','{\"id\":false}'); /*!40000 ALTER TABLE `defaultViewConfig` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -186,7 +206,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:14 +-- Dump completed on 2022-05-02 10:56:20 USE `vn`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -340,7 +360,7 @@ UNLOCK TABLES; LOCK TABLES `component` WRITE; /*!40000 ALTER TABLE `component` DISABLE KEYS */; -INSERT INTO `component` VALUES (10,'Precios Especiales',4,NULL,NULL,1,'specialPrices',0),(14,'porte extra por dia semana',6,NULL,NULL,1,'extraCostPerWeekDay',0),(15,'reparto',6,NULL,NULL,1,'delivery',1),(17,'recobro',5,NULL,NULL,1,'debtCollection',0),(21,'ajuste',11,NULL,NULL,1,'adjustment',0),(22,'venta por paquete',9,1,NULL,0,'salePerPackage',0),(23,'venta por caja',9,2,NULL,0,'salePerBox',0),(28,'valor de compra',1,NULL,NULL,1,'purchaseValue',1),(29,'margen',4,NULL,NULL,1,'margin',1),(32,'descuento ultimas unidades',9,3,-0.05,0,'lastUnitsDiscount',0),(33,'venta por caja',9,1,NULL,0,'salePerBox',0),(34,'descuento comprador',4,NULL,NULL,1,'buyerDiscount',0),(35,'cartera comprador',10,NULL,NULL,1,NULL,0),(36,'descuadre',12,NULL,NULL,1,'imbalance',0),(37,'maná',7,4,NULL,0,'mana',0),(38,'embolsado',9,NULL,NULL,1,'bagged',0),(39,'maná auto',7,NULL,NULL,1,'autoMana',0),(40,'cambios Santos 2016',4,NULL,NULL,1,NULL,0),(41,'bonificacion porte',6,NULL,NULL,1,'freightCharge',0),(42,'promocion Francia',4,NULL,NULL,1,'frenchOffer',0),(43,'promocion Floramondo',4,NULL,NULL,1,'floramondoPromo',0),(44,'rappel cadena',2,NULL,NULL,1,'rappel',0); +INSERT INTO `component` VALUES (10,'Precios Especiales',4,NULL,NULL,1,'specialPrices',0),(14,'porte extra por dia semana',6,NULL,NULL,1,'extraCostPerWeekDay',0),(15,'reparto',6,NULL,NULL,1,'delivery',1),(17,'recobro',5,NULL,NULL,1,'debtCollection',0),(21,'ajuste',11,NULL,NULL,1,'adjustment',0),(22,'venta por paquete',9,1,NULL,0,'salePerPackage',0),(23,'venta por caja',9,2,NULL,0,'salePerBox',0),(28,'valor de compra',1,NULL,NULL,1,'purchaseValue',1),(29,'margen',4,NULL,NULL,1,'margin',1),(32,'descuento ultimas unidades',9,3,-0.05,0,'lastUnitsDiscount',0),(33,'venta por caja',9,1,NULL,0,'salePerBox',0),(34,'descuento comprador',4,NULL,NULL,1,'buyerDiscount',0),(35,'cartera comprador',10,NULL,NULL,1,NULL,0),(36,'descuadre',12,NULL,NULL,1,'imbalance',0),(37,'maná',7,4,NULL,0,'mana',0),(38,'embolsado',9,NULL,NULL,1,'bagged',0),(39,'maná auto',7,NULL,NULL,1,'autoMana',0),(40,'cambios Santos 2016',4,NULL,NULL,1,NULL,0),(41,'bonificacion porte',6,NULL,NULL,1,'freightCharge',0),(42,'promocion Francia',4,NULL,NULL,1,'frenchOffer',0),(43,'promocion Floramondo',4,NULL,NULL,1,'floramondoPromo',0),(44,'rappel cadena',2,NULL,NULL,1,'rappel',0),(45,'maná reclamacion',7,4,NULL,0,'manaClaim',0); /*!40000 ALTER TABLE `component` ENABLE KEYS */; UNLOCK TABLES; @@ -370,7 +390,7 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,94,763,0,NULL,NULL,NULL,0,0,0,30,NULL,'/',NULL,0,NULL,0,0,0,0),(22,NULL,'COMPRAS',2,3,NULL,72,596,2,5,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0),(23,NULL,'CAMARA',13,14,NULL,72,3758,2,6,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1),(31,'IT','INFORMATICA',4,5,NULL,72,127,3,9,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0),(34,NULL,'CONTABILIDAD',6,7,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0),(35,NULL,'FINANZAS',8,9,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,'finanzas@verdnatura.es',1,0,0,0),(36,NULL,'LABORAL',10,11,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0),(37,NULL,'PRODUCCION',12,27,NULL,72,3758,3,11,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1),(38,NULL,'SACADO',15,16,NULL,72,230,4,14,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0),(39,NULL,'ENCAJADO',17,18,NULL,72,3758,4,12,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0),(41,NULL,'ADMINISTRACION',28,29,NULL,72,599,3,8,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0),(43,NULL,'VENTAS',30,49,NULL,0,NULL,NULL,NULL,0,0,1,9,1,'/1/',NULL,1,'',1,0,0,0),(44,NULL,'GERENCIA',50,51,NULL,72,300,2,7,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(45,NULL,'LOGISTICA',52,53,NULL,72,596,3,19,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0),(46,NULL,'REPARTO',54,55,NULL,72,659,3,10,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0),(48,NULL,'ALMACENAJE',56,57,NULL,0,3758,NULL,NULL,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(49,NULL,'PROPIEDAD',58,59,NULL,72,1008,1,1,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(52,NULL,'CARGA AEREA',60,61,NULL,72,163,4,28,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(53,NULL,'MARKETING Y COMUNICACIÓN',62,63,NULL,72,1238,0,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0),(54,NULL,'ORNAMENTALES',64,65,NULL,72,433,3,21,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(55,NULL,'TALLER NATURAL',66,67,NULL,72,3758,2,23,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0),(56,NULL,'TALLER ARTIFICIAL',68,69,NULL,72,1780,2,24,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0),(58,NULL,'CAMPOS',70,71,NULL,72,3758,2,2,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(59,NULL,'MANTENIMIENTO',72,73,NULL,72,1907,4,16,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(60,NULL,'RECLAMACIONES',74,75,NULL,72,563,3,20,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0),(61,NULL,'VNH',76,77,NULL,73,1297,3,17,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(63,NULL,'VENTAS FRANCIA',31,32,NULL,72,277,2,27,0,0,2,0,43,'/1/43/',NULL,0,NULL,0,0,0,0),(66,NULL,'VERDNAMADRID',78,79,NULL,72,163,3,18,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,617,3,26,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0),(69,NULL,'VERDNABARNA',80,81,NULL,74,432,3,22,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(80,NULL,'EQUIPO J VALLES',33,34,NULL,72,693,3,4,0,0,2,0,43,'/1/43/','jvp_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0),(86,NULL,'LIMPIEZA',82,83,NULL,72,599,0,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(89,NULL,'COORDINACION',84,85,NULL,0,3758,NULL,NULL,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(90,NULL,'TRAILER',86,87,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0),(91,NULL,'ARTIFICIAL',21,22,NULL,0,3758,NULL,NULL,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0),(92,NULL,'EQUIPO SILVERIO',35,36,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','sdc_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0),(93,NULL,'CONFECCION',88,89,NULL,0,3758,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0),(94,NULL,'EQUIPO J BROCAL',37,38,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','jes_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0),(95,NULL,'EQUIPO C ZAMBRANO',39,40,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','czg_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0),(96,NULL,'EQUIPO C LOPEZ',41,42,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','cla_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0),(115,NULL,'EQUIPO CLAUDI',43,44,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','csr_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0),(123,NULL,'EQUIPO ELENA BASCUÑANA',45,46,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','ebt_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0),(124,NULL,'CONTROL INTERNO',90,91,NULL,72,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0),(125,NULL,'EQUIPO MIRIAM MAR',47,48,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','mir_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0),(126,NULL,'PRESERVADO',92,93,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0),(128,NULL,'PALETIZADO',23,24,NULL,0,NULL,NULL,NULL,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0),(130,NULL,'REVISION',25,26,NULL,0,NULL,NULL,NULL,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0); +INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,94,763,0,NULL,NULL,NULL,0,0,0,30,NULL,'/',NULL,0,NULL,0,0,0,0,NULL),(22,NULL,'COMPRAS',2,3,NULL,72,596,2,5,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(23,NULL,'CAMARA',13,14,NULL,72,3758,2,6,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL),(31,'IT','INFORMATICA',4,5,NULL,72,127,3,9,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(36,NULL,'LABORAL',10,11,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(37,NULL,'PRODUCCION',12,27,NULL,72,3758,3,11,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL),(38,NULL,'SACADO',15,16,NULL,72,230,4,14,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,3758,4,12,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,599,3,8,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(43,NULL,'VENTAS',30,49,NULL,0,NULL,NULL,NULL,0,0,1,9,1,'/1/',NULL,1,'',1,0,0,0,NULL),(44,NULL,'GERENCIA',50,51,NULL,72,300,2,7,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(45,NULL,'LOGISTICA',52,53,NULL,72,596,3,19,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(46,NULL,'REPARTO',54,55,NULL,72,659,3,10,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(48,NULL,'ALMACENAJE',56,57,NULL,0,3758,NULL,NULL,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(49,NULL,'PROPIEDAD',58,59,NULL,72,1008,1,1,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(52,NULL,'CARGA AEREA',60,61,NULL,72,163,4,28,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',62,63,NULL,72,1238,0,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(54,NULL,'ORNAMENTALES',64,65,NULL,72,433,3,21,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(55,NULL,'TALLER NATURAL',66,67,3366,72,3758,2,23,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,1118),(56,NULL,'TALLER ARTIFICIAL',68,69,8470,72,1780,2,24,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,1927),(58,NULL,'CAMPOS',70,71,NULL,72,3758,2,2,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(59,NULL,'MANTENIMIENTO',72,73,NULL,72,1907,4,16,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(60,NULL,'RECLAMACIONES',74,75,NULL,72,563,3,20,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(61,NULL,'VNH',76,77,NULL,73,1297,3,17,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(63,NULL,'VENTAS FRANCIA',31,32,NULL,72,277,2,27,0,0,2,0,43,'/1/43/',NULL,0,NULL,0,0,0,0,NULL),(66,NULL,'VERDNAMADRID',78,79,NULL,72,163,3,18,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,617,3,26,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(69,NULL,'VERDNABARNA',80,81,NULL,74,432,3,22,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(80,NULL,'EQUIPO J VALLES',33,34,NULL,72,693,3,4,0,0,2,0,43,'/1/43/','jvp_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(86,NULL,'LIMPIEZA',82,83,NULL,72,599,0,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(89,NULL,'COORDINACION',84,85,NULL,0,3758,NULL,NULL,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(90,NULL,'TRAILER',86,87,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,3758,NULL,NULL,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(92,NULL,'EQUIPO SILVERIO',35,36,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','sdc_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(93,NULL,'CONFECCION',88,89,NULL,0,3758,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(94,NULL,'EQUIPO J BROCAL',37,38,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','jes_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(95,NULL,'EQUIPO C ZAMBRANO',39,40,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','czg_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(96,NULL,'EQUIPO C LOPEZ',41,42,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','cla_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(115,NULL,'EQUIPO CLAUDI',43,44,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','csr_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',45,46,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','ebt_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(124,NULL,'CONTROL INTERNO',90,91,NULL,72,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(125,NULL,'EQUIPO MIRIAM MAR',47,48,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','mir_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(126,NULL,'PRESERVADO',92,93,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,NULL,NULL,NULL,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(130,NULL,'REVISION',25,26,NULL,0,NULL,NULL,NULL,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; @@ -410,7 +430,7 @@ UNLOCK TABLES; LOCK TABLES `state` WRITE; /*!40000 ALTER TABLE `state` DISABLE KEYS */; -INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0,0,0,0,4,1),(2,'Libre',2,0,'FREE',NULL,2,1,0,0,0,1,0,4,1),(3,'OK',3,0,'OK',3,28,1,0,0,0,1,1,3,0),(4,'Impreso',4,0,'PRINTED',2,29,1,0,1,0,0,1,2,0),(5,'Preparación',6,1,'ON_PREPARATION',7,5,0,0,0,2,0,0,2,0),(6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0,3,0,0,1,0),(7,'Sin Acabar',1,0,'NOT_READY',NULL,7,0,0,0,0,0,0,4,1),(8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0,3,0,0,1,0),(9,'Encajando',9,2,'PACKING',NULL,9,0,1,0,0,0,0,1,0),(10,'Encajado',10,2,'PACKED',NULL,10,0,1,0,0,0,0,0,0),(11,'Facturado',0,3,'INVOICED',NULL,11,0,1,0,0,0,0,0,0),(12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0,0,0,0,4,1),(13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0,0,0,0,0,0),(14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0,2,0,0,1,0),(15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0,0,0,0,0),(16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0,0,0,0,0,0),(20,'Asignado',4,0,'PICKER_DESIGNED',NULL,20,1,0,0,0,0,0,2,0),(21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0,0,0,0,2,0),(22,'Pte. Ampliar',2,0,'EXPANDABLE',NULL,22,0,0,0,0,0,0,4,1),(23,'URGENTE',5,1,'LAST_CALL',NULL,23,1,0,1,0,0,0,4,1),(24,'Encadenado',4,0,'CHAINED',4,24,0,0,0,0,0,0,3,1),(25,'Embarcando',3,0,'BOARDING',5,25,1,0,0,0,0,0,3,0),(26,'Prep Previa',5,1,'PREVIOUS_PREPARATION',1,28,0,0,0,1,0,0,2,0),(27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0,0,0,0,2,0),(28,'Previa OK',3,1,'OK PREVIOUS',3,28,0,0,0,1,1,1,3,0),(29,'Previa Impreso',4,1,'PRINTED PREVIOUS',2,29,0,0,1,1,0,1,3,0),(30,'Embarcado',4,1,'BOARD',5,30,0,0,0,2,0,0,3,0),(31,'Polizon Impreso',4,1,'PRINTED STOWAWAY',2,29,1,0,1,0,0,1,3,0),(32,'Polizon OK',3,1,'OK STOWAWAY',3,31,1,0,0,1,1,1,3,0),(33,'Auto_Impreso',4,0,'PRINTED_AUTO',2,29,1,0,1,0,0,1,2,0),(34,'Pte Pago',3,0,'WAITING_FOR_PAYMENT',NULL,34,0,0,0,0,0,0,4,1),(35,'Semi-Encajado',9,2,'HALF_PACKED',NULL,10,0,1,0,0,0,0,1,0),(36,'Control Previa',3,1,'PREVIOUS_CONTROL',1,36,0,1,0,4,0,1,3,0); +INSERT INTO `state` VALUES (1,'Arreglar',2,0,'FIXING',NULL,1,0,0,0,0,0,0,4,1,'alert'),(2,'Libre',2,0,'FREE',NULL,2,1,0,0,0,1,0,4,1,'notice'),(3,'OK',3,0,'OK',3,28,1,0,0,0,1,1,3,0,'success'),(4,'Impreso',4,0,'PRINTED',2,29,1,0,1,0,0,1,2,0,'success'),(5,'Preparación',6,1,'ON_PREPARATION',7,5,0,0,0,2,0,0,2,0,'warning'),(6,'En Revisión',7,1,'ON_CHECKING',NULL,6,0,1,0,3,0,0,1,0,'warning'),(7,'Sin Acabar',1,0,'NOT_READY',NULL,7,0,0,0,0,0,0,4,1,'alert'),(8,'Revisado',8,1,'CHECKED',NULL,8,0,1,0,3,0,0,1,0,'warning'),(9,'Encajando',9,2,'PACKING',NULL,9,0,1,0,0,0,0,1,0,NULL),(10,'Encajado',10,2,'PACKED',NULL,10,0,1,0,0,0,0,0,0,NULL),(11,'Facturado',0,3,'INVOICED',NULL,11,0,1,0,0,0,0,0,0,NULL),(12,'Bloqueado',0,0,'BLOCKED',NULL,12,0,0,0,0,0,0,4,1,'alert'),(13,'En Reparto',11,3,'ON_DELIVERY',NULL,13,0,1,0,0,0,0,0,0,NULL),(14,'Preparado',6,1,'PREPARED',NULL,14,0,1,0,2,0,0,1,0,'warning'),(15,'Pte Recogida',12,3,'WAITING_FOR_PICKUP',NULL,15,0,1,0,0,0,0,0,0,NULL),(16,'Entregado',13,3,'DELIVERED',NULL,16,0,1,0,0,0,0,0,0,NULL),(20,'Asignado',4,0,'PICKER_DESIGNED',NULL,20,1,0,0,0,0,0,2,0,'success'),(21,'Retornado',4,1,'PRINTED_BACK',6,21,0,0,0,0,0,0,2,0,'success'),(22,'Pte. Ampliar',2,0,'EXPANDABLE',NULL,22,0,0,0,0,0,0,4,1,'alert'),(23,'URGENTE',5,1,'LAST_CALL',NULL,23,1,0,1,0,0,0,4,1,'success'),(24,'Encadenado',4,0,'CHAINED',4,24,0,0,0,0,0,0,3,1,'success'),(25,'Embarcando',3,0,'BOARDING',5,25,1,0,0,0,0,0,3,0,'alert'),(26,'Prep Previa',5,1,'PREVIOUS_PREPARATION',1,28,0,0,0,1,0,0,2,0,'warning'),(27,'Prep Asistida',5,1,'ASSISTED_PREPARATION',7,27,0,0,0,0,0,0,2,0,'success'),(28,'Previa OK',3,1,'OK PREVIOUS',3,28,0,0,0,1,1,1,3,0,'warning'),(29,'Previa Impreso',4,1,'PRINTED PREVIOUS',2,29,0,0,1,1,0,1,3,0,'success'),(30,'Embarcado',4,1,'BOARD',5,30,0,0,0,2,0,0,3,0,'success'),(31,'Polizon Impreso',4,1,'PRINTED STOWAWAY',2,29,1,0,1,0,0,1,3,0,'success'),(32,'Polizon OK',3,1,'OK STOWAWAY',3,31,1,0,0,1,1,1,3,0,'warning'),(33,'Auto_Impreso',4,0,'PRINTED_AUTO',2,29,1,0,1,0,0,1,2,0,'success'),(34,'Pte Pago',3,0,'WAITING_FOR_PAYMENT',NULL,34,0,0,0,0,0,0,4,1,'alert'),(35,'Semi-Encajado',9,2,'HALF_PACKED',NULL,10,0,1,0,0,0,0,1,0,NULL),(36,'Control Previa',3,1,'PREVIOUS_CONTROL',1,36,0,1,0,4,0,1,3,0,'warning'); /*!40000 ALTER TABLE `state` ENABLE KEYS */; UNLOCK TABLES; @@ -452,7 +472,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:14 +-- Dump completed on 2022-05-02 10:56:21 USE `cache`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -488,7 +508,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:14 +-- Dump completed on 2022-05-02 10:56:21 USE `hedera`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -506,6 +526,16 @@ USE `hedera`; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-- +-- Dumping data for table `browser` +-- + +LOCK TABLES `browser` WRITE; +/*!40000 ALTER TABLE `browser` DISABLE KEYS */; +INSERT INTO `browser` VALUES ('Chrome',29),('Firefox',20),('Iceweasel',20),('IE',12),('Opera',12),('Safari',9); +/*!40000 ALTER TABLE `browser` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Dumping data for table `imageCollection` -- @@ -516,6 +546,106 @@ INSERT INTO `imageCollection` VALUES (1,'catalog','Artículo',3840,2160,'Item',' /*!40000 ALTER TABLE `imageCollection` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Dumping data for table `imageCollectionSize` +-- + +LOCK TABLES `imageCollectionSize` WRITE; +/*!40000 ALTER TABLE `imageCollectionSize` DISABLE KEYS */; +INSERT INTO `imageCollectionSize` VALUES (2,1,50,50,1),(3,1,200,200,1),(5,5,200,200,1),(6,1,70,70,1),(8,5,50,50,1),(9,1,1600,900,0),(13,6,160,160,1),(14,6,520,520,1),(15,6,1600,1600,1); +/*!40000 ALTER TABLE `imageCollectionSize` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `language` +-- + +LOCK TABLES `language` WRITE; +/*!40000 ALTER TABLE `language` DISABLE KEYS */; +INSERT INTO `language` VALUES ('ca','Català','Catalan',1),('en','English','English',1),('es','Español','Spanish',1),('fr','Français','French',1),('mn','Португалий','Mongolian',1),('pt','Português','Portuguese',1); +/*!40000 ALTER TABLE `language` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `link` +-- + +LOCK TABLES `link` WRITE; +/*!40000 ALTER TABLE `link` DISABLE KEYS */; +INSERT INTO `link` VALUES (16,'Printing server','Manage the CUPS printing server','http://server.verdnatura.es:631','printer'),(20,'Webmail','Verdnatura webmail','https://webmail.verdnatura.es/','mail'),(23,'Verdnatura Beta','Trial version of the web page','https://test.verdnatura.es/','vn'),(25,'Shared folder','Shared folder','/share','backup'),(29,'phpMyAdmin','Manage MySQL database','https://pma.verdnatura.es/','pma'),(30,'Nagios','Monitoring system','https://nagios.verdnatura.es/','nagios'),(33,'Gitea','Version control system','https://gitea.verdnatura.es/','git'),(34,'Wiknatura','Verdnatura wiki page','https://wiki.verdnatura.es/','wiki'),(35,'phpLDAPadmin','Manage the LDAP database','https://pla.verdnatura.es/','pla'),(36,'Applications','Access applications repository','/vn-access','backup'); +/*!40000 ALTER TABLE `link` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `location` +-- + +LOCK TABLES `location` WRITE; +/*!40000 ALTER TABLE `location` DISABLE KEYS */; +INSERT INTO `location` VALUES (2,'39.2095886','-0.4173501','Valencia','Calle Fenollar, 2','46680','Algemesi','Valencia','963 242 100','es'),(3,'40.4564969','-3.4875829','Madrid','Avenida de la Constitución, 3 - Nave E','28850','Torrejón de Ardoz','Madrid','916 774 777',NULL),(4,'41.4962045','2.3765504','Barcelona','Camí del crist, 33','08340','Vilassar de Mar','Barcelona','607 562 391','ca'),(5,'52.2612312','4.7818154','Holland','Aalsmeer Flower Auction','1430 BA','Legmeerdijk 313','Aalsmeer','Nederland','nl'),(6,'43.4375416','5.2261456','Marseille','ruben@verdnatura.es','13054','Marigname','Marseille','+33 781 533 900','fr'); +/*!40000 ALTER TABLE `location` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `menu` +-- + +LOCK TABLES `menu` WRITE; +/*!40000 ALTER TABLE `menu` DISABLE KEYS */; +INSERT INTO `menu` VALUES (1,'Home','cms/home',6,NULL,1),(2,'Orders',NULL,11,NULL,1),(3,'Catalog','ecomerce/catalog',6,NULL,2),(5,'About',NULL,6,NULL,2),(6,'Location','cms/location',6,5,2),(7,'Administration',NULL,1,NULL,2),(8,'Users','admin/users',1,7,2),(9,'Connections','admin/connections',1,7,2),(11,'Agencies','agencies/packages',3,NULL,2),(12,'News','news/news',1,7,3),(14,'Why','cms/why',6,5,2),(15,'Photos','admin/photos',1,7,3),(16,'Training','cms/training',6,NULL,2),(17,'Configuration',NULL,11,NULL,3),(19,'Control panel','admin/links',1,7,1),(20,'About us','cms/about',6,5,1),(21,'Basket','ecomerce/basket',11,NULL,1),(22,'Last orders','ecomerce/orders',11,2,2),(23,'Invoices','ecomerce/invoices',11,2,2),(24,'Account','account/conf',11,17,1),(25,'Addresses','account/address-list',11,17,2),(26,'Shelves','reports/shelves',1,29,1),(27,'Items list','reports/items-form',1,29,1),(28,'Visits','admin/visits',1,7,2),(29,'Reports',NULL,1,NULL,2),(30,'Items','admin/items',1,7,3); +/*!40000 ALTER TABLE `menu` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `message` +-- + +LOCK TABLES `message` WRITE; +/*!40000 ALTER TABLE `message` DISABLE KEYS */; +INSERT INTO `message` VALUES (1,'ORDER_DATE_HOLIDAY','No es posible realizar pedidos para días festivos'),(2,'ORDER_EMPTY','El pedido esta vacío'),(3,'ORDER_UNAVAILABLE','Algunos artículos ya no están disponibles, verifica las cantidades resaltadas en rojo'),(4,'SURVEY_MAX_ONE_VOTE','Solo es posible realizar un voto por encuesta'),(5,'ORDER_MAX_EXCEEDED','Has excedido el número máximo de pedidos por confirmar, por favor elimina o confirma los pedidos iniciados'),(6,'LOGIN_INCORRECT','Usuario o contraseña incorrectos. Recuerda que se hace distinción entre mayúsculas y minúsculas.'),(7,'ORDER_DATE_PAST','La fecha de su pedido debe ser mayor o igual al día de hoy'),(8,'ORDER_DATE_LAST','No es posible realizar más para hoy, por favor atrasa la fecha de tu pedido a mañana o días posteriores'),(9,'ORDER_DATE_SUNDAY','No es posible confirmar pedidos para Domingo'),(10,'ORDER_DATE_SATURATED','Estamos saturados de pedidos, por favor selecciona otra fecha de envío o recogida '),(11,'USER_DISCONNECTED','Has sido desconectado del servidor, por favor vuelve a iniciar sesión'),(12,'UNAUTH_ACTION','Acción no permitida'),(13,'ORDER_INVALID_AGENCY','La agencia de envío no es válida'),(14,'ORDER_EMPTY_ADDRESS','Selecciona una dirección de envío'),(15,'ORDER_AMOUNT_ROUNDED','Este artículo se vende agrupado y la cantidad ha sido redondeada'),(16,'ORDER_ALREADY_CONFIRMED','Este pedido ya estaba confirmado'); +/*!40000 ALTER TABLE `message` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `metatag` +-- + +LOCK TABLES `metatag` WRITE; +/*!40000 ALTER TABLE `metatag` DISABLE KEYS */; +INSERT INTO `metatag` VALUES (2,'title','Verdnatura Levante SL, mayorista de flores, plantas y complementos para floristería y decoración'),(3,'description','Verdnatura Levante SL, mayorista de flores, plantas y complementos para floristería y decoración. Envío a toda España, pedidos por internet o por teléfono.'),(4,'keywords','verdnatura, mayorista, floristería, flores, verdes, plantas, ramos, complementos, artificial, natural, decoración, rosas, helecho, fern, clavel, lilium, orquídea, tulipan, crisantemo, cala, gerbera, hiedra, eucaliptus, cinerea, aralia'),(6,'revisit-after','15 days'),(7,'rating','general'),(8,'author','Juan Ferrer Toribio'),(9,'owner','Verdnatura Levante S.L.'),(10,'robots','index, follow'); +/*!40000 ALTER TABLE `metatag` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `newsTag` +-- + +LOCK TABLES `newsTag` WRITE; +/*!40000 ALTER TABLE `newsTag` DISABLE KEYS */; +INSERT INTO `newsTag` VALUES ('course','Curso'),('new','Noticia'),('offer','Oferta'); +/*!40000 ALTER TABLE `newsTag` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `restPriv` +-- + +LOCK TABLES `restPriv` WRITE; +/*!40000 ALTER TABLE `restPriv` DISABLE KEYS */; +INSERT INTO `restPriv` VALUES (1,'tpv/transaction',2),(2,'dms/add',1),(3,'image/upload',1),(4,'misc/sms',1),(5,'core/supplant',1),(6,'core/sync-user',5),(7,'core/set-password',1),(8,'core/change-password',11),(9,'misc/access-version',9); +/*!40000 ALTER TABLE `restPriv` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Dumping data for table `social` +-- + +LOCK TABLES `social` WRITE; +/*!40000 ALTER TABLE `social` DISABLE KEYS */; +INSERT INTO `social` VALUES (1,'Blog','https://blog.verdnatura.es/','blog.svg',0),(3,'Facebook','http://www.facebook.com/verdnatura','facebook.svg',2),(4,'YouTube','http://www.youtube.com/user/verdnatura','youtube.svg',2),(5,'Twitter','https://twitter.com/Verdnatura','twitter.svg',1),(6,'Instagram','https://www.instagram.com/verdnatura','instagram.svg',2),(7,'Linkedin','https://www.linkedin.com/company/verdnatura','linkedin.svg',1),(8,'Pinterest','https://es.pinterest.com/verdnatura/','pinterest.svg',1); +/*!40000 ALTER TABLE `social` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Dumping data for table `tpvError` -- @@ -535,16 +665,6 @@ LOCK TABLES `tpvResponse` WRITE; INSERT INTO `tpvResponse` VALUES (101,'Tarjeta Caducada'),(102,'Tarjeta en excepción transitoria o bajo sospecha de fraude'),(104,'Operación no permitida para esa tarjeta o terminal'),(106,'Intentos de PIN excedidos'),(116,'Disponible Insuficiente'),(118,'Tarjeta no Registrada'),(125,'Tarjeta no efectiva'),(129,'Código de seguridad (CVV2/CVC2) incorrecto'),(180,'Tarjeta ajena al servicio'),(184,'Error en la autenticación del titular'),(190,'Denegación sin especificar motivo'),(191,'Fecha de caducidad errónea'),(202,'Tarjeta en excepción transitoria o bajo sospecha de fraude con retirada de tarjeta'),(904,'Comercio no registrado en FUC'),(909,'Error de sistema'),(912,'Emisor no Disponible'),(913,'Pedido repetido'),(944,'Sesión Incorrecta'),(950,'Operación de devolución no permitida'),(9064,'Número de posiciones de la tarjeta incorrecto'),(9078,'No existe método de pago válido para esa tarjeta'),(9093,'Tarjeta no existente'),(9094,'Rechazo servidores internacionales'),(9104,'A petición del usuario se ha cancelado el pago'),(9218,'El comercio no permite op. seguras por entrada /operaciones'),(9253,'Tarjeta no cumple el check-digit'),(9256,'El comercio no puede realizar preautorizaciones'),(9257,'Esta tarjeta no permite operativa de preautorizaciones'),(9261,'Operación detenida por superar el control de restricciones en la entrada al SIS'),(9912,'Emisor no Disponible'),(9913,'Error en la confirmación que el comercio envía al TPV Virtual (solo aplicable en la opción de sincronización SOAP)'),(9914,'Confirmación “KO” del comercio (solo aplicable en la opción de sincronización SOAP)'),(9915,'A petición del usuario se ha cancelado el pago'),(9928,'Anulación de autorización en diferido realizada por el SIS (proceso batch)'),(9929,'Anulación de autorización en diferido realizada por el comercio'),(9998,'Operación en proceso de solicitud de datos de tarjeta'),(9999,'Operación que ha sido redirigida al emisora autenticar'); /*!40000 ALTER TABLE `tpvResponse` ENABLE KEYS */; UNLOCK TABLES; - --- --- Dumping data for table `imageCollectionSize` --- - -LOCK TABLES `imageCollectionSize` WRITE; -/*!40000 ALTER TABLE `imageCollectionSize` DISABLE KEYS */; -INSERT INTO `imageCollectionSize` VALUES (2,1,50,50,1),(3,1,200,200,1),(5,5,200,200,1),(6,1,70,70,1),(8,5,50,50,1),(9,1,1600,900,0),(13,6,160,160,1),(14,6,520,520,1),(15,6,1600,1600,1); -/*!40000 ALTER TABLE `imageCollectionSize` ENABLE KEYS */; -UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -554,7 +674,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:14 +-- Dump completed on 2022-05-02 10:56:21 USE `postgresql`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -640,7 +760,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:14 +-- Dump completed on 2022-05-02 10:56:21 USE `sage`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -696,4 +816,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:14 +-- Dump completed on 2022-05-02 10:56:21 diff --git a/db/dump/structure.sql b/db/dump/structure.sql index f317dd7f7..a9e21b377 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -2674,22 +2674,6 @@ CREATE TABLE `compradores_evolution` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `conveyorStats` --- - -DROP TABLE IF EXISTS `conveyorStats`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `conveyorStats` ( - `created` datetime NOT NULL, - `saturacion` int(11) DEFAULT NULL, - `velocidad` int(11) DEFAULT NULL, - `rutas` int(11) DEFAULT NULL, - PRIMARY KEY (`created`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `customerEvolution` -- @@ -3062,21 +3046,6 @@ CREATE TABLE `nightTaskConfig` ( ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `novemberSales` --- - -DROP TABLE IF EXISTS `novemberSales`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `novemberSales` ( - `ticketFk` int(11) NOT NULL, - `saleFk` int(11) NOT NULL DEFAULT '0', - `año` int(4) DEFAULT NULL, - `importe` decimal(28,8) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Temporary table structure for view `packingSpeed` -- @@ -3190,32 +3159,6 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; --- --- Table structure for table `salaries2018` --- - -DROP TABLE IF EXISTS `salaries2018`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `salaries2018` ( - `person_id` int(11) NOT NULL DEFAULT '0', - `sex` enum('M','F') CHARACTER SET utf8 NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', - `edad` int(6) DEFAULT NULL, - `antiguedad` int(6) DEFAULT NULL, - `Modalidad` varchar(22) CHARACTER SET utf8mb4 NOT NULL DEFAULT '', - `reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `worker` varchar(82) CHARACTER SET utf8 DEFAULT NULL, - `totalDays` decimal(32,0) DEFAULT NULL, - `totalAnual` decimal(16,0) DEFAULT NULL, - `virtualMonthlySalary` decimal(16,0) DEFAULT NULL, - `departamento` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `category_name` varchar(50) CHARACTER SET utf8 NOT NULL, - `level_name` varchar(5) CHARACTER SET utf8 DEFAULT NULL, - `thisYearDateStart` varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL, - PRIMARY KEY (`person_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `sale` -- @@ -4148,44 +4091,12 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `carteras_add`() -BEGIN - -DELETE FROM bs.carteras -WHERE Año >= YEAR(CURDATE()) - 1; - -INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) -SELECT year as Año, month as Mes, CodigoTrabajador, sum(importe) as Peso -FROM vn2008.time t -JOIN bs.ventas v on t.date = v.fecha -JOIN vn2008.Clientes c on c.Id_Cliente = v.Id_Cliente -JOIN vn2008.Trabajadores tr on tr.Id_Trabajador = c.Id_Trabajador -WHERE t.year >= YEAR(CURDATE()) - 1 -GROUP BY CodigoTrabajador, Año, Mes; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `carteras_add2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `carteras_add2`() BEGIN /** - * Inserta en "bs.carteras". + * Inserta en @bs.carteras. */ DELETE FROM bs.carteras - WHERE Año >= YEAR(CURDATE()) - 1; + WHERE Año >= YEAR(CURDATE()) - 1; INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) SELECT t.year AS Año, t.month AS Mes, w.code AS CodigoTrabajador, SUM(v.importe) AS Peso @@ -4215,9 +4126,11 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() BEGIN DECLARE vFourYearsAgo DATETIME; DECLARE vOneYearAgo DATETIME; + DECLARE vTwoYearAgo DATETIME; - SET vFourYearsAgo = TIMESTAMPADD(YEAR, -4,CURDATE()); SET vOneYearAgo = TIMESTAMPADD(YEAR, -1,CURDATE()); + SET vTwoYearAgo = TIMESTAMPADD(YEAR, -2,CURDATE()); + SET vFourYearsAgo = TIMESTAMPADD(YEAR, -4,CURDATE()); DELETE FROM bs.clientNewBorn WHERE lastShipped < vOneYearAgo; @@ -4230,6 +4143,12 @@ BEGIN DELETE FROM payMethodClientEvolution WHERE dated < vFourYearsAgo; + + DELETE FROM bs.salesByclientSalesPerson + WHERE dated < vFourYearsAgo; + + DELETE FROM bs.m3 + WHERE fecha < vTwoYearAgo; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4642,51 +4561,14 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `compradores_add`(IN intYEAR INT, IN intWEEK_START INT, IN intWEEK_END INT) -BEGIN - -REPLACE bs.compradores - -SELECT tp.Id_Trabajador - , intYEAR as año - , tm.week as semana - , sum(importe) as importe - , 0 as comision - -FROM bs.ventas v -JOIN vn2008.time tm on tm.date = v.fecha -JOIN vn2008.Tipos tp using(tipo_id) -WHERE tm.year = intYEAR and tm.week between intWEEK_START and intWEEK_END -AND reino_id != 6 -GROUP BY tp.Id_Trabajador, tm.week; - - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `compradores_add2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `compradores_add2`(IN vYear INT, IN vWeekFrom INT, IN vWeekTo INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `compradores_add`(IN vYear INT, IN vWeekFrom INT, IN vWeekTo INT) BEGIN /** * Sustituye los registros de "bs.compradores". * * @param vYear: año ventas * @param vWeekFrom: semana desde - * @param vWeekTo: semana hastas + * @param vWeekTo: semana hasta */ REPLACE bs.compradores SELECT it.workerFk AS Id_Trabajador, vYear AS año, tm.week AS semana, SUM(importe) AS importe, 0 AS comision @@ -4858,91 +4740,6 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fondo_evolution_add`() BEGIN -/* - -Inserta en la tabla fondo_maniobra los saldos acumulados en los ultimos 365 dias - -*/ - -DECLARE datFEC DATE DEFAULT '2015-01-01'; - - -SELECT TIMESTAMPADD(DAY,1,MAX(fecha)) INTO datFEC FROM bs.fondo_maniobra; - - WHILE datFEC < CURDATE() DO - - -- esto solo sirve para no aburrirse mientras esperamos... - - IF day(datFEC) mod 28 = 0 then - SELECT datFEC; - end if; - - - REPLACE bs.fondo_maniobra(Fecha, clientes_facturas, clientes_cobros,proveedores_facturas,proveedores_pagos, fondo) - SELECT datFEC as Fecha, Facturas, Cobros,Recibidas,Pagos, Facturas + Cobros + Recibidas + Pagos - FROM - ( - SELECT Sum(Facturas.Importe) AS Facturas - FROM vn2008.Facturas - INNER JOIN vn2008.Clientes ON Facturas.Id_Cliente = Clientes.Id_cliente - WHERE Clientes.`real` - AND empresa_id <>1381 - AND Fecha between '2011-01-01' and datFEC) fac - JOIN - ( - SELECT - Sum(Entregado) AS Cobros - FROM vn2008.Recibos - INNER JOIN vn2008.Clientes ON Recibos.Id_Cliente = Clientes.Id_cliente - WHERE Clientes.`real` - AND empresa_id <> 1381 - AND Fechacobro Between '2011-01-01' and datFEC) cob - JOIN - ( - SELECT - Sum(cantidad) AS Recibidas - FROM vn2008.recibida - INNER JOIN vn2008.recibida_vencimiento ON recibida.id = recibida_vencimiento.recibida_id - WHERE empresa_id <> 1381 - AND recibida.fecha Between '2015-01-01' and datFEC) rec - JOIN - ( - SELECT Sum(importe) AS Pagos - FROM vn2008.pago - WHERE empresa_id <>1381 AND pago.fecha Between '2015-01-01' and datFEC) pag; - - - - UPDATE bs.fondo_maniobra - JOIN - (SELECT avg(fondo) as media - FROM bs.fondo_maniobra - WHERE fecha <= datFEC) sub - SET fondo_medio = media - WHERE fecha = datFEC; - - - 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 `fondo_evolution_add2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `fondo_evolution_add2`() -BEGIN /** * Inserta en la tabla fondo_maniobra los saldos acumulados en los ultimos 365 dias */ @@ -16363,9 +16160,9 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `order_confirmWithUser`(IN `vOrder` INT, IN `vUserId` INT) BEGIN @@ -16490,7 +16287,7 @@ BEGIN SET vShipment = IFNULL(vShipment, CURDATE()); - CALL vn.ticketCreateWithUser( + CALL vn.ticket_add( vClientId, vShipment, vWarehouse, @@ -16500,6 +16297,7 @@ BEGIN NULL, vDelivery, vUserId, + TRUE, vTicket ); ELSE @@ -26668,6 +26466,8 @@ CREATE TABLE `addressFilter` ( `isVNHSupplier` tinyint(1) DEFAULT '0' COMMENT 'corresponde al campo edi.VMPSettings.isVNHSupplier', `isEarlyBird` tinyint(1) DEFAULT '0' COMMENT 'corresponde al campo edi.marketPlace.isEarlybird', `warehouseFk` smallint(5) unsigned DEFAULT NULL, + `beforeDated` date DEFAULT NULL, + `afterDated` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `addressFilter_FK` (`provinceFk`), KEY `addressFilter_FK_1` (`countryFk`), @@ -26857,6 +26657,21 @@ CREATE TABLE `agencyTerm` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `agencyTermConfig` +-- + +DROP TABLE IF EXISTS `agencyTermConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `agencyTermConfig` ( + `expenceFk` varchar(10) DEFAULT NULL, + `vatAccountSupported` varchar(15) DEFAULT NULL, + `vatPercentage` decimal(28,10) DEFAULT NULL, + `transaction` varchar(50) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `alertLevel` -- @@ -27463,15 +27278,15 @@ CREATE TABLE `budgetNotes` ( /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_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_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`$manager`@`%`*/ /*!50003 TRIGGER budgetNotes_BeforeInsert -BEFORE INSERT -ON budgetNotes FOR EACH ROW +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`budgetNotes_BeforeInsert` + BEFORE INSERT ON `budgetNotes` + FOR EACH ROW BEGIN IF ISNULL(NEW.userFk) THEN @@ -27607,6 +27422,7 @@ trig: BEGIN DECLARE vGrouping INT; DECLARE vGroupingMode TINYINT; DECLARE vGenericFk INT; + DECLARE vGenericInDate BOOL; IF @isModeInventory THEN LEAVE trig; @@ -27645,9 +27461,20 @@ trig: BEGIN IF vGenericFk THEN - SET NEW.itemOriginalFk = NEW.itemFk; - - SET NEW.itemFk = vGenericFk; + SELECT COUNT(*) INTO vGenericInDate + FROM vn.genericAllocation ga + JOIN vn.entry e ON e.id = NEW.entryFk + JOIN vn.travel tr on tr.id = e.travelFk + WHERE ga.itemFk = vGenericFk + AND tr.landed BETWEEN ga.startDated AND ga.endDated; + + IF vGenericInDate THEN + + SET NEW.itemOriginalFk = NEW.itemFk; + + SET NEW.itemFk = vGenericFk; + + END IF; END IF; @@ -27696,8 +27523,8 @@ DELIMITER ;; BEFORE UPDATE ON `buy` FOR EACH ROW trig:BEGIN - DECLARE vGenericFk INT; + DECLARE vGenericInDate BOOL; IF @isTriggerDisabled THEN @@ -27717,12 +27544,22 @@ trig:BEGIN IF vGenericFk THEN - SET NEW.itemOriginalFk = NEW.itemFk; - - SET NEW.itemFk = vGenericFk; + SELECT COUNT(*) INTO vGenericInDate + FROM vn.genericAllocation ga + JOIN vn.entry e ON e.id = NEW.entryFk + JOIN vn.travel tr on tr.id = e.travelFk + WHERE ga.itemFk = vGenericFk + AND tr.landed BETWEEN ga.startDated AND ga.endDated; + + IF vGenericInDate THEN + + SET NEW.itemOriginalFk = NEW.itemFk; + + SET NEW.itemFk = vGenericFk; + + END IF; END IF; - END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27746,6 +27583,8 @@ trig: BEGIN DECLARE vBuyerFk INT; DECLARE vIsBuyerToBeEmailed BOOL; DECLARE vItemName VARCHAR(50); + DECLARE vIsInventory BOOL; + DECLARE vEmail VARCHAR(255); IF !(NEW.id <=> OLD.id) OR !(NEW.entryFk <=> OLD.entryFk) @@ -27797,7 +27636,34 @@ trig: BEGIN 'Este email se ha generado automáticamente' ); END IF; + END IF; + + SELECT e.isInventory INTO vIsInventory + FROM entry e + WHERE e.id = NEW.entryFk; + + SELECT e.mailToNotify INTO vEmail + FROM entryConfig e + LIMIT 1; + + IF vIsInventory AND + (!(NEW.quantity <=> OLD.quantity) + OR !(NEW.price1<=>OLD.price1) + OR !(NEW.price2<=>OLD.price2) + OR !(NEW.price3<=>OLD.price3)) THEN + + CALL mail_insert( + vEmail, + NULL, + CONCAT('Se ha modificado la entrada ', NEW.entryFk ,' del Artículo ', NEW.itemFk, ' siendo inventario'), + CONCAT( + 'Antes: Cantidad: ', OLD.quantity, ' Precio1: ', OLD.price1, ' Precio2: ', OLD.price2, ' Precio3: ', OLD.price3, + '
', + 'Despues: Cantidad: ', NEW.quantity, ' Precio1: ', NEW.price1, ' Precio2: ', NEW.price2, ' Precio3: ', NEW.price3 + ) + ); END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -28736,6 +28602,46 @@ CREATE TABLE `clientDms` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `clientItemCategory` +-- + +DROP TABLE IF EXISTS `clientItemCategory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientItemCategory` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `clientFk` int(11) NOT NULL, + `itemCategoryFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `clientItemCategory_FK` (`clientFk`), + KEY `clientItemCategory_FK_1` (`itemCategoryFk`), + CONSTRAINT `clientItemCategory_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `clientItemCategory_FK_1` FOREIGN KEY (`itemCategoryFk`) REFERENCES `itemCategory` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `clientItemType` +-- + +DROP TABLE IF EXISTS `clientItemType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `clientItemType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `clientFk` int(11) NOT NULL, + `itemTypeFk` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `isAllowed` tinyint(1) DEFAULT '0', + PRIMARY KEY (`id`), + KEY `clientItemType_FK` (`clientFk`), + KEY `clientItemType_FK_1` (`itemTypeFk`), + CONSTRAINT `clientItemType_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `clientItemType_FK_1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='son familias de productos que se quieren sustraer a la oferta del cliente'; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `clientLog` -- @@ -29038,6 +28944,7 @@ CREATE TABLE `cmr` ( `merchandiseDetail` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `state` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `landed` datetime DEFAULT NULL COMMENT 'Hora de llegada a destino', + `ead` datetime DEFAULT NULL COMMENT 'Estimated Arriving Date', PRIMARY KEY (`id`), KEY `cmr_fk1_idx` (`ticketFk`), KEY `cmr_fk2_idx` (`companyFk`), @@ -29100,7 +29007,8 @@ DROP TABLE IF EXISTS `cmrConfig`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `cmrConfig` ( - `dayOfMonth` int(11) DEFAULT NULL + `dayOfMonth` int(11) DEFAULT NULL, + `landingDays` tinyint(4) NOT NULL DEFAULT '1' ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -30351,11 +30259,14 @@ CREATE TABLE `department` ( `hasToSendMail` tinyint(1) DEFAULT '0' COMMENT 'Para el envio de mail en el procedimiento workerTimeControl_sendMail()', `hasToCheckLogin` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Para comprobar en el login de la app', `hasToMistake` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indica si al departamento pueden serles puestos errores', + `clientFk` int(11) DEFAULT NULL COMMENT 'Cuenta de cliente que se utiliza para los compras de consumo departamental', PRIMARY KEY (`id`), UNIQUE KEY `name_UNIQUE` (`name`), KEY `fk_department_Trabajadores1_idx` (`workerFk`), KEY `dep_org_ibfk_3_idx` (`companyFk`), KEY `lft_rgt_depth_idx` (`lft`,`rgt`,`depth`), + KEY `department_FK` (`clientFk`), + CONSTRAINT `department_FK` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_department_Trabajadores1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -30795,6 +30706,38 @@ CREATE TABLE `dock` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Se utiliza para el panel de grafana: https://grafana.verdnatura.es/d/w9w3Uo-7z/'; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `docuware` +-- + +DROP TABLE IF EXISTS `docuware`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `docuware` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `fileCabinetName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `dialogName` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `find` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `docuwareConfig` +-- + +DROP TABLE IF EXISTS `docuwareConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `docuwareConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `url` varchar(75) COLLATE utf8_unicode_ci DEFAULT NULL, + `token` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `dua` -- @@ -31322,6 +31265,7 @@ DROP TABLE IF EXISTS `entryConfig`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `entryConfig` ( `defaultEntry` int(11) NOT NULL, + `mailToNotify` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`defaultEntry`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32490,6 +32434,10 @@ CREATE TABLE `genericAllocation` ( `numFlores` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `category` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `productor` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `longName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `size` int(11) DEFAULT NULL, + `startDated` date DEFAULT NULL, + `endDated` date DEFAULT NULL, PRIMARY KEY (`id`), KEY `genericAllocation_FK` (`itemFk`), KEY `genericAllocation_FK_1` (`typeFk`), @@ -32499,6 +32447,8 @@ CREATE TABLE `genericAllocation` ( KEY `genericAllocation_numFlores_IDX` (`numFlores`) USING BTREE, KEY `genericAllocation_category_IDX` (`category`) USING BTREE, KEY `genericAllocation_productor_IDX` (`productor`) USING BTREE, + KEY `genericAllocation_longName_IDX` (`longName`) USING BTREE, + KEY `genericAllocation_size_IDX` (`size`) USING BTREE, CONSTRAINT `genericAllocation_FK` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los filtros para asignar códigos genéricos a los items'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -32702,33 +32652,35 @@ DROP TABLE IF EXISTS `host`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `host` ( + `id` int(11) NOT NULL AUTO_INCREMENT, `code` varchar(30) CHARACTER SET utf8 NOT NULL, `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, `workerFk` int(10) unsigned DEFAULT NULL, `windowsSerial` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, `printerFk` tinyint(3) unsigned DEFAULT NULL, - `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `packingSite` tinyint(3) unsigned DEFAULT NULL, + `itemPackingTypeFk__` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `packingSite__` tinyint(3) unsigned DEFAULT NULL, `warehouseFk` smallint(5) unsigned DEFAULT '60', `companyFk` smallint(5) unsigned DEFAULT '442', `bankFk` int(11) DEFAULT '13', `routeDaysBefore` smallint(6) DEFAULT '2', `routeDaysAfter` smallint(6) DEFAULT '1', `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`code`), + PRIMARY KEY (`id`), + UNIQUE KEY `host_UN` (`code`), KEY `configHost_FK_3` (`companyFk`), KEY `configHost_FK` (`printerFk`), - KEY `configHost_FK_1` (`itemPackingTypeFk`), + KEY `configHost_FK_1` (`itemPackingTypeFk__`), KEY `configHost_FK_2` (`warehouseFk`), KEY `configHost_FK_4` (`bankFk`), KEY `configHost_FK_5` (`workerFk`), CONSTRAINT `configHost_FK` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) ON UPDATE CASCADE, - CONSTRAINT `configHost_FK_1` FOREIGN KEY (`itemPackingTypeFk`) REFERENCES `itemPackingType` (`code`) ON UPDATE CASCADE, + CONSTRAINT `configHost_FK_1` FOREIGN KEY (`itemPackingTypeFk__`) REFERENCES `itemPackingType` (`code`) ON UPDATE CASCADE, CONSTRAINT `configHost_FK_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `configHost_FK_3` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, CONSTRAINT `configHost_FK_4` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, CONSTRAINT `configHost_FK_5` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDBDEFAULT 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 */ ; @@ -33303,7 +33255,7 @@ CREATE TABLE `invoiceInIntrastat` ( PRIMARY KEY (`id`), KEY `intrastat_id` (`intrastatFk`), KEY `invoiceInIntrastat_FK` (`invoiceInFk`), - CONSTRAINT `invoiceInIntrastat_FK` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`), + CONSTRAINT `invoiceInIntrastat_FK` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE, CONSTRAINT `invoiceInIntrastat_ibfk_1` FOREIGN KEY (`intrastatFk`) REFERENCES `intrastat` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -33838,7 +33790,7 @@ CREATE TABLE `item` ( `upToDown` decimal(10,0) unsigned NOT NULL DEFAULT '0' COMMENT 'Se muestra el precio por kilo ', `supplyResponseFk` int(11) DEFAULT NULL, `hasKgPrice` tinyint(1) NOT NULL DEFAULT '0', - `sectorFk` int(11) DEFAULT '2', + `sectorFk` int(11) DEFAULT NULL, `isFloramondo` tinyint(1) NOT NULL DEFAULT '0', `isFragile` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'articulos solo para recogidas por su fragilidad', `numberOfItemsPerCask` int(11) DEFAULT NULL COMMENT 'Campo para Floramondo', @@ -33867,6 +33819,8 @@ CREATE TABLE `item` ( KEY `item_id12` (`quality`), KEY `item_family` (`family`), KEY `item_FK` (`genericFk`), + KEY `item_size_IDX` (`size`) USING BTREE, + KEY `item_size_IDX2` (`longName`) USING BTREE, CONSTRAINT `item_FK` FOREIGN KEY (`genericFk`) REFERENCES `item` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `item_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE, CONSTRAINT `item_family` FOREIGN KEY (`family`) REFERENCES `itemFamily` (`code`) ON UPDATE CASCADE, @@ -34118,10 +34072,13 @@ CREATE TABLE `itemCategory` ( `icon` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `isReclining` tinyint(4) NOT NULL DEFAULT '1', + `departmentFk` int(11) DEFAULT NULL COMMENT 'Departamento responsable del manufacturado de esta categoria', PRIMARY KEY (`id`), UNIQUE KEY `reino_UNIQUE` (`name`), KEY `itemCategory_idx3` (`merchandise`), - KEY `itemCategoryDisplayIdx` (`display`) + KEY `itemCategoryDisplayIdx` (`display`), + KEY `itemCategory_FK` (`departmentFk`), + CONSTRAINT `itemCategory_FK` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -34191,6 +34148,18 @@ SET character_set_client = utf8; ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; +-- +-- Table structure for table `itemConfig` +-- + +DROP TABLE IF EXISTS `itemConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemConfig` ( + `isItemTagTriggerDisabled` tinyint(1) NOT NULL DEFAULT '1' +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `itemConversor__` -- @@ -34718,29 +34687,27 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_INSERT` AFTER INSERT ON `itemShelving` FOR EACH ROW -INSERT INTO vn.itemShelvingLog(itemShelvingFk, - workerFk, - accion, - itemFk, - shelvingFk, - quantity, - available, +INSERT INTO vn.itemShelvingLog(itemShelvingFk, + workerFk, + accion, + itemFk, + shelvingFk, + available, visible, - `grouping`, - packing, - stars) - VALUES( NEW.id, - NEW.userFk, - 'CREA REGISTRO', - NEW.itemFk, - NEW.shelvingFk, - NEW.quantity, - NEW.available, + `grouping`, + packing, + stars) + VALUES( NEW.id, + NEW.userFk, + 'CREA REGISTRO', + NEW.itemFk, + NEW.shelvingFk, + NEW.available, NEW.visible, - NEW.`grouping`, - NEW.packing, - NEW.stars - ) */;; + NEW.`grouping`, + NEW.packing, + NEW.stars + ) */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -34778,29 +34745,27 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_UPDATE` AFTER UPDATE ON `itemShelving` FOR EACH ROW -INSERT INTO vn.itemShelvingLog(itemShelvingFk, - workerFk, - accion, - itemFk, - shelvingFk, - quantity, - available, +INSERT INTO vn.itemShelvingLog(itemShelvingFk, + workerFk, + accion, + itemFk, + shelvingFk, + available, visible, - `grouping`, - packing, - stars) - VALUES( NEW.id, - account.userGetId(), - 'CAMBIO', - NEW.itemFk, - NEW.shelvingFk, - NEW.quantity, - NEW.available, + `grouping`, + packing, + stars) + VALUES( NEW.id, + account.userGetId(), + 'CAMBIO', + NEW.itemFk, + NEW.shelvingFk, + NEW.available, NEW.visible, - NEW.`grouping`, - NEW.packing, - NEW.stars - ) */;; + NEW.`grouping`, + NEW.packing, + NEW.stars + ) */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -34952,7 +34917,6 @@ SET character_set_client = utf8; /*!50001 CREATE TABLE `itemShelvingPlacementSupplyStock` ( `itemShelvingFk` tinyint NOT NULL, `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, `packing` tinyint NOT NULL, `stock` tinyint NOT NULL, `longName` tinyint NOT NULL, @@ -35032,30 +34996,6 @@ BEGIN SET isPicked = TRUE WHERE id = NEW.saleFk; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_AFTER_DELETE` - AFTER DELETE ON `itemShelvingSale` - FOR EACH ROW -BEGIN - - UPDATE vn.itemShelving - SET visible = visible + OLD.quantity - WHERE itemShelving.id = OLD.itemShelvingFk; - END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35221,7 +35161,12 @@ DELIMITER ;; FOR EACH ROW trig: BEGIN DECLARE vItemFk INT; - IF @isTriggerDisabled THEN + DECLARE visTriggerDisabled BOOL; + + SELECT isItemTagTriggerDisabled INTO visTriggerDisabled + FROM vn.itemConfig; + + IF @isTriggerDisabled OR visTriggerDisabled THEN LEAVE trig; END IF; @@ -35274,7 +35219,12 @@ DELIMITER ;; FOR EACH ROW trig: BEGIN DECLARE vItemFk INT; - IF @isTriggerDisabled THEN + DECLARE visTriggerDisabled BOOL; + + SELECT isItemTagTriggerDisabled INTO visTriggerDisabled + FROM vn.itemConfig; + + IF @isTriggerDisabled OR visTriggerDisabled THEN LEAVE trig; END IF; @@ -35305,7 +35255,12 @@ DELIMITER ;; FOR EACH ROW trig: BEGIN DECLARE vItemFk INT; - IF @isTriggerDisabled THEN + DECLARE visTriggerDisabled BOOL; + + SELECT isItemTagTriggerDisabled INTO visTriggerDisabled + FROM vn.itemConfig; + + IF @isTriggerDisabled OR visTriggerDisabled THEN LEAVE trig; END IF; @@ -36478,19 +36433,25 @@ CREATE TABLE `packagingGifts` ( /*!40101 SET character_set_client = @saved_cs_client */; -- --- Temporary table structure for view `packingSite` +-- Table structure for table `packingSite` -- DROP TABLE IF EXISTS `packingSite`; -/*!50001 DROP VIEW IF EXISTS `packingSite`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `packingSite` ( - `hostFk` tinyint NOT NULL, - `printerFk` tinyint NOT NULL, - `code` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packingSite` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `hostFk` int(11) NOT NULL, + `printerFk` tinyint(3) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `packingSite_UN` (`code`), + KEY `packingSite_FK_1` (`printerFk`), + KEY `packingSite_FK` (`hostFk`), + CONSTRAINT `packingSite_FK` FOREIGN KEY (`hostFk`) REFERENCES `host` (`id`), + CONSTRAINT `packingSite_FK_1` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; -- -- Table structure for table `packingSiteLog` @@ -36501,8 +36462,7 @@ DROP TABLE IF EXISTS `packingSiteLog`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `packingSiteLog` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `packingSite` tinyint(3) unsigned DEFAULT NULL, + `packingSiteFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, `hostFk` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `workerFk` int(10) unsigned NOT NULL, `printerModelFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -36512,12 +36472,12 @@ CREATE TABLE `packingSiteLog` ( PRIMARY KEY (`id`), UNIQUE KEY `packingSiteLog_UN` (`id`), KEY `packingSiteLog_FK` (`workerFk`), - KEY `packingSiteLog_FK_3` (`itemPackingTypeFk`), KEY `packingSiteLog_FK_4` (`typeErrorFk`), KEY `packingSiteLog_FK_1` (`printerModelFk`), + KEY `packingSiteLog_FK_2` (`packingSiteFk`), CONSTRAINT `packingSiteLog_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), CONSTRAINT `packingSiteLog_FK_1` FOREIGN KEY (`printerModelFk`) REFERENCES `printerModel` (`code`) ON UPDATE CASCADE, - CONSTRAINT `packingSiteLog_FK_3` FOREIGN KEY (`itemPackingTypeFk`) REFERENCES `itemPackingType` (`code`) ON UPDATE CASCADE, + CONSTRAINT `packingSiteLog_FK_2` FOREIGN KEY (`packingSiteFk`) REFERENCES `packingSite` (`code`) ON UPDATE CASCADE, CONSTRAINT `packingSiteLog_FK_4` FOREIGN KEY (`typeErrorFk`) REFERENCES `packingSiteTypeError` (`code`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -36536,25 +36496,6 @@ CREATE TABLE `packingSiteTypeError` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; --- --- Table structure for table `packingSite__` --- - -DROP TABLE IF EXISTS `packingSite__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `packingSite__` ( - `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `hostFk` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `printerFk` tinyint(3) unsigned DEFAULT NULL, - PRIMARY KEY (`code`), - KEY `packingSite_FK` (`hostFk`), - KEY `packingSite_FK_1` (`printerFk`), - CONSTRAINT `packingSite_FK` FOREIGN KEY (`hostFk`) REFERENCES `vn2008`.`config_host__` (`config_host_id`), - CONSTRAINT `packingSite_FK_1` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - -- -- Table structure for table `parking` -- @@ -37454,7 +37395,6 @@ CREATE TABLE `printServerQueue` ( `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `reportFk__` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`), - UNIQUE KEY `Id_Impresora_2` (`printerFk`,`priorityFk`,`labelReportFk`,`statusFk`,`param1`,`workerFk`,`param2`), KEY `Id_estado` (`statusFk`), KEY `Id_Impresora` (`printerFk`), KEY `Id_Prioridad` (`priorityFk`), @@ -37462,7 +37402,7 @@ CREATE TABLE `printServerQueue` ( KEY `printServerQueue_FK` (`labelReportFk`), CONSTRAINT `printServerQueue_FK` FOREIGN KEY (`labelReportFk`) REFERENCES `labelReport` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `printServerQueue_ibfk_3` FOREIGN KEY (`priorityFk`) REFERENCES `queuePriority` (`id`) ON UPDATE CASCADE, - CONSTRAINT `printServerQueue_ibfk_4` FOREIGN KEY (`printerFk`) REFERENCES `vn2008`.`Impresoras__` (`Id_Impresora`) ON UPDATE CASCADE + CONSTRAINT `printServerQueue_printerFk` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37573,6 +37513,12 @@ CREATE TABLE `productionConfig` ( `rookieDays` int(11) NOT NULL DEFAULT '3' COMMENT 'dias en que se cuida con especial cuidado los pedidos de un cliente por ser nuevo o recuperado', `notBuyingMonths` int(11) NOT NULL DEFAULT '3' COMMENT 'numero de meses que han de pasar desde su ultima compra para considerar nueva la siguiente compra', `id` int(11) NOT NULL DEFAULT '1', + `isZoneClosedByExpeditionActivated` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'activa el procedimiento vn.zone_getClosed', + `maxNotReadyCollections` int(11) NOT NULL DEFAULT '5', + `minTicketsToCloseZone` int(11) DEFAULT '15' COMMENT 'mínimo numero de tickets que deben de tener expediciones para cerrar una zona', + `movingTicketDelRoute` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Si está activo, al cambiar la fecha de un ticket desde el F11, le quita la ruta', + `defaultZone` int(11) NOT NULL DEFAULT '697', + `defautlAgencyMode` int(11) NOT NULL DEFAULT '1328' COMMENT 'SENDING', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción'; /*!40101 SET character_set_client = @saved_cs_client */; @@ -37815,14 +37761,14 @@ DROP TABLE IF EXISTS `propertyNotes`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `propertyNotes` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `propertyFk` int(10) unsigned NOT NULL, + `propertyFk` int(11) NOT NULL, `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `note` text COLLATE utf8_unicode_ci NOT NULL, `userFk` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`id`), KEY `propertyNotes_FK_1` (`userFk`), KEY `propertyNotes_FK` (`propertyFk`), - CONSTRAINT `propertyNotes_FK` FOREIGN KEY (`propertyFk`) REFERENCES `account`.`user` (`id`), + CONSTRAINT `propertyNotes_FK` FOREIGN KEY (`propertyFk`) REFERENCES `property` (`id`), CONSTRAINT `propertyNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -38893,32 +38839,20 @@ BEGIN 'Este email se ha generado automáticamente' ) ); END IF; - END IF; - - IF !(ABS(NEW.isPicked) <=> ABS(OLD.isPicked)) AND NEW.quantity > 0 THEN - - UPDATE vn.collection c - JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk - /*JOIN vn.item i ON i.id = NEW.itemFk - AND (c.itemPackingTypeFk = i.itemPackingTypeFk - OR ISNULL(c.itemPackingTypeFk))*/ - SET c.salePickedCount = c.salePickedCount + IF(NEW.isPicked != 0, 1, -1); - - - END IF; - - IF !(NEW.quantity <=> OLD.quantity) AND (NEW.quantity = 0 OR OLD.quantity = 0) THEN - - UPDATE vn.collection c - JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk - /*JOIN vn.item i ON i.id = NEW.itemFk - AND (c.itemPackingTypeFk = i.itemPackingTypeFk - OR ISNULL(c.itemPackingTypeFk))*/ - SET c.saleTotalCount = c.saleTotalCount + IF(OLD.quantity = 0, 1, -1); - - END IF; - - IF !(NEW.quantity <=> OLD.quantity) THEN + IF (OLD.quantity > NEW.quantity) THEN + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT NEW.id, cm.id, sc.value + FROM saleComponent sc + JOIN component cd ON cd.id = sc.componentFk + JOIN component cm ON cm.code = 'mana' + WHERE saleFk = NEW.id AND cd.code = 'lastUnitsDiscount' + ON DUPLICATE KEY UPDATE value = sc.value + VALUES(value); + + DELETE sc.* + FROM vn.saleComponent sc + JOIN component c ON c.id = sc.componentFk + WHERE saleFk = NEW.id AND c.code = 'lastUnitsDiscount'; + END IF; INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) SELECT r.id FROM vn.sale s @@ -38929,6 +38863,22 @@ BEGIN AND r.created >= CURDATE() GROUP BY r.id; END IF; + + IF !(ABS(NEW.isPicked) <=> ABS(OLD.isPicked)) AND NEW.quantity > 0 THEN + + UPDATE vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk + SET c.salePickedCount = c.salePickedCount + IF(NEW.isPicked != 0, 1, -1); + + END IF; + + IF !(NEW.quantity <=> OLD.quantity) AND (NEW.quantity = 0 OR OLD.quantity = 0) THEN + + UPDATE vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk + SET c.saleTotalCount = c.saleTotalCount + IF(OLD.quantity = 0, 1, -1); + + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -39174,8 +39124,8 @@ CREATE TABLE `saleGoal` ( `rank` smallint(6) NOT NULL, `walletWeightFrom` int(11) NOT NULL, `walletWeightTo` int(11) DEFAULT NULL, - `goal` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `goalType` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `goal` decimal(10,2) DEFAULT NULL, + `goalType` smallint(6) DEFAULT NULL COMMENT 'grado', PRIMARY KEY (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -40447,6 +40397,7 @@ CREATE TABLE `state` ( `isOK` tinyint(4) NOT NULL DEFAULT '0', `graphCategory` int(11) NOT NULL DEFAULT '0', `isNotValidated` tinyint(1) DEFAULT '0' COMMENT 'Los tienen que ser validados por un comercial para prepararse', + `classColor` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `code_UNIQUE` (`code`), KEY `state_id3` (`semaphore`), @@ -40470,8 +40421,8 @@ CREATE TABLE `stockBuyed` ( `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `reserved` decimal(10,2) DEFAULT NULL, `requested` decimal(10,2) DEFAULT NULL, + `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`), - 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -42981,11 +42932,18 @@ CREATE TABLE `vehicle` ( `deliveryPointFk` int(11) DEFAULT '6' COMMENT 'Direccion para Buscaman', `isKmTruckRate` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Computar km como camión en el cálculo de salario de reparto', `photo` blob, + `chassis` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'numero de bastidor', + `fuelTypeFk` int(11) DEFAULT NULL, + `ppeFk` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `empresa_id` (`companyFk`), KEY `provinceFk_idx` (`warehouseFk`), KEY `vehicle_deliveryPointFk_idx` (`deliveryPointFk`), + KEY `vehicle_FK` (`fuelTypeFk`), + KEY `vehicle_FK_1` (`ppeFk`), CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `vehicle_FK` FOREIGN KEY (`fuelTypeFk`) REFERENCES `fuelType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `vehicle_FK_1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE, CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -43071,7 +43029,7 @@ CREATE TABLE `vehicleNotes` ( KEY `vehicleNotes_FK` (`vehicleFk`), CONSTRAINT `vehicleNotes_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`), CONSTRAINT `vehicleNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -43329,6 +43287,7 @@ CREATE TABLE `worker` ( `isTodayRelative` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Para el F11. Calcula los problemas de visiblidad en funcion del dia actual', `isF11Allowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Usuario autorizado para abrir el F11', `sectorFk` int(11) DEFAULT NULL COMMENT 'Sector que tiene asociado el trabajador.', + `labelerFk` tinyint(3) unsigned DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `CodigoTrabajador_UNIQUE` (`code`), UNIQUE KEY `user` (`user__`), @@ -43336,7 +43295,9 @@ CREATE TABLE `worker` ( UNIQUE KEY `Id_Cliente_Interno` (`clientFk__`), KEY `sub` (`sub`), KEY `boss_idx` (`bossFk`), + KEY `worker_FK` (`labelerFk`), CONSTRAINT `Clientes` FOREIGN KEY (`clientFk__`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `worker_FK` FOREIGN KEY (`labelerFk`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `worker_ibfk_1` FOREIGN KEY (`id`) REFERENCES `account`.`user` (`id`) ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -46737,6 +46698,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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `firstDayOfWeek` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `firstDayOfWeek`(vYear INT, vWeek INT) RETURNS date + DETERMINISTIC +BEGIN +/** + * Returns the date of the first day of the week + * + * @param vYear The year + * @param vWeek The week number + * @return Date of the first day of the week + */ + DECLARE vDate DATE; + + SELECT dated INTO vDate + FROM `time` + WHERE `year` = vYear + AND `week` = vWeek + ORDER BY dated + LIMIT 1; + + RETURN 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 `getAlert3State` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -48116,6 +48113,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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `lastDayOfWeek` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `lastDayOfWeek`(vYear INT, vWeek INT) RETURNS date + DETERMINISTIC +BEGIN +/** + * Returns the date of the last day of the week + * + * @param vYear The year + * @param vWeek The week number + * @return Date of the first day of the week + */ + DECLARE vDate DATE; + + SELECT dated INTO vDate + FROM `time` + WHERE `year` = vYear + AND `week` = vWeek + ORDER BY dated DESC + LIMIT 1; + + RETURN 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 `machineWorker_Worker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -49357,7 +49390,7 @@ BEGIN LIMIT 1; IF vTicket IS NULL THEN - CALL vn.ticketCreateWithUser( + CALL vn.ticket_add( vClientFk, IFNULL(vShipped, CURDATE()), vWarehouseFk, @@ -49367,6 +49400,7 @@ BEGIN NULL, vShipped, `account`.`myUser_getId`(), + TRUE, vTicket ); END IF; @@ -50657,9 +50691,9 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimate`(vWarehouseFk SMALLINT, vDated DATE) BEGIN @@ -50695,7 +50729,6 @@ BEGIN WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) AND landed > vDated; - DROP TEMPORARY TABLE tmp.buyUltimateFromInterval; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51604,31 +51637,30 @@ 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_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) -BEGIN - - /** - * Calcula los articulos disponibles y sus precios - * - * @table tmp.item(itemFk) Listado de artículos a calcular - * @param vLanded Fecha de recepcion de mercancia - * @param vAddressFk Id del consignatario - * @param vAgencyModeFk Id de la agencia - * @return tmp.ticketCalculateItem(itemFk, available, producer, - * item, size, stems, category, inkFk, image, origin, price) - * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) - * @return tmp.ticketComponent - * @return tmp.ticketComponentPrice - */ +BEGIN +/** + * Calcula los articulos disponibles y sus precios + * + * @table tmp.item(itemFk) Listado de artículos a calcular + * @param vLanded Fecha de recepcion de mercancia + * @param vAddressFk Id del consignatario + * @param vAgencyModeFk Id de la agencia + * @return tmp.ticketCalculateItem(itemFk, available, producer, + * item, size, stems, category, inkFk, image, origin, price) + * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) + * @return tmp.ticketComponent + * @return tmp.ticketComponentPrice + */ DECLARE vAvailableCalc INT; - DECLARE vAvailableNoRaidsCalc INT; + -- DECLARE vAvailableNoRaidsCalc INT; DECLARE vShipped DATE; DECLARE vWarehouseFk SMALLINT; DECLARE vZoneFk INT; @@ -51668,6 +51700,7 @@ BEGIN origin VARCHAR(3), price DECIMAL(10,2), priceKg DECIMAL(10,2), + `grouping` INT(10) UNSIGNED, PRIMARY KEY `itemFk` (`itemFk`) ) ENGINE = MEMORY DEFAULT CHARSET=utf8; @@ -51682,7 +51715,7 @@ BEGIN END IF; CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped); - CALL `cache`.availableNoRaids_refresh (vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped); + -- CALL `cache`.availableNoRaids_refresh (vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped); CALL vn.buyUltimate(vWarehouseFk, vShipped); INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk) @@ -51692,12 +51725,15 @@ BEGIN bu.buyFk, vZoneFk FROM `cache`.available a - LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id - AND anr.calc_id = vAvailableNoRaidsCalc + /*LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id + AND anr.calc_id = vAvailableNoRaidsCalc*/ JOIN tmp.item i ON i.itemFk = a.item_id JOIN vn.item it ON it.id = i.itemFk + JOIN vn.`zone` z ON z.id = vZoneFk LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id - LEFT JOIN edi.supplyOffer so ON so.srId = it.supplyResponseFk + LEFT JOIN edi.supplyResponse sr ON sr.ID = it.supplyResponseFk + LEFT JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + LEFT JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID LEFT JOIN (SELECT isVNHSupplier, isEarlyBird, TRUE AS itemAllowed FROM vn.addressFilter af JOIN (SELECT ad.provinceFk, p.countryFk, ad.isLogifloraAllowed @@ -51708,16 +51744,31 @@ BEGIN AND sub2.countryFk <=> IFNULL(af.countryFk, sub2.countryFk) AND sub2.isLogifloraAllowed <=> IFNULL(af.isLogifloraAllowed, sub2.isLogifloraAllowed) WHERE vWarehouseFk = af.warehouseFk - ) sub ON sub.isVNHSupplier = so.isVNHSupplier - AND IFNULL(sub.isEarlyBird, so.isEarlyBird) = so.isEarlyBird + AND (vShipped < af.beforeDated + OR ISNULL(af.beforeDated) + OR vShipped > af.afterDated + OR ISNULL(af.afterDated)) + ) sub ON sub.isVNHSupplier = v.isVNHSupplier + AND (sub.isEarlyBird = mp.isEarlyBird OR ISNULL(sub.isEarlyBird)) JOIN vn.agencyMode am ON am.id = vAgencyModeFk JOIN vn.agency ag ON ag.id = am.agencyFk JOIN vn.itemType itt ON itt.id = it.typeFk + JOIN vn.itemCategory itc on itc.id = itt.categoryFk + JOIN vn.address ad ON ad.id = vAddressFk + LEFT JOIN vn.clientItemType cit + ON cit.clientFk = ad.clientFk + AND cit.itemTypeFk = itt.id + LEFT JOIN vn.clientItemCategory cic + ON cic.clientFk = ad.clientFk + AND cic.itemCategoryFk = itc.id WHERE a.calc_id = vAvailableCalc AND a.available > 0 - AND (sub.itemAllowed OR NOT it.isFloramondo OR anr.available > 0) - AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize); - + AND (sub.itemAllowed OR NOT it.isFloramondo /*OR anr.available > 0*/) + AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize) + AND (itc.isReclining OR ISNULL(it.`size`) OR it.`size` < z.itemMaxSize OR ISNULL(z.itemMaxSize)) + AND NOT (cit.isAllowed <=> FALSE) + AND (ISNULL(cic.itemCategoryFk) OR cit.isAllowed); + DROP TEMPORARY TABLE tmp.buyUltimate; CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); @@ -51734,7 +51785,8 @@ BEGIN image, origin, price, - priceKg) + priceKg, + `grouping`) SELECT tl.itemFk, SUM(tl.available) available, @@ -51747,17 +51799,20 @@ BEGIN i.image, o.code origin, bl.price, - bl.priceKg + bl.priceKg, + bl.`grouping` FROM tmp.ticketLot tl JOIN item i ON tl.itemFk = i.id LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible JOIN origin o ON o.id = i.originFk JOIN ( - SELECT * - FROM (SELECT price, itemFk, priceKg + SELECT price, itemFk, priceKg, MIN(`grouping`) `grouping` + FROM ( + SELECT price, itemFk, priceKg, `grouping` FROM tmp.ticketComponentPrice WHERE warehouseFk = vWarehouseFk - ORDER BY (rate = 2) DESC) sub + ORDER BY (rate = 2) DESC + ) sub GROUP BY itemFk ) bl ON bl.itemFk = tl.itemFk WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk @@ -51768,339 +51823,6 @@ BEGIN CLOSE cTravelTree; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_calculate_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `catalog_calculate_beta`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) -BEGIN - - /** - * Calcula los articulos disponibles y sus precios - * - * @table tmp.item(itemFk) Listado de artículos a calcular - * @param vLanded Fecha de recepcion de mercancia - * @param vAddressFk Id del consignatario - * @param vAgencyModeFk Id de la agencia - * @return tmp.ticketCalculateItem(itemFk, available, producer, - * item, size, stems, category, inkFk, image, origin, price) - * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) - * @return tmp.ticketComponent - * @return tmp.ticketComponentPrice - */ - - DECLARE vAvailableCalc INT; - DECLARE vAvailableNoRaidsCalc INT; - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vZoneFk INT; - DECLARE vDone BOOL; - DECLARE cTravelTree CURSOR FOR - SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot( - `warehouseFk` smallint(5) unsigned NOT NULL, - `itemFk` int(11) NOT NULL, - `available` double DEFAULT NULL, - `buyFk` int(11) DEFAULT NULL, - `fix` tinyint(3) unsigned DEFAULT '0', -- este campo parece obsoleto - `zoneFk` int(11) NOT NULL, - KEY `itemFk` (`itemFk`), - KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH - ) ENGINE=MEMORY DEFAULT CHARSET=utf8; - - CALL catalog_componentPrepare(); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; - CREATE TEMPORARY TABLE tmp.ticketCalculateItem( - itemFk INT(11) NOT NULL, - available INT(11), - producer VARCHAR(50), - item VARCHAR(50), - size INT(10) UNSIGNED, - stems INT(11), - category VARCHAR(3), - inkFk VARCHAR(3), - image VARCHAR(50), - origin VARCHAR(3), - price DECIMAL(10,2), - priceKg DECIMAL(10,2), - PRIMARY KEY `itemFk` (`itemFk`) - ) ENGINE = MEMORY DEFAULT CHARSET=utf8; - - OPEN cTravelTree; - - l: LOOP - SET vDone = FALSE; - FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped; - - IF vDone THEN - LEAVE l; - END IF; - - CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped); - CALL `cache`.availableNoRaids_refresh (vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped); - CALL vn.buyUltimate(vWarehouseFk, vShipped); - - INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk) - SELECT vWarehouseFk, - a.item_id, - IFNULL(a.available, 0), - bu.buyFk, - vZoneFk - FROM `cache`.available a - LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id - AND anr.calc_id = vAvailableNoRaidsCalc - JOIN tmp.item i ON i.itemFk = a.item_id - JOIN vn.item it ON it.id = i.itemFk - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id - LEFT JOIN edi.supplyOffer so ON so.srId = it.supplyResponseFk - LEFT JOIN (SELECT isVNHSupplier, isEarlyBird, TRUE AS itemAllowed - FROM vn.addressFilter af - JOIN (SELECT ad.provinceFk, p.countryFk, ad.isLogifloraAllowed - FROM vn.address ad - JOIN vn.province p ON p.id = ad.provinceFk - WHERE ad.id = vAddressFk - ) sub2 ON sub2.provinceFk <=> IFNULL(af.provinceFk, sub2.provinceFk) - AND sub2.countryFk <=> IFNULL(af.countryFk, sub2.countryFk) - AND sub2.isLogifloraAllowed <=> IFNULL(af.isLogifloraAllowed, sub2.isLogifloraAllowed) - WHERE vWarehouseFk = af.warehouseFk - ) sub ON sub.isVNHSupplier = so.isVNHSupplier - AND IFNULL(sub.isEarlyBird, so.isEarlyBird) = so.isEarlyBird - JOIN vn.agencyMode am ON am.id = vAgencyModeFk - JOIN vn.agency ag ON ag.id = am.agencyFk - JOIN vn.itemType itt ON itt.id = it.typeFk - WHERE a.calc_id = vAvailableCalc - AND a.available > 0 - AND (sub.itemAllowed OR NOT it.isFloramondo OR anr.available > 0) - AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize); - - DROP TEMPORARY TABLE tmp.buyUltimate; - - CALL vn.catalog_componentCalculate_beta(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - INSERT INTO tmp.ticketCalculateItem ( - itemFk, - available, - producer, - item, - size, - stems, - category, - inkFk, - image, - origin, - price, - priceKg) - SELECT - tl.itemFk, - SUM(tl.available) available, - p.name producer, - i.name item, - i.size size, - i.stems, - i.category, - i.inkFk, - i.image, - o.code origin, - bl.price, - bl.priceKg - FROM tmp.ticketLot tl - JOIN item i ON tl.itemFk = i.id - LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible - JOIN origin o ON o.id = i.originFk - JOIN ( - SELECT * - FROM (SELECT price, itemFk, priceKg - FROM tmp.ticketComponentPrice - WHERE warehouseFk = vWarehouseFk - ORDER BY (rate = 2) DESC) sub - GROUP BY itemFk - ) bl ON bl.itemFk = tl.itemFk - WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk - GROUP BY tl.itemFk - ON DUPLICATE KEY UPDATE available = available + VALUES(available); - - END LOOP; - - CLOSE cTravelTree; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_calculate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `catalog_calculate__`( - vLanded DATE, - vAddressFk INT, - vAgencyModeFk INT) -proc: BEGIN -/** - * Calcula los articulos disponibles y sus precios - * - * @table tmp.item(itemFk) Listado de artículos a calcular - * @param vLanded Fecha de recepcion de mercancia - * @param vAddressFk Id del consignatario - * @param vAgencyModeFk Id de la agencia - * @return tmp.ticketCalculateItem(itemFk, available, producer, - * item, size, stems, category, inkFk, image, origin, price) - * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) - * @return tmp.ticketComponent - * @return tmp.ticketComponentPrice - * @return tmp.zoneGetShipped - */ - - DECLARE vAvailableCalc INT; - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vZoneFk INT; - DECLARE vDone BOOL; - DECLARE cTravelTree CURSOR FOR - SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - -- Establece los almacenes y las fechas que van a entrar al disponible - - CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot( - `warehouseFk` smallint(5) unsigned NOT NULL, - `itemFk` int(11) NOT NULL, - `available` double DEFAULT NULL, - `buyFk` int(11) DEFAULT NULL, - `fix` tinyint(3) unsigned DEFAULT '0', - `zoneFk` int(11) NOT NULL, - KEY `itemFk` (`itemFk`), - KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH - ) ENGINE=MEMORY DEFAULT CHARSET=utf8; - - CALL catalog_componentPrepare(); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; - CREATE TEMPORARY TABLE tmp.ticketCalculateItem( - itemFk INT(11) NOT NULL, - available INT(11), - producer VARCHAR(50), - item VARCHAR(50), - size INT(10) UNSIGNED, - stems INT(11), - category VARCHAR(3), - inkFk VARCHAR(3), - image VARCHAR(50), - origin VARCHAR(3), - price DECIMAL(10,2), - priceKg DECIMAL(10,2), - PRIMARY KEY `itemFk` (`itemFk`) - ) ENGINE = MEMORY DEFAULT CHARSET=utf8; - - OPEN cTravelTree; - - l: LOOP - SET vDone = FALSE; - FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped; - - IF vDone THEN - LEAVE l; - END IF; - - CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped); - CALL buyUltimate (vWarehouseFk, vShipped); - - INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk) - SELECT vWarehouseFk, - i.item_id, - IFNULL(i.available, 0), - bu.buyFk, - vZoneFk - FROM `cache`.available i - JOIN tmp.item br ON br.itemFk = i.item_id - LEFT JOIN item it ON it.id = i.item_id -- esta linea sobra ? - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.item_id - WHERE i.calc_id = vAvailableCalc - AND i.available > 0; - - CALL util.debugAdd('ticketLot: ', (SELECT COUNT(*) FROM tmp.ticketLot)); - - DROP TEMPORARY TABLE tmp.buyUltimate; - - CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - INSERT INTO tmp.ticketCalculateItem ( - itemFk, - available, - producer, - item, - size, - stems, - category, - inkFk, - image, - origin, - price, - priceKg) - SELECT - tl.itemFk, - SUM(tl.available) available, - p.name producer, - i.name item, - i.size size, - i.stems, - i.category, - i.inkFk, - i.image, - o.code origin, - bl.price, - bl.priceKg - FROM tmp.ticketLot tl - JOIN item i ON tl.itemFk = i.id - LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible - JOIN origin o ON o.id = i.originFk - JOIN ( - SELECT * - FROM (SELECT price, itemFk, priceKg - FROM tmp.ticketComponentPrice - WHERE warehouseFk = vWarehouseFk - ORDER BY (rate = 2) DESC) sub - GROUP BY itemFk - ) bl ON bl.itemFk = tl.itemFk - WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk - GROUP BY tl.itemFk - ON DUPLICATE KEY UPDATE available = available + VALUES(available); - - END LOOP; - - CLOSE cTravelTree; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52111,11 +51833,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 = 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_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentCalculate`( vZoneFk INT, vAddressFk INT, @@ -52135,341 +51857,6 @@ BEGIN * @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) */ - DECLARE vClientFk INT; - DECLARE vIsFrenchVNHBuyer BOOLEAN DEFAULT FALSE; - DECLARE vVNHWarehouseFk INT DEFAULT 7; - DECLARE vFrenchDiscount DECIMAL(3,2) DEFAULT 0.12; - - SELECT clientFk INTO vClientFK - FROM address - WHERE id = vAddressFk; - - SELECT (c.country = 'FRANCIA' AND vWarehouseFk = vVNHWarehouseFk) - INTO vIsFrenchVNHBuyer - FROM vn.country c - JOIN vn.province p ON p.countryFk = c.id - JOIN vn.address a ON a.provinceFk = p.id - WHERE a.id = vAddressFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate; - - CREATE TEMPORARY TABLE tmp.ticketComponentCalculate - (PRIMARY KEY (itemFk, warehouseFk)) - ENGINE = MEMORY - SELECT - tl.itemFk, - tl.warehouseFk, - tl.available, - -- IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) rate2, - IF(i.hasMinPrice, GREATEST(i.minPrice,IFNULL(pf.rate2, b.price2)),IFNULL(pf.rate2, b.price2)) rate2, - IF(i.hasMinPrice, GREATEST(i.minPrice,IFNULL(pf.rate3, b.price3)),IFNULL(pf.rate3, b.price3)) rate3, - -- @minPrice := IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) rate3, - -- TRUE AS minPrice, - IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing, - IFNULL(pf.`grouping`, b.`grouping`) `grouping`, - ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, - tl.buyFk, - i.typeFk, - IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping - FROM tmp.ticketLot tl - JOIN buy b ON b.id = tl.buyFk - JOIN item i ON i.id = tl.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN specialPrice sp ON sp.itemFk = i.id - AND sp.clientFk = vClientFk - LEFT JOIN ( - SELECT * FROM ( - SELECT pf.itemFk, - pf.`grouping`, - pf.packing, - pf.box, - pf.rate2, - pf.rate3, - zw.warehouseFk - FROM priceFixed pf - JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk - AND zw.warehouseFk IN (pf.warehouseFk,0) - WHERE vShipped BETWEEN pf.started AND pf.ended - ORDER BY pf.itemFk, pf.warehouseFk DESC - ) tpf - GROUP BY tpf.itemFk, tpf.warehouseFk - ) pf ON pf.itemFk = tl.itemFk - AND pf.warehouseFk = tl.warehouseFk - WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 - AND ic.merchandise - AND tl.zoneFk = vZoneFk - AND tl.warehouseFk = vWarehouseFk; - - -- Coste - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - c2.id, - b.buyingValue + b.freightValue + b.packageValue + b.comissionValue - FROM tmp.ticketComponentCalculate tcc - JOIN vn.component c2 ON c2.code = 'purchaseValue' - JOIN buy b ON b.id = tcc.buyFk; - - -- Margen - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - c2.id, - tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue - FROM tmp.ticketComponentCalculate tcc - JOIN vn.component c2 ON c2.code = 'margin' - JOIN buy b ON b.id = tcc.buyFk; - - -- Promo Francia - IF vIsFrenchVNHBuyer THEN - - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - c2.id, - - vFrenchDiscount * (b.buyingValue + b.freightValue + b.packageValue + b.comissionValue) / ( 1 - vFrenchDiscount) - FROM tmp.ticketComponentCalculate tcc - JOIN vn.component c2 ON c2.code = 'frenchOffer' - JOIN buy b ON b.id = tcc.buyFk; - - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase; - CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY - SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk - FROM tmp.ticketComponent tc - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk - GROUP BY tc.itemFk, warehouseFk; - - -- RECOBRO - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, tcb.itemFk, c2.id, - ROUND(tcb.base * - LEAST( - MAX(GREATEST(IFNULL(cr.priceIncreasing,0), - IFNULL(cr1.priceIncreasing,0), - IFNULL(cr2.priceIncreasing,0)) - ), - 0.25), - 3) - FROM tmp.ticketComponentBase tcb - JOIN vn.component c2 ON c2.code = 'debtCollection' - JOIN claimRatio cr ON cr.clientFk = vClientFk - LEFT JOIN clientYoke cy1 ON cy1.leftOx = cr.clientFk - LEFT JOIN claimRatio cr1 ON cr1.clientFk = cy1.rightOx - LEFT JOIN clientYoke cy2 ON cy2.rightOx = cr.clientFk - LEFT JOIN claimRatio cr2 ON cr2.clientFk = cy2.leftOx - WHERE GREATEST(IFNULL(cr.priceIncreasing,0), IFNULL(cr1.priceIncreasing,0), IFNULL(cr2.priceIncreasing,0)) > 0.009 - GROUP BY tcb.itemFk; - - -- Mana auto - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, tcb.itemFk, c2.id, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto - FROM tmp.ticketComponentBase tcb - JOIN `client` c on c.id = vClientFk - JOIN workerMana wm ON c.salesPersonFk = wm.workerFk - JOIN vn.component c2 ON c2.code = 'autoMana' - WHERE wm.isPricesModifierActivated - HAVING manaAuto <> 0; - - -- Precios especiales - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, - tcb.itemFk, - c2.id, - GREATEST( - IFNULL(ROUND(tcb.base * c2.tax, 4), 0), - IF(i.hasMinPrice, i.minPrice,0) - tcc.rate3 - ) cost - FROM tmp.ticketComponentBase tcb - JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount' - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - JOIN vn.item i ON i.id = tcb.itemFk - WHERE sp.value IS NULL - AND i.supplyResponseFk IS NULL; - - -- Venta por paquetes - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 - FROM tmp.ticketComponentCalculate tcc - JOIN vn.component c2 ON c2.code = 'salePerPackage' - JOIN buy b ON b.id = tcc.buyFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE sp.value IS NULL; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.zone (INDEX (id)) - ENGINE = MEMORY - SELECT vZoneFk id; - - CALL zone_getOptionsForShipment(vShipped, TRUE); - - -- Reparto - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFK, - tcc.itemFk, - c2.id, - z.inflation * ROUND(ic.cm3delivery * (IFNULL(zo.price,5000) - IFNULL(zo.bonus,0)) / (1000 * vc.standardFlowerBox) , 4) cost - FROM tmp.ticketComponentCalculate tcc - JOIN item i ON i.id = tcc.itemFk - JOIN tmp.zoneOption zo ON zo.zoneFk = vZoneFk - JOIN zone z ON z.id = vZoneFk - JOIN agencyMode am ON am.id = z.agencyModeFk - JOIN vn.volumeConfig vc - JOIN vn.component c2 ON c2.code = 'delivery' - LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk - AND ic.itemFk = tcc.itemFk - HAVING cost <> 0; - - DROP TEMPORARY TABLE tmp.zoneOption; - /* - -- Extra reparto - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcc.warehouseFk, tcc.itemFk, c2.id, ap.packagingValue cost - FROM tmp.ticketComponentCalculate tcc - JOIN vn.addressForPackaging ap - JOIN vn.component c2 ON c2.code = 'bagged' - WHERE ap.addressFk = vAddressFk; - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy; - CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY - SELECT * FROM tmp.ticketComponent; - - -- Precio especial - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - c2.id, - sp.value - SUM(tcc.cost) sumCost - FROM tmp.ticketComponentCopy tcc - JOIN component c ON c.id = tcc.componentFk - JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk - JOIN vn.component c2 ON c2.code = 'specialPrices' - WHERE c.classRate IS NULL - AND tcc.warehouseFk = vWarehouseFk - GROUP BY tcc.itemFk, tcc.warehouseFk - HAVING ABS(sumCost) > 0.001; - - -- Rappel - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - IFNULL(c.componentFk ,c2.id), - SUM(tcc.cost) * ((1/(1-c.rappel/100)) -1) sumCost - FROM tmp.ticketComponentCopy tcc - JOIN vn.clientChain cc ON cc.clientFk = vClientFk - JOIN vn.`chain` c ON c.id = cc.chainFk - JOIN vn.component c2 ON c2.code = 'rappel' - WHERE tcc.warehouseFk = vWarehouseFk - GROUP BY tcc.itemFk, tcc.warehouseFk; - - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum; - CREATE TEMPORARY TABLE tmp.ticketComponentSum - (INDEX (itemFk, warehouseFk)) - ENGINE = MEMORY - SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate - FROM tmp.ticketComponent tc - JOIN component c ON c.id = tc.componentFk - GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; - CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY - SELECT tcc.warehouseFk, - tcc.itemFk, - 1 rate, - IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`, - CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, - CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 1) = 1 - AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT - tcc.warehouseFk, - tcc.itemFk, - 2 rate, - tcc.packing `grouping`, - SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2 - AND tcc.packing > 0 AND tcc.available >= tcc.packing) - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT - tcc.warehouseFk, - tcc.itemFk, - 3 rate, - tcc.available `grouping`, - SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 3) = 3 - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT * FROM ( - SELECT * FROM tmp.ticketComponentRate ORDER BY price - ) t - GROUP BY itemFk, warehouseFk, `grouping`; - - DROP TEMPORARY TABLE - tmp.ticketComponentCalculate, - tmp.ticketComponentSum, - tmp.ticketComponentBase, - tmp.ticketComponentRate, - tmp.ticketComponentCopy; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_componentCalculate_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `catalog_componentCalculate_beta`( vZoneFk INT, - vAddressFk INT, - vShipped DATE, - vWarehouseFk INT) -BEGIN - /** - * Calcula los componentes de los articulos de tmp.ticketLot - * - * @param vZoneFk para calcular el transporte - * @param vAddressFk Consignatario - * @param vShipped dia de salida del pedido - * @param vWarehouseFk warehouse de salida del pedido - * @table tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk) - * @table tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - * - * @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - */ - DECLARE vClientFk INT; DECLARE vIsFrenchVNHBuyer BOOLEAN DEFAULT FALSE; DECLARE vVNHWarehouseFk INT DEFAULT 7; @@ -52797,456 +52184,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 `catalog_componentCalculate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `catalog_componentCalculate__`( - vZoneFk INT, - vAddressFk INT, - vShipped DATE, - vWarehouseFk INT) -proc: BEGIN -/** - * Calcula los componentes de los articulos de tmp.ticketLot - * - * @param vZoneFk para calcular el transporte - * @param vAddressFk Consignatario - * @param vShipped dia de salida del pedido - * @param vWarehouseFk warehouse de salida del pedido - * @param tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk) - * @table tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - * - * @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - */ - DECLARE vClientFk INT; - DECLARE vMinimumDensityWeight INT DEFAULT 167; - DECLARE vBoxVolume BIGINT; - DECLARE vSpecialPriceComponent INT DEFAULT 10; - DECLARE vDeliveryComponent INT DEFAULT 15; - DECLARE vRecoveryComponent INT DEFAULT 17; - DECLARE vSellByPacketComponent INT DEFAULT 22; - DECLARE vBuyValueComponent INT DEFAULT 28; - DECLARE vMarginComponent INT DEFAULT 29; - DECLARE vDiscountLastItemComponent INT DEFAULT 32; - DECLARE vExtraBaggedComponent INT DEFAULT 38; - DECLARE vManaAutoComponent INT DEFAULT 39; - DECLARE vFrenchOffer INT DEFAULT 42; - DECLARE vIsFrenchVNHBuyer BOOLEAN DEFAULT FALSE; - DECLARE vVNHWarehouseFk INT DEFAULT 7; - DECLARE vFloramondoWarehouseFk INT DEFAULT 40; - DECLARE vIsLogifloraAllowed BOOLEAN DEFAULT 0; - DECLARE vMaxLogifloraDays INT; - DECLARE vRangeLogifloraDays INT DEFAULT 3; - DECLARE vVisibleCache INT; - DECLARE vRappelComponent INT DEFAULT 44; - DECLARE vIsZonePremium BOOL; - DECLARE vFrenchDiscount DECIMAL(3,2) DEFAULT 0.12; - DECLARE vIsCatalonianBuyer BOOL; - DECLARE visAnyVolumeAllowed BOOL; - - SELECT (COUNT(*) > 0) INTO vIsZonePremium - FROM vn.zoneFilter zf - WHERE zf.zoneFk = vZoneFk; - - SELECT vc.standardFlowerBox * 1000 INTO vBoxVolume - FROM vn.volumeConfig vc; - - SELECT clientFk, isLogifloraAllowed INTO vClientFK, vIsLogifloraAllowed - FROM address - WHERE id = vAddressFk; - - SELECT (c.country IN ('Francia','Suiza') AND vWarehouseFk IN (vVNHWarehouseFk, vFloramondoWarehouseFk)) - INTO vIsFrenchVNHBuyer - FROM vn.country c - JOIN vn.province p ON p.countryFk = c.id - JOIN vn.address a ON a.provinceFk = p.id - WHERE a.id = vAddressFk; - - SELECT (p.name = 'Barcelona' AND vWarehouseFk = vVNHWarehouseFk) - INTO vIsCatalonianBuyer - FROM vn.province p - JOIN vn.address a ON a.provinceFk = p.id - WHERE a.id = vAddressFk; -- PAK 18/10/21 - - SELECT travellingDays INTO vMaxLogifloraDays - FROM edi.warehouseFloramondo - WHERE warehouseFk = vWarehouseFk; - - -- Se eliminan los productos de tamaños no convencionales, salvo agencias que lo permitan - SELECT a.isAnyVolumeAllowed INTO visAnyVolumeAllowed - FROM vn.agency a - JOIN vn.agencyMode am ON am.agencyFk = a.id - JOIN vn.`zone`z ON z.agencyModeFk = am.id - WHERE z.id = vZoneFk; - - IF NOT vIsAnyVolumeAllowed THEN - - DELETE tl.* - FROM tmp.ticketLot tl - JOIN vn.item i ON i.id = tl.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - WHERE it.isUnconventionalSize; - - END IF; - - -- Esto sirve para que los franceses compren sólo por las cuentas de VNH - DELETE tl.* - FROM tmp.ticketLot tl - JOIN vn.item i ON i.id = tl.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - WHERE v.isVNHSupplier != vIsFrenchVNHBuyer; - - IF (NOT vIsLogifloraAllowed AND vVNHWarehouseFk != vWarehouseFk) - OR NOT vn.isLogifloraDay(vShipped, vWarehouseFk) - -- OR NOT(vIsCatalonianBuyer OR vIsFrenchVNHBuyer) - THEN - - CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); - - DELETE tl FROM tmp.ticketLot tl - JOIN item i ON i.id = tl.itemFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.entry e ON e.id = b.entryFk - LEFT JOIN vn.supplier s ON s.id = e.supplierFk -- PAK 13/10/21 - LEFT JOIN cache.visible v ON v.calc_id = vVisibleCache AND v.item_id = i.id - LEFT JOIN (SELECT DISTINCT s.itemFk - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - WHERE t.warehouseFk = vWarehouseFk - AND t.addressFk = vAddressFk - AND t.shipped = vShipped - AND t.zoneFk = vZoneFk) sub ON sub.itemFk = i.id - WHERE (i.supplyResponseFk - AND (IFNULL(e.isRaid,TRUE) - OR s.nickname = 'INVENTARIO') -- PAK 13/10/21 - AND ISNULL(sub.itemFk) - AND IFNULL(v.visible,0) = 0 - AND vWarehouseFk = tl.warehouseFk); - - END IF; - - -- Eliminem productes de la oferta que no deuen vore els francesos - IF vIsFrenchVNHBuyer THEN - - CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); - - DELETE tl FROM tmp.ticketLot tl - JOIN item i ON i.id = tl.itemFk - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - LEFT JOIN cache.visible v ON v.calc_id = vVisibleCache AND v.item_id = i.id - LEFT JOIN (SELECT DISTINCT s.itemFk - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - WHERE t.warehouseFk = vWarehouseFk - AND t.addressFk = vAddressFk - AND t.shipped = vShipped - AND t.zoneFk = vZoneFk) sub ON sub.itemFk = i.id - WHERE (mp.isEarlyBird = FALSE - AND IFNULL(sub.itemFk,0) = 0 - AND IFNULL(v.visible ,0) = 0); - - END IF; - - -- Eliminem productes de la oferta que no deuen vore les zones PREMIUM - IF vIsZonePremium THEN - - DELETE tl.* - FROM tmp.ticketLot tl - JOIN item i ON i.id = tl.itemFk - LEFT JOIN vn.zoneFilter zf ON zf.itemTypeFk = i.typeFk - AND zf.zoneFk = vZoneFk - AND i.`size` <= zf.sizeMax - WHERE zf.id IS NULL ; - - END IF; - - -- Eliminem productes de la oferta que la zona no pot transportar - DELETE tl.* - FROM tmp.ticketLot tl - JOIN item i ON i.id = tl.itemFk - JOIN vn.zone z ON z.id = vZoneFk - WHERE i.size > z.itemMaxSize; - - SET @rate2 := 0; - SET @rate3 := 0; - SET @minPrice := 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate; - CREATE TEMPORARY TABLE tmp.ticketComponentCalculate - (PRIMARY KEY (itemFk, warehouseFk)) - ENGINE = MEMORY - SELECT - tl.itemFk, - tl.warehouseFk, - tl.available, - IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) * 1.0 rate2, - @minPrice := IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) * 1.0 rate3, - IFNULL(@minPrice, 0) AS minPrice, - IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing, - IFNULL(pf.`grouping`, b.`grouping`) `grouping`, - ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, - tl.buyFk, - i.typeFk, - IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping - FROM tmp.ticketLot tl - JOIN buy b ON b.id = tl.buyFk - JOIN item i ON i.id = tl.itemFk - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN specialPrice sp ON sp.itemFk = i.id AND sp.clientFk = vClientFk - LEFT JOIN ( - SELECT * FROM ( - SELECT pf.itemFk, pf.`grouping`, pf.packing, pf.box, pf.rate2, pf.rate3, zw.warehouseFk - FROM priceFixed pf - JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk AND (zw.warehouseFk = pf.warehouseFk OR pf.warehouseFk = 0) - WHERE vShipped BETWEEN pf.started AND pf.ended ORDER BY pf.itemFk, pf.warehouseFk DESC - ) tpf - GROUP BY tpf.itemFk, tpf.warehouseFk - ) pf ON pf.itemFk = tl.itemFk AND pf.warehouseFk = tl.warehouseFk - WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 AND ic.merchandise <> 0 - AND tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk; - - -- Coste - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - vBuyValueComponent, - b.buyingValue + b.freightValue + b.packageValue + b.comissionValue - FROM tmp.ticketComponentCalculate tcc - JOIN buy b ON b.id = tcc.buyFk; - - -- Margen - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - vMarginComponent, - tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue - FROM tmp.ticketComponentCalculate tcc - JOIN buy b ON b.id = tcc.buyFk; - - -- Promo Francia - IF vIsFrenchVNHBuyer THEN - - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - vFrenchOffer, - - vFrenchDiscount * (b.buyingValue + b.freightValue + b.packageValue + b.comissionValue) / ( 1 - vFrenchDiscount) - FROM tmp.ticketComponentCalculate tcc - JOIN buy b ON b.id = tcc.buyFk; - - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase; - CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY - SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk - FROM tmp.ticketComponent tc - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk - GROUP BY tc.itemFk, warehouseFk; - - -- RECOBRO - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, tcb.itemFk, vRecoveryComponent, - ROUND(tcb.base * LEAST(MAX(GREATEST(IFNULL(cr.priceIncreasing,0), IFNULL(cr1.priceIncreasing,0), IFNULL(cr2.priceIncreasing,0))), 0.25), 3) - FROM tmp.ticketComponentBase tcb - JOIN claimRatio cr ON cr.clientFk = vClientFk - LEFT JOIN clientYoke cy1 ON cy1.leftOx = cr.clientFk - LEFT JOIN claimRatio cr1 ON cr1.clientFk = cy1.rightOx - LEFT JOIN clientYoke cy2 ON cy2.rightOx = cr.clientFk - LEFT JOIN claimRatio cr2 ON cr2.clientFk = cy2.leftOx - WHERE GREATEST(IFNULL(cr.priceIncreasing,0), IFNULL(cr1.priceIncreasing,0), IFNULL(cr2.priceIncreasing,0)) > 0.009 - GROUP BY tcb.itemFk; - - -- Mana auto - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, tcb.itemFk, vManaAutoComponent, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto - FROM tmp.ticketComponentBase tcb - JOIN `client` c on c.id = vClientFk - JOIN workerMana wm ON c.salesPersonFk = wm.workerFk - WHERE wm.isPricesModifierActivated - HAVING manaAuto <> 0; - - -- Precios especiales - INSERT INTO tmp.ticketComponent - SELECT tcb.warehouseFk, - tcb.itemFk, - c.id, - GREATEST(IFNULL(ROUND(tcb.base * c.tax, 4), 0), tcc.minPrice - tcc.rate3) - FROM tmp.ticketComponentBase tcb - JOIN component c - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - JOIN vn.item i ON i.id = tcb.itemFk - WHERE c.id = vDiscountLastItemComponent - AND c.tax <> 0 - AND tcc.minPrice < tcc.rate3 - AND sp.value IS NULL - AND i.supplyResponseFk IS NULL; -- FLORAMONDO - - -- Venta por paquetes - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, tcc.itemFk, vSellByPacketComponent, tcc.rate2 - tcc.rate3 - FROM tmp.ticketComponentCalculate tcc - JOIN buy b ON b.id = tcc.buyFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE sp.value IS NULL; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.zone (INDEX (id)) - ENGINE = MEMORY - SELECT vZoneFk id; - - CALL zone_getOptionsForShipment(vShipped, TRUE); - - -- Reparto - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFK, - tcc.itemFk, - vDeliveryComponent, - z.inflation * ROUND(ic.cm3delivery * (IFNULL(zo.price,5000) - IFNULL(zo.bonus,0)) / vBoxVolume, 4) cost - FROM tmp.ticketComponentCalculate tcc - JOIN item i ON i.id = tcc.itemFk - JOIN tmp.zoneOption zo ON zo.zoneFk = vZoneFk - JOIN zone z ON z.id = vZoneFk - JOIN agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk - AND ic.itemFk = tcc.itemFk - HAVING cost <> 0; - - DROP TEMPORARY TABLE tmp.zoneOption; - - -- Extra reparto - IF (SELECT COUNT(*) FROM vn.addressForPackaging WHERE addressFk = vAddressFk) THEN - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, b.itemFk, vExtraBaggedComponent, ap.packagingValue cost - FROM tmp.ticketComponentCalculate tcc - JOIN vn.addressForPackaging ap - WHERE ap.addressFk = vAddressFk; - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy; - CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY - SELECT * FROM tmp.ticketComponent; - - -- Precio especial - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - vSpecialPriceComponent, - sp.value - SUM(tcc.cost) sumCost - FROM tmp.ticketComponentCopy tcc - JOIN component c ON c.id = tcc.componentFk - JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk - WHERE c.classRate IS NULL - AND tcc.warehouseFk = vWarehouseFk - GROUP BY tcc.itemFk, tcc.warehouseFk - HAVING ABS(sumCost) > 0.001; - - -- Rappel - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - IFNULL(c.componentFk ,vRappelComponent), - SUM(tcc.cost) * ((1/(1-c.rappel/100)) -1) sumCost - FROM tmp.ticketComponentCopy tcc - JOIN vn.clientChain cc ON cc.clientFk = vClientFk - JOIN vn.`chain` c ON c.id = cc.chainFk - WHERE tcc.warehouseFk = vWarehouseFk - GROUP BY tcc.itemFk, tcc.warehouseFk; - - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum; - CREATE TEMPORARY TABLE tmp.ticketComponentSum - (INDEX (itemFk, warehouseFk)) - ENGINE = MEMORY - SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate - FROM tmp.ticketComponent tc - JOIN component c ON c.id = tc.componentFk - GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; - CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY - SELECT tcc.warehouseFk, - tcc.itemFk, - 1 rate, - IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`, - CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, - CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 1) = 1 - AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT - tcc.warehouseFk, - tcc.itemFk, - 2 rate, - tcc.packing `grouping`, - SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2 - AND tcc.packing > 0 AND tcc.available >= tcc.packing) - GROUP BY tcs.warehouseFk, tcs.itemFk; - - IF vIsZonePremium THEN - - DELETE - FROM tmp.ticketComponentRate - WHERE rate = 1; - - END IF; - - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT - tcc.warehouseFk, - tcc.itemFk, - 3 rate, - tcc.available `grouping`, - SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 3) = 3 - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT * FROM ( - SELECT * FROM tmp.ticketComponentRate ORDER BY price - ) t - GROUP BY itemFk, warehouseFk, `grouping`; - - DROP TEMPORARY TABLE - tmp.ticketComponentCalculate, - tmp.ticketComponentSum, - tmp.ticketComponentBase, - tmp.ticketComponentRate, - tmp.ticketComponentCopy; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_componentPrepare` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -54375,7 +53312,7 @@ BEGIN FROM vn.warehouse WHERE hasConfectionTeam; - CALL vn.ticketCreateWithUser( + CALL vn.ticket_add( vClientFk ,CURDATE() ,vWarehouseFk -- Algemesi @@ -54385,6 +53322,7 @@ BEGIN ,NULL -- route ,CURDATE() ,account.myUser_getId() + ,TRUE ,vNewTicket); INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) @@ -54825,7 +53763,12 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_getByTicket`(vTicketFk INT) BEGIN + + DECLARE vLandingDays INT; + SELECT landingDays INTO vLandingDays + FROM vn.cmrConfig; + IF vTicketFk THEN IF (SELECT count(ticketFk) FROM vn.cmr WHERE ticketFk = vTicketFk) THEN @@ -54834,8 +53777,8 @@ BEGIN ELSE - INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, supplierFk) - SELECT vTicketFk, t.companyFk, a.id, t.addressFk, ag.supplierFk + INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, supplierFk, ead) + SELECT vTicketFk, t.companyFk, a.id, t.addressFk, ag.supplierFk, vLandingDays FROM vn.ticket t JOIN vn.agencyMode am ON am.id = t.agencyModeFk JOIN vn.agency ag ON ag.id = am.agencyFk @@ -54849,7 +53792,7 @@ BEGIN ELSE - INSERT INTO vn.cmr(created) VALUES(NOW()); + INSERT INTO vn.cmr(created, ead) VALUES(NOW(), NOW() + INTERVAL vLandingDays DAY); SELECT LAST_INSERT_ID(); @@ -55284,54 +54227,6 @@ BEGIN CALL vn.sale_calculateComponent(vSaleFk, 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 `collection_faults` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_faults`( - vShelvingFk VARCHAR(10), - vQuantity INT, - vItemFk INT) -BEGIN - DECLARE vQuantityTotal INT DEFAULT 0; - DECLARE vshelve VARCHAR(2); - DECLARE vdeep INT(11); - DECLARE vpriority INT(11); - DECLARE vgrouping SMALLINT(5); - DECLARE vpacking INT(11); - DECLARE vpackagingFk VARCHAR(10); - DECLARE vlevel VARCHAR(45); - DECLARE vuserFk INT(10); - - - SELECT SUM(quantity),shelve,deep,priority,`grouping`,packing,packagingFk,`level`,userFk - INTO vQuantityTotal,vshelve,vdeep,vpriority,vgrouping,vpacking,vpackagingFk,vlevel,vuserFk - FROM vn.itemShelving - WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci AND itemFk = vItemFk - GROUP BY itemFk; - - SELECT vQuantityTotal - vQuantity INTO vQuantityTotal; - - DELETE FROM vn.itemShelving WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci AND itemFk = vItemFk; - - INSERT INTO vn.itemShelving (itemFk, shelvingFk,shelve,deep,quantity,visible,available,priority,`grouping`,packing,packagingFk,`level`,userFk ) - VALUES (vItemFk,vShelvingFk,vshelve,vdeep,vQuantityTotal,vQuantityTotal,vQuantityTotal,vpriority,vgrouping,vpacking,vpackagingFk,vlevel,vuserFk ); - - SELECT * FROM vn.itemShelving - WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci AND itemFk = vItemFk; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -55551,7 +54446,16 @@ BEGIN WHERE c.id = vClientFk LIMIT 1; - CALL ticketCreateWithUser(vClientFk, NOW(), vWarehouseFk, 442, vConsignatario, NULL, NULL, NULL, account.userGetId(), vTicketFk); + CALL ticket_add(vClientFk, + NOW(), vWarehouseFk, + 442, + vConsignatario, + NULL, + NULL, + NULL, + account.userGetId(), + TRUE, + vTicketFk); SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; @@ -56125,19 +55029,24 @@ proc:BEGIN DECLARE vMaxTicketPrinted INT; DECLARE vItemPackingTypeFk VARCHAR(1); DECLARE hasAssignedTickets BOOLEAN; - DECLARE vMaxNotReadyCollections INT DEFAULT 0; + DECLARE vMaxNotReadyCollections INT; DECLARE vNotReadyCollections INT; DECLARE vTrainFk INT DEFAULT 1; - - /*IF NOT vn.deviceProductionUser_Exists(vn.getUser()) THEN + DECLARE vUserFk INT; + DECLARE vHourMatters BOOL DEFAULT TRUE; + + SELECT pc.ticketPrintedMax * vWagons, pc.ticketTrolleyMax * vWagons, pc.maxNotReadyCollections + INTO vMaxTicketPrinted, vMaxTickets, vMaxNotReadyCollections + FROM vn.productionConfig pc; + /*IF NOT vn.deviceProductionUser_Exists(vUserFk) THEN LEAVE proc; END IF;*/ - SELECT w.code INTO vWorkerCode + SELECT w.code, w.id INTO vWorkerCode, vUserFk FROM vn.worker w - WHERE w.id = vn.getUser(); + WHERE w.id =account.userGetId(); -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando SELECT isPreviousPrepared, warehouseFk, itemPackingTypeFk @@ -56148,8 +55057,8 @@ proc:BEGIN -- Si está habilitado el modo cazador para las motos, y el usuario no esta registrado, se sale. IF (SELECT isTractorHuntingMode FROM vn.deviceProductionConfig dpc) AND vItemPackingTypeFk = 'H' THEN - IF (SELECT COUNT(*) FROM vn.workerWithoutTractor wwt WHERE wwt.workerFk = account.userGetId()) THEN - INSERT INTO tmp.kk(userFk) VALUES(vn.getUser()); + IF (SELECT COUNT(*) FROM vn.workerWithoutTractor wwt WHERE wwt.workerFk = vUserFk) THEN + CALL util.throw('Usuario no registrado con moto'); LEAVE proc; END IF; END IF; @@ -56157,23 +55066,29 @@ proc:BEGIN -- Si hay colecciones sin terminar, sale del proceso SELECT count(*) INTO vNotReadyCollections - FROM vn.collection c - WHERE c.workerFk = vn.getUser() - AND c.saleTotalCount > c.salePickedCount + 1 - AND c.created > TIMESTAMPADD(HOUR , -5,NOW()); + FROM ( + SELECT count(DISTINCT s.id) totalRow, count(DISTINCT st.id) pickedRow + FROM vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.state ss ON ss.code = 'PREPARED' + LEFT JOIN vn.saleTracking st ON st.saleFk = s.id AND st.stateFk = ss.id + WHERE c.workerFk = vUserFk + AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) + AND s.quantity != 0 + GROUP BY c.id + HAVING totalRow > pickedRow) sub; IF vMaxNotReadyCollections < vNotReadyCollections THEN - + + CALL util.throw('Hay colecciones pendientes'); LEAVE proc; END IF; - SELECT ticketPrintedMax * vWagons, ticketTrolleyMax * vWagons - INTO vMaxTicketPrinted, vMaxTickets - FROM vn.productionConfig pc; - IF vIsPreviousPrepared THEN + CALL util.throw('Es de preparación previa'); LEAVE proc; -- Hasta que tengamos el altillo, vamos a cancelar esta opcion SELECT id INTO vStateFk @@ -56194,6 +55109,8 @@ proc:BEGIN SET vTrainFk = 2; + SET vHourMatters = FALSE; + DELETE pb.* FROM tmp.productionBuffer pb JOIN vn.volumeConfig vc @@ -56203,7 +55120,7 @@ proc:BEGIN -- Se obtiene nº de colección y el buffer con los pedidos preparables INSERT INTO vn.collection - SET workerFk = account.myUser_getId(), + SET workerFk = vUserFk, itemPackingTypeFk = vItemPackingTypeFk, trainFk = vTrainFk; @@ -56283,7 +55200,7 @@ proc:BEGIN AND ( (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) ) AND (pc.isPreviousPreparationRequired = FALSE OR pb.previousWithoutParking = FALSE); @@ -56293,7 +55210,7 @@ proc:BEGIN -- AutoPRINT INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT s2.id, pb.ticketFk, vn.getUser() + SELECT s2.id, pb.ticketFk, vUserFk FROM tmp.productionBuffer pb JOIN vn.agencyMode am ON am.id = pb.agencyModeFk JOIN vn.agency a ON a.id = am.agencyFk @@ -56312,7 +55229,7 @@ proc:BEGIN AND ( (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) ) AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , NOW()) AND (pc.isPreviousPreparationRequired = FALSE @@ -56338,7 +55255,7 @@ proc:BEGIN WHERE ( (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) ) AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) @@ -56426,11 +55343,15 @@ proc:BEGIN LIMIT 1; -- Hay que excluir aquellos que no tengan la misma hora de preparación - DELETE - FROM tmp.ticket - WHERE HH != vHour - OR mm != vMinute; + IF vHourMatters THEN + DELETE + FROM tmp.ticket + WHERE HH != vHour + OR mm != vMinute; + + END IF; + -- En el caso de pedidos de más volumen de un carro, la colección será monoticket. Pero si el primer pedido -- no es monoticket, excluimos a los de más de un carro IF (SELECT (t.shelveLiters > vc.trolleyM3 * 1000) @@ -56632,7 +55553,7 @@ proc:BEGIN -- Actualiza el estado de los tickets INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT vStateFk, ticketFk, account.myUser_getId() + SELECT vStateFk, ticketFk, vUserFk FROM vn.ticketCollection tc WHERE tc.collectionFk = vCollectionFk; @@ -56662,6 +55583,7 @@ proc:BEGIN ELSE + CALL util.throw('No ha sido posible obtener colección'); DELETE FROM vn.collection WHERE id = vCollectionFk; END IF; @@ -56671,7 +55593,8 @@ proc:BEGIN tmp.ticketShelveLiters, tmp.ticket, tmp.wagonsVolumetry, - tmp.ticketShelve; + tmp.ticketShelve, + tmp.productionBuffer; END ;; DELIMITER ; @@ -56679,7 +55602,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 `collection_reject` */; +/*!50003 DROP PROCEDURE IF EXISTS `collection_newWithWagon_beta` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; @@ -56689,25 +55612,671 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_reject`(vSale INT, vQuantity INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_newWithWagon_beta`(vUserFk INT, vSectorFk INT, vWagons INT) +proc:BEGIN + + DECLARE vIsPreviousPrepared BOOLEAN; + DECLARE vCollectionFk INT; + DECLARE vWarehouseFk INT; + DECLARE vMaxTickets INT; + DECLARE vStateFk INT; + DECLARE vFirstTicketFk INT; + DECLARE vHour INT; + DECLARE vMinute INT; + DECLARE vWorkerCode VARCHAR(3); + DECLARE vWagon INT; + DECLARE vWagonCounter INT; + DECLARE vShelve INT; + DECLARE vTicket INT; + DECLARE vTicketToSplit INT; + DECLARE vPrintedTickets INT; + DECLARE vMaxTicketPrinted INT; + DECLARE vItemPackingTypeFk VARCHAR(1); + DECLARE hasAssignedTickets BOOLEAN; + DECLARE vMaxNotReadyCollections INT DEFAULT 0; + DECLARE vNotReadyCollections INT; + DECLARE vTrainFk INT DEFAULT 1; + DECLARE vNow DATETIME; + + SELECT ticketPrintedMax * vWagons, ticketTrolleyMax * vWagons, pc.maxNotReadyCollections , NOW() + INTO vMaxTicketPrinted, vMaxTickets, vMaxNotReadyCollections, vNow + FROM vn.productionConfig pc; + + SELECT w.code INTO vWorkerCode + FROM vn.worker w + WHERE w.id = vUserFk; + + -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando + SELECT isPreviousPrepared, warehouseFk, itemPackingTypeFk + INTO vIsPreviousPrepared, vWarehouseFk, vItemPackingTypeFk + FROM vn.sector + WHERE id = vSectorFk; -- Hola + +-- Si está habilitado el modo cazador para las motos, y el usuario no esta registrado, se sale. + + IF (SELECT isTractorHuntingMode FROM vn.deviceProductionConfig dpc) AND vItemPackingTypeFk = 'H' THEN + IF (SELECT COUNT(*) FROM vn.workerWithoutTractor wwt WHERE wwt.workerFk = vUserFk) THEN + CALL util.throw('Usuario no registrado con moto'); + LEAVE proc; + END IF; + END IF; + +-- Si hay colecciones sin terminar, sale del proceso + SELECT count(*) INTO vNotReadyCollections + FROM ( + SELECT count(DISTINCT s.id) totalRow, count(DISTINCT st.id) pickedRow + FROM vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.state ss ON ss.code = 'PREPARED' + LEFT JOIN vn.saleTracking st ON st.saleFk = s.id AND st.stateFk = ss.id + WHERE c.workerFk = vUserFk + AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) + AND s.quantity != 0 + GROUP BY c.id + HAVING totalRow > pickedRow) sub; + +call util.debugAdd('wargo',CONCAT('vMaxNotReadyCollections ', vMaxNotReadyCollections)); +call util.debugAdd('wargo',CONCAT('vNotReadyCollections ',vNotReadyCollections)); + + IF vMaxNotReadyCollections < vNotReadyCollections THEN + + CALL util.throw('Hay colecciones pendientes'); + LEAVE proc; + + END IF; + + IF vIsPreviousPrepared THEN + + CALL util.throw('Es de preparación previa'); + LEAVE proc; -- Hasta que tengamos el altillo, vamos a cancelar esta opcion + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'PREVIOUS_PREPARATION'; + + ELSE + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'ON_PREPARATION'; + + END IF; + + CALL vn.productionControl(vWarehouseFk, 0); + + -- Esto hay que corregirlo añadiendo un nuevo parámetro al proc. PAK 23/12/21 + IF vSectorFk = 65 THEN -- Pedidos pequeños + + SET vTrainFk = 2; + + DELETE pb.* + FROM tmp.productionBuffer pb + JOIN vn.volumeConfig vc + WHERE pb.m3 * 1000 > vc.minTicketVolume; + + END IF; + + -- Se obtiene nº de colección y el buffer con los pedidos preparables + INSERT INTO vn.collection + SET workerFk = vUserFk, + itemPackingTypeFk = vItemPackingTypeFk, + trainFk = vTrainFk; + + SELECT LAST_INSERT_ID() INTO vCollectionFk; + + -- 05/08/2021 PAK Jose Frau pide que los tickets de recogida en Algemesí sólo se saquen si están asignados. + DELETE pb.* + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE pb.agency = 'REC_ALGEMESI' + AND s.code != 'PICKER_DESIGNED'; + + -- 2/3/2022 PAK Se acuerda con Pepe que los pedidos con riesgo no se sacan aunque se asignen. + DELETE pb.* + FROM tmp.productionBuffer pb + WHERE pb.problem LIKE '%RIESGO%'; + + -- Comprobamos si hay tickets asignados. En ese caso, nos centramos exclusivamente en esos tickets + -- y los sacamos independientemente de problemas o tamaños + SELECT COUNT(*) INTO hasAssignedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode; + + IF hasAssignedTickets THEN + + UPDATE vn.collection + SET itemPackingTypeFk = NULL + WHERE id = vCollectionFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; + CREATE TEMPORARY TABLE tmp.ticketToSplit + SELECT pb.ticketFk + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode + ORDER BY HH, + mm, + s.`order` DESC, + pb.m3 DESC; + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + + SELECT MIN(ticketFk) INTO vTicketToSplit + FROM tmp.ticketToSplit; + + CALL vn.ticket_splitItemPackingType(vTicketToSplit); + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT ticketFk, vCollectionFk + FROM tmp.ticketIPT + WHERE (itemPackingTypeFk = vItemPackingTypeFk) ; + + DELETE FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit; + + DROP TEMPORARY TABLE tmp.ticketIPT; + + END WHILE; + + CALL vn.productionControl(vWarehouseFk, 0); + + ELSE + + SELECT COUNT(*) INTO vPrintedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.productionConfig pc + WHERE pb.shipped = CURDATE() + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND s.isPreparable + AND ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE); + +call util.debugAdd('wargo',CONCAT('vMaxTicketPrinted ', vMaxTicketPrinted)); +call util.debugAdd('wargo',CONCAT('vPrintedTickets ',vPrintedTickets)); + + SET vMaxTicketPrinted = vMaxTicketPrinted - vPrintedTickets; + + -- AutoPRINT + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT s2.id, pb.ticketFk, vUserFk + FROM tmp.productionBuffer pb + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.state s ON s.id = pb.state + JOIN vn.state s2 ON s2.code = 'PRINTED_AUTO' + JOIN vn.ticket t ON t.id = pb.ticketFk + JOIN vn.ticketConfig tc + JOIN vn.productionConfig pc + WHERE pb.shipped = CURDATE() + AND (LENGTH(pb.problem) = 0 + OR (pb.problem = 'PEQUEÑO' AND vTrainFk = 2)) + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND s.isPrintable + AND s.isOK + AND ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , NOW()) + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE) + ORDER BY HH, + mm, + s.`order` DESC, + pb.m3 DESC + LIMIT vMaxTicketPrinted; + + -- Se seleccionan los primeros tickets, asignando colección para dejarlos bloqueados a otros sacadores. + -- Se splitan los tickets preparables, para que solo tengan un tipo de empaquetado + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; + CREATE TEMPORARY TABLE tmp.ticketToSplit + SELECT pb.ticketFk, IFNULL((pb.H + pb.V = 0),TRUE) isNeutral + FROM tmp.productionBuffer pb + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.ticketStateToday tst ON tst.ticket = pb.ticketFk + JOIN vn.state s ON s.id = tst.state + JOIN vn.productionConfig pc + WHERE ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND LENGTH(pb.problem) = 0 + AND s.isPreparable + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE) + ORDER BY pb.HH, pb.mm, s.`order` DESC + LIMIT vMaxTickets; + +call util.debugAdd('wargo',CONCAT('tmp.ticketToSplit ', (SELECT COUNT(*) FROM tmp.ticketToSplit))); + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + + SELECT MIN(ticketFk) INTO vTicketToSplit + FROM tmp.ticketToSplit; + + + IF (SELECT isNeutral + FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit) THEN + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + VALUES(vTicketToSplit, vCollectionFk); + +call util.debugAdd('wargo',CONCAT('neutral ', vTicketToSplit)); + + ELSE + + CALL vn.ticket_splitItemPackingType(vTicketToSplit); + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT ticketFk, vCollectionFk + FROM tmp.ticketIPT + WHERE itemPackingTypeFk = vItemPackingTypeFk; + +call util.debugAdd('wargo',CONCAT('NO neutral ', + (SELECT ticketFk FROM tmp.ticketIPT WHERE itemPackingTypeFk = vItemPackingTypeFk))); + + DROP TEMPORARY TABLE tmp.ticketIPT; + + END IF; + + DELETE FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit; + + END WHILE; + + END IF; + +call util.debugAdd('wargo',CONCAT('vn.ticketCollection ', + (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); + + -- Creamos una tabla temporal con los datos que necesitamos para depurar la colección + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.ticketFk, + pb.`lines`, + pb.m3 * 1000 liters, + 0 as height, + 0 as shelve, + 0 as wagon, + 0 AS shelveLiters, + pb.productionOrder, + pb.HH, + pb.mm + FROM tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON tc.ticketFk = pb.ticketFk + WHERE tc.collectionFk = vCollectionFk + LIMIT vMaxTickets; + + -- Voumen de las lineas de los pedidos, de acuerdo con el packingShelve establecido por los controladores + DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelveLiters; + CREATE TEMPORARY TABLE tmp.ticketShelveLiters + SELECT t.ticketFk, SUM(s.quantity * vc.shelveVolume / i.packingShelve) shelveLiters + FROM tmp.ticket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.volumeConfig vc + WHERE i.packingShelve + GROUP BY t.ticketFk; + + UPDATE tmp.ticket t + JOIN tmp.ticketShelveLiters tsl ON tsl.ticketFk = t.ticketFk + SET t.shelveLiters = tsl.shelveLiters; + + -- Es importante que el primer ticket se coja en todos los casos + + SET vFirstTicketFk = 0; + + SELECT ticketFk, HH, mm + INTO vFirstTicketFk, vHour, vMinute + FROM tmp.ticket + ORDER BY productionOrder DESC, HH, mm + LIMIT 1; + +call util.debugAdd('wargo',CONCAT('vFirstTicketFk ', vFirstTicketFk)); +call util.debugAdd('wargo',CONCAT('vHour ', vHour)); +call util.debugAdd('wargo',CONCAT('vMinute ', vMinute)); + +call util.debugAdd('wargo',CONCAT('tmp.ticket ', (SELECT COUNT(*) FROM tmp.ticket))); + + -- Hay que excluir aquellos que no tengan la misma hora de preparación + DELETE + FROM tmp.ticket + WHERE HH != vHour + OR mm != vMinute; + +call util.debugAdd('wargo',CONCAT('tmp.ticket misma hora ', (SELECT COUNT(*) FROM tmp.ticket))); + + -- En el caso de pedidos de más volumen de un carro, la colección será monoticket. Pero si el primer pedido + -- no es monoticket, excluimos a los de más de un carro + IF (SELECT (t.shelveLiters > vc.trolleyM3 * 1000) + FROM tmp.ticket t + JOIN vn.volumeConfig vc + WHERE t.ticketFk = vFirstTicketFk) THEN + + DELETE + FROM tmp.ticket + WHERE ticketFk != vFirstTicketFk; + + ELSE + + DELETE t.* + FROM tmp.ticket t + JOIN vn.volumeConfig vc + WHERE t.shelveLiters > vc.trolleyM3 * 1000; + + END IF; + +call util.debugAdd('wargo',CONCAT('tmp.ticket volumen ', (SELECT COUNT(*) FROM tmp.ticket))); + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + +call util.debugAdd('wargo',CONCAT('vn.ticketCollection ', + (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); + + -- Construccion del tren + + -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. + UPDATE tmp.ticket t + JOIN + ( SELECT MAX(i.size) maxHeigth, + tc.ticketFk + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.item i ON i.id = s.itemFk + WHERE i.itemPackingTypeFk = 'V' + AND tc.collectionFk = vCollectionFk + GROUP BY tc.ticketFk) sub ON sub.ticketFk = t.ticketFk + SET t.height = IFNULL(sub.maxHeigth,0); + + -- Vamos a generar una tabla con todas las posibilidades de asignacion de pedido + DROP TEMPORARY TABLE IF EXISTS tmp.wagonsVolumetry; + CREATE TEMPORARY TABLE tmp.wagonsVolumetry + SELECT cv.`level` as shelve, + 1 as wagon, + cv.`lines`, + cv.liters, + cv.height + FROM vn.collectionVolumetry cv + WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') + AND cv.trainFk = vTrainFk; + + SET vWagonCounter = 1; + + WHILE vWagonCounter < vWagons DO + + SET vWagonCounter = vWagonCounter + 1; + + INSERT INTO tmp.wagonsVolumetry(shelve, wagon, `lines`, liters, height) + SELECT cv.`level` as shelve, + vWagonCounter as wagon, + cv.`lines`, + cv.liters, + cv.height + FROM vn.collectionVolumetry cv + WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') + AND cv.trainFk = vTrainFk; + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelve; + CREATE TEMPORARY TABLE tmp.ticketShelve + SELECT ticketFk, shelve, wagon, linesDif, LitersDif, heightDif + FROM ( + SELECT t.ticketFk, + wv.shelve, + wv.wagon, + t.productionOrder, + CAST(wv.`lines` AS SIGNED) - t.`lines` as linesDif, + CAST(wv.liters AS SIGNED) - t.shelveLiters as litersDif, + CAST(wv.height AS SIGNED) - t.height as heightDif + FROM tmp.wagonsVolumetry wv + JOIN tmp.ticket t + ) sub + WHERE linesDif >= 0 + AND litersDif >= 0 + AND heightDif >= 0 + ORDER BY productionOrder DESC, linesDif, LitersDif, heightDif ; + + -- Insertamos una opcion virtual para carro completo. Todo ticket tiene que poder entrar en un carro completo.... + INSERT INTO tmp.ticketShelve(ticketFk, shelve, wagon, linesDif, LitersDif, heightDif) + SELECT t.ticketFk, 0, wv.wagon, 999, 999,999 + FROM tmp.ticket t + JOIN tmp.wagonsVolumetry wv + GROUP BY t.ticketFk, wv.wagon; + + SET vWagonCounter = 0; + + WHILE vWagonCounter < vWagons DO + + SET vWagonCounter = vWagonCounter + 1; + + -- Asignamos la primera balda util al primer pedido + IF vWagonCounter = 1 THEN + + SELECT shelve INTO vShelve + FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + AND wagon = vWagonCounter + ORDER BY heightDif, litersDif, linesDif + LIMIT 1; + + ELSE + + SELECT shelve, ticketFk INTO vShelve, vFirstTicketFk + FROM tmp.ticketShelve + WHERE wagon = vWagonCounter + ORDER BY heightDif, litersDif, linesDif + LIMIT 1; + + END IF; + + IF vShelve > 0 THEN + + UPDATE tmp.ticket + SET shelve = vShelve, + wagon = vWagonCounter + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + OR (shelve = vShelve AND wagon = vWagonCounter); + + WHILE (SELECT COUNT(*) FROM tmp.ticketShelve WHERE wagon = vWagonCounter) DO + + SELECT ticketFk, shelve + INTO vTicket, vShelve + FROM tmp.ticketShelve + WHERE wagon = vWagonCounter + LIMIT 1; + + UPDATE tmp.ticket + SET shelve = vShelve, + wagon = vWagonCounter + WHERE ticketFk = vTicket; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vTicket + OR (shelve = vShelve AND wagon = vWagonCounter); + + END WHILE; + + ELSE + + UPDATE tmp.ticket + SET shelve = 1, wagon = vWagonCounter + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + AND wagon != vWagonCounter; + + END IF; + + END WHILE; + + -- Eliminamos los que se han quedado sin balda + DELETE FROM tmp.ticket WHERE shelve = 0; + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + +call util.debugAdd('wargo',CONCAT('vn.ticketCollection bloqueados ', + (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); + + -- Elimina los tickets que ya estan en otra coleccion + DELETE tc.* + FROM vn.ticketCollection tc + JOIN vn.ticketCollection tc2 ON tc2.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND tc2.collectionFk != vCollectionFk; + +call util.debugAdd('wargo',CONCAT('vn.ticketCollection otra coleccion ', + (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); + + -- Actualiza el estado de la colección + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + -- Asigna las bandejas + UPDATE vn.ticketCollection tc + JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + SET tc.level = t.shelve, + tc.wagon = t.wagon, + tc.itemCount = t.`lines`, + tc.liters = t.shelveLiters; + + -- Actualiza el estado de los tickets + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT vStateFk, ticketFk, vUserFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + -- Aviso para la preparacion previa + INSERT INTO vn.ticketDown(ticketFk, collectionFk) + SELECT tc.ticketFk, tc.collectionFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + SELECT * FROM util.debug + where variable = 'wargo' + and created >= vNow + order by created; + + IF (SELECT count(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk) THEN + + CALL vn.salesMerge_byCollection(vCollectionFk); + + UPDATE vn.collection c + JOIN (SELECT count(*) saleTotalCount , + sum(s.isPicked != 0) salePickedCount + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND s.quantity > 0 + ) sub + SET c.saleTotalCount = sub.saleTotalCount, + c.salePickedCount = sub.salePickedCount + WHERE c.id = vCollectionFk; + + SELECT vCollectionFk; + + ELSE + + DELETE FROM vn.collection WHERE id = vCollectionFk; + + CALL util.throw('No se ha obtenido colección'); + + END IF; + + DROP TEMPORARY TABLE + tmp.ticketToSplit, + tmp.ticketShelveLiters, + tmp.ticket, + tmp.wagonsVolumetry, + tmp.ticketShelve, + tmp.productionBuffer; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collection_printSticker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_printSticker`(vCollection INT) BEGIN - - DECLARE vDescription VARCHAR(100); - DECLARE vOriginalQuantity INT; - DECLARE vConcept VARCHAR(100); - DECLARE vOrigin INT; - SELECT concept INTO vConcept FROM sale WHERE id = vSale; - SELECT ticketFk INTO vOrigin FROM sale WHERE id = vSale; - SELECT quantity INTO vOriginalQuantity FROM sale WHERE id = vSale; - SELECT CONCAT("Cambio cantidad ",vConcept," de ", vOriginalQuantity," a ", vQuantity) INTO vDescription; + /*Imprime una etiqueta amarilla a partir de una colección + * + * @param vCollection colección + * @param vPrinterFk id de la impresora + */ - INSERT INTO ticketLog (originFk, userFk, action , description) - VALUES(vOrigin, getUser(), 'update', vDescription); + DECLARE vLabelReportFk INT; + DECLARE vLabelerFk INT; - UPDATE sale SET originalQuantity = vOriginalQuantity, quantity = vQuantity WHERE id = vSale; + SELECT s.labelReportFk, w.labelerFk INTO vLabelReportFk, vLabelerFk + FROM worker w + LEFT JOIN sector s ON s.id= w.sectorFk + WHERE w.id=account.myUser_getId() ; + + IF vLabelReportFk AND vLabelerFk THEN + + INSERT INTO ticketTrolley(ticket, labelCount) + SELECT ticketFk, 1 + FROM ticketCollection + WHERE collectionFk = vCollection + ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; + + INSERT INTO printServerQueue(labelReportFk, param1, workerFk,printerFk) + SELECT vLabelReportFk, vCollection, getUser(),vLabelerFk; + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59743,48 +59312,68 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT) BEGIN - /** - * Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr�cula - * - * @param vShelvingFk Identificador de vn.shelving - * @param vFromEntryFk Entrada origen - * @param vToEntryFk Entrada destino - */ - - DECLARE vItemFk INT; - DECLARE vStickers INT; +/** + * Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr�cula + * + * @param vShelvingFk Identificador de vn.shelving + * @param vFromEntryFk Entrada origen + * @param vToEntryFk Entrada destino + */ DECLARE vBuyFk INT; - DECLARE vHasSameStickers BOOL; + DECLARE ishStickers INT; + DECLARE buyStickers INT; DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE cur CURSOR FOR - SELECT itemFk, FLOOR(quantity / packing) AS stickers - FROM vn.itemShelving WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci ; + SELECT bb.id buyFk, + FLOOR(ish.visible / ish.packing) AS ishStickers, + bb.stickers buyStickers + FROM vn.itemShelving ish + JOIN (SELECT b.id, b.itemFk, b.stickers + FROM vn.buy b + WHERE b.entryFk = vFromEntryFk + ORDER BY b.stickers DESC) bb ON bb.itemFk = ish.itemFk + AND bb.stickers >= FLOOR(ish.visible / ish.packing) + WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci + GROUP BY ish.id; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + -- Cantidades de la matrícula que exceden la de las entradas + SELECT ish.itemFk, + i.longName, + FLOOR(ish.visible / ish.packing) AS etiEnMatricula, + bb.stickers etiEnEntrada + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + LEFT JOIN (SELECT b.id, b.itemFk, b.stickers + FROM vn.buy b + WHERE b.entryFk = vFromEntryFk + ORDER BY b.stickers DESC) bb ON bb.itemFk = ish.itemFk + WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci + AND IFNULL(bb.stickers,0) < FLOOR(ish.visible / ish.packing) + GROUP BY ish.id; + OPEN cur; read_loop: LOOP - - FETCH cur INTO vItemFk, vStickers; - - IF vDone THEN - LEAVE read_loop; - END IF; + SET vDone = FALSE; - SELECT b.id, (stickers = vStickers) INTO vBuyFk, vHasSameStickers - FROM vn.buy - WHERE entryFk = vFromEntryFk - AND itemFk = vItemFk - AND stickers >= vStickers - LIMIT 1; - - IF vHasSameStickers THEN - - UPDATE vn.buy SET entryFk = vToEntryFk WHERE id = vBuyFk; + FETCH cur INTO vBuyFk, ishStickers, buyStickers; + + IF vDone THEN + LEAVE read_loop; + END IF; + IF ishStickers = buyStickers THEN + UPDATE vn.buy + SET entryFk = vToEntryFk + WHERE id = vBuyFk; ELSE - - UPDATE vn.buy SET stickers = stickers - vStickers WHERE id = vBuyFk; + UPDATE vn.buy + SET stickers = stickers - ishStickers, + quantity = stickers * packing + WHERE id = vBuyFk; INSERT INTO vn.buy(entryFk, itemFk, @@ -59817,11 +59406,11 @@ BEGIN SELECT vToEntryFk, itemFk, - vStickers * packing, + ishStickers * packing, buyingValue, freightValue, isIgnored, - vStickers, + ishStickers, packing, `grouping`, groupingMode, @@ -59835,7 +59424,7 @@ BEGIN price3, minPrice, producer, - vStickers, + ishStickers, workerFk, isChecked, isPickedOff, @@ -59847,11 +59436,9 @@ BEGIN WHERE id = vBuyFk; END IF; - END LOOP; CLOSE cur; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60298,6 +59885,39 @@ 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 `expeditionPallet_printLabel` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_printLabel`(vPalletFk INT) +BEGIN + + DECLARE vLabel INT; + DECLARE vPrinterFk INT; + + UPDATE vn.expeditionPallet + SET isPrint = FALSE + WHERE id = vPalletFk; + + SELECT s.labelReportFk, w.labelerFk INTO vLabel, vPrinterFK + FROM worker w + LEFT JOIN sector s ON s.id= w.sectorFk + WHERE w.id=account.myUser_getId() ; + + INSERT INTO printServerQueue (printerFk, labelReportFk, statusFk, param1, workerFk) + VALUES(vPrinterFK, vLabel, 1, vPalletFk, account.myUser_getId()); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_PrintSet` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60594,6 +60214,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 */ ; +/*!50003 DROP PROCEDURE IF EXISTS `expeditionState_addByPallet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByPallet`(vPalletFk INT, vStateCode VARCHAR(100)) +BEGIN +/** + * Inserta nuevos registros en la tabla vn.expeditionState + * + * @param vPalletFk Identificador de vn.expedition + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + DROP TEMPORARY TABLE IF EXISTS tmp.expeditionScan; + CREATE TEMPORARY TABLE tmp.expeditionScan + SELECT expeditionFk, est.id typeFk + FROM vn.expeditionScan e + JOIN vn.expeditionStateType est ON est.code = vStateCode + WHERE e.palletFk = vPalletFk; + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT expeditionFk, typeFk + FROM tmp.expeditionScan; + + DROP TEMPORARY TABLE IF EXISTS tmp.expeditionScan; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionState_addByRoute` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -60707,9 +60363,9 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getFromRoute`(vRouteFk INT) BEGIN @@ -60718,7 +60374,6 @@ BEGIN * @param vRouteFk Id de la ruta */ - SELECT e.id, e.ticketFk, e.checked, @@ -60729,7 +60384,8 @@ BEGIN a.postalCode, t.addressFk, a.nickname, - sub2.itemPackingTypeConcat + sub2.itemPackingTypeConcat, + est.code FROM expedition e JOIN ticket t ON t.id = e.ticketFk JOIN ticketState ts ON ts.ticketFk = e.ticketFk @@ -60745,9 +60401,9 @@ BEGIN GROUP BY t.id,i.itemPackingTypeFk)sub GROUP BY sub.ticketFk ) sub2 ON sub2.ticketFk = t.id + LEFT JOIN expeditionStateType est ON est.id = e.stateTypeFk WHERE t.routeFk = vRouteFk AND e.isBox <> FALSE; - - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -66481,73 +66137,62 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vShelve` VARCHAR(2), IN `vDeep` INT, IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, IN `vLevel` INT,`vCreated` VARCHAR(22)) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vShelve` VARCHAR(2), IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22)) BEGIN - - DECLARE vItemFk INT; - - - + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - SELECT itemFk INTO vItemFk - FROM vn.buy b + SELECT itemFk INTO vItemFk + FROM vn.buy b WHERE b.id = vItemFk; - - - IF (SELECT COUNT(*) FROM vn.shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN - - INSERT IGNORE INTO vn.parking(`code`) VALUES(vShelvingFk); - INSERT INTO vn.shelving(`code`, parkingFk) - SELECT vShelvingFk, id - FROM vn.parking - WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; - - END IF; - - IF (SELECT COUNT(*) FROM vn.itemShelving - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk - AND packing = vPacking) = 1 THEN - UPDATE vn.itemShelving SET quantity = quantity+vQuantity,visible = visible+vQuantity,available = available+vQuantity, created = vCreated - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; - + IF (SELECT COUNT(*) FROM vn.shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN + + INSERT IGNORE INTO vn.parking(`code`) VALUES(vShelvingFk); + INSERT INTO vn.shelving(`code`, parkingFk) + SELECT vShelvingFk, id + FROM vn.parking + WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; + + END IF; + + IF (SELECT COUNT(*) FROM vn.itemShelving + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk + AND packing = vPacking) = 1 THEN + + UPDATE vn.itemShelving + SET visible = visible+vQuantity, + created = vCreated + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk + AND packing = vPacking; + ELSE - CALL cache.last_buy_refresh(FALSE); - INSERT INTO itemShelving( itemFk, - shelvingFk, - shelve, - deep, - quantity, - visible, - available, - created, - `grouping`, - packing, - packagingFk, - level) - SELECT - vItemFk, - vShelvingFk, - vShelve, - vDeep, - vQuantity, - vQuantity, - vQuantity, - vCreated, - IF(vGrouping = 0, IFNULL(b.packing, vPacking), vGrouping) as `grouping`, - IF(vPacking = 0, b.packing, vPacking) as packing, - IF(vPackagingFk = '', b.packageFk, vPackagingFk) as packaging, - vLevel - FROM vn.item i - LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - WHERE i.id = vItemFk; - END IF; + CALL cache.last_buy_refresh(FALSE); + INSERT INTO itemShelving( itemFk, + shelvingFk, + shelve, + visible, + created, + `grouping`, + packing, + packagingFk) + SELECT vItemFk, + vShelvingFk, + vShelve, + vQuantity, + vCreated, + IF(vGrouping = 0, IFNULL(b.packing, vPacking), vGrouping) `grouping`, + IF(vPacking = 0, b.packing, vPacking) packing, + IF(vPackagingFk = '', b.packageFk, vPackagingFk) packaging + FROM vn.item i + LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + WHERE i.id = vItemFk; + END IF; END ;; DELIMITER ; @@ -66693,20 +66338,18 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingPlacementSupplyAdd`(vItemShelvingFk INT, vItemPlacementSupplyFk INT, vQuantity INT) BEGIN - INSERT INTO vn.itemShelvingPlacementSupply( itemShelvingFk, - itemPlacementSupplyFk, - quantity, + INSERT INTO vn.itemShelvingPlacementSupply( itemShelvingFk, + itemPlacementSupplyFk, + quantity, userFk) - VALUES ( vItemShelvingFk, - vItemPlacementSupplyFk, - vQuantity, - getUser()); - - UPDATE vn.itemShelving - SET quantity = quantity - vQuantity, - visible = visible - vQuantity, - available = available - vQuantity - WHERE id = vItemShelvingFk; + VALUES (vItemShelvingFk, + vItemPlacementSupplyFk, + vQuantity, + getUser()); + + UPDATE vn.itemShelving + SET visible = visible - vQuantity + WHERE id = vItemShelvingFk; END ;; @@ -67124,25 +66767,27 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Urgent`(vWorkerFk INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Urgent`() BEGIN +/** + * Devuelve lo mismo que itemShelving_filterBuyer per sin filtrar + */ DECLARE vCalcVisibleFk INT; DECLARE vWarehouseFk INT DEFAULT 60; - -- Eliminar cuando tengamos programador de Android - CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); SELECT * FROM (SELECT sub.itemFk, sub.longName, - CONCAT('Hoy saldrán ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT(DATE_FORMAT(sub2.etd,'%H:%i'), ' salen ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, sub.upstairs, sub.downstairs, sub.visible, sub.sectorFk, - CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho + CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho, + sub2.etd FROM (SELECT iss.itemFk, CONCAT(i.longName,' ',i.size,' ',IFNULL(i.subName,'') ) longName, '' size, @@ -67150,19 +66795,19 @@ BEGIN 0 upstairs, SUM(IFNULL(iss.visible,0)) downstairs, IF(it.isPackaging, null, IFNULL(v.visible,0)) visible, - 0 sectorFk + IFNULL(iss.sectorFk,0) sectorFk FROM itemShelvingStock iss JOIN sector s ON s.id = iss.sectorFk JOIN item i on i.id = iss.itemFk JOIN itemType it ON it.id = i.typeFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk + LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = @vCalcVisibleFk WHERE s.warehouseFk = vWarehouseFk - AND it.workerFk = vWorkerFk GROUP BY itemFk - ) sub LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente + ) sub LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente, MIN(zc.`hour`) etd FROM sale s LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) @@ -67173,21 +66818,23 @@ BEGIN UNION ALL SELECT v.item_id , i.longName, - CONCAT('Hoy saldrán ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT(DATE_FORMAT(sub5.etd,'%H:%i'), ' salen ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, 0, 0, v.visible, - 0, - v.visible nicho + IFNULL(iss.sectorFk,0), + v.visible nicho, + sub5.etd FROM cache.visible v JOIN item i ON i.id = v.item_id JOIN itemType it ON it.id = i.typeFk LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id - LEFT JOIN (SELECT s.itemFk , SUM(s.quantity) pendiente + LEFT JOIN (SELECT s.itemFk , SUM(s.quantity) pendiente, MIN(zc.`hour`) etd FROM sale s LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk JOIN client c on c.id = t.clientFk JOIN clientType ct ON ct.id = c.clientTypeFk WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) @@ -67195,13 +66842,11 @@ BEGIN AND ct.code IN ('normal', 'trust') GROUP BY s.itemFk ) sub5 ON sub5.itemFk = v.item_id - WHERE v.calc_id = vCalcVisibleFk + WHERE v.calc_id = @vCalcVisibleFk AND ISNULL(iss.itemFk) - AND it.workerFk = vWorkerFk ) sub3 WHERE nicho - ORDER BY producer; - + ORDER BY LEFT(producer,3), etd, producer; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67315,20 +66960,21 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSaleAdd`(vItemShelvingFk INT, saleFk INT, vQuantity INT) BEGIN -IF saleFk <> 0 THEN - INSERT INTO vn.itemShelvingSale( itemShelvingFk, - saleFk, - quantity, - userFk) - VALUES ( vItemShelvingFk, - saleFk, + IF saleFk <> 0 THEN + INSERT INTO vn.itemShelvingSale(itemShelvingFk, + saleFk, + quantity, + userFk) + VALUES (vItemShelvingFk, + saleFk, vQuantity, getUser()); - -END IF; - UPDATE vn.itemShelving SET quantity = (quantity - vQuantity), available = (available - vQuantity), visible = (visible - vQuantity) - WHERE id = vItemShelvingFk; + END IF; + + UPDATE vn.itemShelving + SET visible = (visible - vQuantity) + WHERE id = vItemShelvingFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67392,38 +67038,34 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSaleSupplyAddVoz`(vItemShelvingFk VARCHAR(50), saleFk INT, vQuantity INT,idMovimiento INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSaleSupplyAddVoz`(vItemShelvingFk VARCHAR(50), saleFk INT, vQuantity INT, idMovimiento INT) BEGIN + DECLARE vItemShelvingFkAux INT; + DECLARE vItemFk INT; + SELECT itemFk INTO vItemFk FROM vn.sale WHERE id = saleFk; -/*INSERT INTO `vn`.`errorLogApp` (`error`, `workerFk`) VALUES (CONCAT(vItemShelvingFk," ",saleFk), '14255');*/ + SELECT id INTO vItemShelvingFkAux FROM vn.itemShelving WHERE shelvingFk = vItemShelvingFk COLLATE utf8_general_ci AND itemFk = vItemFk; -DECLARE vItemShelvingFkAux INT; -DECLARE vItemFk INT; + INSERT INTO vn.itemShelvingSale( + itemShelvingFk, + saleFk, + quantity, + userFk + ) VALUES ( + vItemShelvingFkAux, + saleFk, + vQuantity, + getUser() + ); -SELECT itemFk INTO vItemFk FROM vn.sale WHERE id = saleFk; - -SELECT id INTO vItemShelvingFkAux FROM vn.itemShelving WHERE shelvingFk = vItemShelvingFk COLLATE utf8_general_ci AND itemFk = vItemFk; - -INSERT INTO vn.itemShelvingSale( itemShelvingFk, - saleFk, - quantity, - userFk) - VALUES ( vItemShelvingFkAux, - saleFk, - vQuantity, - getUser()); - - UPDATE vn.itemShelving - SET quantity = quantity - vQuantity, - visible = visible - vQuantity, - available = available - vQuantity - WHERE id = vItemShelvingFkAux; - - UPDATE vn2008.Movimientos_mark - SET valor = 1 - WHERE Id_Movimiento = idMovimiento; + UPDATE vn.itemShelving + SET visible = visible - vQuantity + WHERE id = vItemShelvingFkAux; + UPDATE vn2008.Movimientos_mark + SET valor = 1 + WHERE Id_Movimiento = idMovimiento; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67542,84 +67184,118 @@ 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_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vShelve VARCHAR(2), IN vDeep INT, IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT, IN vLevel INT) +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vShelve VARCHAR(2), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT) BEGIN + /** * Añade registro o lo actualiza si ya existe. * * @param vShelvingFk matrícula del carro * @param vBarcode el id del registro * @param vShelve de itemshleving - * @param vDeep indica profundidad * @param vQuantity indica la cantidad del producto * @param vPackagingFk el packaging del producto en itemShelving, NULL para coger el de la ultima compra * @param vGrouping el grouping del producto en itemShelving, NULL para coger el de la ultima compra * @param vPacking el packing del producto, NULL para coger el de la ultima compra * @param vWarehouseFk indica el sector - * @param vLevel indica el level * **/ - - DECLARE vItemFk INT; - SELECT barcodeToItem(vBarcode) INTO vItemFk; - + DECLARE vItemFk INT; + + SELECT barcodeToItem(vBarcode) INTO vItemFk; + IF (SELECT COUNT(*) FROM shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN - + INSERT IGNORE INTO parking(code) VALUES(vShelvingFk); - INSERT INTO shelving(code, parkingFk) + INSERT INTO shelving(code, parkingFk) SELECT vShelvingFk, id FROM parking - WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; - - END IF; - - IF (SELECT COUNT(*) FROM itemShelving + WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; + + END IF; + + IF (SELECT COUNT(*) FROM itemShelving WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking) = 1 THEN - UPDATE itemShelving SET quantity = quantity+vQuantity,visible = visible+vQuantity,available = available+vQuantity - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; - - ELSE + UPDATE itemShelving + SET visible = visible+vQuantity + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; + + ELSE CALL cache.last_buy_refresh(FALSE); - INSERT INTO itemShelving( itemFk, - shelvingFk, - shelve, - deep, - quantity, - visible, - available, - grouping, - packing, - packagingFk, - level) - - SELECT - vItemFk, - vShelvingFk, - vShelve, - vDeep, - vQuantity, - vQuantity, - vQuantity, - IFNULL(vGrouping, b.grouping), - IFNULL(vPacking, b.packing), - IFNULL(vPackagingFk, b.packageFk), - vLevel - FROM item i + INSERT INTO itemShelving( itemFk, + shelvingFk, + shelve, + visible, + grouping, + packing, + packagingFk) + + SELECT vItemFk, + vShelvingFk, + vShelve, + vQuantity, + IFNULL(vGrouping, b.grouping), + IFNULL(vPacking, b.packing), + IFNULL(vPackagingFk, b.packageFk) + FROM item i LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk LEFT JOIN buy b ON b.id = lb.buy_id WHERE i.id = vItemFk; - 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 DROP PROCEDURE IF EXISTS `itemShelving_addByClaim` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3)) +BEGIN +/** + * Insert items of claim into itemShelving. + * + * @param vClaimFk The claim + * @param vShelvingFk The shelving + * @table tmp.buyUltimate + */ + DECLARE vWarehouseFk INT; + + SELECT t.warehouseFk INTO vWarehouseFk + FROM claim c + JOIN ticket t ON t.id = c.ticketFk + WHERE c.id = vClaimFk; + + CALL buyUltimate (vWarehouseFk, CURDATE()); + + INSERT INTO itemShelving (itemFk, shelvingFk, quantity, packing, `grouping`, visible) + SELECT s.itemFk, vShelvingFk, cb.quantity, b.packing, b.`grouping`, cb.quantity AS visible + FROM claim c + JOIN claimBeginning cb ON c.id = cb.claimFk + JOIN sale s ON s.id = cb.saleFk + JOIN ticket t ON t.id = s.ticketFk + JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk AND bu.warehouseFk = t.warehouseFk + JOIN buy b ON b.id = bu.buyFk + WHERE c.id = vClaimFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67707,6 +67383,11 @@ proc:BEGIN */ DECLARE vCalcVisibleFk INT; + IF vBuyerFk = 103 THEN -- hay que arreglarlo despues de la campaña PAK 23/04/2022 + CALL vn.itemShelvingRadar_Urgent(); + LEAVE proc; + END IF; + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); SELECT * FROM @@ -67777,7 +67458,6 @@ proc:BEGIN ) sub3 WHERE nicho ORDER BY producer; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68071,12 +67751,11 @@ BEGIN * @param vPacking el packing del del producto en itemShelving * @param vGrouping el grouping del producto en itemShelving */ - UPDATE itemShelving SET - available = vVisible, - visible = vVisible, - packing = vPacking, - grouping = vGrouping - WHERE id = vShelf; + UPDATE itemShelving + SET visible = vVisible, + packing = vPacking, + grouping = vGrouping + WHERE id = vShelf; END ;; DELIMITER ; @@ -68231,38 +67910,6 @@ BEGIN WHERE calc_id = vCalc AND item_id = vItemFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemStockVisible_verify` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemStockVisible_verify`(vItemFk INT, vQuantity INT) -BEGIN - - INSERT INTO vn.itemShelving(itemFk, - shelvingFk, - quantity, - visible, - available, - packing) - VALUES( vItemFk, - 'FAL', - -vQuantity, - -vQuantity, - -vQuantity, - -vQuantity); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -69117,8 +68764,8 @@ BEGIN JOIN supplier s ON s.id = e.supplierFk JOIN alertLevel al ON al.id = CASE - WHEN tr.shipped < CURDATE() THEN 3 - WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3 + WHEN tr.landed < CURDATE() THEN 3 + WHEN tr.landed = CURDATE() AND tr.isReceived = TRUE THEN 3 ELSE 0 END JOIN state st ON st.code = al.code @@ -70244,32 +69891,46 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setGeneric`(vSelf INT) BEGIN - - /* Asigna el código genérico a un item - * - * @param vSelf identificador de vn.item - */ - +/** + * Asigna el código genérico a un item, salvo que sea un código de item genérico. + * + * @param vSelf identificador de vn.item + */ DECLARE vGenericFk INT; - - SELECT ga.itemFk INTO vGenericFk - FROM vn.genericAllocation ga - JOIN vn.item i ON (i.typeFk = ga.typeFk OR ISNULL(ga.typeFk)) - JOIN vn.itemTag it1 ON it1.itemFk = i.id AND (it1.value = ga.origin OR ISNULL(ga.origin)) - JOIN vn.itemTag it2 ON it2.itemFk = i.id AND (it2.value = ga.color OR ISNULL(ga.color)) - JOIN vn.itemTag it3 ON it3.itemFk = i.id AND (it3.value = ga.quality OR ISNULL(ga.quality)) - JOIN vn.itemTag it4 ON it4.itemFk = i.id AND (it4.value = ga.numFlores OR ISNULL(ga.numFlores)) - JOIN vn.itemTag it5 ON it5.itemFk = i.id AND (it5.value = ga.category OR ISNULL(ga.category)) - JOIN vn.itemTag it6 ON it6.itemFk = i.id AND (it6.value = ga.productor OR ISNULL(ga.productor)) - WHERE i.id = vSelf - AND ga.itemFk != vSelf - AND NOT i.isFloramondo - LIMIT 1; + SELECT itemFk INTO vGenericFk + FROM ( + SELECT itemFk, (sum(matches) = maxMatches) `match` + FROM ( + SELECT ga.id gaid, + ga.itemFk, + (it.value <=> ga.origin) + + (it.value <=> ga.color) + + (it.value <=> ga.quality) + + (it.value <=> ga.numFlores) + + (it.value <=> ga.category) + + (it.value <=> ga.productor) matches, + !ISNULL(ga.origin) + +!ISNULL(ga.color) + +!ISNULL(ga.quality) + +!ISNULL(ga.numFlores) + +!ISNULL(ga.category) + +!ISNULL(ga.productor) maxMatches + FROM vn.item i + JOIN vn.itemTag it ON it.itemFk = i.id + JOIN vn.genericAllocation ga + ON (i.typeFk = ga.typeFk OR ga.typeFk IS NULL) + AND (i.longName = ga.longName OR ga.longName IS NULL) + AND (i.`size` = ga.`size` OR ga.`size` IS NULL) + AND i.id != ga.itemFk + WHERE i.id = vSelf + AND NOT i.isFloramondo) sub + GROUP BY gaid + HAVING `match`) sub2; + UPDATE vn.item SET genericFk = vGenericFk WHERE id = vSelf; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72075,7 +71736,7 @@ BEGIN IF vIsInvoiceable THEN - CALL ticketCreateWithUser(vClient, + CALL ticket_add(vClient, vDateEnd, vWarehouse, vCompany, @@ -72084,6 +71745,7 @@ BEGIN NULL, vDateEnd, account.userGetId(), + TRUE, vNewTicket); INSERT INTO ticketPackaging( @@ -72890,21 +72552,48 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `previousSticker_get`(vSaleGroupFk INT) BEGIN - - /* - * Devuelve los campos a imprimir en una etiqueta de preparación previa - * - * @param vSaleGroupFk Identificador de vn.saleGroup - */ +/** + * Devuelve los campos a imprimir en una etiqueta de preparación previa. + * Actualiza el valor de vn.saleGroup.parkingFk en el caso de que exista un saleGroup del mismo ticket + * con parking, del mismo sector, para que todos se pongan juntos + * + * @param vSaleGroupFk Identificador de vn.saleGroup + */ + DECLARE vTicketFk INT; + DECLARE vParkingFk INT; + DECLARE vSectorFk INT; - SELECT sgd.saleGroupFk, + SELECT s.ticketFk + INTO vTicketFk + FROM vn.saleGroupDetail sgd + JOIN vn.sale s ON s.id = sgd.saleFk + WHERE sgd.saleGroupFk = vSaleGroupFk + LIMIT 1; + + SELECT sg.parkingFk, sc.sectorFk + INTO vParkingFk, vSectorFk + FROM vn.saleGroup sg + JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id + JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk + JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = sg.id + JOIN vn.sale s ON s.id = sgd.saleFk + WHERE s.ticketFk = vTicketFk + AND sg.parkingFk IS NOT NULL + LIMIT 1; + + UPDATE vn.saleGroup sg + SET sg.parkingFk = vParkingFk + WHERE sg.id = vSaleGroupFk + AND sg.sectorFk = vSectorFk; + + SELECT sgd.saleGroupFk, t.id ticketFk, p.code as location, t.observations, - IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour, - IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute , - IFNULL(MAX(i.itemPackingTypeFk),'H') itemPackingTypeFk , - count(*) items + IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour, + IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute , + IFNULL(MAX(i.itemPackingTypeFk),'H') itemPackingTypeFk , + count(*) items FROM vn.sale s JOIN vn.item i ON i.id = s.itemFk JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id @@ -72913,7 +72602,6 @@ BEGIN LEFT JOIN vn.parking p ON p.id = sg.parkingFk LEFT JOIN vn.`zone` z ON z.id = t.zoneFk WHERE sgd.saleGroupFk = vSaleGroupFk; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73337,8 +73025,10 @@ proc: BEGIN -- Clientes Nuevos o Recuperados UPDATE tmp.productionBuffer pb LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk + JOIN vn.productionConfig pc SET pb.problem = TRIM(CAST(CONCAT('NUEVO ', pb.problem) AS CHAR(255))) - WHERE ISNULL(cnb.clientFk) OR cnb.isRookie ; + WHERE (ISNULL(cnb.clientFk) OR cnb.isRookie) + AND pc.rookieDays; -- Líneas y volumen por ticket UPDATE tmp.productionBuffer pb @@ -74463,104 +74153,57 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `reportLabelCollection_get`(vSelf INT) -BEGIN - +CREATE DEFINER=`root`@`localhost` PROCEDURE `reportLabelCollection_get`(vParam INT) +BEGIN /** - * Obtiene los datos necesarios de un ticket o colección + * Obtiene los datos de etiquetas a partir de de un ticket o colección. * - * @param vSelf Ticket/Colección del que sacar los datos - **/ - - DECLARE vItemPackingTypeFk VARCHAR(1); + * @param vParam Ticket/Colección del que sacar los datos + */ DECLARE vIsTicket BOOL; - -- Averiguamos si es un ticket o una colección SELECT IF(id, TRUE, FALSE) INTO vIsTicket - FROM vn.ticket + FROM ticket WHERE created > (CURRENT_DATE() - INTERVAL 1 MONTH) - AND id = vSelf; - - -- Si los sacadores NO son de V, pinta los colores - SELECT itemPackingTypeFk INTO vItemPackingTypeFk - FROM vn.collection - WHERE id = vSelf; - - IF !(vItemPackingTypeFk <=> 'V') THEN - - SELECT CONCAT(tc.collectionFk, ' ', LEFT(cc.code,4)) `level`, - tc.ticketFk, - LEFT(IF(t.routeFk IS NULL, am.name, zo.name ), 12) agencyDescription, - am.name, - t.clientFk, - COUNT(*) notes, - w.code workerCode, - tt.labelCount, - IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) horaagencia, - t.shipped, - COUNT(*) lineas, - t.nickName, - CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5,2)) , "m³") m3 - FROM vn.ticket t - JOIN vn.ticketCollection tc ON tc.ticketFk = t.id - JOIN vn.collection c ON c.id = tc.collectionFk - JOIN vn.collectionColors cc ON cc.shelve = tc.`level` - AND cc.wagon = tc.wagon - AND cc.trainFk = c.trainFk - JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id - JOIN vn.worker w ON w.id = c.workerFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id - LEFT JOIN vn.address a ON a.id = t.addressFk - LEFT JOIN vn.route r ON r.id = t.routeFk - LEFT JOIN vn.zoneEstimatedDelivery ze ON ze.zoneFk = t.zoneFk - LEFT JOIN vn.agencyMode agm ON r.agencyModeFk =agm.id - LEFT JOIN vn.zone zo ON t.zoneFk = zo.id - WHERE IF(vIsTicket, tc.ticketFk = vSelf, tc.collectionFk = vSelf) - GROUP BY t.id - ORDER BY cc.code; - - ELSE - - SELECT CONCAT(tc.collectionFk,' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) `level`, - tc.ticketFk, - LEFT(IF(t.routeFk IS NULL, am.name, zo.name ), 12) agencyDescription, - am.name, - t.clientFk, - CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) notes, - w.code workerCode, - tt.labelCount, - IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) horaagencia, - t.shipped, - COUNT(*) lineas, - t.nickName, - CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5,2)), "m³") m3 - FROM vn.ticket t - JOIN vn.ticketCollection tc ON tc.ticketFk = t.id - JOIN vn.collection c ON c.id = tc.collectionFk - JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.worker w ON w.id = c.workerFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id - LEFT JOIN vn.address a ON a.id = t.addressFk - LEFT JOIN vn.route r ON r.id = t.routeFk - LEFT JOIN vn.zoneEstimatedDelivery ze ON ze.zoneFk = t.zoneFk - LEFT JOIN vn.agencyMode agm ON r.agencyModeFk =agm.id - LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id - WHERE IF(vIsTicket, tc.ticketFk = vSelf, tc.collectionFk = vSelf) - GROUP BY t.id; - - END IF; + AND id = vParam; + SELECT c.itemPackingTypeFk, + CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color, + CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV, + tc.ticketFk, + LEFT(IF(t.routeFk IS NULL, am.name, zo.name ), 12) agencyDescription, + am.name, + t.clientFk, + CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), 'm³') m3 , + CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) size, + w.code workerCode, + tt.labelCount, + IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) agencyHour, + t.shipped, + COUNT(*) lineCount, + t.nickName + FROM ticket t + JOIN ticketCollection tc ON tc.ticketFk = t.id + JOIN collection c ON c.id = tc.collectionFk + JOIN collectionColors cc ON cc.shelve = tc.`level` + AND cc.wagon = tc.wagon + AND cc.trainFk = c.trainFk + JOIN sale s ON s.ticketFk = t.id + LEFT JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN itemCategory ic ON ic.id = it.categoryFk + JOIN worker w ON w.id = c.workerFk + JOIN agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN ticketTrolley tt ON tt.ticket = t.id + LEFT JOIN `zone` zo ON t.zoneFk = zo.id + WHERE IF(vIsTicket, tc.ticketFk = vParam, tc.collectionFk = vParam) + GROUP BY t.id + ORDER BY cc.`code`; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75365,18 +75008,17 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_add`() +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_add`(vSectorFk INT) BEGIN - - /* - * Añade un nuevo registro a la tabla y devuelve su id - */ - - INSERT INTO vn.saleGroup(userFk) - VALUES (account.myUser_getId()); +/** + * Añade un nuevo registro a la tabla y devuelve su id. + * + * @param vSectorFk Identificador de vn.sector + */ + INSERT INTO vn.saleGroup(userFk, sectorFk) + VALUES (account.myUser_getId(), vSectorFk); SELECT LAST_INSERT_ID(); - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76571,12 +76213,12 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getFromTicketOrCollection`(vParam INT) BEGIN -/* - * Visualizar lineas de la tabla sale a través del parámetro vParam que puede ser ticket o collection +/** + * Visualizar lineas de la tabla sale a través del parámetro vParam que puede + * ser ticket o collection. * * @param vParam Identificador de ticket o collection */ - DECLARE vItemPackingTypeFk VARCHAR(1); DECLARE vIsCollection BOOL; @@ -76588,7 +76230,6 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; IF vIsCollection THEN - CREATE TEMPORARY TABLE tmp.ticket (INDEX (id)) ENGINE = MEMORY @@ -76616,8 +76257,6 @@ BEGIN SELECT vParam id; END IF; - - SELECT s.ticketFk, sgd.saleGroupFk, s.id as saleFk, @@ -76652,7 +76291,8 @@ BEGIN sub2.originalQuantity as startQuantity, -- eliminar cuando tengamos la nueva apk IFNULL(c.workerFk,getUser()) as workerFk, IFNULL(SUM(iss.quantity),0) as pickedQuantity, - i.packingShelve + i.packingShelve, + MIN(iss.created) picked FROM tmp.ticket t JOIN sale s ON s.ticketFk = t.id JOIN ticket tt ON tt.id = t.id @@ -76678,10 +76318,9 @@ BEGIN LEFT JOIN parking p ON p.id = sg.parkingFk GROUP BY s.id; - - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticket2; - + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticket2; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76700,15 +76339,13 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblems`(IN vIsTodayRelative tinyint(1)) BEGIN - /** - * Calcula los problemas de cada venta - * para un conjunto de tickets. - * - * @param vIsTodayRelative Indica si se calcula el disponible como si todo saliera hoy - * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular - * @return tmp.sale_problems - */ - +/** + * Calcula los problemas de cada venta para un conjunto de tickets. + * + * @param vIsTodayRelative Indica si se calcula el disponible como si todo saliera hoy + * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular + * @return tmp.sale_problems + */ DECLARE vWarehouseFk INT; DECLARE vDate DATE; DECLARE vAvailableCache INT; @@ -76724,6 +76361,13 @@ BEGIN DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; + DELETE tt.* + FROM tmp.sale_getProblems tt + JOIN vn.ticketObservation tto ON tto.ticketFk = tt.ticketFk + JOIN vn.observationType ot ON ot.id = tto.observationTypeFk + WHERE ot.code = 'administrative' + AND tto.description = 'Miriam'; + DROP TEMPORARY TABLE IF EXISTS tmp.sale_problems; CREATE TEMPORARY TABLE tmp.sale_problems ( ticketFk INT(11), @@ -76733,10 +76377,10 @@ BEGIN hasHighRisk TINYINT(1) DEFAULT 0, hasTicketRequest INTEGER(1) DEFAULT 0, isAvailable INTEGER(1) DEFAULT 1, - itemShortage VARCHAR(250), + itemShortage VARCHAR(255), isTaxDataChecked INTEGER(1) DEFAULT 1, - itemDelay VARCHAR(250), - itemLost VARCHAR(250), + itemDelay VARCHAR(255), + itemLost VARCHAR(255), hasComponentLack INTEGER(1), isTooLittle BOOL DEFAULT FALSE, PRIMARY KEY (ticketFk, saleFk) @@ -76755,20 +76399,23 @@ BEGIN -- Too Little INSERT INTO tmp.sale_problems(ticketFk, isTooLittle) - SELECT sub.ticketFk, TRUE - FROM (SELECT tl.ticketFk, SUM(sv.litros) litros, t.totalWithoutVat - FROM tmp.ticket_list tl - JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = CURDATE() - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),CURDATE())) - AND dm.code IN('AGENCY','DELIVERY','PICKUP') - GROUP BY tl.ticketFk) sub + SELECT tp.ticketFk, TRUE + FROM tmp.sale_getProblems tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN (SELECT t.addressFk, SUM(sv.litros) litros, t.totalWithoutVat + FROM tmp.ticket_list tl + JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = CURDATE() + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk + WHERE NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),CURDATE())) + AND dm.code IN('AGENCY','DELIVERY','PICKUP') + AND t.shipped BETWEEN CURDATE() AND util.midnight() + GROUP BY t.addressFk) sub ON sub.addressFk = t.addressFk JOIN vn.volumeConfig vc WHERE sub.litros < vc.minTicketVolume - AND sub.totalWithoutVat < vc.minTicketValue; + AND sub.totalWithoutVat < vc.minTicketValue; -- Faltan componentes INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk) @@ -76857,7 +76504,7 @@ BEGIN SELECT ticketFk, problem, saleFk FROM ( SELECT tl.ticketFk, - CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')) problem, + LEFT(CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')),250) problem, s.id AS saleFk FROM tmp.ticket_list tl JOIN vn.ticket t ON t.id = tl.ticketFk @@ -76885,7 +76532,7 @@ BEGIN INSERT INTO tmp.sale_problems(ticketFk, itemLost, saleFk) SELECT ticketFk, problem, saleFk FROM ( - SELECT tl.ticketFk, GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' ') problem, s.id AS saleFk + SELECT tl.ticketFk, LEFT(GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' '),250) problem, s.id AS saleFk FROM tmp.ticket_list tl JOIN vn.ticket t ON t.id = tl.ticketFk JOIN vn.sale s ON s.ticketFk = t.id @@ -76911,7 +76558,7 @@ BEGIN INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk) SELECT ticketFk, problem, saleFk FROM ( - SELECT tl.ticketFk, GROUP_CONCAT('R: ',i.id, ' ', i.longName, ' ') problem, s.id AS saleFk + SELECT tl.ticketFk, LEFT(GROUP_CONCAT('R: ',i.id, ' ', i.longName, ' '),250) problem, s.id AS saleFk FROM tmp.ticket_list tl JOIN vn.ticket t ON t.id = tl.ticketFk JOIN vn.sale s ON s.ticketFk = t.id @@ -76948,7 +76595,6 @@ BEGIN DROP TEMPORARY TABLE tmp.clientGetDebt, tmp.ticket_list; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -77658,23 +77304,22 @@ 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_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_new`(vSectorFk INT) BEGIN - /** - * Inserta una nueva colección, si el usuario no tiene ninguna vacia. - * Esto se hace para evitar que por error se generen colecciones sin sentido. - * - * @param vSectorFk Identificador de vn.sector - */ - - DECLARE hasEmptyCollections BOOLEAN; +/** + * Inserta una nueva colección, si el usuario no tiene ninguna vacia. + * Esto se hace para evitar que por error se generen colecciones sin sentido. + * + * @param vSectorFk Identificador de vn.sector + */ + DECLARE hasEmptyCollections BOOL; DECLARE vUserFk INT; SET vUserFk = account.myUser_getId(); @@ -77684,14 +77329,13 @@ BEGIN LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id WHERE ISNULL(scsg.id) AND sc.userFk = vUserFk - AND sc.sectorFk = vSectorFk; + AND sc.sectorFk = vSectorFk + AND sc.created >= CURDATE(); IF NOT hasEmptyCollections THEN - INSERT INTO vn.sectorCollection(userFk, sectorFk) VALUES(vUserFk, vSectorFk); END IF; - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -78764,105 +78408,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 `stockBuyed` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `stockBuyed`(vDate DATE) -BEGIN - DECLARE vVolume DECIMAL(10,2); - DECLARE vWarehouse INT DEFAULT 7; - DECLARE vRuben INT; - DECLARE vClaudi INT; - DECLARE vJose INT; - - SELECT w.id INTO vRuben - FROM vn.worker w - WHERE w.code = 'RET'; - - SELECT w.id INTO vClaudi - FROM vn.worker w - WHERE w.code = 'CSR'; - - SELECT w.id INTO vJose - FROM vn.worker w - WHERE w.code = 'ATJ'; - - CALL stockTraslation(vDate); - - -- SELECT Volumen INTO vVolume FROM vn2008.Cubos WHERE Id_Cubo = 'cc' LIMIT 1; - - INSERT INTO stockBuyed(user, buyed, `date`) - SELECT tr.user_id, SUM(( amount / c.packing ) * vn.buy_getVolume(Id_Compra)) / vc.palletM3 / 1000000 buyed, vDate - 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 tmp.buyUltimate bu ON bu.itemFk = Id_Article AND bu.warehouseFk = vWarehouse - JOIN vn2008.Compres c ON c.Id_compra = bu.buyFk - JOIN vn.volumeConfig vc - WHERE r.display <> 0 - GROUP BY tr.Id_Trabajador - ON DUPLICATE KEY UPDATE buyed = VALUES(buyed); - - INSERT INTO stockBuyed(USER, buyed, `date`) - SELECT vRuben, @amount := SUM(ic.cm3 * io.amount / vc.palletM3 / 1000000), vDate - FROM vn2008.item_out io - JOIN vn.itemCost ic ON ic.itemFk = io.item_id AND ic.warehouseFk = vWarehouse - JOIN vn.ticket t ON t.id = io.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.volumeConfig vc - WHERE dat = vDate - AND warehouse_id = vWarehouse - AND c.country = 'Francia' - ON DUPLICATE KEY UPDATE buyed = buyed + @amount; - - INSERT INTO stockBuyed(USER, buyed, `date`) - SELECT vJose, @amount := SUM(ic.cm3 * io.amount / vc.palletM3 / 1000000), vDate - FROM vn2008.item_out io - JOIN vn.itemCost ic ON ic.itemFk = io.item_id AND ic.warehouseFk = vWarehouse - JOIN vn.ticket t ON t.id = io.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.volumeConfig vc - WHERE dat = vDate - AND warehouse_id = vWarehouse - AND c.country = 'Holanda' - ON DUPLICATE KEY UPDATE buyed = buyed + @amount; - - INSERT INTO stockBuyed(USER, buyed, `date`) - SELECT vClaudi, @amount := SUM(ic.cm3 * io.amount / vc.palletM3 / 1000000), vDate - FROM vn2008.item_out io - JOIN vn.itemCost ic ON ic.itemFk = io.item_id AND ic.warehouseFk = vWarehouse - JOIN vn.ticket t ON t.id = io.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.volumeConfig vc - WHERE dat BETWEEN vDate AND util.dayend(vDate) - AND warehouse_id = vWarehouse - AND c.country NOT IN ('Francia','Holanda') - ON DUPLICATE KEY UPDATE buyed = buyed + @amount; - - DROP TEMPORARY TABLE - tmp.buyUltimate, - 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 `stockBuyedByWorker` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -78936,6 +78481,69 @@ 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 `stockBuyed_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyed_add`(vDated DATE) +BEGIN +/** + * Inserta el volumen de compra por comprador en vn.stockBuyed de acuerdo con la fecha + * + * @param vDated Fecha de compra + */ + CALL vn.stockTraslation(vDated); + + DELETE + FROM vn.stockBuyed + WHERE `date` = vDated; + + INSERT INTO vn.stockBuyed(`user`, buyed, `date`, description) + SELECT it.workerFk, + SUM(( ti.amount / b.packing ) * vn.buy_getVolume(b.id)) / vc.palletM3 / 1000000 buyed, + vDated, + u.name + FROM tmp_item ti + JOIN vn.item i ON i.id = ti.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.warehouse wh ON wh.code = 'VNH' + JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = wh.id + JOIN vn.buy b ON b.id = bu.buyFk + JOIN vn.volumeConfig vc + JOIN account.`user` u ON u.id = it.workerFk + WHERE ic.display != 0 + GROUP BY it.workerFk; + + INSERT INTO stockBuyed(buyed, `date`, description) + SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000), vDated, IF(c.country = 'España',p.name,c.country) destiny + FROM vn.itemTicketOut ito + JOIN vn.ticket t ON t.id = ito.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.warehouse wh ON wh.id = t.warehouseFk + JOIN vn.itemCost ic ON ic.itemFk = ito.itemFk AND ic.warehouseFk = t.warehouseFk + JOIN vn.volumeConfig vc + WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated) + AND wh.code = 'VNH' + GROUP BY destiny; + + DROP TEMPORARY TABLE + tmp.buyUltimate, + 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` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -80801,11 +80409,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 = 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_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCreateWithUser`( vClientId INT @@ -80819,191 +80427,19 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCreateWithUser`( ,vUserId INT ,OUT vNewTicket INT) BEGIN --- si se modifica algo avisad a jgallego - DECLARE vZoneFk INT; - DECLARE vPrice DECIMAL(10,2); - DECLARE vBonus DECIMAL(10,2); - - IF vClientId IS NULL THEN - CALL util.throw ('CLIENT_NOT_ESPECIFIED'); - END IF; - - IF NOT vAddressFk OR vAddressFk IS NULL THEN - SELECT id INTO vAddressFk - FROM address - WHERE clientFk = vClientId AND isDefaultAddress; - END IF; - - IF vAgencyModeFk IS NOT NULL THEN - - CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE); - - SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus - FROM tmp.zoneGetShipped - WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; - - IF vZoneFk IS NULL OR vZoneFk = 0 THEN - CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); - END IF; - END IF; - INSERT INTO ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - routeFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus - ) - SELECT - vClientId, - vShipped, - a.id, - vAgencyModeFk, - a.nickname, - vWarehouseFk, - IF(vRouteFk,vRouteFk,NULL), - vCompanyFk, - vlanded, - vZoneFk, - vPrice, - vBonus - FROM address a - JOIN agencyMode am ON am.id = a.agencyModeFk - WHERE a.id = vAddressFk; - - 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.id = vAddressFk; - - IF (SELECT COUNT(*) FROM bs.clientNewBorn cnb - WHERE cnb.clientFk = vClientId - AND NOT cnb.isRookie) = 0 THEN - - CALL vn.ticketObservation_addNewBorn(vNewTicket); - END IF; - - INSERT INTO vn.ticketLog - SET originFk = vNewTicket, userFk = vUserId, `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vNewTicket); - - IF (SELECT ct.isCreatedAsServed FROM vn.clientType ct JOIN vn.client c ON c.typeFk = ct.code WHERE c.id = vClientId ) <> FALSE THEN - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vNewTicket, account.myUser_getId() - 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 `ticketCreateWithUser__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCreateWithUser__`( - vClientId INT - ,vShipped DATE - ,vWarehouseFk INT - ,vCompanyFk INT - ,vAddressFk INT - ,vAgencyModeFk INT - ,vRouteFk INT - ,vlanded DATE - ,vUserId INT - ,OUT vNewTicket INT) -BEGIN - - DECLARE vZoneFk INT; - DECLARE vPrice DECIMAL(10,2); - DECLARE vBonus DECIMAL(10,2); - - IF vClientId IS NULL THEN - CALL util.throw ('CLIENT_NOT_ESPECIFIED'); - END IF; - - IF NOT vAddressFk OR vAddressFk IS NULL THEN - SELECT id INTO vAddressFk - FROM address - WHERE clientFk = vClientId AND isDefaultAddress; - END IF; - - IF vAgencyModeFk IS NOT NULL THEN - - CALL vn.zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk); - - SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus - FROM tmp.zoneGetShipped - WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; - - IF vZoneFk IS NULL OR vZoneFk = 0 THEN - CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); - END IF; - END IF; - INSERT INTO ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - routeFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus - ) - SELECT - vClientId, - vShipped, - a.id, - vAgencyModeFk, - a.nickname, - vWarehouseFk, - IF(vRouteFk,vRouteFk,NULL), - vCompanyFk, - vlanded, - vZoneFk, - vPrice, - vBonus - FROM address a - JOIN agencyMode am ON am.id = a.agencyModeFk - WHERE a.id = vAddressFk; - - 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.id = vAddressFk; - - INSERT INTO vn.ticketLog - SET originFk = vNewTicket, userFk = vUserId, `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vNewTicket); - - IF (SELECT ct.isCreatedAsServed FROM vn.clientType ct JOIN vn.client c ON c.typeFk = ct.code WHERE c.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; + CALL ticket_add( + vClientId, + vShipped, + vWarehouseFk, + vCompanyFk, + vAddressFk, + vAgencyModeFk, + vRouteFk, + vlanded, + vUserId, + TRUE, + vNewTicket + ); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81806,11 +81242,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 = 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_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketPackagingRecovery__`() BEGIN @@ -81841,8 +81277,17 @@ BEGIN WHILE NOT done DO - CALL vn.ticketCreate(vClientFk,vShipped,vWarehouseFk,vCompanyFk, NULL, NULL, NULL, - vShipped,vTicketNewFk); + CALL vn.ticket_add(vClientFk, + vShipped, + vWarehouseFk, + vCompanyFk, + NULL, + NULL, + NULL, + vShipped, + account.userGetId(), + TRUE, + vTicketNewFk); UPDATE vn.ticketPackaging set ticketFk = vTicketNewFk WHERE ticketFk = vTicketFk; @@ -82805,6 +82250,99 @@ 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_canAdvance` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canAdvance`(vDated DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. + * + * @param vDated Fecha de los tickets que se quieren adelantar. + * @param vWarehouseFk Almacén + */ + DECLARE vDateInventory DATE; + DECLARE vDateToAdvance DATE; + + SELECT inventoried INTO vDateInventory FROM vn.config; + + SET vDateToAdvance = TIMESTAMPADD(DAY,-1,vDated); + + DROP TEMPORARY TABLE IF EXISTS tmp.stock; + CREATE TEMPORARY TABLE tmp.stock + (itemFk INT PRIMARY KEY, + amount INT) + ENGINE = MEMORY; + + INSERT INTO tmp.stock(itemFk, amount) + SELECT itemFk, SUM(quantity) amount FROM + ( + SELECT itemFk, quantity + FROM vn.itemTicketOut + WHERE shipped >= vDateInventory + AND shipped < vDated + AND warehouseFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryIn + WHERE landed >= vDateInventory + AND landed < vDated + AND isVirtualStock = FALSE + AND warehouseInFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDated + AND warehouseOutFk = vWarehouseFk + ) t + GROUP BY itemFk HAVING amount != 0; + + SELECT s.ticketFk ticketFuture, + sum((s.quantity <= IFNULL(st.amount,0))) hasStock, + count(DISTINCT s.id) saleCount, + st.name tfState, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) tfIpt, + t2.ticketFk, + t2.state, + t2.ipt + FROM vn.ticket t + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + LEFT JOIN (SELECT + t2.id ticketFk, + t2.addressFk, + st.name state, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt + FROM vn.ticket t2 + JOIN vn.sale s ON s.ticketFk = t2.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticketState ts ON ts.ticketFk = t2.id + JOIN vn.state st ON st.id = ts.stateFk + WHERE t2.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) + AND t2.warehouseFk = vWarehouseFk + GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk + WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id; + + DROP TEMPORARY TABLE tmp.stock; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_canMerge` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -82817,36 +82355,52 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) BEGIN - - /* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro - * - * @param vDated Fecha en cuestión - * @param vScopeDays Dias en el futuro a sondear - * @param vLitersMax Volumen máximo de los tickets a catapultar - * @param vLinesMax Número máximo de lineas de los tickets a catapultar - * @param vWarehouseFk Identificador de vn.warehouse - */ - +/** + * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vDated Fecha en cuestión + * @param vScopeDays Dias en el futuro a sondear + * @param vLitersMax Volumen máximo de los tickets a catapultar + * @param vLinesMax Número máximo de lineas de los tickets a catapultar + * @param vWarehouseFk Identificador de vn.warehouse + */ SELECT sv.ticketFk , + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, CAST(sum(litros) AS DECIMAL(10,0)) liters, CAST(count(*) AS DECIMAL(10,0)) `lines`, + st.name state, sub2.id ticketFuture, - sub2.shipped + sub2.shipped, + sub2.iptd tfIpt, + sub2.state tfState FROM vn.saleVolume sv + JOIN vn.sale s ON s.id = sv.saleFk + JOIN vn.item i ON i.id = s.itemFk JOIN vn.ticket t ON t.id = sv.ticketFk JOIN vn.address a ON a.id = t.addressFk JOIN vn.province p ON p.id = a.provinceFk JOIN vn.country c ON c.id = p.countryFk JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk JOIN vn.alertLevel al ON al.id = ts.alertLevel LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id LEFT JOIN ( SELECT * FROM ( - SELECT t.addressFk , t.id, t.shipped + SELECT + t.addressFk , + t.id, + t.shipped, + st.name state, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd FROM vn.ticket t + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) AND t.warehouseFk = vWarehouseFk + GROUP BY t.id ) sub GROUP BY sub.addressFk ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id @@ -83301,13 +82855,12 @@ BEGIN JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity WHERE saleOriginal.ticketFk = vTicketFk AND saleClon.ticketFk = vNewTicket; - INSERT INTO ticketRequest (description,ordered,shipped,salesPersonCode,buyerCode,quantity,price,itemFk,clientFk,response, - total,buyed,saleFk) - SELECT o.description,o.ordered,vShipment,o.salesPersonCode,o.buyerCode,o.quantity,o.price,o.itemFk,o.clientFk,o.response, - o.total,o.buyed,s2.id - FROM sale s JOIN ticketRequest o ON o.saleFk = s.id - JOIN sale s2 ON s.concept = s2.concept AND s.quantity = s2.quantity AND s.itemFk = s2.itemFk - WHERE s.ticketFk = vTicketFk AND s2.ticketFk = vNewTicket; + INSERT INTO ticketRequest (description,ordered,shipped,quantity,price,itemFk,clientFk,response, + total,buyed,requesterFk,attenderFk,ticketFk) + SELECT description,ordered,shipped,quantity,price,itemFk,clientFk,response, + total,buyed,requesterFk,attenderFk,vNewTicket + FROM ticketRequest + WHERE ticketFk =vTicketFk; INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) VALUES(vNewTicket,4,CONCAT('turno desde ticket: ',vTicketFk)) ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); @@ -84174,6 +83727,7 @@ proc: BEGIN DECLARE vDone BOOL; DECLARE vTicketFk INT; + DECLARE vError INT; DECLARE cCur CURSOR FOR SELECT ticketFk FROM ticketRecalc; @@ -84185,6 +83739,17 @@ proc: BEGIN BEGIN DO RELEASE_LOCK('vn.ticket_doRecalc'); ROLLBACK; + GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; + SET vError = IFNULL(@errno, 0) ; + IF NOT(vError = 1105 OR vError = 1751) THEN + CALL `vn`.`mail_insert`('cau@verdnatura.es', + NULL, + 'Problema al recalcular el total de ticket', + CONCAT('Se ha detectado un problema en ticket_doRecalc al calcular el total del ticket : ', + vTicketFk,' el error es el: ', + CONCAT('ERROR ', IFNULL(@errno, 0), ': ', ifnull(@text, ''))) + ); + END IF; RESIGNAL; END; @@ -84452,9 +84017,9 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) BEGIN @@ -84495,7 +84060,8 @@ BEGIN WHERE t.id = vTicketFk; DROP TEMPORARY TABLE IF EXISTS tmp.itemList; - DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; + DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84646,6 +84212,156 @@ 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_getSplitList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getSplitList`(vDated DATE, vHour TIME, vWarehouseFk INT) +BEGIN +/** + * Devuelve un listado con los tickets posibles para splitar HOY. + * + * @param vDated Fecha a estudiar + * @param vHour Hora a partir de la cual todavía se puede enviar, si la fecha es la de hoy + * @param vWarehouseFk Almacén + */ + DECLARE vAvailableCache INT; + DECLARE vVisibleCache INT; + + CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, CURDATE()); + CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); + CALL `vn`.`zoneClosure_recalc`(); + + DROP TEMPORARY TABLE IF EXISTS tmp.salesToSplit; + + CREATE TEMPORARY TABLE tmp.salesToSplit + (saleFk INT PRIMARY KEY, + ticketFk INT, + problem VARCHAR(1)) ENGINE = MEMORY; + + INSERT INTO tmp.salesToSplit(saleFk, ticketFk, problem) + SELECT s.id, s.ticketFk, 'F' + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) < s.quantity + AND IFNULL(av.available ,0) < s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND NOT i.generic + AND t.warehouseFk = vWarehouseFk; + + INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem) + SELECT s.id, s.ticketFk, 'I' + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) >= s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND NOT i.generic + AND t.warehouseFk = vWarehouseFk; + + INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem) + SELECT s.id, s.ticketFk, 'R' + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) < s.quantity + AND IFNULL(av.available ,0) >= s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND NOT i.generic + AND t.warehouseFk = vWarehouseFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketsToSplit; + + CREATE TEMPORARY TABLE tmp.ticketsToSplit + (ticketFk INT PRIMARY KEY, + problems VARCHAR(100), + addressFk INT, + ipt VARCHAR(10), + etd TIME) ENGINE = MEMORY; + + INSERT INTO tmp.ticketsToSplit + SELECT + ss.ticketFk, + GROUP_CONCAT(DISTINCT ss.problem ORDER BY ss.problem) problems, + t.addressFk, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, + zc.`hour` etd + FROM tmp.salesToSplit ss + JOIN vn.ticket t ON t.id = ss.ticketFk + JOIN vn.sale s ON s.id = ss.saleFk + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk + GROUP BY ss.ticketFk; + + SELECT + ts.*, + t.id ticketFuture, + st.name state, + zc.`hour` tfEtd, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) tfIpt, + st2.name tfState + FROM tmp.ticketsToSplit ts + LEFT JOIN vn.ticketState ts2 ON ts2.ticketFk = ts.ticketFk + LEFT JOIN vn.state st ON st.id = ts2.stateFk + LEFT JOIN vn.ticket t + ON t.id != ts.ticketFk + AND t.addressFk = ts.addressFk + AND t.shipped BETWEEN vDated AND util.dayend(vDated) + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = vDated + LEFT JOIN vn.sale s ON s.ticketFk = t.id + LEFT JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id + LEFT JOIN vn.state st2 ON st2.id = tst.stateFk + WHERE (t.id IS NULL + OR (vDated > CURDATE()) + OR (vDated = CURDATE() AND vHour >= zc.`hour`)) + AND ts.etd <= vHour + GROUP BY ts.ticketFk, t.id + ORDER BY ts.etd, ts.ticketFk; + + DROP TEMPORARY TABLE + tmp.ticketsToSplit; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getTax` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -85503,6 +85219,96 @@ 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_split` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE) +proc:BEGIN +/** + * Mueve las lineas con problemas a otro ticket existente o a uno nuevo. + * + * @param vTicketFk Identificador del ticket a splittar + * @param vTicketFutureFk Identificador del ticket al que se quieren mover las lineas + * @param vDate Fecha a la que se va a mover + * @table tmp.salesToSplit(saleFk, ticketFk, problem) + */ + DECLARE vHasFullProblem BOOL; + DECLARE vProblemLines INT; + DECLARE vTotalLines INT; + + SELECT COUNT(*) INTO vProblemLines + FROM tmp.salesToSplit + WHERE ticketFk = vTicketFk; + + SELECT count(*) INTO vTotalLines + FROM vn.sale s + WHERE s.ticketFk = vTicketFk; + + SET vHasFullProblem = (vTotalLines = vProblemLines); + + -- Ticket completo + IF vHasFullProblem THEN + + UPDATE vn.ticket + SET landed = vDated + 1, + shipped = vDated, + nickname = CONCAT('(',DAY(curdate()),') ', nickname ) + WHERE id = vTicketFk; + + SELECT CONCAT("Se ha cambiado el ticket ", vTicketFk, " al dia ", vDated); + LEAVE proc; + + END IF; + + -- Ticket a futuro existe + IF vTicketFutureFk THEN + + UPDATE vn.sale s + JOIN tmp.salesToSplit ss ON s.id = ss.saleFk + SET s.ticketFk = vTicketFutureFk, + s.concept = CONCAT('(s) ', s.concept) + WHERE ss.ticketFk = vTicketFk; + + SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, + " al ticket existente ", vTicketFutureFk,"(", vDated,")"); + LEAVE proc; + + END IF; + + -- Ticket nuevo + CALL vn.ticket_Clone(vTicketFk, vTicketFutureFk); + + UPDATE vn.ticket t + JOIN vn.productionConfig pc + SET t.landed = vDated + 1, + t.shipped = vDated, + t.agencyModeFk = pc.defautlAgencyMode, + t.zoneFk = pc.defaultZone + WHERE t.id = vTicketFutureFk; + + UPDATE vn.sale s + JOIN tmp.salesToSplit sts ON sts.saleFk = s.id + SET s.ticketFk = vTicketFutureFk, + s.concept = CONCAT('(s) ', s.concept) + WHERE sts.ticketFk = vTicketFk; + + CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING'); + + SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, + " al nuevo ticket ", vTicketFutureFk,"(", vDated,")"); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_splitItemPackingType` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -90992,29 +90798,19 @@ DELIMITER ; /*!50003 SET @saved_col_connection = @@collation_connection */ ; /*!50003 SET character_set_client = utf8mb4 */ ; /*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartment`(IN vWeek int, IN vYear int, IN vWorkerFk int) +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartment`(IN vDatedFrom DATETIME, IN vDatedTo DATETIME, IN vWorkerFk INT) BEGIN - - /** - * Inserta el registro de horario semanalmente de PRODUCCION, CAMARA, REPARTO, TALLER NATURAL y TALLER ARTIFICIAL en vn.mail. - * - * @param vWeek - * @param vYear - * @param vWorkerFk -> En el caso de querer generarlo para todos los empleados deberá de informarse como NULL - */ - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SELECT CONCAT (MIN(dated), ' 00:00:00'), CONCAT (MAX(dated), ' 23:59:59') INTO vDateStart, vDateEnd - FROM time - WHERE year = vYear AND - week = vWeek; - +/** + * Inserta el registro de horario semanalmente de PRODUCCION, CAMARA, REPARTO, TALLER NATURAL y TALLER ARTIFICIAL en vn.mail. + * + * @param vDatedFrom + * @param vDatedTo + * @param vWorkerFk -> En el caso de querer generarlo para todos los empleados deberá de pasarse = NULL + */ SET session group_concat_max_len = 15000; DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; @@ -91022,15 +90818,15 @@ BEGIN DROP TEMPORARY TABLE IF EXISTS tmp.reportHours; IF vWorkerFk IS NULL THEN - CALL timeControl_calculateAll(vDateStart,vDateEnd); - CALL timeBusiness_calculateAll(vDateStart,vDateEnd); + CALL timeControl_calculateAll(vDatedFrom,vDatedTo); + CALL timeBusiness_calculateAll(vDatedFrom,vDatedTo); ELSE - CALL timeControl_calculateByUser(vWorkerFk,vDateStart,vDateEnd); - CALL timeBusiness_calculateByUser(vWorkerFk,vDateStart,vDateEnd); + CALL timeControl_calculateByUser(vWorkerFk,vDatedFrom,vDatedTo); + CALL timeBusiness_calculateByUser(vWorkerFk,vDatedFrom,vDatedTo); END IF; CREATE TEMPORARY TABLE tmp.reportHours - SELECT t.dated, + SELECT t.dated, IF (tm.hoursWeek IS NULL,'', GROUP_CONCAT(DATE_FORMAT(wtc.timed,'%H:%i') ORDER BY wtc.timed ASC SEPARATOR ' ') ) timeWorkDay, SEC_TO_TIME(IFNULL(tm.timeWorkSeconds, 0)) tm, SEC_TO_TIME(IFNULL(tc.timeWorkSeconds, 0)) tc, @@ -91059,12 +90855,11 @@ BEGIN LEFT JOIN client c ON c.id = w.id WHERE wc.name NOT IN ('VNH') AND d.hasToSendMail - AND (wl.ended >= CURDATE() OR wl.ended IS NULL) GROUP BY tm.userFk,t.dated ORDER BY tm.userFk,t.dated; INSERT INTO vn.mail (receiver, replyTo, subject, body) - SELECT eu.email, 'laboral@verdnatura.es', CONCAT('Registro de horas semana ', vWeek, ' año ', vYear) , + SELECT eu.email, 'laboral@verdnatura.es', CONCAT('Registro de horas semana ', WEEK(vDatedFrom), ' año ', YEAR(vDatedFrom)) , CONCAT(' @@ -91150,16 +90945,12 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartmentLauncher`() BEGIN - DECLARE vWeek,vYear INT; + DECLARE vDatedFrom, vDatedTo DATETIME; IF (DAYNAME(CURDATE()) = 'miércoles') THEN - SELECT week,year INTO vWeek,vYear - FROM vn.time - WHERE dated IN (DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY)) - GROUP BY year,week - LIMIT 1; - - CALL vn.workerTimeControl_sendMailByDepartment(vWeek, vYear, NULL); + SELECT DATE_SUB(CURDATE(), INTERVAL 9 DAY), CONCAT(DATE_SUB(CURDATE(), INTERVAL 3 DAY), ' 23:59:59') INTO vDatedFrom, vDatedTo; + + CALL vn.workerTimeControl_sendMailByDepartment(vDatedFrom, vDatedTo, NULL); END IF; END ;; DELIMITER ; @@ -93088,37 +92879,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 `zonePromo_Make__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zonePromo_Make__`() -BEGIN - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) - SELECT t.id , 98, - packages, '-- DIA DE COMPRA BONIFICADO --', zp.amount - FROM vn.ticket t - JOIN vn.zonePromo zp ON zp.zoneFk = t.zoneFk AND zp.dated = DATE(t.shipped) - WHERE zp.isDone = FALSE - AND zp.dated < CURDATE() - AND t.refFk IS NULL; - - UPDATE vn.zonePromo - SET isDone = TRUE - WHERE dated < 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 `zone_doCalcInitialize` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -93290,6 +93050,53 @@ 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 `zone_getClosed` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getClosed`() +proc:BEGIN +/** + * Devuelve una tabla con las zonas cerradas para hoy + * + * @table tmp.closedZones(zoneFk, warehouseFk); + */ + DROP TEMPORARY TABLE IF EXISTS tmp.closedZones; + + CREATE TEMPORARY TABLE tmp.closedZones ( + `zoneFk` int(11) NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + PRIMARY KEY `zoneFk` (`zoneFk`,`warehouseFk`), + KEY `warehouseFk` (`warehouseFk`)) + ENGINE=MEMORY DEFAULT CHARSET=utf8; + + INSERT INTO tmp.closedZones(zoneFk, warehouseFk) + SELECT zoneFk, warehouseFk + FROM ( + SELECT t.zoneFk, t.warehouseFk, count(DISTINCT t.id) numTickets, pc.minTicketsToCloseZone + FROM vn.ticket t + JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.`zone`z on z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.productionConfig pc + WHERE a.isOwn + AND pc.isZoneClosedByExpeditionActivated + AND e.created >= CURDATE() + GROUP BY t.zoneFk, t.warehouseFk + HAVING numTickets >= minTicketsToCloseZone) sub; + END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getCollisions` */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; /*!50003 SET @saved_cs_results = @@character_set_results */ ; @@ -93582,34 +93389,42 @@ DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN) BEGIN /** -* Devuelve una tabla temporal con el dia de recepcion para vShipped. -* -* @param vShipped Fecha de preparacion de mercancia -* @param vAddressFk Id de consignatario, %NULL para recogida -* @param vAgencyModeFk Id agencia -* @param vWarehouseFk vWarehouseFk -* @table tmp.zoneGetLanded Datos de recepción -*/ + * Devuelve una tabla temporal con el dia de recepcion para vShipped. + * Excluye las que tengan cajas preparadas + * + * @param vShipped Fecha de preparacion de mercancia + * @param vAddressFk Id de consignatario, %NULL para recogida + * @param vAgencyModeFk Id agencia + * @param vWarehouseFk vWarehouseFk + * @table tmp.zoneGetLanded Datos de recepción + */ + CALL vn.zone_getFromGeo(address_getGeo(vAddressFk)); - CALL zone_getFromGeo(address_getGeo(vAddressFk)); - CALL zone_getOptionsForShipment(vShipped, vShowExpiredZones); + CALL vn.zone_getOptionsForShipment(vShipped, vShowExpiredZones); + + CALL vn.zone_getClosed(); DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; CREATE TEMPORARY TABLE tmp.zoneGetLanded ENGINE = MEMORY SELECT vWarehouseFk warehouseFk, - TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed, + TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed, zo.zoneFk FROM tmp.zoneOption zo - JOIN zone z ON z.id = zo.zoneFk - JOIN zoneWarehouse zw ON zw.zoneFk = z.id - WHERE agencyModeFk = vAgencyModeFk - AND zw.warehouseFk = vWarehouseFk; - + JOIN vn.`zone` z ON z.id = zo.zoneFk + JOIN vn.zoneWarehouse zw ON zw.zoneFk = z.id + LEFT JOIN tmp.closedZones cz + ON cz.warehouseFk = zw.warehouseFk + AND cz.zoneFk = zw.zoneFk + AND zo.shipped = CURDATE() + WHERE z.agencyModeFk = vAgencyModeFk + AND zw.warehouseFk = vWarehouseFk + AND (ISNULL(cz.zoneFk) OR vShowExpiredZones); + DROP TEMPORARY TABLE - tmp.zone, - tmp.zoneOption; - + tmp.`zone`, + tmp.zoneOption, + tmp.closedZones; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -94062,7 +93877,8 @@ BEGIN l.travelingDays, IFNULL(e.price, z.price) price, IFNULL(e.bonus, z.bonus) bonus, - l.landed + l.landed, + vShipped shipped FROM tmp.zone t JOIN zone z ON z.id = t.id JOIN zoneEvent e ON e.zoneFk = t.id @@ -94099,123 +93915,6 @@ BEGIN WHERE vShipped < CURDATE() OR (vShipped = CURDATE() AND CURTIME() > `hour`); 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 `zone_getOptionsForShipment_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForShipment_beta`(vShipped DATE, vShowExpiredZones BOOLEAN) -BEGIN -/** - * Gets computed options for the passed zones and shipping date. - * - * @table tmp.zones(id) The zones ids - * @param vShipped The shipping date - * @return tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, specificity) The computed options - */ - DECLARE vHour TIME DEFAULT TIME(NOW()); - - DROP TEMPORARY TABLE IF EXISTS tLandings; - CREATE TEMPORARY TABLE tLandings - (INDEX (eventFk)) - ENGINE = MEMORY - SELECT e.id eventFk, - @travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays, - TIMESTAMPADD(DAY, @travelingDays, vShipped) landed - FROM tmp.zone t - JOIN zone z ON z.id = t.id - JOIN zoneEvent e ON e.zoneFk = t.id; - - SELECT * FROM tLandings - JOIN vn.zoneEvent ze ON ze.id = eventFk - WHERE ze.zoneFk = 25; - - DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; - CREATE TEMPORARY TABLE tmp.zoneOption - ENGINE = MEMORY - SELECT * - FROM ( - SELECT t.id zoneFk, - TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, - l.travelingDays, - IFNULL(e.price, z.price) price, - IFNULL(e.bonus, z.bonus) bonus, - l.landed - FROM tmp.zone t - JOIN zone z ON z.id = t.id - JOIN zoneEvent e ON e.zoneFk = t.id - JOIN tLandings l ON l.eventFk = e.id - WHERE ( - e.`type` = 'day' - AND e.`dated` = l.landed - ) OR ( - e.`type` != 'day' - AND e.weekDays & (1 << WEEKDAY(l.landed)) - AND (e.`started` IS NULL OR l.landed >= e.`started`) - AND (e.`ended` IS NULL OR l.landed <= e.`ended`) - ) - ORDER BY - zoneFk, - CASE - WHEN e.`type` = 'day' - THEN -1 - WHEN e.`type` = 'range' - THEN 2 - ELSE 3 - END - ) t - GROUP BY zoneFk; - - SELECT e.id, e.type, (e.`dated` = l.landed), e.`dated` , l.landed, t.id zoneFk, - TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, - l.travelingDays, - IFNULL(e.price, z.price) price, - IFNULL(e.bonus, z.bonus) bonus, - l.landed - FROM tmp.zone t - JOIN zone z ON z.id = t.id - JOIN zoneEvent e ON e.zoneFk = t.id - JOIN tLandings l ON l.eventFk = e.id - WHERE zoneFk = 25 - ORDER BY - zoneFk, - CASE - WHEN e.`type` = 'day' - THEN 1 - WHEN e.`type` = 'range' - THEN 2 - ELSE 3 - END; - - SELECT * FROm tmp.zoneOption WHERE zoneFk = 25; - - DROP TEMPORARY TABLE tLandings; - - DELETE t FROM tmp.zoneOption t - JOIN zoneExclusion e - ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; - - SELECT * FROm tmp.zoneOption WHERE zoneFk = 25; - - IF NOT vShowExpiredZones THEN - DELETE FROM tmp.zoneOption - WHERE vShipped < CURDATE() - OR (vShipped = CURDATE() AND CURTIME() > `hour`); - END IF; - - - END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -94236,36 +93935,99 @@ CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getShipped`(vLanded DATE, vAdd BEGIN /** * Devuelve la mínima fecha de envío para cada warehouse - * + * Excluye aquellas zonas que ya tienen cajas preparadas en ese almacén + * * @param vLanded La fecha de recepcion * @param vAddressFk Id del consignatario * @param vAgencyModeFk Id de la agencia * @return tmp.zoneGetShipped - */ - CALL zone_getFromGeo(address_getGeo(vAddressFk)); - CALL zone_getOptionsForLanding(vLanded, vShowExpiredZones); - + */ + CALL vn.zone_getFromGeo(address_getGeo(vAddressFk)); + CALL vn.zone_getOptionsForLanding(vLanded, vShowExpiredZones); + CALL vn.zone_getClosed(); + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetShipped; CREATE TEMPORARY TABLE tmp.zoneGetShipped ENGINE = MEMORY SELECT * FROM ( - SELECT zo.zoneFk, - TIMESTAMPADD(DAY,-zo.travelingDays, vLanded) shipped, - zo.`hour`, + SELECT zo.zoneFk, + zo.shipped, + zo.`hour`, zw.warehouseFk, - z.agencyModeFk, - zo.price, - zo.bonus + z.agencyModeFk, + zo.price, + zo.bonus FROM tmp.zoneOption zo - JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk - JOIN zone z ON z.id = zo.zoneFk + JOIN vn.zoneWarehouse zw ON zw.zoneFk = zo.zoneFk + JOIN vn.`zone` z ON z.id = zo.zoneFk + LEFT JOIN tmp.closedZones cz + ON cz.warehouseFk = zw.warehouseFk + AND cz.zoneFk = zw.zoneFk + AND zo.shipped = CURDATE() WHERE z.agencyModeFk = vAgencyModeFk - ORDER BY shipped) t + AND (ISNULL(cz.zoneFk) OR vShowExpiredZones) + ORDER BY shipped) t GROUP BY warehouseFk; - + DROP TEMPORARY TABLE - tmp.zone, - tmp.zoneOption; + tmp.`zone`, + tmp.zoneOption, + tmp.closedZones; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getState` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getState`(vDated DATE) +BEGIN +/** + * Devuelve las zonas y el estado para la fecha solicitada + * + * @param vDated Fecha en cuestión + */ + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + + CREATE TEMPORARY TABLE tmp.zone ( + id INT PRIMARY KEY) + ENGINE=MEMORY; + + INSERT INTO tmp.zone(id) + SELECT id + FROM vn.zone; + + CALL vn.zone_getOptionsForShipment(vDated, TRUE); + + CALL vn.zone_getClosed(); + + SELECT zo.zoneFk, + zo.`hour`etd, + (zo.`hour` <= TIME(now())) isLate, + !ISNULL(cz.zoneFk) isFull, + zw.warehouseFk, + zo.landed + FROM tmp.zoneOption zo + JOIN vn.zone z ON z.id = zo.zoneFk + JOIN vn.zoneWarehouse zw ON zw.zoneFk = z.id + LEFT JOIN tmp.closedZones cz + ON cz.warehouseFk = zw.warehouseFk + AND cz.zoneFk = zo.zoneFk; + + DROP TEMPORARY TABLE + tmp.closedZones, + tmp.zoneOption, + tmp.zone; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -97150,7 +96912,7 @@ USE `vn`; /*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`quantity` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) group by `ish`.`id` */; +/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) group by `ish`.`id` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; @@ -97535,25 +97297,6 @@ USE `vn`; /*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET collation_connection = @saved_col_connection */; --- --- Final view structure for view `packingSite` --- - -/*!50001 DROP TABLE IF EXISTS `packingSite`*/; -/*!50001 DROP VIEW IF EXISTS `packingSite`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `packingSite` AS select `h`.`code` AS `hostFk`,`h`.`printerFk` AS `printerFk`,concat(`h`.`itemPackingTypeFk`,`h`.`packingSite`) AS `code` from `host` `h` where (`h`.`itemPackingTypeFk` is not null) order by `h`.`itemPackingTypeFk`,`h`.`packingSite` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - -- -- Final view structure for view `payDemDetail__` -- @@ -98095,11 +97838,11 @@ USE `vn`; /*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8 */; -/*!50001 SET character_set_results = utf8 */; -/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`$itBoss`@`%` SQL SECURITY DEFINER */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `ticketLocation` AS select `tl`.`Id_Ticket` AS `ticketFk`,`tl`.`longitude` AS `longitude`,`tl`.`latitude` AS `latitude` from `vn2008`.`ticket_location` `tl` */; /*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_results = @saved_cs_results */; @@ -98690,4 +98433,4 @@ USE `vncontrol`; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-03-28 9:44:10 +-- Dump completed on 2022-05-02 9:27:49 diff --git a/db/export-data.sh b/db/export-data.sh index 135047f04..900e630f7 100755 --- a/db/export-data.sh +++ b/db/export-data.sh @@ -14,6 +14,8 @@ echo "" > "$DUMPED_FILE" TABLES=( util config + version + versionLog ) dump_tables ${TABLES[@]} @@ -74,10 +76,20 @@ dump_tables ${TABLES[@]} TABLES=( hedera + browser imageCollection + imageCollectionSize + language + link + location + menu + message + metatag + newsTag + restPriv + social tpvError tpvResponse - imageCollectionSize ) dump_tables ${TABLES[@]} From b40b8d931d6f3a12972b5883634b908bf6d98c93 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 2 May 2022 11:18:39 +0200 Subject: [PATCH 056/141] feat(client_credit): remove de old rows --- .../10460-MothersDay/00-clientConfig.sql | 5 +++ db/dump/fixtures.sql | 4 +- modules/client/back/model-config.json | 3 ++ modules/client/back/models/client-config.json | 22 ++++++++++ modules/client/back/models/client-credit.js | 27 ++++++++++++ .../back/models/specs/clientCredit.spec.js | 44 +++++++++++++++++++ 6 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 db/changes/10460-MothersDay/00-clientConfig.sql create mode 100644 modules/client/back/models/client-config.json create mode 100644 modules/client/back/models/client-credit.js create mode 100644 modules/client/back/models/specs/clientCredit.spec.js diff --git a/db/changes/10460-MothersDay/00-clientConfig.sql b/db/changes/10460-MothersDay/00-clientConfig.sql new file mode 100644 index 000000000..cd67a5797 --- /dev/null +++ b/db/changes/10460-MothersDay/00-clientConfig.sql @@ -0,0 +1,5 @@ +ALTER TABLE `vn`.`clientConfig` ADD `maxCreditRows` int(11) NULL COMMENT 'Máximo número de registros a mantener en la tabla clientCredit'; + +UPDATE `vn`.`clientConfig` + SET `maxCreditRows` = 10 + WHERE `id` = 1; \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 0849e6708..1da08156c 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -342,9 +342,9 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`) (1103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), (1104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)); -INSERT INTO `vn`.`clientConfig`(`riskTolerance`) +INSERT INTO `vn`.`clientConfig`(`riskTolerance`, `maxCreditRows`) VALUES - (200); + (200, 10); INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`) VALUES diff --git a/modules/client/back/model-config.json b/modules/client/back/model-config.json index b6bf715b1..4feb3b168 100644 --- a/modules/client/back/model-config.json +++ b/modules/client/back/model-config.json @@ -14,6 +14,9 @@ "Client": { "dataSource": "vn" }, + "ClientConfig": { + "dataSource": "vn" + }, "ClientContact": { "dataSource": "vn" }, diff --git a/modules/client/back/models/client-config.json b/modules/client/back/models/client-config.json new file mode 100644 index 000000000..9d4228ede --- /dev/null +++ b/modules/client/back/models/client-config.json @@ -0,0 +1,22 @@ +{ + "name": "ClientConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "clientConfig" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "riskTolerance": { + "type": "Number" + }, + "maxCreditRows": { + "type": "Number" + } + } +} \ No newline at end of file diff --git a/modules/client/back/models/client-credit.js b/modules/client/back/models/client-credit.js new file mode 100644 index 000000000..587ca0adc --- /dev/null +++ b/modules/client/back/models/client-credit.js @@ -0,0 +1,27 @@ +module.exports = Self => { + Self.observe('after save', async ctx => { + const instance = ctx.instance; + const models = Self.app.models; + + const clientConfig = await models.ClientConfig.findOne({ + where: {id: 1} + }); + const maxCreditRows = clientConfig.maxCreditRows; + + const clientCredit = await models.ClientCredit.find({ + where: {clientFk: instance.clientFk}, + order: 'created DESC' + }); + + if (clientCredit.length > maxCreditRows) { + const creditToDestroy = []; + for (const [index, credit] of clientCredit.entries()) { + if (index >= maxCreditRows) + creditToDestroy.push(credit.id); + } + await models.ClientCredit.destroyAll({ + id: {inq: creditToDestroy} + }); + } + }); +}; diff --git a/modules/client/back/models/specs/clientCredit.spec.js b/modules/client/back/models/specs/clientCredit.spec.js new file mode 100644 index 000000000..db5004e5c --- /dev/null +++ b/modules/client/back/models/specs/clientCredit.spec.js @@ -0,0 +1,44 @@ +const models = require('vn-loopback/server/server').models; + +describe('Client Credit', () => { + const instance = {id: 1101, name: 'Bruce Banner'}; + + describe('after save', () => { + it('should delete old rows of clientCredit', async() => { + const tx = await models.ClientCredit.beginTransaction({}); + const clientConfig = await models.ClientConfig.findOne({ + where: {id: 1} + }); + let rowsBefore; + let rowsAfter; + + try { + const options = {transaction: tx}; + const context = {options}; + + rowsBefore = await models.ClientCredit.find({ + where: {clientFk: instance.id} + }, options); + + const salesAssistant = await models.Account.findOne({ + where: {name: 'salesAssistant'} + }, options); + context.options.accessToken = {userId: salesAssistant.id}; + + await models.Client.changeCredit(context, instance, {credit: 350}); + + rowsAfter = await models.ClientCredit.find({ + where: {clientFk: instance.id} + }, options); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + + expect(rowsBefore.length).toEqual(11); + expect(rowsAfter.length).toEqual(clientConfig.maxCreditRows); + }); + }); +}); From 3f074007058b3b83f45008b4ad50819271133896 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 2 May 2022 12:28:17 +0200 Subject: [PATCH 057/141] fix(delivery-note): type not required --- print/templates/reports/delivery-note/delivery-note.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index adda6e756..f9dba0578 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -7,6 +7,10 @@ const fs = require('fs-extra'); module.exports = { name: 'delivery-note', + created() { + if (!this.type) + this.type = 'deliveryNote'; + }, async serverPrefetch() { this.client = await this.fetchClient(this.ticketId); this.ticket = await this.fetchTicket(this.ticketId); @@ -129,7 +133,7 @@ module.exports = { }, type: { type: String, - required: true + required: false } } }; From d156cb1c30beb5f58be0cd21f2e54eeca3aeba75 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 2 May 2022 13:52:57 +0200 Subject: [PATCH 058/141] Queue transaction --- print/core/router.js | 3 --- print/methods/schedule/invoice.js | 11 +++++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/print/core/router.js b/print/core/router.js index 99f2b3ed6..cd64ba07e 100644 --- a/print/core/router.js +++ b/print/core/router.js @@ -15,7 +15,6 @@ module.exports = app => { WHERE at.id = ?`; const auth = await db.findOne(query, [token]); - console.log(auth); if (!auth || isTokenExpired(auth.created, auth.ttl)) throw new Error('Invalid authorization token'); @@ -32,8 +31,6 @@ module.exports = app => { locale: auth.lang }; - console.log(response.locals.auth); - next(); } catch (error) { next(error); diff --git a/print/methods/schedule/invoice.js b/print/methods/schedule/invoice.js index df4fe17b0..c76ca85b5 100644 --- a/print/methods/schedule/invoice.js +++ b/print/methods/schedule/invoice.js @@ -29,10 +29,14 @@ module.exports = async function(request, response, next) { LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk WHERE status = ''`); + let connection; let invoiceId; for (const invoiceOut of invoices) { try { invoiceId = invoiceOut.id; + connection = await db.getConnection(); + connection.query('START TRANSACTION'); + const args = Object.assign({ invoiceId: invoiceOut.id, recipientId: invoiceOut.clientFk, @@ -57,7 +61,7 @@ module.exports = async function(request, response, next) { fileName: fileName }); - await db.rawSql('UPDATE invoiceOut SET hasPdf = true WHERE id = ?', [invoiceOut.id]); + connection.query('UPDATE invoiceOut SET hasPdf = true WHERE id = ?', [invoiceOut.id]); const isToBeMailed = invoiceOut.recipient && invoiceOut.salesPersonFk && invoiceOut.isToBeMailed; @@ -93,8 +97,11 @@ module.exports = async function(request, response, next) { SET status = "printed", printed = NOW() WHERE invoiceFk = ?`; - await db.rawSql(sql, [invoiceOut.id]); + connection.query(sql, [invoiceOut.id]); + connection.query('COMMIT'); } catch (error) { + connection.query('ROLLBACK'); + connection.release(); sql = `UPDATE invoiceOut_queue SET status = ? WHERE invoiceFk = ?`; From 6584a29ce5df96e9d63c399539c4daa1dce8ae66 Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 3 May 2022 11:16:56 +0200 Subject: [PATCH 059/141] create deleteTrashFiles --- back/methods/dms/deleteTrashFiles.js | 57 ++++++ back/models/dms.js | 1 + db/changes/10460-mother/00-dmsForeignKey.sql | 8 + db/changes/10460-mother/01-dmsType.sql | 5 + db/changes/10460-mother/02-dmsTrigger.sql | 18 ++ db/changes/10460-mother/03-clean.sql | 175 ++++++++++++++++++ db/changes/10460-mother/04-acl.sql | 2 + .../back/methods/claim/deleteOldFiles.js | 63 ------- modules/claim/back/models/claim.js | 1 - modules/invoiceIn/front/dueDay/index.html | 3 + modules/invoiceIn/front/dueDay/index.js | 6 + 11 files changed, 275 insertions(+), 64 deletions(-) create mode 100644 back/methods/dms/deleteTrashFiles.js create mode 100644 db/changes/10460-mother/00-dmsForeignKey.sql create mode 100644 db/changes/10460-mother/01-dmsType.sql create mode 100644 db/changes/10460-mother/02-dmsTrigger.sql create mode 100644 db/changes/10460-mother/03-clean.sql create mode 100644 db/changes/10460-mother/04-acl.sql delete mode 100644 modules/claim/back/methods/claim/deleteOldFiles.js diff --git a/back/methods/dms/deleteTrashFiles.js b/back/methods/dms/deleteTrashFiles.js new file mode 100644 index 000000000..9d16e9d81 --- /dev/null +++ b/back/methods/dms/deleteTrashFiles.js @@ -0,0 +1,57 @@ +const fs = require('fs-extra'); +const path = require('path'); + +module.exports = Self => { + Self.remoteMethod('deleteTrashFiles', { + description: 'Deletes files that have trash type', + accessType: 'WRITE', + returns: { + type: 'object', + root: true + }, + http: { + path: `/deleteTrashFiles`, + verb: 'POST' + } + }); + + Self.deleteTrashFiles = async(options) => { + const tx = await Self.beginTransaction({}); + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + if (!myOptions.transaction) + myOptions.transaction = tx; + + try { + const models = Self.app.models; + const DmsContainer = models.DmsContainer; + + const trashDmsType = await models.DmsType.findOne({ + where: {code: 'trash'} + }, myOptions); + + const dmsToDelete = await models.Dms.find({ + where: { + dmsTypeFk: trashDmsType.id + } + }, myOptions); + + for (let dms of dmsToDelete) { + const pathHash = DmsContainer.getHash(dms.id); + const dmsContainer = await DmsContainer.container(pathHash); + const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file); + await fs.unlink(dstFile); + await dms.destroy(myOptions); + } + if (tx) await tx.commit(); + + } catch (e) { + if (tx) await tx.rollback(); + + throw e; + } + }; +}; diff --git a/back/models/dms.js b/back/models/dms.js index 91291a0c2..24c072f56 100644 --- a/back/models/dms.js +++ b/back/models/dms.js @@ -5,6 +5,7 @@ module.exports = Self => { require('../methods/dms/uploadFile')(Self); require('../methods/dms/removeFile')(Self); require('../methods/dms/updateFile')(Self); + require('../methods/dms/deleteTrashFiles')(Self); Self.checkRole = async function(ctx, id) { const models = Self.app.models; diff --git a/db/changes/10460-mother/00-dmsForeignKey.sql b/db/changes/10460-mother/00-dmsForeignKey.sql new file mode 100644 index 000000000..f44391a17 --- /dev/null +++ b/db/changes/10460-mother/00-dmsForeignKey.sql @@ -0,0 +1,8 @@ +ALTER TABLE vn.propertyDms DROP FOREIGN KEY propertyDms_FK; +ALTER TABLE vn.propertyDms ADD CONSTRAINT propertyDms_FK FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE; + +ALTER TABLE vn.clientDms DROP FOREIGN KEY clientDms_ibfk_2; +ALTER TABLE vn.clientDms ADD CONSTRAINT clientDms_ibfk_2 FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE; + +ALTER TABLE vn.workerDocument DROP FOREIGN KEY workerDocument_ibfk_2; +ALTER TABLE vn.workerDocument ADD CONSTRAINT workerDocument_ibfk_2 FOREIGN KEY (document) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/changes/10460-mother/01-dmsType.sql b/db/changes/10460-mother/01-dmsType.sql new file mode 100644 index 000000000..e82c086cf --- /dev/null +++ b/db/changes/10460-mother/01-dmsType.sql @@ -0,0 +1,5 @@ +ALTER TABLE vn.dmsType ADD monthToDelete INT UNSIGNED DEFAULT NULL NULL; +ALTER TABLE vn.dmsType MODIFY COLUMN monthToDelete int(10) unsigned DEFAULT NULL NULL COMMENT 'Meses en el pasado para ir borrando registros, dejar a null para no borrarlos nunca'; +UPDATE vn.dmsType + SET monthToDelete=6 + WHERE id=20; diff --git a/db/changes/10460-mother/02-dmsTrigger.sql b/db/changes/10460-mother/02-dmsTrigger.sql new file mode 100644 index 000000000..a92efcfab --- /dev/null +++ b/db/changes/10460-mother/02-dmsTrigger.sql @@ -0,0 +1,18 @@ + +DELIMITER $$ +$$ +CREATE TRIGGER dms_beforeDelete +BEFORE DELETE +ON dms FOR EACH ROW +BEGIN + DECLARE vCanNotBeDeleted INT; + SELECT COUNT(*) INTO vCanNotBeDeleted + FROM dmsType dt + WHERE NOT (code <=> 'trash') + AND dt.id = OLD.dmsTypeFk; + + IF vCanNotBeDeleted THEN + CALL util.throw('A dms can not be deleted'); + END IF; +END$$ +DELIMITER ; diff --git a/db/changes/10460-mother/03-clean.sql b/db/changes/10460-mother/03-clean.sql new file mode 100644 index 000000000..13951394f --- /dev/null +++ b/db/changes/10460-mother/03-clean.sql @@ -0,0 +1,175 @@ +DROP PROCEDURE IF EXISTS vn.clean; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clean`() +BEGIN + DECLARE vDateShort DATETIME; + DECLARE vOneYearAgo DATE; + DECLARE vFourYearsAgo DATE; + DECLARE v18Month DATE; + DECLARE v26Month DATE; + DECLARE v3Month DATE; + DECLARE vTrashId varchar(15); + + SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET vOneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE()); + SET vFourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE()); + SET v18Month = TIMESTAMPADD(MONTH, -18,CURDATE()); + SET v26Month = TIMESTAMPADD(MONTH, -26,CURDATE()); + SET v3Month = TIMESTAMPADD(MONTH, -3, CURDATE()); + + DELETE FROM ticketParking WHERE created < vDateShort; + DELETE FROM routesMonitor WHERE dated < vDateShort; + DELETE FROM workerTimeControlLog WHERE created < vDateShort; + DELETE FROM `message` WHERE sendDate < vDateShort; + DELETE FROM messageInbox WHERE sendDate < vDateShort; + DELETE FROM messageInbox WHERE sendDate < vDateShort; + DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo; + DELETE FROM itemShelving WHERE created < CURDATE() AND visible = 0; + DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE()); + DELETE FROM entryLog WHERE creationDate < vDateShort; + DELETE IGNORE FROM expedition WHERE created < v26Month; + DELETE FROM sms WHERE created < v18Month; + DELETE FROM saleTracking WHERE created < vOneYearAgo; + DELETE tobs FROM ticketObservation tobs + JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,CURDATE()); + DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo; + DELETE FROM sharingCart where ended < vDateShort; + DELETE FROM sharingClient where ended < vDateShort; + DELETE tw.* FROM ticketWeekly tw + LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL; + DELETE FROM claim WHERE ticketCreated < vFourYearsAgo; + DELETE FROM message WHERE sendDate < vDateShort; + -- Robert ubicacion anterior de trevelLog comentario para debug + DELETE sc FROM saleChecked sc + JOIN sale s ON sc.saleFk = s.id WHERE s.created < vDateShort; + DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month; + DELETE bm + FROM buyMark bm + JOIN buy b ON b.id = bm.id + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed <= vDateShort; + DELETE FROM stowaway WHERE created < v3Month; + DELETE FROM vn.buy WHERE created < vDateShort AND entryFk = 9200; + DELETE FROM vn.itemShelvingLog WHERE created < vDateShort; + DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort; + + + -- Equipos duplicados + DELETE w.* + FROM workerTeam w + JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated + FROM workerTeam + GROUP BY team,workerFk + HAVING duplicated + ) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id; + + DELETE sc + FROM saleComponent sc + JOIN sale s ON s.id= sc.saleFk + JOIN ticket t ON t.id= s.ticketFk + WHERE t.shipped < v18Month; + + DELETE c + FROM vn.claim c + JOIN vn.claimState cs ON cs.id = c.claimStateFk + WHERE cs.description = "Anulado" AND + c.created < vDateShort; + DELETE + FROM vn.expeditionTruck + WHERE ETD < v3Month; + + -- borrar travels sin entradas + DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; + CREATE TEMPORARY TABLE tmp.thermographToDelete + SELECT th.id,th.dmsFk + FROM vn.travel t + LEFT JOIN vn.entry e ON e.travelFk = t.id + JOIN vn.travelThermograph th ON th.travelFk = t.id + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL; + + SELECT dt.id into vTrashId + FROM vn.dmsType dt + WHERE dt.code = 'trash'; + + UPDATE tmp.thermographToDelete th + JOIN vn.dms d ON d.id = th.dmsFk + SET d.dmsTypeFk = vTrashId; + + DELETE th + FROM tmp.thermographToDelete tmp + JOIN vn.travelThermograph th ON th.id = tmp.id; + + DELETE t + FROM vn.travel t + LEFT JOIN vn.entry e ON e.travelFk = t.id + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL; + + UPDATE dms d + JOIN dmsType dt ON dt.id = d.dmsTypeFk + SET d.dmsTypeFk = vTrashId + WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, CURDATE()); + + -- borrar entradas sin compras + DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; + CREATE TEMPORARY TABLE tmp.entryToDelete + SELECT e.* + FROM vn.entry e + LEFT JOIN vn.buy b ON b.entryFk = e.id + JOIN vn.entryConfig ec ON e.id != ec.defaultEntry + WHERE e.dated < TIMESTAMPADD(MONTH, -3, CURDATE()) AND b.entryFK IS NULL; + + DELETE e + FROM vn.entry e + JOIN tmp.entryToDelete tmp ON tmp.id = e.id; + + -- borrar de route registros menores a 4 años + DROP TEMPORARY TABLE IF EXISTS tmp.routeToDelete; + CREATE TEMPORARY TABLE tmp.routeToDelete + SELECT * + FROM vn.route r + WHERE created < TIMESTAMPADD(YEAR,-4,CURDATE()); + + UPDATE tmp.routeToDelete tmp + JOIN vn.dms d ON d.id = tmp.gestdocFk + SET d.dmsTypeFk = vTrashId; + + DELETE r + FROM tmp.routeToDelete tmp + JOIN vn.route r ON r.id = tmp.id; + + -- borrar registros de dua y awb menores a 2 años + DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete; + CREATE TEMPORARY TABLE tmp.duaToDelete + SELECT * + FROM vn.dua + WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE()); + + UPDATE tmp.duaToDelete tm + JOIN vn.dms d ON d.id = tm.gestdocFk + SET d.dmsTypeFk = vTrashId; + + DELETE d + FROM tmp.duaToDelete tmp + JOIN vn.dua d ON d.id = tmp.id; + + DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,CURDATE()); + + -- Borra los ficheros gestDoc + INSERT INTO vn.printServerQueue(priorityFk, labelReportFk)VALUES(1,11); + + -- Borra los registros de collection y ticketcollection + DELETE FROM vn.collection WHERE created < vDateShort; + + DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; + DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; + DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete; + + DELETE FROM travelLog WHERE creationDate < v3Month; + + CALL shelving_clean; + +END$$ +DELIMITER ; diff --git a/db/changes/10460-mother/04-acl.sql b/db/changes/10460-mother/04-acl.sql new file mode 100644 index 000000000..c576bf1b0 --- /dev/null +++ b/db/changes/10460-mother/04-acl.sql @@ -0,0 +1,2 @@ +INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) + VALUES ('Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee') \ No newline at end of file diff --git a/modules/claim/back/methods/claim/deleteOldFiles.js b/modules/claim/back/methods/claim/deleteOldFiles.js deleted file mode 100644 index 6beb99c88..000000000 --- a/modules/claim/back/methods/claim/deleteOldFiles.js +++ /dev/null @@ -1,63 +0,0 @@ -const fs = require('fs-extra'); -const path = require('path'); - -module.exports = Self => { - Self.remoteMethodCtx('deleteOldFiles', { - description: 'Delete files that are 6 months old from dms', - accessType: 'WRITE', - returns: { - type: 'object', - root: true - }, - http: { - path: `/deleteOldFiles`, - verb: 'POST' - } - }); - - Self.deleteOldFiles = async(ctx, options) => { - const tx = await Self.beginTransaction({}); - const myOptions = {}; - - if (typeof options == 'object') - Object.assign(myOptions, options); - - if (!myOptions.transaction) - myOptions.transaction = tx; - - try { - const models = Self.app.models; - const sixMonthsAgo = new Date(); - sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6); - - const claimDmsType = await models.DmsType.findOne({where: {code: 'claim'}}, myOptions); - const oldDms = await models.Dms.find({ - where: { - and: [{ - created: {lt: sixMonthsAgo}}, { - dmsTypeFk: claimDmsType.id - }] - } - }); - - for (let dms of oldDms) { - const ClaimContainer = models.ClaimContainer; - const pathHash = await ClaimContainer.getHash(dms.id); - const claimContainer = await ClaimContainer.container(pathHash); - const dstFile = path.join(claimContainer.client.root, pathHash, dms.file); - await fs.unlink(dstFile); - await models.ClaimDms.removeFile(ctx, dms.id); - } - if (tx) await tx.commit(); - - return oldDms; - } catch (e) { - if (tx) await tx.rollback(); - - if (fs.existsSync(srcFile)) - await fs.unlink(srcFile); - - throw e; - } - }; -}; diff --git a/modules/claim/back/models/claim.js b/modules/claim/back/models/claim.js index 339eb6051..18b9b3c87 100644 --- a/modules/claim/back/models/claim.js +++ b/modules/claim/back/models/claim.js @@ -8,5 +8,4 @@ module.exports = Self => { require('../methods/claim/updateClaimAction')(Self); require('../methods/claim/isEditable')(Self); require('../methods/claim/downloadFile')(Self); - require('../methods/claim/deleteOldFiles')(Self); }; diff --git a/modules/invoiceIn/front/dueDay/index.html b/modules/invoiceIn/front/dueDay/index.html index 579ef3609..1a1935e72 100644 --- a/modules/invoiceIn/front/dueDay/index.html +++ b/modules/invoiceIn/front/dueDay/index.html @@ -25,6 +25,9 @@ ng-model="invoiceInDueDay.bankFk" url="Banks" show-field="bank" + select-fields="['id','bank']" + order="id" + search-function="$ctrl.bankSearchFunc($search)" rule> {{id}}: {{bank}} diff --git a/modules/invoiceIn/front/dueDay/index.js b/modules/invoiceIn/front/dueDay/index.js index 22b697f7e..3cc1c81e8 100644 --- a/modules/invoiceIn/front/dueDay/index.js +++ b/modules/invoiceIn/front/dueDay/index.js @@ -17,6 +17,12 @@ class Controller extends Section { this.card.reload(); }); } + + bankSearchFunc($search) { + return /^\d+$/.test($search) + ? {id: $search} + : {bank: {like: '%' + $search + '%'}}; + } } ngModule.vnComponent('vnInvoiceInDueDay', { From e140c9d1f421904303327ba4cd51904b854eda43 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 3 May 2022 15:17:34 +0200 Subject: [PATCH 060/141] console.logs --- modules/client/back/models/client-credit.js | 7 +++++-- .../back/models/specs/clientCredit.spec.js | 18 +++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/modules/client/back/models/client-credit.js b/modules/client/back/models/client-credit.js index 587ca0adc..96ac5a22a 100644 --- a/modules/client/back/models/client-credit.js +++ b/modules/client/back/models/client-credit.js @@ -12,13 +12,16 @@ module.exports = Self => { where: {clientFk: instance.clientFk}, order: 'created DESC' }); - if (clientCredit.length > maxCreditRows) { const creditToDestroy = []; for (const [index, credit] of clientCredit.entries()) { - if (index >= maxCreditRows) + console.log(index); + if (index >= maxCreditRows) { + console.log(index, 'BORRAR'); creditToDestroy.push(credit.id); + } } + await models.ClientCredit.destroyAll({ id: {inq: creditToDestroy} }); diff --git a/modules/client/back/models/specs/clientCredit.spec.js b/modules/client/back/models/specs/clientCredit.spec.js index db5004e5c..4d4c2bdee 100644 --- a/modules/client/back/models/specs/clientCredit.spec.js +++ b/modules/client/back/models/specs/clientCredit.spec.js @@ -9,23 +9,20 @@ describe('Client Credit', () => { const clientConfig = await models.ClientConfig.findOne({ where: {id: 1} }); - let rowsBefore; let rowsAfter; try { const options = {transaction: tx}; - const context = {options}; - - rowsBefore = await models.ClientCredit.find({ - where: {clientFk: instance.id} - }, options); - + const ctx = {options}; const salesAssistant = await models.Account.findOne({ where: {name: 'salesAssistant'} }, options); - context.options.accessToken = {userId: salesAssistant.id}; - - await models.Client.changeCredit(context, instance, {credit: 350}); + ctx.options.accessToken = {userId: salesAssistant.id}; + await models.ClientCredit.create({ + amount: 355, + clientFk: instance.id, + workerFk: salesAssistant.id + }, ctx.options); rowsAfter = await models.ClientCredit.find({ where: {clientFk: instance.id} @@ -37,7 +34,6 @@ describe('Client Credit', () => { throw e; } - expect(rowsBefore.length).toEqual(11); expect(rowsAfter.length).toEqual(clientConfig.maxCreditRows); }); }); From d0f9613b4efa7b07319031f483430a6b52cf065b Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 4 May 2022 07:19:45 +0200 Subject: [PATCH 061/141] delete hedera fixtures --- db/dump/fixtures.sql | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 0849e6708..c2e42d140 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -70,7 +70,7 @@ UPDATE `vn`.`worker` `w` UPDATE `vn`.`worker` `w` SET `originCountryFk` = '1'; - + UPDATE `vn`.`worker` `w` SET `educationLevelFk` = '2'; @@ -147,15 +147,6 @@ INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, (19,'Francia', 1, 'FR', 1, 27, 4, 0, 1), (30,'Canarias', 1, 'IC', 1, 24, 4, 1, 2); -INSERT INTO `hedera`.`language` (`code`, `name`, `orgName`, `isActive`) - VALUES - ('ca', 'Català' , 'Catalan' , TRUE), - ('en', 'English' , 'English' , TRUE), - ('es', 'Español' , 'Spanish' , TRUE), - ('fr', 'Français' , 'French' , TRUE), - ('mn', 'Португалий', 'Mongolian' , TRUE), - ('pt', 'Português' , 'Portuguese', TRUE); - INSERT INTO `vn`.`warehouseAlias`(`id`, `name`) VALUES (1, 'Main Warehouse'), From 800b4984fff124d0419e0b8f1915b7dc7f7e334d Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 4 May 2022 07:46:47 +0200 Subject: [PATCH 062/141] fix(test): use ctx.options --- modules/client/back/models/client-credit.js | 10 ++++------ modules/client/back/models/specs/clientCredit.spec.js | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/client/back/models/client-credit.js b/modules/client/back/models/client-credit.js index 96ac5a22a..7070dd6ae 100644 --- a/modules/client/back/models/client-credit.js +++ b/modules/client/back/models/client-credit.js @@ -11,20 +11,18 @@ module.exports = Self => { const clientCredit = await models.ClientCredit.find({ where: {clientFk: instance.clientFk}, order: 'created DESC' - }); + }, ctx.options); + if (clientCredit.length > maxCreditRows) { const creditToDestroy = []; for (const [index, credit] of clientCredit.entries()) { - console.log(index); - if (index >= maxCreditRows) { - console.log(index, 'BORRAR'); + if (index >= maxCreditRows) creditToDestroy.push(credit.id); - } } await models.ClientCredit.destroyAll({ id: {inq: creditToDestroy} - }); + }, ctx.options); } }); }; diff --git a/modules/client/back/models/specs/clientCredit.spec.js b/modules/client/back/models/specs/clientCredit.spec.js index 4d4c2bdee..7a42b7531 100644 --- a/modules/client/back/models/specs/clientCredit.spec.js +++ b/modules/client/back/models/specs/clientCredit.spec.js @@ -16,8 +16,8 @@ describe('Client Credit', () => { const ctx = {options}; const salesAssistant = await models.Account.findOne({ where: {name: 'salesAssistant'} - }, options); - ctx.options.accessToken = {userId: salesAssistant.id}; + }, ctx.options); + await models.ClientCredit.create({ amount: 355, clientFk: instance.id, @@ -25,8 +25,8 @@ describe('Client Credit', () => { }, ctx.options); rowsAfter = await models.ClientCredit.find({ - where: {clientFk: instance.id} - }, options); + where: {clientFk: instance.id}, + }, ctx.options); await tx.rollback(); } catch (e) { From 6d5d9ca0e4713d47457eeb23291911efe7349b4a Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 4 May 2022 07:54:45 +0200 Subject: [PATCH 063/141] DB export --- db/dump/dumpedFixtures.sql | 22 +- db/dump/structure.sql | 63721 +---------------------------------- 2 files changed, 128 insertions(+), 63615 deletions(-) diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 64c048142..5a2aa3fa7 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -32,7 +32,7 @@ UNLOCK TABLES; LOCK TABLES `version` WRITE; /*!40000 ALTER TABLE `version` DISABLE KEYS */; -INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10118','1d6101514fea3d96a8a91de884f3ad978e230fe6','2022-05-01 10:54:59','10126'); +INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL),('vn-database','10129','7ebb66d5a9e47920e2c5ebfdf373bdf9d1bd6221','2022-05-03 13:46:59','10131'); /*!40000 ALTER TABLE `version` ENABLE KEYS */; UNLOCK TABLES; @@ -42,7 +42,7 @@ UNLOCK TABLES; LOCK TABLES `versionLog` WRITE; /*!40000 ALTER TABLE `versionLog` DISABLE KEYS */; -INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL); +INSERT INTO `versionLog` VALUES ('vn-database','00001','00-test.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','00003','00-sage.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10008','00-alterRoleConfig.sql','juan@10.5.1.3','2022-01-31 10:12:26',NULL,NULL),('vn-database','10014','00-rolePrefix.sql','jenkins@10.0.2.68','2022-02-11 00:13:25',NULL,NULL),('vn-database','10017','01-firstScript.sql','jenkins@10.0.2.70','2022-03-09 11:36:54',NULL,NULL),('vn-database','10021','00-bankAccount.sql','jenkins@10.0.2.69','2022-03-16 14:11:22',NULL,NULL),('vn-database','10023','00-firstScript.sql','jenkins@10.0.2.69','2022-03-16 15:05:29',NULL,NULL),('vn-database','10026','00-invoiceInIntrastat.sql','jenkins@10.0.2.69','2022-03-21 15:10:53',NULL,NULL),('vn-database','10027','00-Clientes_cedidos.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10028','00-item_last_buy_.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10029','00-bankToViewAccountingToTable.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10030','00-KkejarNiche.sql','jenkins@10.0.2.69','2022-03-22 15:58:12',NULL,NULL),('vn-database','10036','00-updateBuyConfig.sql','jenkins@10.0.2.69','2022-03-29 12:36:54',NULL,NULL),('vn-database','10037','00-firstScript.sql','jenkins@10.0.2.69','2022-03-28 11:14:26',NULL,NULL),('vn-database','10038','00-printServerQueue.sql','jenkins@10.0.2.69','2022-03-29 08:13:24',NULL,NULL),('vn-database','10048','00-firstScript.sql','jenkins@10.0.2.69','2022-03-30 12:29:06',NULL,NULL),('vn-database','10058','00-vehicleAddFields.sql','jenkins@10.0.2.69','2022-04-06 08:48:34',NULL,NULL),('vn-database','10060','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:11',NULL,NULL),('vn-database','10062','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 10:51:45',NULL,NULL),('vn-database','10064','00-firstScript.sql','jenkins@10.0.2.69','2022-04-06 13:57:11',NULL,NULL),('vn-database','10066','00-firstScript.sql','jenkins@10.0.2.69','2022-04-07 08:50:12',NULL,NULL),('vn-database','10067','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 10:18:20',NULL,NULL),('vn-database','10071','00-packingSiteLog.sql','jenkins@10.0.2.69','2022-04-08 09:37:30',NULL,NULL),('vn-database','10072','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 11:01:46',NULL,NULL),('vn-database','10073','00-firstScript.sql','jenkins@10.0.2.69','2022-04-08 13:40:56',NULL,NULL),('vn-database','10074','00-firstScript.sql','jenkins@10.0.2.69','2022-04-10 13:15:05',NULL,NULL),('vn-database','10077','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 08:07:15',NULL,NULL),('vn-database','10078','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 07:44:21',NULL,NULL),('vn-database','10079','00-firstScript.sql','jenkins@10.0.2.69','2022-04-12 12:01:37',NULL,NULL),('vn-database','10086','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 08:58:34',NULL,NULL),('vn-database','10087','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 09:39:49',NULL,NULL),('vn-database','10088','00-firstScript.sql','jenkins@10.0.2.69','2022-04-13 15:05:12',NULL,NULL),('vn-database','10089','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:12:52',NULL,NULL),('vn-database','10090','00-firstScript.sql','jenkins@10.0.2.69','2022-04-18 14:34:46',NULL,NULL),('vn-database','10092','00-firstScript.sql','jenkins@10.0.2.69','2022-04-19 14:45:46',NULL,NULL),('vn-database','10093','00-autoradioConfig.sql','jenkins@10.0.2.69','2022-05-03 09:16:47',NULL,NULL),('vn-database','10094','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 10:57:30',NULL,NULL),('vn-database','10099','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10100','00-firstScript.sql','jenkins@10.0.2.69','2022-04-20 14:35:27',NULL,NULL),('vn-database','10101','00-firstScript.sql','jenkins@10.0.2.69','2022-04-21 14:59:31',NULL,NULL),('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL),('vn-database','10114','00-updateConfig.sql','jenkins@10.0.2.69','2022-04-27 13:37:25',NULL,NULL),('vn-database','10116','00-firstScript.sql','jenkins@10.0.2.69','2022-04-28 11:10:14',NULL,NULL),('vn-database','10118','00-firstScript.sql','jenkins@10.0.2.69','2022-04-29 08:10:15',NULL,NULL),('vn-database','10127','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 11:04:46',NULL,NULL),('vn-database','10128','00-firstScript.sql','jenkins@10.0.2.69','2022-05-02 13:04:31',NULL,NULL),('vn-database','10129','00-firstScript.sql','jenkins@10.0.2.69','2022-05-03 08:21:01',NULL,NULL); /*!40000 ALTER TABLE `versionLog` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -54,7 +54,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-02 10:56:20 +-- Dump completed on 2022-05-04 7:54:36 USE `account`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -140,7 +140,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-02 10:56:20 +-- Dump completed on 2022-05-04 7:54:37 USE `salix`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -206,7 +206,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-02 10:56:20 +-- Dump completed on 2022-05-04 7:54:37 USE `vn`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -390,7 +390,7 @@ UNLOCK TABLES; LOCK TABLES `department` WRITE; /*!40000 ALTER TABLE `department` DISABLE KEYS */; -INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,94,763,0,NULL,NULL,NULL,0,0,0,30,NULL,'/',NULL,0,NULL,0,0,0,0,NULL),(22,NULL,'COMPRAS',2,3,NULL,72,596,2,5,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(23,NULL,'CAMARA',13,14,NULL,72,3758,2,6,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL),(31,'IT','INFORMATICA',4,5,NULL,72,127,3,9,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(36,NULL,'LABORAL',10,11,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(37,NULL,'PRODUCCION',12,27,NULL,72,3758,3,11,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL),(38,NULL,'SACADO',15,16,NULL,72,230,4,14,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,3758,4,12,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,599,3,8,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(43,NULL,'VENTAS',30,49,NULL,0,NULL,NULL,NULL,0,0,1,9,1,'/1/',NULL,1,'',1,0,0,0,NULL),(44,NULL,'GERENCIA',50,51,NULL,72,300,2,7,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(45,NULL,'LOGISTICA',52,53,NULL,72,596,3,19,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(46,NULL,'REPARTO',54,55,NULL,72,659,3,10,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(48,NULL,'ALMACENAJE',56,57,NULL,0,3758,NULL,NULL,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(49,NULL,'PROPIEDAD',58,59,NULL,72,1008,1,1,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(52,NULL,'CARGA AEREA',60,61,NULL,72,163,4,28,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',62,63,NULL,72,1238,0,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(54,NULL,'ORNAMENTALES',64,65,NULL,72,433,3,21,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(55,NULL,'TALLER NATURAL',66,67,3366,72,3758,2,23,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,1118),(56,NULL,'TALLER ARTIFICIAL',68,69,8470,72,1780,2,24,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,1927),(58,NULL,'CAMPOS',70,71,NULL,72,3758,2,2,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(59,NULL,'MANTENIMIENTO',72,73,NULL,72,1907,4,16,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(60,NULL,'RECLAMACIONES',74,75,NULL,72,563,3,20,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(61,NULL,'VNH',76,77,NULL,73,1297,3,17,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(63,NULL,'VENTAS FRANCIA',31,32,NULL,72,277,2,27,0,0,2,0,43,'/1/43/',NULL,0,NULL,0,0,0,0,NULL),(66,NULL,'VERDNAMADRID',78,79,NULL,72,163,3,18,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,617,3,26,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(69,NULL,'VERDNABARNA',80,81,NULL,74,432,3,22,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(80,NULL,'EQUIPO J VALLES',33,34,NULL,72,693,3,4,0,0,2,0,43,'/1/43/','jvp_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(86,NULL,'LIMPIEZA',82,83,NULL,72,599,0,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(89,NULL,'COORDINACION',84,85,NULL,0,3758,NULL,NULL,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(90,NULL,'TRAILER',86,87,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,3758,NULL,NULL,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(92,NULL,'EQUIPO SILVERIO',35,36,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','sdc_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(93,NULL,'CONFECCION',88,89,NULL,0,3758,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(94,NULL,'EQUIPO J BROCAL',37,38,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','jes_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(95,NULL,'EQUIPO C ZAMBRANO',39,40,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','czg_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(96,NULL,'EQUIPO C LOPEZ',41,42,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','cla_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(115,NULL,'EQUIPO CLAUDI',43,44,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','csr_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',45,46,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','ebt_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(124,NULL,'CONTROL INTERNO',90,91,NULL,72,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(125,NULL,'EQUIPO MIRIAM MAR',47,48,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','mir_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(126,NULL,'PRESERVADO',92,93,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,NULL,NULL,NULL,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(130,NULL,'REVISION',25,26,NULL,0,NULL,NULL,NULL,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL); +INSERT INTO `department` VALUES (1,NULL,'VERDNATURA',1,94,763,0,NULL,NULL,NULL,0,0,0,30,NULL,'/',NULL,0,NULL,0,0,0,0,NULL),(22,NULL,'COMPRAS',2,3,NULL,72,596,2,5,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(23,NULL,'CAMARA',13,14,NULL,72,3758,2,6,1,1,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,1,NULL),(31,'IT','INFORMATICA',4,5,NULL,72,127,3,9,0,0,1,0,1,'/1/','informatica-cau',1,NULL,1,0,0,0,NULL),(34,NULL,'CONTABILIDAD',6,7,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(35,NULL,'FINANZAS',8,9,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(36,NULL,'LABORAL',10,11,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(37,NULL,'PRODUCCION',12,27,NULL,72,3758,3,11,1,1,1,7,1,'/1/',NULL,0,NULL,0,1,1,1,NULL),(38,NULL,'SACADO',15,16,NULL,72,230,4,14,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(39,NULL,'ENCAJADO',17,18,NULL,72,3758,4,12,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(41,NULL,'ADMINISTRACION',28,29,NULL,72,599,3,8,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(43,'VT','VENTAS',30,49,NULL,0,NULL,NULL,NULL,0,0,1,9,1,'/1/',NULL,1,'',1,0,0,0,NULL),(44,NULL,'GERENCIA',50,51,NULL,72,300,2,7,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(45,NULL,'LOGISTICA',52,53,NULL,72,596,3,19,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(46,NULL,'REPARTO',54,55,NULL,72,659,3,10,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,0,0,NULL),(48,NULL,'ALMACENAJE',56,57,NULL,0,3758,NULL,NULL,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(49,NULL,'PROPIEDAD',58,59,NULL,72,1008,1,1,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(52,NULL,'CARGA AEREA',60,61,NULL,72,163,4,28,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(53,NULL,'MARKETING Y COMUNICACIÓN',62,63,NULL,72,1238,0,0,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(54,NULL,'ORNAMENTALES',64,65,NULL,72,433,3,21,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(55,NULL,'TALLER NATURAL',66,67,3366,72,3758,2,23,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,1118),(56,NULL,'TALLER ARTIFICIAL',68,69,8470,72,1780,2,24,0,0,1,0,1,'/1/',NULL,0,NULL,0,1,1,0,1927),(58,NULL,'CAMPOS',70,71,NULL,72,3758,2,2,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(59,NULL,'MANTENIMIENTO',72,73,NULL,72,1907,4,16,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(60,NULL,'RECLAMACIONES',74,75,NULL,72,563,3,20,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(61,NULL,'VNH',76,77,NULL,73,1297,3,17,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(63,NULL,'VENTAS FRANCIA',31,32,NULL,72,277,2,27,0,0,2,0,43,'/1/43/',NULL,0,NULL,0,0,0,0,NULL),(66,NULL,'VERDNAMADRID',78,79,NULL,72,163,3,18,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(68,NULL,'COMPLEMENTOS',19,20,NULL,72,617,3,26,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(69,NULL,'VERDNABARNA',80,81,NULL,74,432,3,22,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(80,NULL,'EQUIPO J VALLES',33,34,NULL,72,693,3,4,0,0,2,0,43,'/1/43/','jvp_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(86,NULL,'LIMPIEZA',82,83,NULL,72,599,0,0,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(89,NULL,'COORDINACION',84,85,NULL,0,3758,NULL,NULL,1,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(90,NULL,'TRAILER',86,87,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,0,0,NULL),(91,NULL,'ARTIFICIAL',21,22,NULL,0,3758,NULL,NULL,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(92,NULL,'EQUIPO SILVERIO',35,36,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','sdc_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(93,NULL,'CONFECCION',88,89,NULL,0,3758,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(94,NULL,'EQUIPO J BROCAL',37,38,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','jes_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(95,NULL,'EQUIPO C ZAMBRANO',39,40,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','czg_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(96,NULL,'EQUIPO C LOPEZ',41,42,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','cla_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(115,NULL,'EQUIPO CLAUDI',43,44,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','csr_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(123,NULL,'EQUIPO ELENA BASCUÑANA',45,46,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','ebt_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(124,NULL,'CONTROL INTERNO',90,91,NULL,72,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,1,NULL,1,0,0,0,NULL),(125,NULL,'EQUIPO MIRIAM MAR',47,48,NULL,0,NULL,NULL,NULL,0,0,2,0,43,'/1/43/','mir_equipo',1,'direccioncomercial@verdnatura.es',1,0,0,0,NULL),(126,NULL,'PRESERVADO',92,93,NULL,0,NULL,NULL,NULL,0,0,1,0,1,'/1/',NULL,0,NULL,0,0,1,0,NULL),(128,NULL,'PALETIZADO',23,24,NULL,0,NULL,NULL,NULL,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL),(130,NULL,'REVISION',25,26,NULL,0,NULL,NULL,NULL,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL); /*!40000 ALTER TABLE `department` ENABLE KEYS */; UNLOCK TABLES; @@ -472,7 +472,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-02 10:56:21 +-- Dump completed on 2022-05-04 7:54:37 USE `cache`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -508,7 +508,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-02 10:56:21 +-- Dump completed on 2022-05-04 7:54:37 USE `hedera`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -674,7 +674,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-02 10:56:21 +-- Dump completed on 2022-05-04 7:54:38 USE `postgresql`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -760,7 +760,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-02 10:56:21 +-- Dump completed on 2022-05-04 7:54:38 USE `sage`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -816,4 +816,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-02 10:56:21 +-- Dump completed on 2022-05-04 7:54:38 diff --git a/db/dump/structure.sql b/db/dump/structure.sql index a9e21b377..a466c0f81 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -5168,25 +5168,41 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `manaCustomerUpdate`() BEGIN -DECLARE vToDated DATE; + DECLARE vToDated DATE; DECLARE vFromDated DATE; DECLARE vForDeleteDated DATE; - DECLARE vManaId INT DEFAULT 37; - DECLARE vManaAutoId INT DEFAULT 39; - DECLARE vManaBankId INT DEFAULT 66; - DECLARE vManaGreugeTypeId INT DEFAULT 3; + DECLARE vManaId INT; + DECLARE vManaAutoId INT; + DECLARE vClaimManaId INT; + DECLARE vManaBankId INT; + DECLARE vManaGreugeTypeId INT; - SELECT IFNULL(max(dated), '2016-01-01') - INTO vFromDated - FROM bs.manaCustomer; + SELECT id INTO vManaId + FROM vn.component WHERE code = 'mana'; + + SELECT id INTO vManaAutoId + FROM vn.component WHERE code = 'autoMana'; - DELETE - FROM bs.manaCustomer + SELECT id INTO vClaimManaId + FROM vn.component WHERE code = 'manaClaim'; + + SELECT id INTO vManaBankId + FROM vn.bank WHERE code = 'mana'; + + SELECT id INTO vManaGreugeTypeId + FROM vn.greugeType WHERE code = 'mana'; + + SELECT IFNULL(MAX(dated), '2016-01-01') + INTO vFromDated + FROM vn.clientManaCache; + + DELETE + FROM vn.clientManaCache WHERE dated = vFromDated; - SELECT IFNULL(max(dated), '2016-01-01') + SELECT IFNULL(MAX(dated), '2016-01-01') INTO vFromDated - FROM bs.manaCustomer; + FROM vn.clientManaCache; WHILE timestampadd(DAY,30,vFromDated) < CURDATE() DO @@ -5197,31 +5213,25 @@ DECLARE vToDated DATE; vToDated, vForDeleteDated; - DELETE FROM bs.manaCustomer + DELETE FROM vn.clientManaCache WHERE dated <= vForDeleteDated; - - INSERT INTO bs.manaCustomer(Id_Cliente, Mana, dated) - + INSERT INTO vn.clientManaCache(clientFk, mana, dated) SELECT Id_Cliente, cast(sum(mana) as decimal(10,2)) as mana, vToDated as dated FROM - ( SELECT cs.Id_Cliente, Cantidad * Valor as mana FROM vn2008.Tickets t JOIN vn2008.Consignatarios cs using(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 Id_Componente IN (vManaAutoId, vManaId) + WHERE Id_Componente IN (vManaAutoId, vManaId, vClaimManaId) AND t.Fecha > vFromDated AND date(t.Fecha) <= vToDated - - UNION ALL - SELECT r.Id_Cliente, - Entregado FROM vn2008.Recibos r WHERE Id_Banco = vManaBankId @@ -5229,25 +5239,21 @@ DECLARE vToDated DATE; AND Fechacobro <= vToDated UNION ALL - SELECT g.Id_Cliente, g.Importe FROM vn2008.Greuges g WHERE Greuges_type_id = vManaGreugeTypeId AND Fecha > vFromDated AND Fecha <= vToDated - UNION ALL - - SELECT Id_Cliente, mana - FROM bs.manaCustomer - WHERE dated = vFromDated + SELECT clientFk, mana + FROM vn.clientManaCache + WHERE dated = vFromDated ) sub - GROUP BY Id_Cliente HAVING Id_Cliente; SET vFromDated = vToDated; - + END WHILE; END ;; @@ -7649,9 +7655,10 @@ proc: BEGIN JOIN vn.entry e ON b.entryFk = e.id JOIN vn.travel t ON t.id = e.travelFk JOIN vn.warehouse w ON w.id = t.warehouseInFk + JOIN vn.supplier s ON s.id = e.supplierFk WHERE t.landed BETWEEN vInventoryDate AND vStartDate AND t.warehouseInFk = vWarehouse - AND NOT e.isInventory + AND s.name != 'INVENTARIO' AND NOT e.isRaid GROUP BY b.itemFk ) c @@ -18864,9 +18871,9 @@ CREATE TABLE `business_labour_payroll` ( `importepactado` decimal(10,2) NOT NULL DEFAULT '0.00', PRIMARY KEY (`business_id`), KEY `business_labour_payroll_cod_categoria_idx` (`cod_categoria`), - KEY `business_labour_payroll_cod_contrato` (`cod_contrato`), + KEY `business_labour_payroll_FK` (`cod_contrato`), + CONSTRAINT `business_labour_payroll_FK` FOREIGN KEY (`cod_contrato`) REFERENCES `vn`.`workerBusinessType` (`id`) ON UPDATE CASCADE, CONSTRAINT `business_labour_payroll_cod_categoria` FOREIGN KEY (`cod_categoria`) REFERENCES `vn2008`.`payroll_categorias` (`codcategoria`) ON UPDATE CASCADE, - CONSTRAINT `business_labour_payroll_cod_contrato` FOREIGN KEY (`cod_contrato`) REFERENCES `vn2008`.`payroll_contratos__` (`CodContrato`) ON UPDATE CASCADE, CONSTRAINT `business_labour_payroll_fk1` FOREIGN KEY (`business_id`) REFERENCES `business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -26530,18 +26537,17 @@ CREATE TABLE `agency` ( `isOwn` tinyint(1) NOT NULL DEFAULT '0', `labelZone` tinyint(4) NOT NULL DEFAULT '0', `workCenterFk` int(11) DEFAULT NULL, - `supplierFk` int(11) DEFAULT NULL, + `supplierFk__` int(11) DEFAULT NULL, `isAnyVolumeAllowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Permite vender productos que tengan vn.itemType.IsUnconventionalSize = TRUE', PRIMARY KEY (`id`), KEY `warehouse_id` (`warehouseFk`), KEY `Id_Banco` (`bankFk`), KEY `agencias_alias_idx` (`warehouseAliasFk`), KEY `agency_ibfk_3_idx` (`workCenterFk`), - KEY `agency_ibfk_4_idx` (`supplierFk`), + KEY `agency_ibfk_4_idx` (`supplierFk__`), CONSTRAINT `agency_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, CONSTRAINT `agency_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, - CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE, - CONSTRAINT `agency_ibfk_4` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE + CONSTRAINT `agency_ibfk_3` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) ON UPDATE CASCADE ) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!50003 SET @saved_cs_client = @@character_set_client */ ; @@ -26638,24 +26644,24 @@ SET character_set_client = utf8; SET character_set_client = @saved_cs_client; -- --- Table structure for table `agencyTerm` +-- Temporary table structure for view `agencyTerm` -- DROP TABLE IF EXISTS `agencyTerm`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `agencyTerm` ( - `agencyFk` smallint(5) unsigned NOT NULL, - `minimumPackages` int(11) NOT NULL DEFAULT '0' COMMENT 'numero minimo de bultos', - `kmPrice` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'precio extra por km', - `packagePrice` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'precio extra por bulto', - `routePrice` decimal(10,2) DEFAULT NULL COMMENT 'precio fijo por ruta', - `minimumKm` int(11) NOT NULL DEFAULT '0', - `minimumM3` decimal(10,2) NOT NULL DEFAULT '0.00', - `m3Price` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`agencyFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; +/*!50001 DROP VIEW IF EXISTS `agencyTerm`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `agencyTerm` ( + `agencyFk` tinyint NOT NULL, + `minimumPackages` tinyint NOT NULL, + `kmPrice` tinyint NOT NULL, + `packagePrice` tinyint NOT NULL, + `routePrice` tinyint NOT NULL, + `minimumKm` tinyint NOT NULL, + `minimumM3` tinyint NOT NULL, + `m3Price` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; -- -- Table structure for table `agencyTermConfig` @@ -26742,11 +26748,9 @@ 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, - `login` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, `client` int(32) DEFAULT NULL, - `center` int(32) DEFAULT NULL, + `center` varchar(2) 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 */; @@ -27916,6 +27920,7 @@ CREATE TABLE `claim` ( `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, `ticketFk` int(11) DEFAULT NULL, `hasToPickUp` tinyint(1) NOT NULL, + `packages` smallint(10) unsigned DEFAULT '0' COMMENT 'packages received by the client', PRIMARY KEY (`id`), KEY `cl_dep_id` (`claimDepartmentFk__`), KEY `cl_est_id` (`claimStateFk`), @@ -27979,6 +27984,20 @@ DELIMITER ; /*!50003 SET character_set_results = @saved_cs_results */ ; /*!50003 SET collation_connection = @saved_col_connection */ ; +-- +-- Table structure for table `claimConfig` +-- + +DROP TABLE IF EXISTS `claimConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `claimConfig` ( + `id` int(11) NOT NULL, + `pickupContact` varchar(250) 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 `claimDestination` -- @@ -28207,6 +28226,7 @@ CREATE TABLE `claimState` ( `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, `roleFk` int(10) unsigned NOT NULL DEFAULT '1', `priority` int(11) NOT NULL DEFAULT '1', + `hasToNotify` tinyint(4) DEFAULT '0', PRIMARY KEY (`id`), KEY `roleFgn_idx` (`roleFk`), CONSTRAINT `roleFgn` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`) ON UPDATE CASCADE @@ -29734,6 +29754,7 @@ CREATE TABLE `country` ( `isUeeMember` tinyint(4) NOT NULL DEFAULT '0', `ibanLength` tinyint(4) DEFAULT NULL, `continentFk` tinyint(4) DEFAULT NULL, + `a3Code` int(11) DEFAULT NULL COMMENT 'Código país para a3', PRIMARY KEY (`id`), KEY `Id_Paisreal` (`politicalCountryFk`), KEY `currency_id_fk_idx` (`currencyFk`), @@ -34630,16 +34651,16 @@ CREATE TABLE `itemShelving` ( `itemFk` int(11) NOT NULL, `shelvingFk` varchar(10) CHARACTER SET utf8 NOT NULL, `shelve` varchar(2) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'A', - `deep` int(11) unsigned NOT NULL DEFAULT '1', - `quantity` int(11) NOT NULL DEFAULT '0', + `deep__` int(11) unsigned NOT NULL DEFAULT '1', + `quantity__` int(11) NOT NULL DEFAULT '0', `visible` int(11) NOT NULL DEFAULT '0', - `available` int(11) NOT NULL DEFAULT '0', + `available__` int(11) NOT NULL DEFAULT '0', `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `priority` int(11) unsigned DEFAULT NULL COMMENT 'El 0 es la mínima prioridad', `grouping` smallint(5) unsigned DEFAULT NULL, `packing` int(11) unsigned DEFAULT NULL, `packagingFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `level` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', + `level__` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '1', `userFk` int(10) unsigned DEFAULT NULL, `stars` int(11) DEFAULT NULL, PRIMARY KEY (`id`), @@ -34687,27 +34708,25 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_INSERT` AFTER INSERT ON `itemShelving` FOR EACH ROW -INSERT INTO vn.itemShelvingLog(itemShelvingFk, - workerFk, - accion, - itemFk, - shelvingFk, - available, - visible, - `grouping`, - packing, - stars) - VALUES( NEW.id, - NEW.userFk, - 'CREA REGISTRO', - NEW.itemFk, - NEW.shelvingFk, - NEW.available, - NEW.visible, - NEW.`grouping`, - NEW.packing, - NEW.stars - ) */;; +INSERT INTO vn.itemShelvingLog( itemShelvingFk, + workerFk, + accion, + itemFk, + shelvingFk, + visible, + `grouping`, + packing, + stars) + VALUES( NEW.id, + NEW.userFk, + 'CREA REGISTRO', + NEW.itemFk, + NEW.shelvingFk, + NEW.visible, + NEW.`grouping`, + NEW.packing, + NEW.stars + ) */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -34745,27 +34764,25 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelving_AFTER_UPDATE` AFTER UPDATE ON `itemShelving` FOR EACH ROW -INSERT INTO vn.itemShelvingLog(itemShelvingFk, - workerFk, - accion, - itemFk, - shelvingFk, - available, - visible, - `grouping`, - packing, - stars) - VALUES( NEW.id, - account.userGetId(), - 'CAMBIO', - NEW.itemFk, - NEW.shelvingFk, - NEW.available, - NEW.visible, - NEW.`grouping`, - NEW.packing, - NEW.stars - ) */;; +INSERT INTO vn.itemShelvingLog( itemShelvingFk, + workerFk, + accion, + itemFk, + shelvingFk, + visible, + `grouping`, + packing, + stars) + VALUES( NEW.id, + account.userGetId(), + 'CAMBIO', + NEW.itemFk, + NEW.shelvingFk, + NEW.visible, + NEW.`grouping`, + NEW.packing, + NEW.stars + ) */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; /*!50003 SET character_set_client = @saved_cs_client */ ; @@ -34930,63507 +34947,3 @@ SET character_set_client = utf8; `sectorFk` tinyint NOT NULL ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `itemShelvingPlacementSupplyStock__` --- - -DROP TABLE IF EXISTS `itemShelvingPlacementSupplyStock__`; -/*!50001 DROP VIEW IF EXISTS `itemShelvingPlacementSupplyStock__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingPlacementSupplyStock__` ( - `itemShelvingFk` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `stock` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `size` tinyint NOT NULL, - `subName` tinyint NOT NULL, - `shelving` tinyint NOT NULL, - `parking` tinyint NOT NULL, - `created` tinyint NOT NULL, - `priority` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `itemShelvingSale` --- - -DROP TABLE IF EXISTS `itemShelvingSale`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemShelvingSale` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemShelvingFk` int(10) unsigned NOT NULL, - `saleFk` int(11) NOT NULL, - `quantity` decimal(10,0) NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `userFk` int(11) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `itemShelvingSale_fk1_idx` (`itemShelvingFk`), - KEY `itemShelvingSale_fk2_idx` (`saleFk`), - KEY `itemShelvingSale_fk3_idx` (`userFk`), - CONSTRAINT `itemShelvingSale_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `itemShelvingSale_fk2` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `itemShelvingSale_fk3` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle del producto que se retira de los carros, relacionando la linea de movimiento correspondiente'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_AFTER_INSERT` - AFTER INSERT ON `itemShelvingSale` - FOR EACH ROW -BEGIN - - UPDATE vn.sale - SET isPicked = TRUE - WHERE id = NEW.saleFk; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Temporary table structure for view `itemShelvingSaleSum` --- - -DROP TABLE IF EXISTS `itemShelvingSaleSum`; -/*!50001 DROP VIEW IF EXISTS `itemShelvingSaleSum`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingSaleSum` ( - `id` tinyint NOT NULL, - `itemShelvingFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `created` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `itemShelvingStock` --- - -DROP TABLE IF EXISTS `itemShelvingStock`; -/*!50001 DROP VIEW IF EXISTS `itemShelvingStock`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingStock` ( - `itemFk` tinyint NOT NULL, - `visible` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `grouping` tinyint NOT NULL, - `sector` tinyint NOT NULL, - `visibleOriginal` tinyint NOT NULL, - `removed` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `shelvingFk` tinyint NOT NULL, - `parkingCode` tinyint NOT NULL, - `parkingFk` tinyint NOT NULL, - `itemShelvingFk` tinyint NOT NULL, - `created` tinyint NOT NULL, - `isPreviousPrepared` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `itemShelvingStockFull` --- - -DROP TABLE IF EXISTS `itemShelvingStockFull`; -/*!50001 DROP VIEW IF EXISTS `itemShelvingStockFull`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingStockFull` ( - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `grouping` tinyint NOT NULL, - `sector` tinyint NOT NULL, - `removed` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `shelvingFk` tinyint NOT NULL, - `parkingCode` tinyint NOT NULL, - `parkingFk` tinyint NOT NULL, - `itemShelvingFk` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `itemShelvingStockRemoved` --- - -DROP TABLE IF EXISTS `itemShelvingStockRemoved`; -/*!50001 DROP VIEW IF EXISTS `itemShelvingStockRemoved`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingStockRemoved` ( - `itemShelvingFk` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `removed` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `itemShelvingStock_byWarehouse` --- - -DROP TABLE IF EXISTS `itemShelvingStock_byWarehouse`; -/*!50001 DROP VIEW IF EXISTS `itemShelvingStock_byWarehouse`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemShelvingStock_byWarehouse` ( - `itemFk` tinyint NOT NULL, - `visible` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `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(50) COLLATE utf8_unicode_ci NOT NULL, - `intValue` int(11) DEFAULT NULL, - `priority` int(2) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `itemTagItemUq` (`itemFk`,`tagFk`), - KEY `tagFk` (`tagFk`,`value`), - KEY `priorityItem` (`priority`,`itemFk`), - KEY `value` (`value`), - KEY `itemFk_2` (`itemFk`,`tagFk`,`intValue`), - CONSTRAINT `itemTagItemFk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `itemTagTagFk` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeInsert` - BEFORE INSERT ON `itemTag` - FOR EACH ROW -BEGIN - SET NEW.intValue = itemTag_getIntValue(NEW.`value`); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_AFTER_INSERT` - AFTER INSERT ON `itemTag` - FOR EACH ROW -trig: BEGIN - DECLARE vItemFk INT; - DECLARE visTriggerDisabled BOOL; - - SELECT isItemTagTriggerDisabled INTO visTriggerDisabled - FROM vn.itemConfig; - - IF @isTriggerDisabled OR visTriggerDisabled THEN - LEAVE trig; - END IF; - - SET vItemFk = NEW.itemFk; - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - SELECT vItemFk id; - CALL item_refreshTags(); - DROP TEMPORARY TABLE 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 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeUpdate` - BEFORE UPDATE ON `itemTag` - FOR EACH ROW -BEGIN - IF !(OLD.`value` <=> NEW.`value`) - OR !(OLD.intValue <=> NEW.intValue) THEN - SET NEW.intValue = itemTag_getIntValue(NEW.`value`); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterUpdate` - AFTER UPDATE ON `itemTag` - FOR EACH ROW -trig: BEGIN - DECLARE vItemFk INT; - DECLARE visTriggerDisabled BOOL; - - SELECT isItemTagTriggerDisabled INTO visTriggerDisabled - FROM vn.itemConfig; - - IF @isTriggerDisabled OR visTriggerDisabled THEN - LEAVE trig; - END IF; - - SET vItemFk = NEW.itemFk; - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - SELECT vItemFk id; - - CALL item_refreshTags(); - DROP TEMPORARY TABLE 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 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterDelete` - AFTER DELETE ON `itemTag` - FOR EACH ROW -trig: BEGIN - DECLARE vItemFk INT; - DECLARE visTriggerDisabled BOOL; - - SELECT isItemTagTriggerDisabled INTO visTriggerDisabled - FROM vn.itemConfig; - - IF @isTriggerDisabled OR visTriggerDisabled THEN - LEAVE trig; - END IF; - - SET vItemFk = OLD.itemFk; - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - SELECT vItemFk id; - CALL item_refreshTags(); - DROP TEMPORARY TABLE 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 */ ; - --- --- 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 TABLE `itemTagged` ( - `itemFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `itemTaxCountry` --- - -DROP TABLE IF EXISTS `itemTaxCountry`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemTaxCountry` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemFk` int(11) DEFAULT NULL, - `countryFk` mediumint(8) unsigned DEFAULT NULL, - `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '1', - `effectived` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - UNIQUE KEY `itemFk_UNIQUE` (`itemFk`,`countryFk`), - KEY `taxClassFK_idx` (`taxClassFk`), - KEY `countryFK_paises_idx` (`countryFk`), - CONSTRAINT `countryFK_paises` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, - CONSTRAINT `itemFK_Article` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `taxClassFK_Iva_Group` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 `itemTicketOut` --- - -DROP TABLE IF EXISTS `itemTicketOut`; -/*!50001 DROP VIEW IF EXISTS `itemTicketOut`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `itemTicketOut` ( - `warehouseFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `isPicked` tinyint NOT NULL, - `reserved` tinyint NOT NULL, - `refFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `itemType` --- - -DROP TABLE IF EXISTS `itemType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemType` ( - `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `gramsMin` int(11) DEFAULT NULL, - `gramsMax` int(11) DEFAULT NULL, - `order` int(11) DEFAULT '0', - `categoryFk` int(10) unsigned NOT NULL, - `workerFk` int(10) unsigned NOT NULL, - `isInventory` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'Se utiliza tanto en el cálculo del inventario, como en el del informe del inventario valorado', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `f11` tinyint(4) NOT NULL DEFAULT '0', - `transaction` tinyint(4) NOT NULL DEFAULT '0', - `making` int(10) unsigned DEFAULT NULL COMMENT 'Son productos de confección propia', - `location` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `life` smallint(5) unsigned DEFAULT NULL, - `maneuver` double NOT NULL DEFAULT '0.21', - `target` double NOT NULL DEFAULT '0.15', - `topMargin` double NOT NULL DEFAULT '0.3', - `profit` double NOT NULL DEFAULT '0.02', - `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', - `isPackaging` tinyint(1) NOT NULL DEFAULT '0', - `hasComponents` tinyint(1) NOT NULL DEFAULT '1', - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '60', - `compression` decimal(5,2) DEFAULT '1.00', - `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `temperatureFk` varchar(10) CHARACTER SET utf8 DEFAULT NULL, - `isUnconventionalSize` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'familia con productos cuyas medidas no son aptas para la cinta transportadora o paletizar', - PRIMARY KEY (`code`), - UNIQUE KEY `tipo_id_UNIQUE` (`id`), - UNIQUE KEY `Tipo_UNIQUE` (`name`,`categoryFk`), - KEY `Trabajador` (`workerFk`), - KEY `reino_id` (`categoryFk`), - KEY `Tipos_fk3_idx` (`making`), - KEY `warehouseFk5_idx` (`warehouseFk`), - KEY `temperatureFk` (`temperatureFk`), - CONSTRAINT `Tipos_fk3` FOREIGN KEY (`making`) REFERENCES `confectionType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `Trabajador` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `itemType_ibfk_1` FOREIGN KEY (`categoryFk`) REFERENCES `itemCategory` (`id`) ON UPDATE CASCADE, - CONSTRAINT `temperatureFk` FOREIGN KEY (`temperatureFk`) REFERENCES `temperature` (`code`), - CONSTRAINT `warehouseFk5` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemType_beforeUpdate` - BEFORE UPDATE ON `itemType` - FOR EACH ROW --- Edit trigger body code below this line. Do not edit lines above this one -BEGIN - - IF NEW.itemPackingTypeFk = '' THEN - - SET NEW.itemPackingTypeFk = NULL; - - END IF; - - IF NEW.itemPackingTypeFk != OLD.itemPackingTypeFk THEN - - UPDATE vn.item - SET itemPackingTypeFk = NEW.itemPackingTypeFk - WHERE typeFk = 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 `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 `itemTypeRestriction` --- - -DROP TABLE IF EXISTS `itemTypeRestriction`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemTypeRestriction` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemTypeFk` smallint(5) unsigned NOT NULL, - `dated` date NOT NULL, - `minAmount` decimal(10,2) NOT NULL COMMENT 'importe mínimo en la linea de venta', - PRIMARY KEY (`id`), - UNIQUE KEY `itemTypeRestriction_UN` (`itemTypeFk`,`dated`), - KEY `itemTypeRestriction_dated_IDX` (`dated`,`itemTypeFk`) USING BTREE, - CONSTRAINT `itemTypeRestriction_itemType_id_fk` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `itemTypeTag` --- - -DROP TABLE IF EXISTS `itemTypeTag`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemTypeTag` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemTypeFk` smallint(5) unsigned NOT NULL, - `tagFk` int(11) NOT NULL, - `priority` int(2) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `itemTypeFk_UNIQUE` (`itemTypeFk`,`tagFk`), - KEY `itemTypeTagTipo_idx` (`itemTypeFk`), - KEY `itemTypeTagTag_idx` (`tagFk`), - CONSTRAINT `itemTypeTagTag` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `itemTypeTagTipos` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `itemVerdecora__` --- - -DROP TABLE IF EXISTS `itemVerdecora__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `itemVerdecora__` ( - `itemFk` int(11) NOT NULL, - `codin` int(11) DEFAULT NULL, - PRIMARY KEY (`itemFk`), - CONSTRAINT `itemVerdecora_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona nuestros articulos con los de Verdecora'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `item_Free_Id` --- - -DROP TABLE IF EXISTS `item_Free_Id`; -/*!50001 DROP VIEW IF EXISTS `item_Free_Id`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `item_Free_Id` ( - `newId` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `labelInfo` --- - -DROP TABLE IF EXISTS `labelInfo`; -/*!50001 DROP VIEW IF EXISTS `labelInfo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `labelInfo` ( - `itemId` tinyint NOT NULL, - `itemName` tinyint NOT NULL, - `stickers` tinyint NOT NULL, - `life` tinyint NOT NULL, - `colorCode` tinyint NOT NULL, - `stems` tinyint NOT NULL, - `category` tinyint NOT NULL, - `productor` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `size` tinyint NOT NULL, - `isPickedOff` tinyint NOT NULL, - `notes` tinyint NOT NULL, - `wh_in` tinyint NOT NULL, - `entryId` tinyint NOT NULL, - `buyId` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `labelReport` --- - -DROP TABLE IF EXISTS `labelReport`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `labelReport` ( - `id` tinyint(3) unsigned NOT NULL, - `name` varchar(50) 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 `labourTree` --- - -DROP TABLE IF EXISTS `labourTree`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `labourTree` ( - `id` int(11) NOT NULL DEFAULT '0', - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `lft` int(11) NOT NULL, - `rgt` int(11) NOT NULL, - `depth` bigint(22) NOT NULL DEFAULT '0', - `sons` decimal(10,0) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `lastHourProduction` --- - -DROP TABLE IF EXISTS `lastHourProduction`; -/*!50001 DROP VIEW IF EXISTS `lastHourProduction`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `lastHourProduction` ( - `warehouseFk` tinyint NOT NULL, - `m3` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `lastPurchases` --- - -DROP TABLE IF EXISTS `lastPurchases`; -/*!50001 DROP VIEW IF EXISTS `lastPurchases`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `lastPurchases` ( - `landed` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `warehouse` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `subName` tinyint NOT NULL, - `entryFk` tinyint NOT NULL, - `stickers` tinyint NOT NULL, - `packing` tinyint NOT NULL, - `ref` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `pro` tinyint NOT NULL, - `ektRef` tinyint NOT NULL, - `agj` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `lastTopClaims` --- - -DROP TABLE IF EXISTS `lastTopClaims`; -/*!50001 DROP VIEW IF EXISTS `lastTopClaims`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `lastTopClaims` ( - `itemFk` tinyint NOT NULL, - `itemName` tinyint NOT NULL, - `itemTypeName` tinyint NOT NULL, - `claimsNumber` tinyint NOT NULL, - `claimedAmount` tinyint NOT NULL, - `totalAmount` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `ledgerConfig` --- - -DROP TABLE IF EXISTS `ledgerConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ledgerConfig` ( - `lastBookEntry` int(11) NOT NULL, - PRIMARY KEY (`lastBookEntry`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `lungSize` --- - -DROP TABLE IF EXISTS `lungSize`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `lungSize` ( - `hora` time NOT NULL, - `size` decimal(5,0) NOT NULL, - `dia` date NOT NULL, - PRIMARY KEY (`hora`,`size`,`dia`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `machine` --- - -DROP TABLE IF EXISTS `machine`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `machine` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plate` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `serialNumber` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `maker` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `model` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `purchased` date DEFAULT NULL, - `warehouseFk` int(11) DEFAULT NULL, - `departmentFk` int(11) DEFAULT NULL, - `type` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `use` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `productionYear` int(11) DEFAULT NULL, - `photo` blob, - `workerFk` int(10) unsigned DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `ppeFk` int(11) DEFAULT NULL, - `supplierFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `plate` (`plate`), - UNIQUE KEY `serialNumber` (`serialNumber`), - KEY `machine_FK` (`ppeFk`), - KEY `machine_FK_2` (`supplierFk`), - KEY `machine_FK_1` (`workerFk`), - CONSTRAINT `machine_FK` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `machine_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `machine_FK_2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Maquinaria industrial, vehículos y demás elementos amortizables'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_BI` - BEFORE INSERT ON `machine` - FOR EACH ROW -BEGIN - - SET NEW.workerFk = vn.getUser(); - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `machineDetail` --- - -DROP TABLE IF EXISTS `machineDetail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `machineDetail` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `machineFk` int(11) NOT NULL, - `dated` date NOT NULL, - `action` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `value` decimal(10,2) DEFAULT NULL, - `workerFk` int(10) unsigned NOT NULL, - `dmsFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `machineDetail_FK` (`machineFk`), - KEY `machineDetail_FK_2` (`dmsFk`), - KEY `machineDetail_FK_1` (`workerFk`), - CONSTRAINT `machineDetail_FK` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `machineDetail_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `machineDetail_FK_2` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `machineDms` --- - -DROP TABLE IF EXISTS `machineDms`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `machineDms` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `machineFk` int(11) NOT NULL, - `dmsFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `machineDms_UN` (`machineFk`,`dmsFk`), - KEY `machineDms_FK` (`dmsFk`), - CONSTRAINT `machineDms_FK` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `machineDms_FK_1` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `machineWorker` --- - -DROP TABLE IF EXISTS `machineWorker`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `machineWorker` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `machineFk` int(11) NOT NULL, - `inTimed` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `outTimed` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `machineWorker_FK_1` (`machineFk`), - KEY `machineWorker_FK` (`workerFk`), - CONSTRAINT `machineWorker_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `machineWorker_FK_1` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registros horarios de vehículos de almacén por empleado'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `machineWorkerConfig` --- - -DROP TABLE IF EXISTS `machineWorkerConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `machineWorkerConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `maxHours` smallint(5) unsigned NOT NULL COMMENT 'Indicates how many hours a user record is reviewed to update or insert', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT 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, - `receiver` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `sender` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `replyTo` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `subject` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `body` text COLLATE utf8_unicode_ci NOT NULL, - `sent` tinyint(2) NOT NULL DEFAULT '0', - `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `attachment` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `status` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'OK', - `senderFk` int(11) DEFAULT NULL, - `recipientFk` int(11) DEFAULT NULL, - `plainTextBody` text COLLATE utf8_unicode_ci, - PRIMARY KEY (`id`), - KEY `sent_idx` (`sent`), - KEY `creation_idx` (`creationDate`) -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`mail_beforeInsert` - BEFORE INSERT ON `mail` - FOR EACH ROW -BEGIN - - IF NEW.sender IS NOT NULL THEN - - SET NEW.receiver = NEW.sender; - - 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 `mailTemplates` --- - -DROP TABLE IF EXISTS `mailTemplates`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mailTemplates` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) CHARACTER SET utf8 NOT NULL, - `attachmentPath` text CHARACTER SET utf8 NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `mandate` --- - -DROP TABLE IF EXISTS `mandate`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mandate` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL, - `code` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `finished` timestamp NULL DEFAULT NULL, - `mandateTypeFk` smallint(5) NOT NULL, - PRIMARY KEY (`id`), - KEY `mandato_fgkey1_idx` (`clientFk`), - KEY `mandato_fgkey2_idx` (`companyFk`), - KEY `mandato_fgkey3_idx` (`mandateTypeFk`), - CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`mandateTypeFk`) REFERENCES `mandateType` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`mandate_beforeInsert` - BEFORE INSERT ON `mandate` - FOR EACH ROW -BEGIN - IF (NEW.code IS NULL) THEN - SET NEW.code=CONCAT(NEW.clientFk,'-',(SELECT AUTO_INCREMENT - FROM information_schema.TABLES - WHERE TABLE_SCHEMA='vn' and TABLE_NAME='mandate')); - 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 `mandateType` --- - -DROP TABLE IF EXISTS `mandateType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mandateType` ( - `id` smallint(5) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `medicalCenter` --- - -DROP TABLE IF EXISTS `medicalCenter`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `medicalCenter` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `medicalReview` --- - -DROP TABLE IF EXISTS `medicalReview`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `medicalReview` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `centerFk` int(11) NOT NULL, - `date` date DEFAULT NULL, - `time` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, - `isFit` tinyint(1) DEFAULT NULL, - `amount` double DEFAULT NULL, - `invoice` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `remark` longtext COLLATE utf8_unicode_ci, - PRIMARY KEY (`id`), - KEY `frgcenter_idx` (`centerFk`), - KEY `frgnkWorker_idx` (`workerFk`), - CONSTRAINT `frgcenter` FOREIGN KEY (`centerFk`) REFERENCES `medicalCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `frgnkWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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(50) CHARACTER SET utf8 NOT NULL, - `sender` varchar(50) CHARACTER SET utf8 NOT NULL, - `recipient` varchar(50) CHARACTER SET utf8 NOT NULL, - `message` longtext CHARACTER SET utf8, - `sendDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `sender` (`sender`), - KEY `recipient` (`recipient`), - KEY `uuid` (`uuid`(8)) -) ENGINE=InnoDBDEFAULT 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(50) CHARACTER SET utf8 NOT NULL, - `sender` varchar(50) CHARACTER SET utf8 NOT NULL, - `recipient` varchar(45) CHARACTER SET utf8 NOT NULL, - `finalRecipient` varchar(50) CHARACTER SET utf8 NOT NULL, - `message` longtext CHARACTER SET utf8, - `sendDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `read` varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `uuid` (`uuid`(8)), - KEY `finalRecipient` (`finalRecipient`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `mistake` --- - -DROP TABLE IF EXISTS `mistake`; -/*!50001 DROP VIEW IF EXISTS `mistake`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `mistake` ( - `revisador` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `firstName` tinyint NOT NULL, - `lastName` tinyint NOT NULL, - `description` tinyint NOT NULL, - `created` tinyint NOT NULL, - `workerFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `mistakeRatio` --- - -DROP TABLE IF EXISTS `mistakeRatio`; -/*!50001 DROP VIEW IF EXISTS `mistakeRatio`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `mistakeRatio` ( - `revisador` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `firstName` tinyint NOT NULL, - `lastName` tinyint NOT NULL, - `description` tinyint NOT NULL, - `created` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `mistakeType` --- - -DROP TABLE IF EXISTS `mistakeType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mistakeType` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `mobileAppVersionControl` --- - -DROP TABLE IF EXISTS `mobileAppVersionControl`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mobileAppVersionControl` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `appName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `version` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', - `IsVersionCritical` tinyint(1) DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para llevar el control de las Versions de las aplicaciones móvil '; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `mrw` --- - -DROP TABLE IF EXISTS `mrw`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mrw` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ticketFk` int(11) NOT NULL, - `counter` smallint(5) unsigned DEFAULT NULL, - `shipped` date DEFAULT NULL, - `price` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `newBornSales` --- - -DROP TABLE IF EXISTS `newBornSales`; -/*!50001 DROP VIEW IF EXISTS `newBornSales`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `newBornSales` ( - `amount` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `userFk` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `firstShipped` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `newBornSales__` --- - -DROP TABLE IF EXISTS `newBornSales__`; -/*!50001 DROP VIEW IF EXISTS `newBornSales__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `newBornSales__` ( - `amount` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `userFk` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `firstShipped` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `noticeCategory` --- - -DROP TABLE IF EXISTS `noticeCategory`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `noticeCategory` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `keyName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `subject` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `description` text COLLATE utf8_unicode_ci, - `isEnabled` tinyint(1) NOT NULL DEFAULT '1', - `requiredRole` int(11) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `keyName_UNIQUE` (`keyName`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `noticeSubscription` --- - -DROP TABLE IF EXISTS `noticeSubscription`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `noticeSubscription` ( - `noticeCategoryFk` int(11) NOT NULL DEFAULT '0', - `userFk` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`noticeCategoryFk`,`userFk`), - KEY `noticeSubscription_ibfk_2` (`userFk`), - CONSTRAINT `noticeSubscription_ibfk_1` FOREIGN KEY (`noticeCategoryFk`) REFERENCES `noticeCategory` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `noticeSubscription_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 `observationType` --- - -DROP TABLE IF EXISTS `observationType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `observationType` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `hasNewBornMessage` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indica aquellos que deben de recibir un mensaje advirtiendo de un cliente nuevo', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `occupationCode` --- - -DROP TABLE IF EXISTS `occupationCode`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `occupationCode` ( - `code` varchar(1) CHARACTER SET utf8 NOT NULL, - `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Código de ocupación de la seguridad social'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `orderTicket` --- - -DROP TABLE IF EXISTS `orderTicket`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `orderTicket` ( - `orderFk` int(10) unsigned NOT NULL, - `ticketFk` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`ticketFk`,`orderFk`), - KEY `order_id` (`orderFk`), - CONSTRAINT `hedera_id` FOREIGN KEY (`orderFk`) REFERENCES `hedera`.`order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `idTicketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`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 `origin` --- - -DROP TABLE IF EXISTS `origin`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `origin` ( - `id` tinyint(2) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `warehouseFk` smallint(5) unsigned DEFAULT '4', - `flag` blob, - `nl` tinyint(4) NOT NULL DEFAULT '0', - `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `Abreviatura` (`code`), - KEY `warehouse_id` (`warehouseFk`), - KEY `Id_Paises` (`countryFk`), - CONSTRAINT `origin_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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; - --- --- Table structure for table `outgoingInvoiceVat` --- - -DROP TABLE IF EXISTS `outgoingInvoiceVat`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `outgoingInvoiceVat` ( - `outgoingInvoice` mediumint(8) NOT NULL, - `taxBase` decimal(12,2) DEFAULT NULL, - `equalizationTax` decimal(12,2) DEFAULT NULL, - `Vat` decimal(12,2) DEFAULT NULL, - PRIMARY KEY (`outgoingInvoice`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `packageChecked` --- - -DROP TABLE IF EXISTS `packageChecked`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `packageChecked` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `entryFk_UNIQUE` (`itemFk`), - KEY `fkItem_idx` (`itemFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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` ( - `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `equivalentFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`packagingFk`,`equivalentFk`), - KEY `packageEquivalent_fk2_idx` (`equivalentFk`), - CONSTRAINT `packageEquivalent_fk1` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `packageEquivalent_fk2` FOREIGN KEY (`equivalentFk`) REFERENCES `packaging` (`id`) 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; - --- --- Table structure for table `packaging` --- - -DROP TABLE IF EXISTS `packaging`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `packaging` ( - `id` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `volume` decimal(10,2) DEFAULT '0.00', - `width` decimal(10,2) DEFAULT '0.00', - `depth` decimal(10,2) DEFAULT '0.00', - `height` decimal(10,2) DEFAULT '0.00', - `value` decimal(10,2) DEFAULT '0.00', - `isPackageReturnable` tinyint(1) NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `packagingReturnFk` int(11) DEFAULT NULL, - `lower` int(11) DEFAULT NULL, - `upload` int(11) DEFAULT NULL, - `base` decimal(10,2) DEFAULT NULL, - `itemFk` int(11) DEFAULT NULL, - `price` decimal(10,2) NOT NULL, - `isBox` tinyint(1) NOT NULL DEFAULT '0', - `cubicPackage` decimal(10,2) DEFAULT NULL, - `returnCost` decimal(10,2) NOT NULL DEFAULT '0.00', - `cmrName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `freightItemFk` int(11) DEFAULT NULL, - `hasCompressionVariations` tinyint(1) DEFAULT '0' COMMENT 'Floramondo puede servirlos no llenos del todo', - `conveyorBuildingClassFk` int(11) DEFAULT NULL, - `isTrolley` tinyint(1) NOT NULL DEFAULT '0', - `isPallet` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `packaging_fk1` (`itemFk`), - KEY `packaging_fk2_idx` (`freightItemFk`), - KEY `packaging_FK` (`conveyorBuildingClassFk`), - CONSTRAINT `packaging_FK` FOREIGN KEY (`conveyorBuildingClassFk`) REFERENCES `conveyorBuildingClass` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `packaging_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE, - CONSTRAINT `packaging_fk2` FOREIGN KEY (`freightItemFk`) REFERENCES `item` (`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 */; - --- --- Table structure for table `packagingConfig` --- - -DROP TABLE IF EXISTS `packagingConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `packagingConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `upperGap` int(11) NOT NULL, - `previousPreparationMinimumSize` int(11) NOT NULL, - `defaultConveyorBuildingClass` int(11) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Altura mínima para preparar pedidos en preparacion previa'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `packagingGifts` --- - -DROP TABLE IF EXISTS `packagingGifts`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `packagingGifts` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `photo` blob, - `started` date NOT NULL, - `ended` date NOT NULL, - `warehouseFk` smallint(5) unsigned DEFAULT NULL, - `provinceFk` smallint(5) unsigned DEFAULT NULL, - `countryFk` mediumint(8) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `PackagingGifts_FK_2` (`countryFk`), - KEY `PackagingGifts_FK` (`provinceFk`), - KEY `PackagingGifts_FK_1` (`warehouseFk`), - CONSTRAINT `PackagingGifts_FK` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`), - CONSTRAINT `PackagingGifts_FK_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`), - CONSTRAINT `PackagingGifts_FK_2` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `packingSite` --- - -DROP TABLE IF EXISTS `packingSite`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `packingSite` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `code` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `hostFk` int(11) NOT NULL, - `printerFk` tinyint(3) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `packingSite_UN` (`code`), - KEY `packingSite_FK_1` (`printerFk`), - KEY `packingSite_FK` (`hostFk`), - CONSTRAINT `packingSite_FK` FOREIGN KEY (`hostFk`) REFERENCES `host` (`id`), - CONSTRAINT `packingSite_FK_1` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `packingSiteLog` --- - -DROP TABLE IF EXISTS `packingSiteLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `packingSiteLog` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `packingSiteFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `hostFk` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `workerFk` int(10) unsigned NOT NULL, - `printerModelFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `typeErrorFk` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text COLLATE utf8_unicode_ci, - PRIMARY KEY (`id`), - UNIQUE KEY `packingSiteLog_UN` (`id`), - KEY `packingSiteLog_FK` (`workerFk`), - KEY `packingSiteLog_FK_4` (`typeErrorFk`), - KEY `packingSiteLog_FK_1` (`printerModelFk`), - KEY `packingSiteLog_FK_2` (`packingSiteFk`), - CONSTRAINT `packingSiteLog_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), - CONSTRAINT `packingSiteLog_FK_1` FOREIGN KEY (`printerModelFk`) REFERENCES `printerModel` (`code`) ON UPDATE CASCADE, - CONSTRAINT `packingSiteLog_FK_2` FOREIGN KEY (`packingSiteFk`) REFERENCES `packingSite` (`code`) ON UPDATE CASCADE, - CONSTRAINT `packingSiteLog_FK_4` FOREIGN KEY (`typeErrorFk`) REFERENCES `packingSiteTypeError` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `packingSiteTypeError` --- - -DROP TABLE IF EXISTS `packingSiteTypeError`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `packingSiteTypeError` ( - `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `parking` --- - -DROP TABLE IF EXISTS `parking`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `parking` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `column` varchar(5) CHARACTER SET utf8 DEFAULT '--', - `row` varchar(5) CHARACTER SET utf8 DEFAULT '--', - `sectorFk` int(11) NOT NULL DEFAULT '2', - `code` varchar(8) CHARACTER SET utf8 DEFAULT NULL, - `pickingOrder` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `code_UNIQUE` (`code`), - KEY `parking_fk1_idx` (`sectorFk`), - CONSTRAINT `parking_fk1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_INSERT` - BEFORE INSERT ON `parking` - FOR EACH ROW -BEGIN - - -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_UPDATE` - BEFORE UPDATE ON `parking` - FOR EACH ROW -BEGIN - - -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `payDem` --- - -DROP TABLE IF EXISTS `payDem`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `payDem` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `payDem` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `payDemDetail` --- - -DROP TABLE IF EXISTS `payDemDetail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `payDemDetail` ( - `id` tinyint(3) unsigned NOT NULL, - `detail` tinyint(3) unsigned NOT NULL, - PRIMARY KEY (`id`,`detail`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `payDemDetail__` --- - -DROP TABLE IF EXISTS `payDemDetail__`; -/*!50001 DROP VIEW IF EXISTS `payDemDetail__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `payDemDetail__` ( - `id` tinyint NOT NULL, - `detail` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `payMethod` --- - -DROP TABLE IF EXISTS `payMethod`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `payMethod` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `solution` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `outstandingDebt` tinyint(3) unsigned zerofill NOT NULL DEFAULT '000', - `graceDays` int(11) unsigned NOT NULL DEFAULT '0', - `isIbanRequiredForClients` tinyint(3) DEFAULT '0', - `isIbanRequiredForSuppliers` tinyint(3) DEFAULT '0', - `isNotified` tinyint(3) NOT NULL DEFAULT '1', - `hasVerified` tinyint(1) DEFAULT '0', - `graceMonthsDisableChecked` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Deshabilita la comprobación de los datos bancarios de todos aquellos proveedores que no hayan recibido un pago en los meses especificados', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `payment` --- - -DROP TABLE IF EXISTS `payment`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `payment` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `received` date NOT NULL, - `supplierFk` int(11) NOT NULL, - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', - `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '1', - `divisa` decimal(10,2) DEFAULT NULL, - `bankFk` int(11) NOT NULL DEFAULT '0', - `payMethodFk` tinyint(3) unsigned NOT NULL, - `bankingFees` double(6,2) unsigned NOT NULL DEFAULT '0.00', - `concept` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', - `exchangeInsuranceFk` int(11) DEFAULT NULL, - `dueDated` date DEFAULT NULL, - `workerFk` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `empresa_id` (`companyFk`), - KEY `id_banco` (`bankFk`), - KEY `id_moneda` (`currencyFk`), - KEY `pay_met` (`payMethodFk`), - KEY `fk_pago_pago_sdc1_idx` (`exchangeInsuranceFk`), - KEY `pagoDueDatedIdx` (`dueDated`), - KEY `pago_ibfk_3` (`supplierFk`), - KEY `payment_FK` (`workerFk`), - CONSTRAINT `pago_ibfk_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `pago_moneda_1` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, - CONSTRAINT `pago_pay_met` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, - CONSTRAINT `payment_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), - CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `payment_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = 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 ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `payment_beforeInsert` BEFORE INSERT ON `payment` FOR EACH ROW -BEGIN - DECLARE cuenta_banco,cuenta_proveedor DOUBLE; - DECLARE vNewBookEntry INT; - DECLARE bolCASH BOOLEAN; - DECLARE isSupplierActive BOOLEAN; - - -- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH - SELECT (at2.code = 'cash') INTO bolCASH - FROM vn.bank b - JOIN vn.accountingType at2 ON at2.id = b.cash - WHERE b.id = NEW.bankFk; - - IF bolCASH THEN - - SELECT account INTO cuenta_banco - FROM bank - WHERE id = NEW.bankFk; - - SELECT account INTO cuenta_proveedor - FROM supplier - WHERE id = NEW.supplierFk; - - CALL vn.ledger_next(vNewBookEntry); - - INSERT INTO XDiario ( ASIEN, - FECHA, - SUBCTA, - CONTRA, - CONCEPTO, - EURODEBE, - EUROHABER, - empresa_id) - SELECT vNewBookEntry, - NEW.received, - SUBCTA, - CONTRA, - NEW.concept, - EURODEBE, - EUROHABER, - NEW.companyFk - FROM ( SELECT cuenta_banco SUBCTA, - cuenta_proveedor CONTRA, - 0 EURODEBE, - NEW.amount + NEW.bankingFees EUROHABER - UNION ALL - SELECT cuenta_proveedor SUBCTA, - cuenta_banco CONTRA, - NEW.amount EURODEBE, - 0 EUROHABER) gf; - - IF NEW.bankingFees <> 0 THEN - INSERT INTO XDiario ( ASIEN, - FECHA, - SUBCTA, - CONTRA, - CONCEPTO, - EURODEBE, - EUROHABER, - empresa_id) - SELECT vNewBookEntry, - NEW.received, - IF(c.id = 1,6260000002, - IF(CEE = 1,6260000003,6260000004)), - cuenta_banco, - NEW.concept, - NEW.bankingFees, - 0, - NEW.companyFk - FROM supplier s - JOIN country c ON s.countryFk = c.id - WHERE s.id = NEW.supplierFk; - END IF; - END IF; - - SET NEW.dueDated = IFNULL(NEW.dueDated, NEW.received); - - SELECT isActive INTO isSupplierActive - FROM supplier - WHERE id = NEW.supplierFk; - - IF isSupplierActive = FALSE THEN - CALL util.throw('SUPPLIER_INACTIVE'); - END IF; - - IF ISNULL(NEW.workerFk) THEN - SET NEW.workerFk = account.myUser_getId(); - END IF; - - END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`payment_afterInsert` - AFTER INSERT ON `payment` - FOR EACH ROW -BEGIN - DECLARE vIsPayMethodChecked BOOLEAN; - DECLARE vEmail VARCHAR(150); - - SELECT isPayMethodChecked INTO vIsPayMethodChecked - FROM supplier - WHERE id = NEW.supplierFk; - - - IF vIsPayMethodChecked = FALSE THEN - - SELECT notificationEmail INTO vEmail - FROM department - WHERE name = 'FINANZAS'; - - CALL mail_insert( - vEmail, - NULL, - 'Pago con método sin verificar', - CONCAT( - 'Se ha realizado el pago ', - NEW.id, - ' al proveedor ', - NEW.supplierFk, - ' con el método de pago sin verificar.' - ) - ); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER payment_beforeUpdate BEFORE UPDATE ON payment FOR EACH ROW -BEGIN - IF ISNULL(NEW.workerFk) THEN - SET NEW.workerFk = account.myUser_getId(); - 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 */ ; - --- --- 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, - `dueDated` tinyint NOT NULL, - `supplierFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `currencyFk` tinyint NOT NULL, - `divisa` tinyint NOT NULL, - `bankFk` tinyint NOT NULL, - `payMethodFk` tinyint NOT NULL, - `companyFk` tinyint NOT NULL, - `exchangeInsuranceFk` tinyint NOT NULL, - `isConciliated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `pcs` --- - -DROP TABLE IF EXISTS `pcs`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pcs` ( - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `routeFk` int(10) unsigned DEFAULT NULL, - `id` int(11) NOT NULL AUTO_INCREMENT, - `pallet` int(11) DEFAULT NULL, - `box` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `pcs_graf` --- - -DROP TABLE IF EXISTS `pcs_graf`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pcs_graf` ( - `id` int(11) NOT NULL DEFAULT '0', - `dia` date DEFAULT NULL, - `created` datetime DEFAULT NULL, - `box` decimal(4,0) DEFAULT NULL, - `pallet` decimal(2,0) DEFAULT NULL, - `routeFk` int(10) unsigned DEFAULT NULL, - `hh` int(11) DEFAULT NULL, - `mm` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `pcs_graf_index1` (`hh`), - KEY `pcs_graf_index2` (`mm`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `pedidosInternos` --- - -DROP TABLE IF EXISTS `pedidosInternos`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pedidosInternos` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `idArticle` int(11) DEFAULT NULL, - `quantity` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `periodicityType` --- - -DROP TABLE IF EXISTS `periodicityType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `periodicityType` ( - `code` varchar(45) CHARACTER SET utf8 NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 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(10) unsigned DEFAULT NULL, - `isDisable` tinyint(1) NOT NULL DEFAULT '0', - `isFreelance` tinyint(1) NOT NULL DEFAULT '0', - `isSsDiscounted` tinyint(1) NOT NULL DEFAULT '0', - `nickname` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `p2` longtext COLLATE utf8_unicode_ci, - `sex` enum('M','F') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', - PRIMARY KEY (`id`), - UNIQUE KEY `nif` (`fi`), - UNIQUE KEY `person_UN` (`readerId`), - KEY `nifIndex` (`fi`), - KEY `workerFk_idx` (`workerFk`), - CONSTRAINT `Person_ibfk_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `personMedia` --- - -DROP TABLE IF EXISTS `personMedia`; -/*!50001 DROP VIEW IF EXISTS `personMedia`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `personMedia` ( - `workerFk` tinyint NOT NULL, - `mediaValue` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `pgc` --- - -DROP TABLE IF EXISTS `pgc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pgc` ( - `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `rate` decimal(10,2) NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `cplusTaxBreakFk` int(10) unsigned DEFAULT '1', - `mod340` tinyint(1) NOT NULL DEFAULT '0', - `mod347` tinyint(1) NOT NULL DEFAULT '0', - `cplusTrascendency477Fk` int(10) unsigned DEFAULT '1', - `isEqualizated` tinyint(1) DEFAULT '0', - PRIMARY KEY (`code`), - KEY `pgc_fk1_idx` (`cplusTaxBreakFk`), - KEY `pgc_fk2_idx` (`cplusTrascendency477Fk`), - CONSTRAINT `pgc_fk1` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE, - CONSTRAINT `pgc_fk2` FOREIGN KEY (`cplusTrascendency477Fk`) REFERENCES `cplusTrascendency477` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Plan General Contable'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `pgcEqu` --- - -DROP TABLE IF EXISTS `pgcEqu`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pgcEqu` ( - `vatFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Cuenta de IVA', - `equFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Cuenta de recargo de equivalencia', - PRIMARY KEY (`vatFk`,`equFk`), - KEY `pgcEqu_fk2_idx` (`equFk`), - CONSTRAINT `pgcEqu_fk1` FOREIGN KEY (`vatFk`) REFERENCES `pgc` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `pgcEqu_fk2` FOREIGN KEY (`equFk`) REFERENCES `pgc` (`code`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge las cuentas contables con recargo de equivalencia e identifica a la que corresponde al iva y la que corresponde al recargo'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `pgcMaster` --- - -DROP TABLE IF EXISTS `pgcMaster`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pgcMaster` ( - `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='tan solo tiene las cuentas de contaplus'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `plantpassport` --- - -DROP TABLE IF EXISTS `plantpassport`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `plantpassport` ( - `producerFk` mediumint(3) unsigned NOT NULL, - `plantpassportAuthorityFk` mediumint(3) unsigned NOT NULL, - `number` varchar(25) CHARACTER SET utf8 DEFAULT NULL, - `isRequested` tinyint(2) NOT NULL DEFAULT '0', - PRIMARY KEY (`producerFk`,`plantpassportAuthorityFk`), - KEY `plantpassport_authority_idx` (`plantpassportAuthorityFk`), - KEY `producer_id_idx` (`producerFk`), - CONSTRAINT `plantpassport_authority` FOREIGN KEY (`plantpassportAuthorityFk`) REFERENCES `plantpassportAuthority` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `producer` FOREIGN KEY (`producerFk`) REFERENCES `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 */; - --- --- Table structure for table `plantpassportAuthority` --- - -DROP TABLE IF EXISTS `plantpassportAuthority`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `plantpassportAuthority` ( - `id` mediumint(3) unsigned NOT NULL, - `denomination` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `countryFk` mediumint(8) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `denomination_UNIQUE` (`denomination`), - KEY `Pais_id_idx` (`countryFk`), - CONSTRAINT `Pais_id` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='entidades certificadoras'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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` varchar(30) 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 */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_beforeInsert` - BEFORE INSERT ON `postCode` - FOR EACH ROW -BEGIN - SET NEW.geoFk = zoneGeo_new('postCode', NEW.`code`, - (SELECT geoFk FROM town WHERE id = NEW.townFk)); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_beforeUpdate` - BEFORE UPDATE ON `postCode` - FOR EACH ROW -BEGIN - -- IF !(OLD.geoFk <=> NEW.geoFk) THEN - -- CALL zoneGeo_throwNotEditable; - -- END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_afterUpdate` - AFTER UPDATE ON `postCode` - FOR EACH ROW -BEGIN - IF !(OLD.townFk <=> NEW.townFk) THEN - CALL zoneGeo_setParent(NEW.geoFk, - (SELECT geoFk FROM town WHERE id = NEW.townFk)); - END IF; - - IF !(OLD.`code` <=> NEW.`code`) THEN - UPDATE zoneGeo SET `name` = NEW.`code` - WHERE id = NEW.geoFk; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_afterDelete` - AFTER DELETE ON `postCode` - FOR EACH ROW -BEGIN - CALL zoneGeo_delete(OLD.geoFk); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `ppe` --- - -DROP TABLE IF EXISTS `ppe`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ppe` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `amortization` decimal(10,2) NOT NULL DEFAULT '0.00', - `firstAmortizated` date DEFAULT NULL, - `lastAmortizated` date DEFAULT NULL, - `finished` date DEFAULT NULL, - `value` decimal(10,2) NOT NULL DEFAULT '0.00', - `planFk` int(11) NOT NULL, - `groupFk` int(11) DEFAULT NULL, - `account` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `endowment` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `elementAccount` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `nature` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `location` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, - `discharged` date DEFAULT NULL, - `cause` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `photo` blob, - `isInvestmentAsset` tinyint(4) NOT NULL DEFAULT '0', - `workerFk` int(10) unsigned DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `ppe_fk1_idx` (`workerFk`), - KEY `ppe_fk2_idx` (`planFk`), - KEY `ppe_fk3_idx` (`groupFk`), - KEY `ppe_fk4_idx` (`companyFk`), - KEY `ppe_fk5_idx` (`account`), - KEY `ppe_fk6` (`endowment`), - KEY `ppe_fk7` (`elementAccount`), - CONSTRAINT `ppe_fk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `ppe_fk2` FOREIGN KEY (`planFk`) REFERENCES `ppePlan` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ppe_fk3` FOREIGN KEY (`groupFk`) REFERENCES `ppeGroup` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `ppe_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ppe_fk5` FOREIGN KEY (`account`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE, - CONSTRAINT `ppe_fk6` FOREIGN KEY (`endowment`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE, - CONSTRAINT `ppe_fk7` FOREIGN KEY (`elementAccount`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Property, plant & equipment\nInmvolizado, en español'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ppeComponent` --- - -DROP TABLE IF EXISTS `ppeComponent`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ppeComponent` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ppeFk` int(11) NOT NULL, - `invoiceInFk` mediumint(8) unsigned NOT NULL, - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`id`), - KEY `ppeComponent_fk1_idx` (`ppeFk`), - KEY `ppeComponent_fk2_idx` (`invoiceInFk`), - CONSTRAINT `ppeComponent_fk1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ppeComponent_fk2` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ppeDMS` --- - -DROP TABLE IF EXISTS `ppeDMS`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ppeDMS` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dmsFk` int(11) NOT NULL, - `ppeFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `ppeDMS_fk1_idx` (`dmsFk`), - KEY `ppeDMS_fk2_idx` (`ppeFk`), - CONSTRAINT `ppeDMS_fk1` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ppeDMS_fk2` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ppeGroup` --- - -DROP TABLE IF EXISTS `ppeGroup`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ppeGroup` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de inmovilizado'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ppePlan` --- - -DROP TABLE IF EXISTS `ppePlan`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ppePlan` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `rate` decimal(3,2) NOT NULL DEFAULT '1.00', - `days` int(11) NOT NULL DEFAULT '365', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Plan de amortizacion para la tabla ppe'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `priceFixed` --- - -DROP TABLE IF EXISTS `priceFixed`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `priceFixed` ( - `itemFk` int(10) NOT NULL, - `rate0` double NOT NULL, - `rate1` double NOT NULL, - `rate2` double NOT NULL, - `rate3` double NOT NULL, - `started` date NOT NULL, - `ended` date NOT NULL, - `bonus` double NOT NULL DEFAULT '0', - `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `id` int(11) NOT NULL AUTO_INCREMENT, - `grouping` smallint(5) DEFAULT NULL, - `packing` int(11) DEFAULT NULL, - `box` tinyint(4) DEFAULT NULL, - PRIMARY KEY (`itemFk`,`started`,`ended`,`warehouseFk`), - UNIQUE KEY `price_fixed_id_UNIQUE` (`id`), - KEY `item_id` (`itemFk`), - KEY `date_start` (`started`), - KEY `date_end` (`ended`), - KEY `warehouse_id` (`warehouseFk`), - CONSTRAINT `priceFixed_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `priceFixed_ibfk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`priceFixed_beforeInsert` - BEFORE INSERT ON `priceFixed` - FOR EACH ROW -BEGIN - DECLARE vDated DATE; - IF NEW.started > NEW.ended THEN - SET vDated = NEW.started; - SET NEW.started = NEW.ended; - SET NEW.ended = vDated; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`priceFixed_beforeUpdate` - BEFORE UPDATE ON `priceFixed` - FOR EACH ROW -BEGIN - DECLARE vDated DATE; - IF NEW.started > NEW.ended THEN - SET vDated = NEW.started; - SET NEW.started = NEW.ended; - SET NEW.ended = vDated; - 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 `printServerQueue` --- - -DROP TABLE IF EXISTS `printServerQueue`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `printServerQueue` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `printerFk` tinyint(3) unsigned DEFAULT NULL, - `priorityFk` tinyint(3) unsigned DEFAULT NULL, - `labelReportFk` tinyint(3) unsigned DEFAULT NULL, - `statusFk` tinyint(3) unsigned DEFAULT '1', - `started` datetime DEFAULT NULL, - `finished` datetime DEFAULT NULL, - `param1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `workerFk` int(11) DEFAULT NULL, - `param2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `param3` text COLLATE utf8_unicode_ci, - `error` text COLLATE utf8_unicode_ci, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `reportFk__` tinyint(3) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `Id_estado` (`statusFk`), - KEY `Id_Impresora` (`printerFk`), - KEY `Id_Prioridad` (`priorityFk`), - KEY `Id_Trabajador` (`workerFk`), - KEY `printServerQueue_FK` (`labelReportFk`), - CONSTRAINT `printServerQueue_FK` FOREIGN KEY (`labelReportFk`) REFERENCES `labelReport` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `printServerQueue_ibfk_3` FOREIGN KEY (`priorityFk`) REFERENCES `queuePriority` (`id`) ON UPDATE CASCADE, - CONSTRAINT `printServerQueue_printerFk` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `printServerQueue2` --- - -DROP TABLE IF EXISTS `printServerQueue2`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `printServerQueue2` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `printerFk` tinyint(3) unsigned DEFAULT NULL, - `priorityFk` tinyint(3) unsigned DEFAULT NULL, - `reportFk` tinyint(3) unsigned DEFAULT '0', - `statusFk` tinyint(3) unsigned DEFAULT '1', - `started` datetime DEFAULT NULL, - `finished` datetime DEFAULT NULL, - `param1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `workerFk` int(11) DEFAULT NULL, - `param2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `param3` text COLLATE utf8_unicode_ci, - `error` text COLLATE utf8_unicode_ci, - PRIMARY KEY (`id`), - UNIQUE KEY `Id_Impresora_2` (`printerFk`,`priorityFk`,`reportFk`,`statusFk`,`param1`,`workerFk`,`param2`), - KEY `Id_estado` (`statusFk`), - KEY `Id_Impresora` (`printerFk`), - KEY `Id_Informe` (`reportFk`), - KEY `Id_Prioridad` (`priorityFk`), - KEY `Id_Trabajador` (`workerFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `printerModel` --- - -DROP TABLE IF EXISTS `printerModel`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `printerModel` ( - `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `printer__` --- - -DROP TABLE IF EXISTS `printer__`; -/*!50001 DROP VIEW IF EXISTS `printer__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `printer__` ( - `id` tinyint NOT NULL, - `path` tinyint NOT NULL, - `name` tinyint NOT NULL, - `reference` tinyint NOT NULL, - `isLabeler` tinyint NOT NULL, - `description` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `printingQueueCheck` --- - -DROP TABLE IF EXISTS `printingQueueCheck`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `printingQueueCheck` ( - `lastCount` int(11) unsigned NOT NULL DEFAULT '0', - `lastCheckSum` int(11) unsigned NOT NULL DEFAULT '0', - `isAlreadyNotified` tinyint(2) NOT NULL DEFAULT '0', - PRIMARY KEY (`lastCount`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Comprueba que el servidor de impresion no esta parado'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `producer` --- - -DROP TABLE IF EXISTS `producer`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `producer` ( - `id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `isVisible` tinyint(1) NOT NULL DEFAULT '1', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `productionConfig` --- - -DROP TABLE IF EXISTS `productionConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `productionConfig` ( - `isPreviousPreparationRequired` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Impide que los sacadores reciban tickets que tengan productos de prep previa', - `ticketPrintedMax` int(10) unsigned NOT NULL DEFAULT '8' COMMENT 'numero máxido de tickets por carro que se ponen en impreso al pedir colección', - `ticketTrolleyMax` int(10) unsigned NOT NULL DEFAULT '4' COMMENT 'numero máximo de tickets por carro para asignar baldas en una colección', - `rookieDays` int(11) NOT NULL DEFAULT '3' COMMENT 'dias en que se cuida con especial cuidado los pedidos de un cliente por ser nuevo o recuperado', - `notBuyingMonths` int(11) NOT NULL DEFAULT '3' COMMENT 'numero de meses que han de pasar desde su ultima compra para considerar nueva la siguiente compra', - `id` int(11) NOT NULL DEFAULT '1', - `isZoneClosedByExpeditionActivated` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'activa el procedimiento vn.zone_getClosed', - `maxNotReadyCollections` int(11) NOT NULL DEFAULT '5', - `minTicketsToCloseZone` int(11) DEFAULT '15' COMMENT 'mínimo numero de tickets que deben de tener expediciones para cerrar una zona', - `movingTicketDelRoute` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Si está activo, al cambiar la fecha de un ticket desde el F11, le quita la ruta', - `defaultZone` int(11) NOT NULL DEFAULT '697', - `defautlAgencyMode` int(11) NOT NULL DEFAULT '1328' COMMENT 'SENDING', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `productionVolume` --- - -DROP TABLE IF EXISTS `productionVolume`; -/*!50001 DROP VIEW IF EXISTS `productionVolume`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `productionVolume` ( - `hora` tinyint NOT NULL, - `minuto` tinyint NOT NULL, - `cm3` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `productionVolume_LastHour` --- - -DROP TABLE IF EXISTS `productionVolume_LastHour`; -/*!50001 DROP VIEW IF EXISTS `productionVolume_LastHour`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `productionVolume_LastHour` ( - `m3` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `professionalCategory` --- - -DROP TABLE IF EXISTS `professionalCategory`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `professionalCategory` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `salary` decimal(10,2) DEFAULT NULL, - `salaryorSeniority` decimal(10,2) DEFAULT NULL, - `year` int(2) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `project` --- - -DROP TABLE IF EXISTS `project`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `project` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `photo` blob, - `started` date DEFAULT NULL, - `finished` date DEFAULT NULL, - `userFk` int(11) unsigned NOT NULL, - `departmentFk` int(11) DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `location` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `amount` decimal(15,2) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `project_FK` (`userFk`), - KEY `project_FK_1` (`departmentFk`), - KEY `project_FK_2` (`companyFk`), - CONSTRAINT `project_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `project_FK_1` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `project_FK_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla master de proyectos'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `projectNotes` --- - -DROP TABLE IF EXISTS `projectNotes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `projectNotes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `txt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - `projectFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `projectNotes_FK` (`projectFk`), - KEY `projectNotes_FK_1` (`userFk`), - CONSTRAINT `projectNotes_FK` FOREIGN KEY (`projectFk`) REFERENCES `project` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `projectNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de notas para project'; -/*!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 = 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 = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER projectNotes_BeforeInsert -BEFORE INSERT -ON projectNotes FOR EACH ROW -BEGIN - - IF ISNULL(NEW.userFk) THEN - - SET NEW.userFk = account.myUser_getId(); - - 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 `property` --- - -DROP TABLE IF EXISTS `property`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `property` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(250) COLLATE utf8_unicode_ci NOT NULL, - `cadaster` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, - `smallholding` int(11) DEFAULT NULL, - `area` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `townFk` int(11) NOT NULL, - `registry` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, - `volume` int(11) DEFAULT NULL, - `book` int(11) DEFAULT NULL, - `page` int(11) DEFAULT NULL, - `farm` int(11) DEFAULT NULL, - `registration` int(11) DEFAULT NULL, - `value` int(11) DEFAULT NULL, - `propertyGroupFk` int(11) NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL, - `photo` blob, - `allocation` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, - `m2` decimal(10,2) DEFAULT NULL, - `tome` int(11) DEFAULT NULL, - `url` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL, - `protocol` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'numero de protocolo notarial de la escritura de compra venta', - PRIMARY KEY (`id`), - KEY `property_FK` (`propertyGroupFk`), - KEY `property_FK_1` (`townFk`), - KEY `property_company` (`companyFk`), - CONSTRAINT `property_FK` FOREIGN KEY (`propertyGroupFk`) REFERENCES `propertyGroup` (`id`) ON UPDATE CASCADE, - CONSTRAINT `property_FK_1` FOREIGN KEY (`townFk`) REFERENCES `town` (`id`) ON UPDATE CASCADE, - CONSTRAINT `property_company` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `propertyDms` --- - -DROP TABLE IF EXISTS `propertyDms`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `propertyDms` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dmsFk` int(11) NOT NULL, - `propertyFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `propertyDms_FK` (`dmsFk`), - KEY `propertyDms_FK_1` (`propertyFk`), - CONSTRAINT `propertyDms_FK` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `propertyDms_FK_1` FOREIGN KEY (`propertyFk`) REFERENCES `property` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `propertyGroup` --- - -DROP TABLE IF EXISTS `propertyGroup`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `propertyGroup` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `propertyNotes` --- - -DROP TABLE IF EXISTS `propertyNotes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `propertyNotes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `propertyFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `note` text COLLATE utf8_unicode_ci NOT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `propertyNotes_FK_1` (`userFk`), - KEY `propertyNotes_FK` (`propertyFk`), - CONSTRAINT `propertyNotes_FK` FOREIGN KEY (`propertyFk`) REFERENCES `property` (`id`), - CONSTRAINT `propertyNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `province` --- - -DROP TABLE IF EXISTS `province`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `province` ( - `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `countryFk` mediumint(8) unsigned NOT NULL, - `warehouseFk` smallint(6) unsigned DEFAULT NULL COMMENT 'warehouse responsable de las rutas', - `zoneFk` tinyint(4) DEFAULT NULL, - `geoFk` int(11) DEFAULT NULL, - `autonomyFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `Paises_Id` (`countryFk`), - KEY `warehouse_Id` (`warehouseFk`), - KEY `provicne_zone_fk_idx` (`zoneFk`), - KEY `province_FK` (`autonomyFk`), - CONSTRAINT `province_FK` FOREIGN KEY (`autonomyFk`) REFERENCES `autonomy` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `province_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, - CONSTRAINT `province_zone_fk` FOREIGN KEY (`zoneFk`) REFERENCES `vn2008`.`zones` (`zone_id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `warehouse_Id` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeInsert` - BEFORE INSERT ON `province` - FOR EACH ROW -BEGIN - - SET NEW.geoFk = zoneGeo_new('province', NEW.`name`, - (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); - - SET NEW.countryFk = (SELECT a.countryFk FROM vn.autonomy a WHERE a.id = NEW.autonomyFk); - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeUpdate` - BEFORE UPDATE ON `province` - FOR EACH ROW -BEGIN - - IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN - - SET NEW.countryFk = (SELECT a.countryFk FROM vn.autonomy a WHERE a.id = NEW.autonomyFk); - - END IF; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterUpdate` - AFTER UPDATE ON `province` - FOR EACH ROW -BEGIN - IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN - CALL zoneGeo_setParent(NEW.geoFk, - (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); - END IF; - - IF !(OLD.`name` <=> NEW.`name`) THEN - UPDATE zoneGeo SET `name` = NEW.`name` - WHERE id = NEW.geoFk; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterDelete` - AFTER DELETE ON `province` - FOR EACH ROW -BEGIN - CALL zoneGeo_delete(OLD.geoFk); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `punchState` --- - -DROP TABLE IF EXISTS `punchState`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `punchState` ( - `workerFk` int(11) NOT NULL, - `state` tinyint(4) DEFAULT '1', - `created` datetime DEFAULT NULL, - PRIMARY KEY (`workerFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Table for storing punches that have cars with errors'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `queuePriority` --- - -DROP TABLE IF EXISTS `queuePriority`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `queuePriority` ( - `id` tinyint(3) unsigned NOT NULL DEFAULT '0', - `priority` varchar(50) 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 `rankBonus` --- - -DROP TABLE IF EXISTS `rankBonus`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rankBonus` ( - `rank` int(11) DEFAULT NULL, - `bonus` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `rankingNewBornByQuarter__` --- - -DROP TABLE IF EXISTS `rankingNewBornByQuarter__`; -/*!50001 DROP VIEW IF EXISTS `rankingNewBornByQuarter__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `rankingNewBornByQuarter__` ( - `total` tinyint NOT NULL, - `name` tinyint NOT NULL, - `time_sec` tinyint NOT NULL, - `userFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `rankingSellingByQuarter__` --- - -DROP TABLE IF EXISTS `rankingSellingByQuarter__`; -/*!50001 DROP VIEW IF EXISTS `rankingSellingByQuarter__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `rankingSellingByQuarter__` ( - `importe` tinyint NOT NULL, - `name` tinyint NOT NULL, - `userFk` tinyint NOT NULL, - `time_sec` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `rate` --- - -DROP TABLE IF EXISTS `rate`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rate` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL, - `rate0` double NOT NULL, - `rate1` double NOT NULL, - `rate2` double NOT NULL, - `rate3` double NOT NULL, - PRIMARY KEY (`id`), - KEY `tarifa_warehouse` (`warehouseFk`), - CONSTRAINT `tarifa_warehouse` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `rateConfig` --- - -DROP TABLE IF EXISTS `rateConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `rateConfig` ( - `id` int(11) NOT NULL, - `rate0` int(11) DEFAULT NULL, - `rate1` int(11) DEFAULT NULL, - `rate2` int(11) DEFAULT NULL, - `rate3` 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 table structure for view `rate__` --- - -DROP TABLE IF EXISTS `rate__`; -/*!50001 DROP VIEW IF EXISTS `rate__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `rate__` ( - `id` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL, - `rate0` tinyint NOT NULL, - `rate1` tinyint NOT NULL, - `rate2` tinyint NOT NULL, - `rate3` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `receipt` --- - -DROP TABLE IF EXISTS `receipt`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `receipt` ( - `Id` int(11) NOT NULL AUTO_INCREMENT, - `invoiceFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'nombre incorrecto, renombrar a description', - `amountPaid` decimal(10,2) NOT NULL DEFAULT '0.00', - `amountUnpaid__` decimal(10,2) NOT NULL DEFAULT '0.00', - `payed` datetime DEFAULT NULL, - `workerFk` int(10) unsigned DEFAULT NULL, - `bankFk` int(11) DEFAULT '0', - `clientFk` int(11) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `isConciliate` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', - PRIMARY KEY (`Id`), - KEY `Id_Banco` (`bankFk`), - KEY `Id_Trabajador` (`workerFk`), - KEY `empresa_id` (`companyFk`), - KEY `clientDate` (`clientFk`,`payed`), - KEY `id_factura` (`invoiceFk`), - KEY `payed` (`payed`), - CONSTRAINT `receiptWorkerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `receipt_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `receipt_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, - CONSTRAINT `recibo_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeInsert` - BEFORE INSERT ON `receipt` - FOR EACH ROW -BEGIN - DECLARE vIsAutoConciliated BOOLEAN; - - IF NEW.isConciliate = FALSE THEN - SELECT isAutoConciliated INTO vIsAutoConciliated - FROM accounting a - JOIN accountingType at2 ON at2.id = a.accountingTypeFk - WHERE a.id = NEW.bankFk; - - SET NEW.isConciliate = vIsAutoConciliated; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterInsert` - AFTER INSERT ON `receipt` - FOR EACH ROW -CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid) */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeUpdate` - BEFORE UPDATE ON `receipt` - FOR EACH ROW -BEGIN - CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid); - CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid); - SET NEW.workerFk = account.myUser_getId(); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterUpdate` - AFTER UPDATE ON `receipt` - FOR EACH ROW -BEGIN - IF NEW.isConciliate = FALSE AND NEW.payed > OLD.payed THEN - CALL mail_insert( - 'finanzas@verdnatura.es', - NULL, - CONCAT('Cambios de recibos del cliente: ', NEW.clientFk), - CONCAT('Se ha cambiado el recibo: ', NEW.Id, ' de ', OLD.payed, ' a ', NEW.payed) - ); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeDelete` - BEFORE DELETE ON `receipt` - FOR EACH ROW -CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid) */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `recipe` --- - -DROP TABLE IF EXISTS `recipe`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `recipe` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemFk` int(11) NOT NULL COMMENT 'bouquet al que hace referencia la receta', - `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `size` int(10) unsigned DEFAULT NULL, - `originFk` tinyint(2) unsigned DEFAULT NULL, - `typeFk` smallint(5) unsigned DEFAULT NULL, - `longName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `quantity` int(11) NOT NULL DEFAULT '1', - `element` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `inkFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `recipe_ix_1` (`element`), - KEY `recipe_ix_2` (`itemFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `recipe_log` --- - -DROP TABLE IF EXISTS `recipe_log`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `recipe_log` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `recipe_ItemFk` int(11) NOT NULL, - `element` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `selected_ItemFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `recipe_log_ix1` (`recipe_ItemFk`), - KEY `recipe_log_ix2` (`element`), - KEY `recipe_log_ix3` (`selected_ItemFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena las decisiones tomadas al generar recetas'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `recovery` --- - -DROP TABLE IF EXISTS `recovery`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `recovery` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL DEFAULT '0', - `started` date NOT NULL COMMENT 'Fecha a partir de la que comienza el recobro', - `finished` date DEFAULT NULL COMMENT 'Fecha en la que acaba', - `amount` double NOT NULL, - `period` tinyint(3) unsigned NOT NULL DEFAULT '7' COMMENT 'numero de dias que indica cada cuanto hare el recobro', - PRIMARY KEY (`id`), - KEY `cliente_idx` (`clientFk`), - CONSTRAINT `cliente333` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, - CONSTRAINT `cliente_cliente` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 */; - --- --- Table structure for table `referenceCurrent` --- - -DROP TABLE IF EXISTS `referenceCurrent`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `referenceCurrent` ( - `dated` date NOT NULL, - `value` decimal(10,4) NOT NULL, - `currencyFk` tinyint(3) unsigned NOT NULL, - PRIMARY KEY (`dated`,`currencyFk`), - KEY `referenceCurrent_currencyFk _idx` (`currencyFk`), - CONSTRAINT `referenceCurrent_currencyFk ` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`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 `referenceRate` --- - -DROP TABLE IF EXISTS `referenceRate`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `referenceRate` ( - `currencyFk` tinyint(3) unsigned NOT NULL, - `dated` date NOT NULL, - `value` float unsigned NOT NULL, - PRIMARY KEY (`currencyFk`,`dated`), - KEY `date` (`dated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `referenceRateConfig` --- - -DROP TABLE IF EXISTS `referenceRateConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `referenceRateConfig` ( - `simulatedValue` float unsigned NOT NULL DEFAULT '1.2309', - PRIMARY KEY (`simulatedValue`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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 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; - --- --- Table structure for table `route` --- - -DROP TABLE IF EXISTS `route`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `route` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned DEFAULT NULL, - `created` date NOT NULL, - `vehicleFk` int(10) unsigned DEFAULT NULL, - `agencyModeFk` int(11) DEFAULT NULL, - `time` datetime DEFAULT NULL, - `isOk` tinyint(1) unsigned NOT NULL DEFAULT '0', - `kmStart` mediumint(9) NOT NULL, - `kmEnd` mediumint(9) NOT NULL, - `started` datetime NOT NULL, - `finished` datetime NOT NULL, - `gestdocFk` int(11) DEFAULT NULL, - `cost` double unsigned DEFAULT NULL, - `m3` decimal(10,1) unsigned DEFAULT NULL, - `description` text COLLATE utf8_unicode_ci, - `zoneFk` int(11) DEFAULT NULL, - `priority` int(11) NOT NULL DEFAULT '0', - `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, - `beachFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `Id_Agencia` (`agencyModeFk`), - KEY `Fecha` (`created`), - KEY `gestdoc_id` (`gestdocFk`), - KEY `route_ibfk_2_idx` (`workerFk`), - KEY `fk_route_1_idx` (`zoneFk`), - KEY `asdfasdf_idx` (`invoiceInFk`), - KEY `route_idxIsOk` (`isOk`), - CONSTRAINT `fk_route_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `route_fk5` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `route_ibfk_1` FOREIGN KEY (`gestdocFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `route_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `route_invoiceInFk` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_AFTER_INSERT` - AFTER INSERT ON `route` - FOR EACH ROW -BEGIN - IF NEW.kmEnd < NEW.kmStart AND NEW.kmEnd <> 0 THEN - CALL util.throw ('KmEnd menor que kmStart'); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_beforeUpdate` - BEFORE UPDATE ON `route` - FOR EACH ROW -BEGIN - IF NEW.isOk <> FALSE AND OLD.isOk = FALSE THEN - SET NEW.m3 = ( SELECT SUM(litros)/1000 - FROM vn.saleVolume s - JOIN vn.ticket t ON s.ticketFk = t.id - WHERE t.routeFk = NEW.id); - END IF; - - IF NEW.kmEnd < NEW.kmStart AND NEW.kmEnd <> 0 THEN - CALL util.throw ('KmEnd menor que kmStart'); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterUpdate` - AFTER UPDATE ON `route` - FOR EACH ROW -BEGIN - IF IFNULL(NEW.gestdocFk,0) <> IFNULL(OLD.gestdocFk,0) AND NEW.gestdocFk > 0 THEN - -- JGF 09/09/14 cuando se añade un gestdoc a una ruta, se le asigna automagicamente a todos sus Tickets - - -- Inserta el gestdoc en todos los tickets de la ruta - INSERT INTO ticketDms(ticketFk,dmsFk) - SELECT id, NEW.gestdocFk FROM ticket WHERE routeFk = NEW.id - ON DUPLICATE KEY UPDATE dmsFk = NEW.gestdocFk; - - -- Update del firmado - UPDATE ticket t - JOIN ticketDms tg ON t.id = tg.ticketFk - SET isSigned = 1 WHERE t.routeFk = 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 `routeAction` --- - -DROP TABLE IF EXISTS `routeAction`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `routeAction` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `price` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `routeComplement` --- - -DROP TABLE IF EXISTS `routeComplement`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `routeComplement` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `workerFk` int(10) unsigned NOT NULL, - `price` decimal(10,2) NOT NULL, - `routeActionFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `fgn_workerFk_idx` (`workerFk`), - KEY `fgn_routeActionFk_idx` (`routeActionFk`), - CONSTRAINT `fgn_routeActionFk` FOREIGN KEY (`routeActionFk`) REFERENCES `routeAction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fgn_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `routeConfig` --- - -DROP TABLE IF EXISTS `routeConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `routeConfig` ( - `id` int(10) unsigned NOT NULL, - `kmRate` decimal(10,4) DEFAULT NULL, - `kmTruckRate` decimal(10,4) DEFAULT NULL, - `m3Distribution` decimal(10,4) DEFAULT NULL, - `m3Management` decimal(10,2) DEFAULT NULL, - `m3Palletization` decimal(10,2) DEFAULT NULL, - `load1m3` decimal(10,4) DEFAULT NULL, - `load2m3` decimal(10,4) DEFAULT NULL, - `load3m3` decimal(10,4) DEFAULT NULL, - `load4m3` decimal(10,4) DEFAULT NULL, - `load5m3` decimal(10,4) DEFAULT NULL, - `load6m3` decimal(10,4) DEFAULT NULL, - `rateHoliday` decimal(5,2) DEFAULT NULL, - `plusCategory1` decimal(5,2) DEFAULT NULL, - `plusCategory2` decimal(5,2) DEFAULT NULL, - `maxSalaryCategory1` decimal(6,2) DEFAULT NULL, - `maxSalaryCategory2` decimal(6,2) DEFAULT NULL, - `distributionM3Category1` decimal(5,2) DEFAULT NULL, - `distributionM3Category2` decimal(5,2) DEFAULT NULL, - `plusCategory1Concept` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `plusCategory2Concept` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `defaultCompanyFk` smallint(5) unsigned DEFAULT '442', - PRIMARY KEY (`id`), - KEY `routeConfig_FK` (`defaultCompanyFk`), - CONSTRAINT `routeConfig_FK` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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) NOT 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, - `ready` tinyint(4) NOT NULL DEFAULT '0', - `id` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`), - UNIQUE KEY `routeFk_UNIQUE` (`routeFk`), - KEY `routeGate_fk1_idx` (`gateAreaFk`) -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`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 `routeLoadWorker` --- - -DROP TABLE IF EXISTS `routeLoadWorker`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `routeLoadWorker` ( - `routeFk` int(10) unsigned NOT NULL, - `workerFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`routeFk`,`workerFk`), - KEY `frmWorker_idx` (`workerFk`), - CONSTRAINT `frmRutas` FOREIGN KEY (`routeFk`) REFERENCES `route` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `frmWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`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 `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(10) unsigned NOT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, - `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), - KEY `userFk` (`userFk`), - CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `routeRecalc` --- - -DROP TABLE IF EXISTS `routeRecalc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `routeRecalc` ( - `routeFk` int(11) NOT NULL, - PRIMARY KEY (`routeFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Queue of changed volume to recalc route volumen'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `routeUserPercentage` --- - -DROP TABLE IF EXISTS `routeUserPercentage`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `routeUserPercentage` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `percentage` decimal(10,2) NOT NULL, - `dated` date NOT NULL, - PRIMARY KEY (`id`), - KEY `routeUserPercentageFk_idx` (`workerFk`), - CONSTRAINT `routeUserPercentageFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `routesMonitor` --- - -DROP TABLE IF EXISTS `routesMonitor`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `routesMonitor` ( - `routeFk` int(10) unsigned NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `beachFk` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `ticketPacked` int(11) DEFAULT NULL, - `ticketFree` int(11) DEFAULT NULL, - `ticketProduction` int(11) DEFAULT NULL, - `packages` int(11) DEFAULT NULL, - `note` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `dated` date DEFAULT NULL, - `dockFk` int(11) DEFAULT NULL, - `m3` decimal(10,1) DEFAULT NULL, - `priority` int(11) NOT NULL DEFAULT '0', - `etd` time DEFAULT NULL, - `expeditionTruckFk` int(11) DEFAULT NULL, - `m3boxes` decimal(10,1) DEFAULT NULL, - `bufferFk` int(11) DEFAULT NULL COMMENT 'Buffer del sorter por el que se quiere sacar esa ruta', - `isPickingAllowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Los tickets de esta ruta se pueden preparar', - PRIMARY KEY (`routeFk`), - KEY `routesMonitor_FK` (`bufferFk`), - CONSTRAINT `routesMonitor_FK` FOREIGN KEY (`bufferFk`) REFERENCES `srt`.`buffer` (`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 */; - --- --- Table structure for table `sale` --- - -DROP TABLE IF EXISTS `sale`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sale` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `itemFk` int(11) NOT NULL, - `ticketFk` int(11) NOT NULL, - `concept` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `quantity` decimal(10,2) NOT NULL DEFAULT '0.00', - `originalQuantity` double(9,1) DEFAULT NULL, - `price` decimal(10,2) DEFAULT '0.00', - `discount` tinyint(2) unsigned NOT NULL DEFAULT '0', - `priceFixed` decimal(10,2) NOT NULL DEFAULT '0.00', - `reserved` tinyint(1) NOT NULL DEFAULT '0', - `isPicked` tinyint(1) NOT NULL DEFAULT '0', - `isPriceFixed` tinyint(1) NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `isAdded` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `Id_Ticket` (`ticketFk`), - KEY `itemFk_ticketFk` (`itemFk`,`ticketFk`), - CONSTRAINT `movement_ticket_id` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `sale_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterInsert` - AFTER INSERT ON `sale` - FOR EACH ROW -BEGIN - - IF (SELECT COUNT(*) from item i WHERE id = NEW.itemFk AND family = 'SER') THEN - CALL util.throw('Cannot insert a service item into a ticket'); - END IF; - - CALL stock.log_add('sale', NEW.id, NULL); - CALL ticket_requestRecalc(NEW.ticketFk); - - IF NEW.quantity > 0 THEN - - UPDATE vn.collection c - JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk - JOIN vn.item i ON i.id = NEW.itemFk - AND (c.itemPackingTypeFk = i.itemPackingTypeFk - OR ISNULL(c.itemPackingTypeFk)) - SET c.saleTotalCount = c.saleTotalCount + 1; - - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.route r ON r.id = t.routeFk - WHERE r.isOk = FALSE - AND s.id = NEW.id - AND r.created >= CURDATE() - GROUP BY r.id; - END IF; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeUpdate` - BEFORE UPDATE ON `sale` - FOR EACH ROW -BEGIN -/* - IF (SELECT COUNT(*) from item i WHERE id = NEW.itemFk AND family = 'SER') THEN - CALL util.throw('Cannot insert a service item into a ticket'); - END IF; -*/ - IF NEW.discount > 100 THEN - SET NEW.discount = 0; - END IF; - - IF old.discount > 0 AND NEW.discount = 0 THEN - INSERT INTO ticketLog - SET originFk = NEW.ticketFk, userFk = account.myUser_getId(), `action` = 'insert', - description = CONCAT('Cambio de descuento del item :', ' ', new.itemFk, ' de ', old.discount ,' a 0 '); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterUpdate` - AFTER UPDATE ON `sale` - FOR EACH ROW -BEGIN - DECLARE vIsToSendMail BOOL; - DECLARE vPickedLines INT; - DECLARE vCollectionFk INT; - DECLARE vUserRole VARCHAR(255); - - IF !(NEW.id <=> OLD.id) - OR !(NEW.ticketFk <=> OLD.ticketFk) - OR !(NEW.itemFk <=> OLD.itemFk) - OR !(NEW.quantity <=> OLD.quantity) - OR !(NEW.created <=> OLD.created) - OR !(NEW.isPicked <=> OLD.isPicked) THEN - CALL stock.log_add('sale', NEW.id, OLD.id); - END IF; - - IF !(NEW.price <=> OLD.price) - OR !(NEW.ticketFk <=> OLD.ticketFk) - OR !(NEW.itemFk <=> OLD.itemFk) - OR !(NEW.quantity <=> OLD.quantity) - OR !(NEW.discount <=> OLD.discount) THEN - CALL ticket_requestRecalc(NEW.ticketFk); - CALL ticket_requestRecalc(OLD.ticketFk); - END IF; - - IF !(OLD.ticketFk <=> NEW.ticketFk) THEN - UPDATE ticketRequest SET ticketFk = NEW.ticketFk - WHERE saleFk = NEW.id; - END IF; - - SELECT account.myUser_getName() INTO vUserRole; - SELECT account.user_getMysqlRole(vUserRole) INTO vUserRole; - - IF !(OLD.quantity <=> NEW.quantity) THEN - SELECT COUNT(*) INTO vIsToSendMail - FROM vncontrol.inter i - JOIN vn.state s ON s.id = i.state_id - WHERE s.code='PACKED' - AND i.Id_Ticket = OLD.ticketFk - AND vUserRole IN ('salesPerson', 'salesBoss') - LIMIT 1; - - IF vIsToSendMail THEN - CALL vn.mail_insert('jefesventas@verdnatura.es', - 'noreply@verdnatura.es', - CONCAT('Ticket ', OLD.ticketFk ,' modificada cantidad tras encajado'), - CONCAT('Ticket
', OLD.ticketFk ,'.
', - 'Modificada la catidad de ', OLD.quantity, ' a ' , NEW.quantity, - ' del artículo ', OLD.itemFk, ' tras estado encajado del ticket.
', - 'Este email se ha generado automáticamente' ) - ); - END IF; - IF (OLD.quantity > NEW.quantity) THEN - INSERT INTO saleComponent(saleFk, componentFk, value) - SELECT NEW.id, cm.id, sc.value - FROM saleComponent sc - JOIN component cd ON cd.id = sc.componentFk - JOIN component cm ON cm.code = 'mana' - WHERE saleFk = NEW.id AND cd.code = 'lastUnitsDiscount' - ON DUPLICATE KEY UPDATE value = sc.value + VALUES(value); - - DELETE sc.* - FROM vn.saleComponent sc - JOIN component c ON c.id = sc.componentFk - WHERE saleFk = NEW.id AND c.code = 'lastUnitsDiscount'; - END IF; - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.route r ON r.id = t.routeFk - WHERE r.isOk = FALSE - AND s.id = NEW.id - AND r.created >= CURDATE() - GROUP BY r.id; - END IF; - - IF !(ABS(NEW.isPicked) <=> ABS(OLD.isPicked)) AND NEW.quantity > 0 THEN - - UPDATE vn.collection c - JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk - SET c.salePickedCount = c.salePickedCount + IF(NEW.isPicked != 0, 1, -1); - - END IF; - - IF !(NEW.quantity <=> OLD.quantity) AND (NEW.quantity = 0 OR OLD.quantity = 0) THEN - - UPDATE vn.collection c - JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk - SET c.saleTotalCount = c.saleTotalCount + IF(OLD.quantity = 0, 1, -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 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_BEFORE_DELETE` - BEFORE DELETE ON `sale` - FOR EACH ROW -BEGIN - IF OLD.quantity > 0 THEN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.route r ON r.id = t.routeFk - WHERE r.isOk = FALSE - AND s.id = OLD.id - AND r.created >= CURDATE() - GROUP BY r.id; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterDelete` - AFTER DELETE ON `sale` - FOR EACH ROW -BEGIN - DECLARE vIsToSendMail BOOL; - DECLARE vUserRole VARCHAR(255); - - CALL stock.log_add('sale', NULL, OLD.id); - CALL ticket_requestRecalc(OLD.ticketFk); - - SELECT account.myUser_getName() INTO vUserRole; - SELECT account.user_getMysqlRole(vUserRole) INTO vUserRole; - - SELECT COUNT(*) INTO vIsToSendMail - FROM vncontrol.inter i - JOIN vn.state s ON s.id = i.state_id - WHERE s.code='PACKED' - AND i.Id_Ticket = OLD.ticketFk - AND vUserRole IN ('salesPerson', 'salesBoss') - LIMIT 1; - - IF vIsToSendMail THEN - CALL vn.mail_insert('jefesventas@verdnatura.es', - 'noreply@verdnatura.es', - CONCAT('Ticket ', OLD.ticketFk ,' eliminado artículo tras encajado' ), - CONCAT('Ticket ', OLD.ticketFk ,'.
', - 'Eliminado artículo ', OLD.itemFk, ' tras estado encajado del ticket.
Este email se ha generado automáticamente' ) - ); - END IF; - - IF OLD.quantity > 0 THEN - - UPDATE vn.collection c - JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = OLD.ticketFk - JOIN vn.item i ON i.id = OLD.itemFk - AND (c.itemPackingTypeFk = i.itemPackingTypeFk - OR ISNULL(c.itemPackingTypeFk)) - SET c.saleTotalCount = c.saleTotalCount - 1, - c.salePickedCount = c.salePickedCount - ABS(OLD.isPicked); - - 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 `saleBuy` --- - -DROP TABLE IF EXISTS `saleBuy`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleBuy` ( - `saleFk` int(11) NOT NULL, - `buyFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `workerFk` int(11) DEFAULT NULL, - PRIMARY KEY (`saleFk`), - KEY `saleBuy_FK` (`buyFk`), - CONSTRAINT `saleBuy_FK` FOREIGN KEY (`buyFk`) REFERENCES `buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `saleBuy_FK_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`BEFORE_INSERT` - BEFORE INSERT ON `saleBuy` - FOR EACH ROW -BEGIN - - SET NEW.workerFk = vn.getUser(); - - END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_AI` - AFTER INSERT ON `saleBuy` - FOR EACH ROW -BEGIN -/* Activar de nuevo cuando volvamos a vender fruta y verdura - * - UPDATE vn.sale s - SET s.concept = CONCAT(s.concept, ' Lote: ', NEW.buyFk) - WHERE s.id = NEW.saleFk; -*/ -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Table structure for table `saleChecked` --- - -DROP TABLE IF EXISTS `saleChecked`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleChecked` ( - `saleFk` int(11) NOT NULL, - `isChecked` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`saleFk`), - CONSTRAINT `fk_Movimientos_checked_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`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 `saleCloned` --- - -DROP TABLE IF EXISTS `saleCloned`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleCloned` ( - `saleClonedFk` int(11) NOT NULL, - `saleOriginalFk` int(11) NOT NULL, - PRIMARY KEY (`saleClonedFk`), - KEY `saleOriginalFk_idx` (`saleOriginalFk`), - CONSTRAINT `saleClonedFk_fk2` FOREIGN KEY (`saleClonedFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `saleOriginalFk_fk1` FOREIGN KEY (`saleOriginalFk`) REFERENCES `sale` (`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 `saleComponent` --- - -DROP TABLE IF EXISTS `saleComponent`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleComponent` ( - `saleFk` int(11) NOT NULL, - `componentFk` int(11) NOT NULL, - `value` double NOT NULL, - `isGreuge` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Indica si ya se ha tenido en cuenta para calcular el greuge', - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`saleFk`,`componentFk`), - KEY `fk_mov_comp_idx` (`componentFk`), - CONSTRAINT `mc_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `mc_fk2` FOREIGN KEY (`componentFk`) REFERENCES `component` (`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 `saleCost` --- - -DROP TABLE IF EXISTS `saleCost`; -/*!50001 DROP VIEW IF EXISTS `saleCost`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleCost` ( - `itemFk` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `discount` tinyint NOT NULL, - `price` tinyint NOT NULL, - `component` tinyint NOT NULL, - `coste` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `saleGoal` --- - -DROP TABLE IF EXISTS `saleGoal`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleGoal` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `month` int(11) DEFAULT NULL, - `year` int(11) DEFAULT NULL, - `rank` smallint(6) NOT NULL, - `walletWeightFrom` int(11) NOT NULL, - `walletWeightTo` int(11) DEFAULT NULL, - `goal` decimal(10,2) DEFAULT NULL, - `goalType` smallint(6) DEFAULT NULL COMMENT 'grado', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `saleGroup` --- - -DROP TABLE IF EXISTS `saleGroup`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleGroup` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `userFk` int(11) DEFAULT NULL, - `parkingFk` int(11) DEFAULT NULL, - `sectorFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='agrupa lineas de venta'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `saleGroupDetail` --- - -DROP TABLE IF EXISTS `saleGroupDetail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleGroupDetail` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `saleFk` int(11) NOT NULL, - `saleGroupFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `saleGroupDetail_FK` (`saleFk`), - KEY `saleGroupDetail_FK_1` (`saleGroupFk`), - CONSTRAINT `saleGroupDetail_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `saleGroupDetail_FK_1` FOREIGN KEY (`saleGroupFk`) REFERENCES `saleGroup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='relaciona sale y saleGroup'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `saleItemShelving__` --- - -DROP TABLE IF EXISTS `saleItemShelving__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleItemShelving__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `saleFk` int(11) NOT NULL, - `itemShelvingFk` int(10) unsigned NOT NULL, - `quantity` int(11) NOT NULL DEFAULT '0', - `isPicked` tinyint(4) NOT NULL DEFAULT '0', - `ubication` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `saleItemShelving_fk1_idx` (`itemShelvingFk`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `saleMistake` --- - -DROP TABLE IF EXISTS `saleMistake`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleMistake` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `saleFk` int(11) NOT NULL, - `userFk` int(10) unsigned NOT NULL COMMENT 'Controlador', - `typeFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `saleMistake_fk1_idx` (`saleFk`), - KEY `saleMistake_fk2_idx` (`userFk`), - KEY `saleMistake_fk3_idx` (`typeFk`), - CONSTRAINT `saleMistake_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `saleMistake_fk2` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `saleMistake_fk3` FOREIGN KEY (`typeFk`) REFERENCES `mistakeType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `saleMistakeList` --- - -DROP TABLE IF EXISTS `saleMistakeList`; -/*!50001 DROP VIEW IF EXISTS `saleMistakeList`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleMistakeList` ( - `saleFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `created` tinyint NOT NULL, - `revisador` tinyint NOT NULL, - `description` tinyint NOT NULL, - `controlled` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `saleMistake_list__` --- - -DROP TABLE IF EXISTS `saleMistake_list__`; -/*!50001 DROP VIEW IF EXISTS `saleMistake_list__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleMistake_list__` ( - `saleFk` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `created` tinyint NOT NULL, - `revisador` tinyint NOT NULL, - `description` tinyint NOT NULL, - `controlled` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `saleMistake_list__2` --- - -DROP TABLE IF EXISTS `saleMistake_list__2`; -/*!50001 DROP VIEW IF EXISTS `saleMistake_list__2`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleMistake_list__2` ( - `saleFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `sacador` tinyint NOT NULL, - `created` tinyint NOT NULL, - `revisador` tinyint NOT NULL, - `description` tinyint NOT NULL, - `controlled` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `saleParking__` --- - -DROP TABLE IF EXISTS `saleParking__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleParking__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `saleFk` int(11) NOT NULL, - `parkingFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `userFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `saleParking_FK` (`saleFk`), - KEY `saleParking_FK_1` (`parkingFk`), - CONSTRAINT `saleParking_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `saleParking_FK_1` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='ubica las lineas de venta preparadas previamente'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `saleSaleTracking` --- - -DROP TABLE IF EXISTS `saleSaleTracking`; -/*!50001 DROP VIEW IF EXISTS `saleSaleTracking`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleSaleTracking` ( - `saleFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `saleState` --- - -DROP TABLE IF EXISTS `saleState`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleState` ( - `saleFk` int(11) NOT NULL, - `stateFk` tinyint(3) unsigned NOT NULL, - PRIMARY KEY (`saleFk`), - KEY `saleState_fk2_idx` (`stateFk`), - CONSTRAINT `saleState_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `saleState_fk2` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='cahce para el estado de la linea'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `saleTracking` --- - -DROP TABLE IF EXISTS `saleTracking`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `saleTracking` ( - `saleFk` int(11) NOT NULL, - `isChecked` tinyint(3) unsigned NOT NULL DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `originalQuantity` double DEFAULT NULL, - `workerFk` int(11) NOT NULL, - `actionFk` int(11) NOT NULL, - `id` int(11) NOT NULL AUTO_INCREMENT, - `stateFk` tinyint(3) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `saleTracking_UN` (`saleFk`,`workerFk`,`actionFk`,`stateFk`), - KEY `Id_Movimiento` (`saleFk`), - KEY `fgnStateFk_idx` (`stateFk`), - KEY `saleTracking_idx5` (`created`), - KEY `saleTracking_fk2_idx` (`actionFk`), - CONSTRAINT `fgnStateFk` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE, - CONSTRAINT `saleTracking_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_beforeInsert` - BEFORE INSERT ON `saleTracking` - FOR EACH ROW -BEGIN - IF(NEW.stateFk = 14) THEN - SET NEW.actionFk = 3; - END IF; - - IF(NEW.stateFk = 8) THEN - SET NEW.actionFk = 4; - END IF; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_After_Insert` - AFTER INSERT ON `saleTracking` - FOR EACH ROW -BEGIN - - IF NEW.isChecked THEN - - UPDATE vn.sale s - SET s.isPicked = TRUE - WHERE s.id = NEW.saleFk - AND s.isPicked = 0; - - 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 */ ; - --- --- Temporary table structure for view `saleValue` --- - -DROP TABLE IF EXISTS `saleValue`; -/*!50001 DROP VIEW IF EXISTS `saleValue`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleValue` ( - `warehouse` tinyint NOT NULL, - `client` tinyint NOT NULL, - `clientTypeFk` tinyint NOT NULL, - `buyer` tinyint NOT NULL, - `itemTypeFk` tinyint NOT NULL, - `family` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `cost` tinyint NOT NULL, - `value` tinyint NOT NULL, - `year` tinyint NOT NULL, - `week` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `saleVolume` --- - -DROP TABLE IF EXISTS `saleVolume`; -/*!50001 DROP VIEW IF EXISTS `saleVolume`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleVolume` ( - `ticketFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `litros` tinyint NOT NULL, - `routeFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `volume` tinyint NOT NULL, - `physicalWeight` tinyint NOT NULL, - `weight` tinyint NOT NULL, - `physicalVolume` tinyint NOT NULL, - `freight` tinyint NOT NULL, - `zoneFk` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `isPicked` tinyint NOT NULL, - `eurosValue` tinyint NOT NULL, - `itemPackingTypeFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `saleVolume_Today_VNH` --- - -DROP TABLE IF EXISTS `saleVolume_Today_VNH`; -/*!50001 DROP VIEW IF EXISTS `saleVolume_Today_VNH`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `saleVolume_Today_VNH` ( - `Cliente` tinyint NOT NULL, - `Provincia` tinyint NOT NULL, - `Pais` tinyint NOT NULL, - `volume` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `sale_freightComponent` --- - -DROP TABLE IF EXISTS `sale_freightComponent`; -/*!50001 DROP VIEW IF EXISTS `sale_freightComponent`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `sale_freightComponent` ( - `ticketFk` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `shipped` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `salesPersonGoal` --- - -DROP TABLE IF EXISTS `salesPersonGoal`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `salesPersonGoal` ( - `salesPersonName` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '', - `month` int(11) DEFAULT NULL, - `year` int(11) DEFAULT NULL, - `goal` int(11) DEFAULT NULL, - PRIMARY KEY (`salesPersonName`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `salesPersonSince` --- - -DROP TABLE IF EXISTS `salesPersonSince`; -/*!50001 DROP VIEW IF EXISTS `salesPersonSince`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesPersonSince` ( - `workerFk` tinyint NOT NULL, - `started` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `salesPreparedLastHour` --- - -DROP TABLE IF EXISTS `salesPreparedLastHour`; -/*!50001 DROP VIEW IF EXISTS `salesPreparedLastHour`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesPreparedLastHour` ( - `warehouseFk` tinyint NOT NULL, - `saleFk` tinyint NOT NULL, - `isChecked` tinyint NOT NULL, - `originalQuantity` tinyint NOT NULL, - `accion` tinyint NOT NULL, - `created` tinyint NOT NULL, - `code` tinyint NOT NULL, - `firstname` tinyint NOT NULL, - `lastName` tinyint NOT NULL, - `workerCode` tinyint NOT NULL, - `litros` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `departmentName` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `salesPreviousPreparated` --- - -DROP TABLE IF EXISTS `salesPreviousPreparated`; -/*!50001 DROP VIEW IF EXISTS `salesPreviousPreparated`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesPreviousPreparated` ( - `saleFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `salesToPrePrepare__` --- - -DROP TABLE IF EXISTS `salesToPrePrepare__`; -/*!50001 DROP VIEW IF EXISTS `salesToPrePrepare__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `salesToPrePrepare__` ( - `Id_Ticket` tinyint NOT NULL, - `Id_Movimiento` tinyint NOT NULL, - `Id_Movimiento_mark` tinyint NOT NULL, - `Id_Trabjador` tinyint NOT NULL, - `isChecked` tinyint NOT NULL, - `created` tinyint NOT NULL, - `Id_Article` tinyint NOT NULL, - `Concepte` tinyint NOT NULL, - `subName` tinyint NOT NULL, - `Cantidad` tinyint NOT NULL, - `original_quantity` tinyint NOT NULL, - `Hora` tinyint NOT NULL, - `Departure` tinyint NOT NULL, - `Minuto` tinyint NOT NULL, - `agency_id` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `province_id` tinyint NOT NULL, - `picked` tinyint NOT NULL, - `trabajador` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `stateFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `sample` --- - -DROP TABLE IF EXISTS `sample`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sample` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(25) CHARACTER SET utf8 NOT NULL, - `description` varchar(105) COLLATE utf8_unicode_ci NOT NULL, - `isVisible` tinyint(1) unsigned NOT NULL DEFAULT '1', - `hasCompany` tinyint(1) unsigned NOT NULL DEFAULT '0', - `hasPreview` tinyint(1) unsigned NOT NULL DEFAULT '1', - `datepickerEnabled` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sector` --- - -DROP TABLE IF EXISTS `sector`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sector` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', - `isPreviousPreparedByPacking` tinyint(4) NOT NULL DEFAULT '1', - `code` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `pickingPlacement` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `path` int(11) DEFAULT NULL, - `isPreviousPrepared` tinyint(1) NOT NULL DEFAULT '0', - `isPackagingArea` tinyint(1) NOT NULL DEFAULT '0', - `labelReportFk` tinyint(3) unsigned DEFAULT NULL, - `sonFk` int(11) DEFAULT NULL, - `isMain` tinyint(1) NOT NULL DEFAULT '0', - `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `workerFk` int(11) DEFAULT NULL, - `labelReport__` tinyint(3) DEFAULT NULL, - `printerFk` tinyint(3) unsigned DEFAULT NULL, - `isHideForPickers` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'sector a ocultar a los sacadores', - `isReserve` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Sectores de reserva, como Albenfruit o Fuentes', - PRIMARY KEY (`id`,`warehouseFk`), - UNIQUE KEY `code_UNIQUE` (`code`), - KEY `sector_fk1_idx` (`warehouseFk`), - KEY `sector_labelReport` (`labelReportFk`), - CONSTRAINT `sector_fk1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `sector_labelReport` FOREIGN KEY (`labelReportFk`) REFERENCES `labelReport` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sectorCollection` --- - -DROP TABLE IF EXISTS `sectorCollection`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sectorCollection` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `userFk` int(10) unsigned NOT NULL, - `sectorFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `sectorCollection_FK` (`userFk`), - KEY `sectorCollection_FK_2` (`sectorFk`), - CONSTRAINT `sectorCollection_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `sectorCollection_FK_1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Las lineas de preparacion de pedidos por sectores se agrupan bajo el identificador de esta tabla'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sectorCollectionSaleGroup` --- - -DROP TABLE IF EXISTS `sectorCollectionSaleGroup`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sectorCollectionSaleGroup` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `sectorCollectionFk` int(11) NOT NULL, - `saleGroupFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `sectorCollectionSaleGroup_UN` (`sectorCollectionFk`,`saleGroupFk`), - KEY `sectorCollectionSaleGroup_FK_1` (`saleGroupFk`), - CONSTRAINT `sectorCollectionSaleGroup_FK` FOREIGN KEY (`sectorCollectionFk`) REFERENCES `sectorCollection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `sectorCollectionSaleGroup_FK_1` FOREIGN KEY (`saleGroupFk`) REFERENCES `saleGroup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las lineas de venta con la coleccion del sector'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sectorProductivity` --- - -DROP TABLE IF EXISTS `sectorProductivity`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sectorProductivity` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(11) DEFAULT NULL, - `firstName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `lastName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `sector` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `ticketCount` int(11) DEFAULT NULL, - `saleCount` int(11) DEFAULT NULL, - `error` int(11) DEFAULT NULL, - `volume` decimal(10,6) DEFAULT NULL, - `hourWorked` decimal(10,2) DEFAULT NULL, - `dated` date DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sharingCart` --- - -DROP TABLE IF EXISTS `sharingCart`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sharingCart` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `started` date NOT NULL, - `ended` date NOT NULL, - `workerSubstitute` int(10) unsigned NOT NULL, - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`started`,`ended`,`workerSubstitute`), - KEY `Suplent` (`workerSubstitute`), - CONSTRAINT `Suplent_key` FOREIGN KEY (`workerSubstitute`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Trabajador_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeInsert` - BEFORE INSERT ON `sharingCart` - FOR EACH ROW -BEGIN - IF NEW.workerFk = NEW.workerSubstitute THEN - CALL util.throw ('worker and workerSubstitute must be different'); - ELSE - INSERT IGNORE INTO sharingCartDaily (ownerFk, substituteFk, dated) - SELECT NEW.workerFk, NEW.workerSubstitute, dated - FROM time - WHERE dated BETWEEN NEW.started AND NEW.ended; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeUpdate` - BEFORE UPDATE ON `sharingCart` - FOR EACH ROW -BEGIN - IF NEW.workerFk = NEW.workerSubstitute THEN - CALL util.throw ('worker and workerSubstitute must be different'); - ELSE - DELETE sc FROM sharingCartDaily sc - WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND - sc.ownerFk = OLD.workerFk AND - sc.substituteFk = OLD.workerSubstitute; - - INSERT IGNORE INTO sharingCartDaily (ownerFk, substituteFk, dated) - SELECT NEW.workerFk, NEW.workerSubstitute, dated - FROM time - WHERE dated BETWEEN NEW.started AND NEW.ended; - - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeDelete` - BEFORE DELETE ON `sharingCart` - FOR EACH ROW -BEGIN - DELETE sc FROM sharingCartDaily sc - WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND - sc.ownerFk = OLD.workerFk AND - sc.substituteFk = OLD.workerSubstitute; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `sharingCartDaily` --- - -DROP TABLE IF EXISTS `sharingCartDaily`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sharingCartDaily` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ownerFk` int(10) unsigned NOT NULL, - `substituteFk` int(10) unsigned NOT NULL, - `dated` date NOT NULL, - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - UNIQUE KEY `sharingCartDailyWorker_idx` (`ownerFk`,`dated`), - KEY `sharingCartDailySubstitute_idx` (`substituteFk`), - CONSTRAINT `sharingCartDailySubstitute` FOREIGN KEY (`substituteFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `sharingCartDailyWorker` FOREIGN KEY (`ownerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='para calcular las comisiones de las sustituciones de los comerciales'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sharingClient` --- - -DROP TABLE IF EXISTS `sharingClient`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sharingClient` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `started` date NOT NULL, - `ended` date NOT NULL, - `clientFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `Worker` (`workerFk`), - KEY `Client` (`clientFk`), - CONSTRAINT `Clients_key` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, - CONSTRAINT `Trabajadores_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingClient_beforeInsert` - BEFORE INSERT ON `sharingClient` - FOR EACH ROW -BEGIN - SET NEW.ended = GREATEST(CURDATE(),NEW.ended); - SET NEW.started = GREATEST(CURDATE(),NEW.started); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingClient_beforeUpdate` - BEFORE UPDATE ON `sharingClient` - FOR EACH ROW -BEGIN - SET NEW.ended = GREATEST(CURDATE(),NEW.ended); - SET NEW.started = GREATEST(CURDATE(),NEW.started); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `shelving` --- - -DROP TABLE IF EXISTS `shelving`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `shelving` ( - `code` varchar(10) CHARACTER SET utf8 NOT NULL, - `parkingFk` int(11) DEFAULT NULL, - `isPrinted` tinyint(4) NOT NULL DEFAULT '0', - `priority` int(11) NOT NULL DEFAULT '0', - `parked` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `userFk` int(10) unsigned DEFAULT NULL, - `isSpam` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'señala las matrículas con producto que se puede llevar a la reserva', - `isRecyclable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'las matrículas marcadas como reciclables se liberan cada noche desde vn.shelving_clean para poder volver a utilizarlas', - PRIMARY KEY (`code`), - KEY `shelving_fk1_idx` (`parkingFk`), - KEY `shelving_fk2_idx` (`userFk`), - CONSTRAINT `shelving_fk1` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `shelving_fk2` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla usada para localizar el carro en el parking del altillo'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeInsert` - BEFORE INSERT ON `shelving` - FOR EACH ROW -BEGIN - - IF NEW.code = "" THEN - - CALL util.throw('NOT_EMPTY_CODE_ALLOWED'); - - END IF; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_BEFORE_UPDATE` - BEFORE UPDATE ON `shelving` - FOR EACH ROW -BEGIN - - IF OLD.parkingFk != NEW.parkingFk THEN - - UPDATE item i - JOIN itemShelving ish ON ish.itemFk = i.id - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON p.id = sh.parkingFk - SET i.sectorFk = p.sectorFk - WHERE sh.`code` = OLD.`code`; - - END IF; - - IF NEW.code = "" THEN - - CALL util.throw('NOT_EMPTY_CODE_ALLOWED'); - - 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 `shelvingLog` --- - -DROP TABLE IF EXISTS `shelvingLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `shelvingLog` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` varchar(10) CHARACTER SET utf8 NOT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, - `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `userFk` (`userFk`), - KEY `originFk` (`originFk`), - CONSTRAINT `shelvingLog_FK_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `shelvingLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `silexACL` --- - -DROP TABLE IF EXISTS `silexACL`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `silexACL` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `module` varchar(50) NOT NULL, - `method` varchar(50) NOT NULL, - `role` varchar(20) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `module_UNIQUE` (`module`,`method`,`role`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sinister` --- - -DROP TABLE IF EXISTS `sinister`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sinister` ( - `id` int(11) NOT NULL, - `supplierFk` int(11) NOT NULL, - `clientFk` int(11) NOT NULL, - `amount` decimal(10,2) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `insureRate` decimal(3,2) NOT NULL DEFAULT '0.75', - `isBooked` tinyint(4) NOT NULL DEFAULT '0', - `workerFk` int(10) unsigned NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `sinister_fk1_idx` (`supplierFk`), - KEY `sinister_fk2_idx` (`clientFk`), - KEY `sinister_fk3_idx` (`workerFk`), - KEY `sinister_fk4_idx` (`companyFk`), - CONSTRAINT `sinister_fk1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, - CONSTRAINT `sinister_fk2` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `sinister_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `sinister_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Impago de cliente asegurado'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `sinisterDetail` --- - -DROP TABLE IF EXISTS `sinisterDetail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sinisterDetail` ( - `id` int(11) NOT NULL, - `sinisterFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `amountIn` decimal(10,2) DEFAULT NULL, - `amountOut` decimal(10,2) DEFAULT NULL, - `isConciliated` tinyint(1) NOT NULL DEFAULT '0', - `workerFk` int(10) unsigned NOT NULL, - `bankFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `sinisterDetail_fk1_idx` (`sinisterFk`), - KEY `sinisterDetail_fk2_idx` (`workerFk`), - KEY `sinisterDetail_fk3_idx` (`bankFk`), - CONSTRAINT `sinisterDetail_fk1` FOREIGN KEY (`sinisterFk`) REFERENCES `sinister` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `sinisterDetail_fk2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `sinisterDetail_fk3` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`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 `smartTag` --- - -DROP TABLE IF EXISTS `smartTag`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `smartTag` ( - `code` varchar(12) CHARACTER SET utf8 NOT NULL, - `shelvingFk` varchar(10) CHARACTER SET utf8 DEFAULT NULL, - `level` int(11) DEFAULT NULL, - PRIMARY KEY (`code`), - KEY `smartTag_shelving_fk` (`shelvingFk`), - CONSTRAINT `smartTag_shelving_fk` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) 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` --- - -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) DEFAULT '0', - `status` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'OK', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT 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, - `apiKey` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SMS configuration parameters'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `solunionCAP` --- - -DROP TABLE IF EXISTS `solunionCAP`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `solunionCAP` ( - `creditInsurance` int(11) NOT NULL, - `dateStart` date NOT NULL, - `dateEnd` date NOT NULL, - `dateLeaving` date DEFAULT NULL, - PRIMARY KEY (`creditInsurance`,`dateStart`), - KEY `solunionCAPdateLeavingIdx` (`dateLeaving`), - CONSTRAINT `solunionCAP` FOREIGN KEY (`creditInsurance`) REFERENCES `creditInsurance` (`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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_INSERT` - AFTER INSERT ON `solunionCAP` - FOR EACH ROW -BEGIN - UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client - JOIN creditInsurance ci ON ci.creditClassification = cc.id - SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_UPDATE` - AFTER UPDATE ON `solunionCAP` - FOR EACH ROW -BEGIN - IF NEW.dateLeaving IS NOT NULL THEN - UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client - JOIN creditInsurance ci ON ci.creditClassification = cc.id - SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; - ELSE - UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client - JOIN creditInsurance ci ON ci.creditClassification = cc.id - SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_BEFORE_DELETE` - BEFORE DELETE ON `solunionCAP` - FOR EACH ROW -BEGIN - UPDATE vn2008.Clientes c - JOIN creditClassification cc ON c.Id_Cliente = cc.client - JOIN creditInsurance ci ON ci.creditClassification = cc.id - SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `sorter` --- - -DROP TABLE IF EXISTS `sorter`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `sorter` ( - `id` int(11) NOT NULL DEFAULT '0', - `created` datetime NOT NULL, - `routeFk` int(10) unsigned NOT NULL, - `ticketFk` int(10) NOT NULL, - `isBox` int(11) DEFAULT '1', - `itemFk` int(11) DEFAULT NULL, - `width` decimal(10,2) DEFAULT '0.00', - `depth` decimal(10,2) DEFAULT '0.00', - `height` decimal(10,2) DEFAULT '0.00', - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', - `weight` decimal(5,2) NOT NULL DEFAULT '0.00', - `buildingOrder` int(5) NOT NULL DEFAULT '0', - `ETD` time NOT NULL DEFAULT '23:59:00', - `palletOrder` int(5) DEFAULT NULL, - `lungGrow` int(11) DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `specialPrice` --- - -DROP TABLE IF EXISTS `specialPrice`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `specialPrice` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL DEFAULT '0', - `itemFk` int(11) NOT NULL DEFAULT '0', - `value` double NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `Id_Cliente_2` (`clientFk`,`itemFk`), - KEY `Id_Article` (`itemFk`), - KEY `Id_Cliente` (`clientFk`), - CONSTRAINT `sp_article_id` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE, - CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, - CONSTRAINT `{01A99AF1-3D3F-4B15-AC0C-C7A834F319A3}` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `{EE4ADEF6-0AC6-401F-B7C4-D797972FC065}` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `specie_UN` (`name`) -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_INSERT` - BEFORE INSERT ON `specie` - FOR EACH ROW -BEGIN - SET NEW.name = LCASE(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 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_UPDATE` - BEFORE UPDATE ON `specie` - FOR EACH ROW -BEGIN - SET NEW.name = LCASE(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 */ ; - --- --- Table structure for table `specieGeoInvasive` --- - -DROP TABLE IF EXISTS `specieGeoInvasive`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `specieGeoInvasive` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `genusFk` int(11) NOT NULL, - `specieFk` int(11) NOT NULL, - `zoneGeofk` int(11) NOT NULL, - `isForbidden` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - KEY `specieGeoInvasive_FK` (`genusFk`), - KEY `specieGeoInvasive_FK_1` (`specieFk`), - KEY `specieGeoInvasive_FK_2` (`zoneGeofk`), - CONSTRAINT `specieGeoInvasive_FK` FOREIGN KEY (`genusFk`) REFERENCES `genus` (`id`) ON UPDATE CASCADE, - CONSTRAINT `specieGeoInvasive_FK_1` FOREIGN KEY (`specieFk`) REFERENCES `specie` (`id`) ON UPDATE CASCADE, - CONSTRAINT `specieGeoInvasive_FK_2` FOREIGN KEY (`zoneGeofk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Esta tabla recoge las prohibiciones de comerciar con especies invasoras de acuerdo con el Catálogo de Especies Exóticas Invasoras publicado por el Estado Español'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `starredModule` --- - -DROP TABLE IF EXISTS `starredModule`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `starredModule` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `moduleFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `position` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `starred_workerFk` (`workerFk`), - KEY `starred_moduleFk` (`moduleFk`), - CONSTRAINT `starred_moduleFk` FOREIGN KEY (`moduleFk`) REFERENCES `salix`.`module` (`code`) ON UPDATE CASCADE, - CONSTRAINT `starred_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `state` --- - -DROP TABLE IF EXISTS `state`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `state` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - `order` tinyint(3) unsigned DEFAULT NULL, - `alertLevel` int(11) NOT NULL DEFAULT '0', - `code` varchar(45) CHARACTER SET utf8 NOT NULL, - `sectorProdPriority` tinyint(3) DEFAULT NULL, - `nextStateFk` tinyint(4) NOT NULL COMMENT 'Estado al que tiene que cambiar el ticket despues de preparacion previa', - `isPreviousPreparable` tinyint(1) NOT NULL DEFAULT '0', - `isPicked` tinyint(1) NOT NULL DEFAULT '0', - `isPreparable` tinyint(1) NOT NULL DEFAULT '0', - `semaphore` int(11) NOT NULL DEFAULT '0', - `isPrintable` tinyint(4) NOT NULL DEFAULT '0', - `isOK` tinyint(4) NOT NULL DEFAULT '0', - `graphCategory` int(11) NOT NULL DEFAULT '0', - `isNotValidated` tinyint(1) DEFAULT '0' COMMENT 'Los tienen que ser validados por un comercial para prepararse', - `classColor` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `code_UNIQUE` (`code`), - KEY `state_id3` (`semaphore`), - KEY `alertLevel` (`alertLevel`), - CONSTRAINT `state_ibfk_1` FOREIGN KEY (`alertLevel`) REFERENCES `alertLevel` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `stockBuyed` --- - -DROP TABLE IF EXISTS `stockBuyed`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `stockBuyed` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `user` int(10) unsigned DEFAULT NULL, - `buyed` decimal(10,2) DEFAULT NULL, - `date` date DEFAULT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `reserved` decimal(10,2) DEFAULT NULL, - `requested` decimal(10,2) DEFAULT NULL, - `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `stockBuyed_user_idx` (`user`), - CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `stowaway` --- - -DROP TABLE IF EXISTS `stowaway`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `stowaway` ( - `id` int(11) NOT NULL COMMENT 'ticket pequeño', - `shipFk` int(11) NOT NULL COMMENT 'ticket grande', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tickets polizones y sus naves de embarque'; -/*!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` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `account` varchar(10) DEFAULT NULL, - `street` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `city` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `provinceFk` smallint(5) unsigned DEFAULT NULL, - `countryFk` mediumint(8) unsigned DEFAULT NULL, - `nif` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `isOfficial` tinyint(1) NOT NULL DEFAULT '1', - `isFarmer` tinyint(1) NOT NULL DEFAULT '0', - `retAccount` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `phone` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `Fax__` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `commission` float NOT NULL DEFAULT '0', - `nickname` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `payMethodFk` tinyint(3) unsigned NOT NULL, - `payDay` tinyint(4) unsigned DEFAULT NULL, - `payDemFk` tinyint(3) unsigned NOT NULL DEFAULT '7', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `isSerious` tinyint(1) unsigned NOT NULL DEFAULT '1', - `note` text CHARACTER SET utf8 COLLATE utf8_unicode_ci, - `postcodeFk` int(11) unsigned DEFAULT NULL, - `postCode` char(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, - `isActive` tinyint(4) DEFAULT '1', - `taxTypeSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipo de IVA SAGE', - `withholdingSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipos de retención SAGE', - `transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Ti po de transacción SAGE', - `isTrucker` tinyint(1) NOT NULL DEFAULT '0', - `workerFk` int(10) unsigned DEFAULT NULL COMMENT 'Responsible for approving invoices', - `supplierActivityFk` varchar(45) NOT NULL DEFAULT 'flowersPlants', - `healthRegister` varchar(45) DEFAULT NULL, - `isPayMethodChecked` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Se ha validado la forma de pago', - PRIMARY KEY (`id`), - UNIQUE KEY `cuenta` (`account`), - UNIQUE KEY `NIF` (`nif`), - KEY `pais_id` (`countryFk`), - KEY `pay_met_id` (`payMethodFk`), - KEY `province_id` (`provinceFk`), - KEY `pay_dem_id` (`payDemFk`), - KEY `codpos` (`postCode`), - KEY `supplier_taxTypeFk_idx` (`taxTypeSageFk`), - KEY `supplier_withholdingFk_idx` (`withholdingSageFk`), - KEY `supplier_transactionFk_idx` (`transactionTypeSageFk`), - KEY `suppplier_supplierActivityFk` (`supplierActivityFk`), - KEY `supplier_workerFk` (`workerFk`), - CONSTRAINT `Id_Pais` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, - CONSTRAINT `pay_dem_id` FOREIGN KEY (`payDemFk`) REFERENCES `payDem` (`id`) ON UPDATE CASCADE, - CONSTRAINT `pay_met_id` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, - CONSTRAINT `province_id` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, - CONSTRAINT `supplier_taxTypeFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE, - CONSTRAINT `supplier_transactionFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE, - CONSTRAINT `supplier_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE, - CONSTRAINT `supplier_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `suppplier_supplierActivityFk` FOREIGN KEY (`supplierActivityFk`) REFERENCES `supplierActivity` (`code`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_beforeUpdate` - BEFORE UPDATE ON `supplier` - FOR EACH ROW -BEGIN - DECLARE vHasChange BOOL DEFAULT FALSE; - DECLARE vPayMethodHasVerified BOOL; - - SELECT hasVerified INTO vPayMethodHasVerified - FROM payMethod - WHERE id = NEW.payMethodFk; - - SET vHasChange = (NEW.payDemFk <> OLD.payDemFk) OR (NEW.payDay <> OLD.payDay); - - IF vPayMethodHasVerified AND !vHasChange THEN - SET vHasChange = (NEW.payMethodFk <> OLD.payMethodFk); - END IF; - - IF vHasChange THEN - SET NEW.isPayMethodChecked = 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 */ ; - --- --- Table structure for table `supplierAccount` --- - -DROP TABLE IF EXISTS `supplierAccount`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `supplierAccount` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `supplierFk` int(11) NOT NULL, - `iban` varchar(30) CHARACTER SET utf8 DEFAULT NULL, - `office` varchar(4) CHARACTER SET utf8 DEFAULT NULL, - `DC` varchar(2) CHARACTER SET utf8 DEFAULT NULL, - `number` varchar(10) CHARACTER SET utf8 DEFAULT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta(comprobar)', - `bicSufix` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '', - `bankEntityFk` int(10) DEFAULT NULL, - `bankFk` int(11) DEFAULT NULL COMMENT 'obsoleta(comprobar)', - `beneficiary` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `fk_proveedores_proveedores_account_idx` (`supplierFk`), - KEY `fk_Proveedores_account_entity1_idx` (`bankEntityFk`), - KEY `fk_banco_prov_account_idx` (`bankFk`) -) ENGINE=InnoDBDEFAULT 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 = 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 ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER supplierAccount_afterUpdate - AFTER UPDATE ON supplierAccount - FOR EACH ROW -BEGIN - DECLARE vPayMethodHasVerified BOOL; - - SELECT pm.hasVerified INTO vPayMethodHasVerified - FROM vn.supplier s - JOIN vn.payMethod pm ON pm.id = s.payMethodFk - WHERE s.id = OLD.supplierFk; - - IF OLD.iban <> NEW.iban OR OLD.bankEntityFk <> NEW.bankEntityFk AND vPayMethodHasVerified THEN - UPDATE vn.supplier - SET isPayMethodChecked = FALSE - WHERE id = OLD.supplierFk; - 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 `supplierActivity` --- - -DROP TABLE IF EXISTS `supplierActivity`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `supplierActivity` ( - `code` varchar(45) CHARACTER SET utf8 NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `supplierAddress` --- - -DROP TABLE IF EXISTS `supplierAddress`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `supplierAddress` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `supplierFk` int(11) DEFAULT NULL, - `nickname` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, - `street` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `provinceFk` smallint(6) unsigned DEFAULT NULL, - `postalCode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `city` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `mobile` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `supplierAddress_province_fk` (`provinceFk`), - CONSTRAINT `supplierAddress_province_fk` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`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 `supplierContact` --- - -DROP TABLE IF EXISTS `supplierContact`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `supplierContact` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `supplierFk` int(11) DEFAULT NULL, - `phone` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL, - `mobile` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL, - `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `observation` text COLLATE utf8_unicode_ci, - `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `supplier_id` (`supplierFk`), - CONSTRAINT `supplier_id` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `supplierExpense` --- - -DROP TABLE IF EXISTS `supplierExpense`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `supplierExpense` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `supplierFk` int(11) NOT NULL, - `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '2', - `amount` decimal(10,2) NOT NULL DEFAULT '0.00', - `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `dmsFk` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', - `dueDated` date NOT NULL, - PRIMARY KEY (`id`), - KEY `empresa_id` (`companyFk`), - KEY `supplierExDated` (`dated`), - KEY `id_moneda` (`currencyFk`), - KEY `proveedor_pago` (`supplierFk`), - KEY `gestdoc_id` (`dmsFk`), - KEY `dueDatedIdx` (`dueDated`), - CONSTRAINT `gestdoc_fk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `pago_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `pago_moneda` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, - CONSTRAINT `proveedor_pago` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `supplierLog` --- - -DROP TABLE IF EXISTS `supplierLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `supplierLog` ( - `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 CHARACTER SET utf8, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, - `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `logSupplier_ibfk_1` (`originFk`), - KEY `supplierLog_ibfk_2` (`userFk`), - CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `supplierPackaging` --- - -DROP TABLE IF EXISTS `supplierPackaging`; -/*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `supplierPackaging` ( - `supplierFk` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `longName` tinyint NOT NULL, - `supplier` tinyint NOT NULL, - `entryFk` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `out` tinyint NOT NULL, - `in` tinyint NOT NULL, - `warehouse` tinyint NOT NULL, - `buyingValue` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `tablet` --- - -DROP TABLE IF EXISTS `tablet`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tablet` ( - `uuid` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `place` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `macwifi` varchar(45) COLLATE utf8_unicode_ci DEFAULT '0', - PRIMARY KEY (`uuid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `tabletDepartment` --- - -DROP TABLE IF EXISTS `tabletDepartment`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tabletDepartment` ( - `tabletFk` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `departmentFk` int(11) NOT NULL, - PRIMARY KEY (`tabletFk`,`departmentFk`), - KEY `departmentFk_idx` (`departmentFk`), - CONSTRAINT `departmentFk` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `tablet_uuid` FOREIGN KEY (`tabletFk`) REFERENCES `tablet` (`uuid`) 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 `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, - `code` varchar(45) CHARACTER SET utf8 DEFAULT NULL, - `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL, - `isFree` tinyint(1) NOT NULL DEFAULT '1', - `isQuantitatif` tinyint(4) NOT NULL DEFAULT '0', - `sourceTable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `unit` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `ediTypeFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `overwrite` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'nombre del campo de item a sobreescribir con el valor del tag, hay que añadir el código correspondiente en item_refreshTags', - PRIMARY KEY (`id`), - UNIQUE KEY `tagNameIdx` (`name`,`ediTypeFk`), - UNIQUE KEY `tagEdiTypeFkIdx` (`ediTypeFk`), - CONSTRAINT `fgnTag` FOREIGN KEY (`ediTypeFk`) REFERENCES `edi`.`type` (`type_id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_BEFORE_INSERT` - BEFORE INSERT ON `tag` - FOR EACH ROW -BEGIN - IF NEW.ediTypeFk IS NULL AND (SELECT COUNT(*) FROM tag WHERE `name` = NEW.`name`) THEN - CALL util.throw('name duplicated'); - 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 `tagAbbreviation` --- - -DROP TABLE IF EXISTS `tagAbbreviation`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tagAbbreviation` ( - `value` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `abbreviation` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`value`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!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 TABLE `tagL10n` ( - `id` tinyint NOT NULL, - `name` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `taxArea` --- - -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) 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 */; - --- --- Table structure for table `taxClass` --- - -DROP TABLE IF EXISTS `taxClass`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `taxClass` ( - `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, - `description` varchar(30) COLLATE utf8_unicode_ci NOT NULL, - `code` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'R', - PRIMARY KEY (`id`), - UNIQUE KEY `code_UNIQUE` (`code`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `taxClassCode` --- - -DROP TABLE IF EXISTS `taxClassCode`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `taxClassCode` ( - `taxClassFk` tinyint(3) unsigned NOT NULL, - `effectived` date NOT NULL, - `taxCodeFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`taxClassFk`,`effectived`,`taxCodeFk`), - KEY `iva_codigo_id` (`taxCodeFk`), - CONSTRAINT `taxClassCode_ibfk_1` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, - CONSTRAINT `taxClassCode_ibfk_2` FOREIGN KEY (`taxCodeFk`) REFERENCES `taxCode` (`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 `taxCode` --- - -DROP TABLE IF EXISTS `taxCode`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `taxCode` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `code` varchar(10) CHARACTER SET utf8 NOT NULL, - `taxTypeFk` tinyint(2) NOT NULL, - `rate` decimal(4,1) NOT NULL DEFAULT '0.0', - `equalizationTax` decimal(4,1) NOT NULL DEFAULT '0.0', - `type` char(1) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Solo rellenar si en el asiento ira en el DEBE', - `link` tinyint(4) unsigned 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 COMMENT 'Código de Transacción de SAGE', - `operationCode` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Código de operaciones de SAGE', - `taxCode` int(4) DEFAULT NULL COMMENT 'Código de IVA SAGE', - `isIntracommunity` tinyint(2) DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `taxCode_dated_IDX` (`dated`,`taxTypeFk`,`type`,`link`) USING BTREE, - KEY `iva_tipo_id` (`taxTypeFk`), - KEY `codigo` (`code`), - KEY `tipo_index` (`type`), - CONSTRAINT `taxCode_ibfk_1` FOREIGN KEY (`taxTypeFk`) REFERENCES `taxType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `taxType` --- - -DROP TABLE IF EXISTS `taxType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `taxType` ( - `id` tinyint(2) NOT NULL AUTO_INCREMENT, - `nickname` varchar(6) COLLATE utf8_unicode_ci NOT NULL, - `isAccrued` tinyint(4) NOT NULL DEFAULT '0', - `serial` char(1) COLLATE utf8_unicode_ci DEFAULT NULL, - `TIPOOPE` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT ' ' COMMENT 'respetar el nombre de la columna, se utiliza en contaplus', - `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `countryFk` mediumint(8) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `serie_id` (`serial`), - KEY `Id_Pais` (`countryFk`), - CONSTRAINT `taxType_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `temperature` --- - -DROP TABLE IF EXISTS `temperature`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `temperature` ( - `code` varchar(10) CHARACTER SET utf8 NOT NULL, - `description` text COLLATE utf8_unicode_ci, - `name` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `thermograph` --- - -DROP TABLE IF EXISTS `thermograph`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `thermograph` ( - `id` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `model` enum('TL30','SENSITECH','TREKVIEW1','TREKVIEW2','DISPOSABLE','TEMPMATE') 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 `ticket` --- - -DROP TABLE IF EXISTS `ticket`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticket` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `clientFk` int(11) NOT NULL DEFAULT '0', - `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', - `shipped` datetime NOT NULL, - `nickname` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `notes` longtext COLLATE utf8_unicode_ci, - `refFk` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `invoiceOutFk` int(10) unsigned DEFAULT NULL COMMENT 'eliminar', - `isBooked` tinyint(1) NOT NULL DEFAULT '0', - `addressFk` int(11) NOT NULL DEFAULT '0', - `workerFk` int(11) DEFAULT NULL, - `observations` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'eliminar', - `isSigned` tinyint(1) NOT NULL DEFAULT '0', - `isLabeled` tinyint(1) NOT NULL DEFAULT '0', - `isPrinted` tinyint(1) NOT NULL DEFAULT '0', - `packages` smallint(10) unsigned DEFAULT '0', - `location` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, - `hour` int(11) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `isBlocked` tinyint(1) NOT NULL DEFAULT '1', - `solution` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, - `routeFk` int(10) unsigned DEFAULT NULL, - `priority` tinyint(3) unsigned DEFAULT NULL, - `hasPriority` tinyint(1) unsigned NOT NULL DEFAULT '1', - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `agencyModeFk` int(11) DEFAULT NULL, - `landed` date DEFAULT NULL, - `isBoxed` tinyint(2) NOT NULL DEFAULT '0', - `isDeleted` tinyint(2) NOT NULL DEFAULT '0', - `zoneFk` int(11) DEFAULT NULL, - `collectionFk__` int(11) DEFAULT NULL, - `zonePrice` decimal(10,2) DEFAULT NULL, - `zoneBonus` decimal(10,2) DEFAULT NULL, - `totalWithVat` decimal(10,2) DEFAULT NULL COMMENT 'cache calculada del total con iva', - `totalWithoutVat` decimal(10,2) DEFAULT NULL COMMENT 'cache calculada del total sin iva', - PRIMARY KEY (`id`), - KEY `Id_Cliente` (`clientFk`), - KEY `Id_Consigna` (`addressFk`), - KEY `Id_Trabajador` (`workerFk`), - KEY `warehouse_id` (`warehouseFk`), - KEY `empresa_id` (`companyFk`), - KEY `Id_Agencia` (`agencyModeFk`), - KEY `Factura` (`refFk`), - KEY `Id_Ruta` (`routeFk`), - KEY `warehouse_date` (`warehouseFk`,`shipped`), - KEY `Fecha` (`shipped`,`clientFk`), - KEY `tickets_zone_fk_idx` (`zoneFk`), - KEY `tickets_fk11_idx` (`collectionFk__`), - CONSTRAINT `ticket_FK` FOREIGN KEY (`refFk`) REFERENCES `invoiceOut` (`ref`) ON UPDATE CASCADE, - CONSTRAINT `ticket_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ticket_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ticket_ibfk_5` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ticket_ibfk_6` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ticket_ibfk_8` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`), - CONSTRAINT `ticket_ibfk_9` FOREIGN KEY (`routeFk`) REFERENCES `route` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `tickets_fk11` FOREIGN KEY (`collectionFk__`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `tickets_zone_fk` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterInsert` - AFTER INSERT ON `ticket` - FOR EACH ROW -BEGIN - - DECLARE vClientType VARCHAR(255); - DECLARE vStateCode VARCHAR(255); - DECLARE vTransferorFirstShipped DATE; - - -- Borrar cuando se cambie el insert ticket en la APP móvil - - SELECT typeFk INTO vClientType - FROM vn.`client` WHERE id = NEW.clientFk; - - IF vClientType = 'loses' THEN - SET vStateCode = 'DELIVERED'; - ELSE - SET vStateCode = 'FREE'; - END IF; - - INSERT INTO vncontrol.inter(Id_Ticket, state_id, Id_Trabajador) - SELECT NEW.id, id, account.myUser_getId() - FROM state - WHERE `code` = vStateCode COLLATE utf8_general_ci; - - IF YEAR(NEW.shipped) > 2000 THEN - - SELECT cnb.firstShipped INTO vTransferorFirstShipped - FROM bs.clientNewBorn cnb - JOIN `client` c ON c.transferorFk = cnb.clientFk - WHERE c.id = NEW.clientFk; - - INSERT INTO bs.clientNewBorn(clientFk, firstShipped, lastShipped) - VALUES(NEW.clientFk, IFNULL(vTransferorFirstShipped, CURDATE()), CURDATE()) - ON DUPLICATE KEY UPDATE lastShipped = 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 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeUpdate` - BEFORE UPDATE ON `ticket` - FOR EACH ROW -BEGIN - DECLARE vNewTime TIME; - - IF !(NEW.routeFk <=> OLD.routeFk) THEN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id - FROM vn.route r - WHERE r.isOk = FALSE - AND r.id IN (OLD.routeFk,NEW.routeFk) - AND r.created >= CURDATE() - GROUP BY r.id; - call util.debugAdd(NEW.id,CONCAT(OLD.routeFk,' ',NEW.routeFk)); - END IF; - - IF !(DATE(NEW.shipped) <=> DATE(OLD.shipped)) THEN - IF YEAR(NEW.shipped) < 2000 THEN - SIGNAL SQLSTATE '46000' - SET MESSAGE_TEXT = 'Year cannot be lesser than 2000'; - END IF; - - IF YEAR(NEW.shipped) = 2000 THEN - SET NEW.isDeleted = TRUE; - END IF; - - END IF; - - IF !(NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id - FROM vn.ticket t - JOIN vn.route r ON r.id = t.routeFk - WHERE r.isOk = FALSE - AND t.id = NEW.id - AND r.created >= CURDATE() - GROUP BY r.id; - SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); - SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); - SET NEW.routeFk = NULL; - SET NEW.zoneFk = NULL; - END IF; - - IF NEW.routeFk AND NEW.isDeleted THEN - CALL util.throw ('This ticket is deleted'); - END IF; - - IF !(NEW.routeFk <=> OLD.routeFk) AND NEW.routeFk IS NOT NULL THEN - SELECT MAX(TIME(shipped)) INTO vNewTime - FROM vn.ticket - WHERE routeFk = NEW.routeFk - HAVING MAX(TIME(shipped)) > TIME(NEW.shipped); - - IF vNewTime THEN - SET NEW.shipped = TIMESTAMP(DATE(NEW.shipped), vNewTime); - INSERT INTO vn.ticketLog - SET originFk = NEW.id, - userFk = account.myUser_getId(), - `action` = 'update', - description = CONCAT('Cambia la hora por cambio de ruta de ', - TIME(OLD.shipped), - ' a ', - TIME(NEW.shipped)); - END IF; - INSERT IGNORE INTO zoneAgencyMode (agencyModeFk,zoneFk) - SELECT r.agencyModeFk, NEW.zoneFk FROM route r - WHERE r.id = NEW.routeFk; - - CALL vn.routeUpdateM3(NEW.routeFk); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterUpdate` - AFTER UPDATE ON `ticket` - FOR EACH ROW -BEGIN - - IF !(NEW.id <=> OLD.id) - OR !(NEW.warehouseFk <=> OLD.warehouseFk) - OR !(NEW.shipped <=> OLD.shipped) THEN - CALL stock.log_add('ticket', NEW.id, OLD.id); - END IF; - - IF !(NEW.clientFk <=> OLD.clientFk) - OR !(NEW.addressFk <=> OLD.addressFk) - OR !(NEW.companyFk <=> OLD.companyFk) THEN - CALL ticket_requestRecalc(NEW.id); - END IF; - - IF NEW.clientFk = 2067 AND !(NEW.clientFk <=> OLD.clientFk) THEN - -- Fallo que se insertan no se sabe como tickets en este cliente - CALL mail_insert( - 'jgallego@verdnatura.es', - 'jgallego@verdnatura.es', - 'Modificado ticket al cliente 2067', - CONCAT(account.myUserGetName(), ' ha modificado el ticket ',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 */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeDelete` - BEFORE DELETE ON `ticket` - FOR EACH ROW -BEGIN - INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) - SELECT r.id - FROM vn.route r - WHERE r.isOk = FALSE - AND r.id = OLD.routeFk - AND r.created >= CURDATE() - GROUP BY r.id; - - DELETE FROM sale WHERE ticketFk = OLD.id; - - DELETE FROM ticketDms WHERE ticketFk = 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 `ticketCollection` --- - -DROP TABLE IF EXISTS `ticketCollection`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketCollection` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ticketFk` int(11) NOT NULL, - `collectionFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `level` int(11) DEFAULT NULL, - `wagon` int(11) NOT NULL DEFAULT '0', - `smartTagFk` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, - `usedShelves` int(11) DEFAULT NULL COMMENT 'número de bandejas que ocupa un ticket en el carro', - `itemCount` int(11) DEFAULT NULL COMMENT 'número de productos distintos en el pedido', - `liters` int(11) DEFAULT NULL COMMENT 'volumen del pedido en litros', - PRIMARY KEY (`id`), - UNIQUE KEY `ticketCollection_UN` (`ticketFk`,`collectionFk`), - KEY `ticketCollection_fk1_idx` (`collectionFk`), - KEY `ticketCollection_fk2_idx` (`ticketFk`), - KEY `ticketCollection_smartTagFk_IDX` (`smartTagFk`) USING BTREE, - KEY `ticketCollection_created_IDX` (`created`) USING BTREE, - CONSTRAINT `ticketCollection_fk1` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketCollection_fk2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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`@`localhost`*/ /*!50003 TRIGGER ticketCollection_afterDelete -AFTER DELETE -ON ticketCollection FOR EACH ROW -BEGIN - - DECLARE vSalesRemaining INT; - - SELECT count(*) INTO vSalesRemaining - FROM vn.ticketCollection tc - JOIN sale s ON s.ticketFk = tc.ticketFk - WHERE collectionFk = OLD.collectionFk - AND tc.id != OLD.id; - - IF NOT vSalesRemaining THEN - - DELETE FROM vn.collection WHERE id = OLD.collectionFk; - - ELSE - - UPDATE vn.collection - SET saleTotalCount = vSalesRemaining - WHERE id = OLD.collectionFk; - - 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 `ticketConfig` --- - -DROP TABLE IF EXISTS `ticketConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `scopeDays` tinyint(3) DEFAULT NULL, - `pickingDelay` int(11) NOT NULL DEFAULT '10' COMMENT 'minutos de cortesia desde que se crea un ticket hasta que se puede preparar', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ticketDms` --- - -DROP TABLE IF EXISTS `ticketDms`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketDms` ( - `ticketFk` int(11) NOT NULL, - `dmsFk` int(11) NOT NULL, - PRIMARY KEY (`ticketFk`,`dmsFk`), - KEY `gestdoc_id` (`dmsFk`), - CONSTRAINT `ticketDms_dmsFk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketDms_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeDelete` - BEFORE DELETE ON `ticketDms` - FOR EACH ROW -BEGIN - UPDATE dms - SET dmsTypeFk = (SELECT id - FROM dmsType - WHERE `code` = 'trash' - ) - WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) - FROM ticketDms - WHERE dmsFk = OLD.dmsFk - ) ; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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 `ticketDocumentation` --- - -DROP TABLE IF EXISTS `ticketDocumentation`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketDocumentation` ( - `ticketFk` int(11) NOT NULL, - PRIMARY KEY (`ticketFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Marca si se ha revisado el ticket para aportar la documentación CRM/DUA (relativa al trasporte internacional de mercancias)'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ticketDown` --- - -DROP TABLE IF EXISTS `ticketDown`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketDown` ( - `ticketFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `selected` int(11) NOT NULL DEFAULT '0', - `collectionFk` int(11) NOT NULL, - `id` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`), - KEY `created_idx` (`created`), - KEY `selected_idx` (`selected`), - KEY `ticketDown_FK` (`collectionFk`), - CONSTRAINT `ticketDown_FK` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketDown_fk1` FOREIGN KEY (`selected`) REFERENCES `ticketDown_SelectionType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Cola de impresion para los tickets que se van a solicitar al altillo'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ticketDown_SelectionType` --- - -DROP TABLE IF EXISTS `ticketDown_SelectionType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketDown_SelectionType` ( - `id` int(11) NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `description_UNIQUE` (`description`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `ticketLabel_Source` --- - -DROP TABLE IF EXISTS `ticketLabel_Source`; -/*!50001 DROP VIEW IF EXISTS `ticketLabel_Source`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketLabel_Source` ( - `level` tinyint NOT NULL, - `Id_Ticket` tinyint NOT NULL, - `Agencia` tinyint NOT NULL, - `Id_Cliente` tinyint NOT NULL, - `Notas` tinyint NOT NULL, - `Sacador` tinyint NOT NULL, - `ncarro` tinyint NOT NULL, - `horaagencia` tinyint NOT NULL, - `fecha` tinyint NOT NULL, - `urgente` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `ticketLastState` --- - -DROP TABLE IF EXISTS `ticketLastState`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketLastState` ( - `ticketFk` int(11) NOT NULL DEFAULT '0', - `ticketTrackingFk` int(11) NOT NULL, - `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`ticketFk`), - KEY `double_foreign` (`ticketFk`,`ticketTrackingFk`), - CONSTRAINT `Id_Ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `double_foreign` FOREIGN KEY (`ticketFk`, `ticketTrackingFk`) REFERENCES `vncontrol`.`inter` (`Id_Ticket`, `inter_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 `ticketLastUpdated` --- - -DROP TABLE IF EXISTS `ticketLastUpdated`; -/*!50001 DROP VIEW IF EXISTS `ticketLastUpdated`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketLastUpdated` ( - `ticketFk` tinyint NOT NULL, - `lastUpdated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `ticketLastUpdatedList` --- - -DROP TABLE IF EXISTS `ticketLastUpdatedList`; -/*!50001 DROP VIEW IF EXISTS `ticketLastUpdatedList`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketLastUpdatedList` ( - `ticketFk` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `ticketLocation` --- - -DROP TABLE IF EXISTS `ticketLocation`; -/*!50001 DROP VIEW IF EXISTS `ticketLocation`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketLocation` ( - `ticketFk` tinyint NOT NULL, - `longitude` tinyint NOT NULL, - `latitude` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- 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 DEFAULT NULL, - `action` set('insert','update','delete','select') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, - `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `logTicketoriginFk` (`originFk`), - KEY `logTicketuserFk` (`userFk`), - CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `ticketMRW` --- - -DROP TABLE IF EXISTS `ticketMRW`; -/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketMRW` ( - `id_Agencia` tinyint NOT NULL, - `empresa_id` tinyint NOT NULL, - `Consignatario` tinyint NOT NULL, - `DOMICILIO` tinyint NOT NULL, - `POBLACION` tinyint NOT NULL, - `CODPOSTAL` tinyint NOT NULL, - `telefono` tinyint NOT NULL, - `movil` tinyint NOT NULL, - `IF` tinyint NOT NULL, - `Id_Ticket` tinyint NOT NULL, - `warehouse_id` tinyint NOT NULL, - `Id_Consigna` tinyint NOT NULL, - `CodigoPais` tinyint NOT NULL, - `Fecha` tinyint NOT NULL, - `province_id` tinyint NOT NULL, - `landing` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `ticketNotInvoiced` --- - -DROP TABLE IF EXISTS `ticketNotInvoiced`; -/*!50001 DROP VIEW IF EXISTS `ticketNotInvoiced`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketNotInvoiced` ( - `companyFk` tinyint NOT NULL, - `companyCode` tinyint NOT NULL, - `clientFk` tinyint NOT NULL, - `clientName` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `value` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `ticketObservation` --- - -DROP TABLE IF EXISTS `ticketObservation`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketObservation` ( - `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, - `ticketFk` int(11) NOT NULL, - `observationTypeFk` tinyint(3) unsigned NOT NULL, - `description` text COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `Id_Ticket` (`ticketFk`,`observationTypeFk`), - KEY `observation_type_id` (`observationTypeFk`), - CONSTRAINT `ticketObservation_ibfk_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketObservation_ibfk_2` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 `ticketPackage` --- - -DROP TABLE IF EXISTS `ticketPackage`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketPackage` ( - `ticket` int(11) NOT NULL, - `counter` int(10) unsigned NOT NULL DEFAULT '0', - PRIMARY KEY (`ticket`), - CONSTRAINT `ticketPackage_ticketFk` FOREIGN KEY (`ticket`) REFERENCES `ticket` (`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 `ticketPackaging` --- - -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 AUTO_INCREMENT, - `ticketFk` int(11) NOT NULL, - `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `quantity` int(10) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `pvp` double DEFAULT NULL, - `workerFk` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `ticketPackaging_fk1_idx` (`ticketFk`), - KEY `ticketPackaging_fk2_idx` (`packagingFk`), - KEY `ticketPackaging_fk3_idx` (`workerFk`), - CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketPackaging_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ticketPackaging_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_BEFORE_INSERT` - BEFORE INSERT ON `ticketPackaging` - FOR EACH ROW -BEGIN - - SET NEW.workerFk = account.myUser_getId(); - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- 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, - `isForgetable` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`clientFk`,`packagingFk`), - KEY `ticketPackagingStartingStock_fk2_idx` (`packagingFk`), - KEY `ticketPackagingStartingStock_fk3_idx` (`itemFk`), - CONSTRAINT `ticketPackagingStartingStock_fk1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketPackagingStartingStock_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketPackagingStartingStock_fk3` FOREIGN KEY (`itemFk`) REFERENCES `item` (`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 `ticketPackingList` --- - -DROP TABLE IF EXISTS `ticketPackingList`; -/*!50001 DROP VIEW IF EXISTS `ticketPackingList`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketPackingList` ( - `nickname` tinyint NOT NULL, - `ticketFk` tinyint NOT NULL, - `agencyMode` tinyint NOT NULL, - `flag` tinyint NOT NULL, - `province` tinyint NOT NULL, - `itemFk` tinyint NOT NULL, - `concept` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `litros` tinyint NOT NULL, - `observaciones` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `ticketParking` --- - -DROP TABLE IF EXISTS `ticketParking`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketParking` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ticketFk` int(11) NOT NULL, - `parkingFk` int(11) NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `workerFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `ticketParking_idx1` (`ticketFk`,`parkingFk`), - UNIQUE KEY `ticketFk_UNIQUE` (`ticketFk`), - KEY `ticketParking_fk1_idx` (`parkingFk`), - CONSTRAINT `ticketParking_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketParking_fk2` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_BEFORE_INSERT` - BEFORE INSERT ON `ticketParking` - FOR EACH ROW -BEGIN - - SET NEW.workerFk = vn.getUser(); - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Temporary table structure for view `ticketPreviousPreparingList` --- - -DROP TABLE IF EXISTS `ticketPreviousPreparingList`; -/*!50001 DROP VIEW IF EXISTS `ticketPreviousPreparingList`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `ticketPreviousPreparingList` ( - `ticketFk` tinyint NOT NULL, - `code` tinyint NOT NULL, - `saleLines` tinyint NOT NULL, - `alreadyMadeSaleLines` tinyint NOT NULL, - `madeRate` tinyint NOT NULL, - `created` tinyint NOT NULL, - `parking` tinyint NOT NULL, - `sectorFk` tinyint NOT NULL, - `alertCode` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `ticketRecalc` --- - -DROP TABLE IF EXISTS `ticketRecalc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketRecalc` ( - `ticketFk` int(11) NOT NULL, - PRIMARY KEY (`ticketFk`), - CONSTRAINT `ticketRecalc_ibfk_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue of changed tickets to recalc its total'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `ticketRequest` --- - -DROP TABLE IF EXISTS `ticketRequest`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketRequest` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `ordered` datetime DEFAULT NULL, - `shipped` datetime DEFAULT NULL, - `salesPersonCode` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `buyerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'NOE', - `quantity` int(11) DEFAULT NULL, - `price` double DEFAULT NULL, - `price__` double DEFAULT NULL, - `itemFk` double DEFAULT NULL, - `clientFk` int(11) DEFAULT NULL, - `response` longtext COLLATE utf8_unicode_ci, - `ok__` tinyint(1) NOT NULL DEFAULT '0', - `total` int(11) DEFAULT NULL, - `buyed` datetime DEFAULT NULL, - `ko__` tinyint(1) NOT NULL DEFAULT '0', - `saleFk` int(11) DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `isOk` tinyint(1) DEFAULT NULL, - `requesterFk` int(10) unsigned DEFAULT NULL, - `attenderFk` int(10) unsigned DEFAULT NULL, - `ticketFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `Id_Movimiento_UNIQUE` (`saleFk`), - KEY `Id_ARTICLE` (`itemFk`), - KEY `Id_CLIENTE` (`clientFk`), - KEY `Id_Comprador` (`buyerCode`), - KEY `Id_Movimiento` (`saleFk`), - KEY `Id_Vendedor` (`salesPersonCode`), - KEY `fgnRequester_idx` (`requesterFk`), - KEY `fgnAtender_idx` (`attenderFk`), - KEY `fgnTicket_idx` (`ticketFk`), - CONSTRAINT `fgbMovimiento` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `fgnAtender` FOREIGN KEY (`attenderFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fgnRequester` FOREIGN KEY (`requesterFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, - CONSTRAINT `fgnTicket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_beforeInsert` - BEFORE INSERT ON `ticketRequest` - FOR EACH ROW -BEGIN - IF NEW.ticketFk IS NULL THEN - SET NEW.ticketFk = (SELECT s.ticketFk FROM sale s WHERE s.id = NEW.saleFk); - END IF; - - IF NEW.requesterFk IS NULL THEN - SET NEW.requesterFk = (SELECT w.id FROM worker w WHERE w.code = NEW.salesPersonCode); - END IF; - - IF NEW.attenderFk IS NULL THEN - SET NEW.attenderFk = (SELECT w.id FROM worker w WHERE w.code = NEW.buyerCode); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_beforeUpdate` - BEFORE UPDATE ON `ticketRequest` - FOR EACH ROW -BEGIN - IF NEW.saleFk <> OLD.saleFk THEN - SET NEW.ticketFk = (SELECT s.ticketFk FROM sale s WHERE s.id = NEW.saleFk); - END IF; - - IF NEW.salesPersonCode <> OLD.salesPersonCode THEN - SET NEW.requesterFk = (SELECT w.id FROM worker w WHERE w.code = NEW.salesPersonCode); - END IF; - - IF NEW.buyerCode <> OLD.buyerCode THEN - SET NEW.attenderFk = (SELECT w.id FROM worker w WHERE w.code = NEW.buyerCode); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketService` --- - -DROP TABLE IF EXISTS `ticketService`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketService` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `quantity` int(11) NOT NULL DEFAULT '0', - `price` decimal(10,2) NOT NULL DEFAULT '0.00', - `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '2', - `ticketFk` int(11) NOT NULL, - `ticketServiceTypeFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `ticketServiceIvaGroup_idx` (`taxClassFk`), - KEY `fgn_ticketFk_idx` (`ticketFk`), - KEY `ticketService_ticketServiceType_idx` (`ticketServiceTypeFk`), - CONSTRAINT `fgn_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `ticketServiceIvaGroup` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, - CONSTRAINT `ticketService_ticketServiceType` FOREIGN KEY (`ticketServiceTypeFk`) REFERENCES `ticketServiceType` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servicios asociadas a un ticket'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ai` - AFTER INSERT ON `ticketService` - FOR EACH ROW -BEGIN - - CALL ticket_requestRecalc(NEW.ticketFk); - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_au` - AFTER UPDATE ON `ticketService` - FOR EACH ROW -BEGIN - IF !(NEW.price <=> OLD.price) - OR !(NEW.ticketFk <=> OLD.ticketFk) - OR !(NEW.quantity <=> OLD.quantity) THEN - CALL ticket_requestRecalc(NEW.ticketFk); - CALL ticket_requestRecalc(OLD.ticketFk); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ad` - AFTER DELETE ON `ticketService` - FOR EACH ROW -BEGIN - - CALL ticket_requestRecalc(OLD.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 */ ; - --- --- Table structure for table `ticketServiceType` --- - -DROP TABLE IF EXISTS `ticketServiceType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketServiceType` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, - `expenceFk` varchar(10) NOT NULL DEFAULT '7050000000', - PRIMARY KEY (`id`), - KEY `ticketServiceType_expenceFk` (`expenceFk`), - CONSTRAINT `ticketServiceType_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COMMENT='Lista de los posibles servicios a elegir'; -/*!40101 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` ( - `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, - `isPreviousPreparable` tinyint NOT NULL, - `isPicked` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- 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 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, - `updated` tinyint NOT NULL, - `isPicked` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- 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 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; - --- --- Table structure for table `ticketTrolley` --- - -DROP TABLE IF EXISTS `ticketTrolley`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketTrolley` ( - `ticket` int(11) NOT NULL, - `labelCount` int(11) NOT NULL DEFAULT '0', - PRIMARY KEY (`ticket`), - CONSTRAINT `fk_ticketTrolley_vs_ticket` FOREIGN KEY (`ticket`) REFERENCES `ticket` (`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 `ticketUpdateAction` --- - -DROP TABLE IF EXISTS `ticketUpdateAction`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketUpdateAction` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT 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 */; - --- --- Table structure for table `ticketWeekly` --- - -DROP TABLE IF EXISTS `ticketWeekly`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `ticketWeekly` ( - `ticketFk` int(11) NOT NULL AUTO_INCREMENT, - `weekDay` tinyint(1) NOT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6\nShipped, dia de preparacion del pedido', - `agencyModeFk` int(11) DEFAULT NULL, - PRIMARY KEY (`ticketFk`), - KEY `agencyModeFk_idx` (`agencyModeFk`), - CONSTRAINT `Id_Ticket_fk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `agencyModeFk` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `till` --- - -DROP TABLE IF EXISTS `till`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `till` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `isAccountable` tinyint(1) NOT NULL DEFAULT '0', - `serie` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, - `number` int(11) DEFAULT NULL, - `concept` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `in` decimal(10,2) DEFAULT NULL, - `out` decimal(10,2) DEFAULT NULL, - `bankFk` int(11) DEFAULT '1', - `workerFk` int(10) unsigned DEFAULT NULL, - `companyFk` smallint(5) unsigned DEFAULT '442' COMMENT 'kakear', - `isLinked` tinyint(4) DEFAULT '0', - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `isOk` tinyint(4) NOT NULL DEFAULT '0', - `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'to kak\\n', - `isConciliate` tinyint(4) NOT NULL DEFAULT '0', - `supplierAccountFk` mediumint(8) unsigned NOT NULL, - `calculatedCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - `InForeignValue` decimal(10,2) DEFAULT NULL, - `OutForeignValue` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `id_calculated_UNIQUE` (`calculatedCode`), - KEY `CajasCajafecha` (`dated`), - KEY `Id_Banco` (`bankFk`), - KEY `Id_Trabajador` (`workerFk`), - KEY `empresa_id` (`companyFk`), - KEY `warehouse_id` (`warehouseFk`), - KEY `fk_Cajas_Proveedores_account1_idx` (`supplierAccountFk`), - CONSTRAINT `till_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, - CONSTRAINT `till_ibfk_3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`till_beforeInsert` - BEFORE INSERT ON `till` - FOR EACH ROW -BEGIN - IF IFNULL(NEW.concept,"") = "" THEN - CALL util.throw ('Error. El concepto esta vacío'); - 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 `tillConfig` --- - -DROP TABLE IF EXISTS `tillConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `tillConfig` ( - `id` int(11) NOT NULL, - `openingBalance` decimal(10,2) NOT NULL, - `updated` timestamp NOT NULL 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 `time` --- - -DROP TABLE IF EXISTS `time`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `time` ( - `dated` date NOT NULL, - `period` int(6) NOT NULL, - `month` int(2) NOT NULL, - `year` int(4) NOT NULL, - `day` int(2) NOT NULL, - `week` int(2) NOT NULL, - `yearMonth` int(6) NOT NULL, - `salesYear` int(4) NOT NULL COMMENT 'año para los calculos de las comisiones ventas', - PRIMARY KEY (`dated`), - 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 `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 */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_AFTER_UPDATE` - AFTER UPDATE ON `time` - FOR EACH ROW -BEGIN - /*INSERT INTO vn.mail SET - `sender` = 'jgallego@verdnatura.es', - `replyTo` = 'jgallego@verdnatura.es', - `subject` = 'tabla time modificada', - `body` = CONCAT(account.myUserGetName(), ' ha modificado la tabla time ', - NEW.`dated`);*/ -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- 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 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, - `yearMonth` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- 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 AUTO_INCREMENT, - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - `provinceFk` smallint(6) unsigned NOT NULL, - `geoFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `name_idx` (`name`), - KEY `townProvinceFk` (`provinceFk`), - CONSTRAINT `townProvinceFk` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_beforeInsert` - BEFORE INSERT ON `town` - FOR EACH ROW -BEGIN - SET NEW.geoFk = zoneGeo_new('town', NEW.`name`, - (SELECT geoFk FROM province WHERE id = NEW.provinceFk)); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_beforeUpdate` - BEFORE UPDATE ON `town` - FOR EACH ROW -BEGIN - -- IF !(OLD.geoFk <=> NEW.geoFk) THEN - -- CALL zoneGeo_throwNotEditable; - -- END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_afterUpdate` - AFTER UPDATE ON `town` - FOR EACH ROW -BEGIN - IF !(OLD.provinceFk <=> NEW.provinceFk) THEN - CALL zoneGeo_setParent(NEW.geoFk, - (SELECT geoFk FROM province WHERE id = NEW.provinceFk)); - END IF; - - IF !(OLD.`name` <=> NEW.`name`) THEN - UPDATE zoneGeo SET `name` = NEW.`name` - WHERE id = NEW.geoFk; - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_afterDelete` - AFTER DELETE ON `town` - FOR EACH ROW -BEGIN - CALL zoneGeo_delete(OLD.geoFk); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Temporary table structure for view `tr2` --- - -DROP TABLE IF EXISTS `tr2`; -/*!50001 DROP VIEW IF EXISTS `tr2`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `tr2` ( - `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, - `kg` tinyint NOT NULL, - `cargoSupplierFk` tinyint NOT NULL, - `totalEntries` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `traceabilityBuy` --- - -DROP TABLE IF EXISTS `traceabilityBuy`; -/*!50001 DROP VIEW IF EXISTS `traceabilityBuy`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `traceabilityBuy` ( - `buyFk` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `landed` tinyint NOT NULL, - `warehouseName` tinyint NOT NULL, - `entryFk` tinyint NOT NULL, - `supplierName` tinyint NOT NULL, - `itemFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `traceabilitySale` --- - -DROP TABLE IF EXISTS `traceabilitySale`; -/*!50001 DROP VIEW IF EXISTS `traceabilitySale`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `traceabilitySale` ( - `ticketFk` tinyint NOT NULL, - `buyFk` tinyint NOT NULL, - `shipped` tinyint NOT NULL, - `nickname` tinyint NOT NULL, - `quantity` tinyint NOT NULL, - `worker` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `train` --- - -DROP TABLE IF EXISTS `train`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `train` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la configuración de los carros que se utilizan para sacar pedidos'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `trainingCenter` --- - -DROP TABLE IF EXISTS `trainingCenter`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `trainingCenter` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `trainingCourse` --- - -DROP TABLE IF EXISTS `trainingCourse`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `trainingCourse` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `trainingCourseTypeFk` int(11) NOT NULL, - `centerFk` int(11) DEFAULT NULL, - `started` datetime NOT NULL, - `ended` datetime NOT NULL, - `invoice` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `amount` double DEFAULT NULL, - `remark` longtext COLLATE utf8_unicode_ci, - `hasDiscount` tinyint(1) NOT NULL DEFAULT '0', - `hasDiploma` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `frgnWorker_idx` (`workerFk`), - KEY `frgnCenter_idx` (`centerFk`), - KEY `frgnTrainingCourseType_idx` (`trainingCourseTypeFk`), - CONSTRAINT `frgnCenter` FOREIGN KEY (`centerFk`) REFERENCES `trainingCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `frgnTrainingCourseType` FOREIGN KEY (`trainingCourseTypeFk`) REFERENCES `trainingCourseType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `frgnWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `trainingCourseType` --- - -DROP TABLE IF EXISTS `trainingCourseType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `trainingCourseType` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `travel` --- - -DROP TABLE IF EXISTS `travel`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `travel` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `shipped` date DEFAULT NULL, - `shipmentHour` time DEFAULT NULL, - `landed` date NOT NULL, - `landingHour` time DEFAULT NULL, - `warehouseInFk` smallint(6) unsigned DEFAULT NULL, - `warehouseOutFk` smallint(6) unsigned DEFAULT NULL, - `agencyFk` int(11) DEFAULT NULL, - `ref` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, - `isDelivered` tinyint(1) NOT NULL DEFAULT '0', - `isReceived` 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, - `totalEntries` tinyint(4) unsigned DEFAULT '0', - `appointment` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `shipment_2` (`shipped`,`landed`,`warehouseInFk`,`warehouseOutFk`,`agencyFk`,`ref`), - KEY `agency_id` (`agencyFk`), - KEY `shipment` (`shipped`), - KEY `landing` (`landed`), - KEY `warehouse_landing` (`warehouseInFk`,`landed`), - KEY `warehouse_out_shipment` (`warehouseOutFk`,`shipped`), - KEY `travel_ibfk_4_idx` (`cargoSupplierFk`), - CONSTRAINT `travel_ibfk_1` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_beforeInsert` - BEFORE INSERT ON `travel` - FOR EACH ROW -BEGIN - CALL travel_checkDates(NEW.shipped, NEW.landed); -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_beforeUpdate` - BEFORE UPDATE ON `travel` - FOR EACH ROW -BEGIN - IF !(NEW.landed <=> OLD.landed) - OR !(NEW.shipped <=> OLD.shipped) THEN - CALL travel_checkDates(NEW.shipped, NEW.landed); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_afterUpdate` - AFTER UPDATE ON `travel` - FOR EACH ROW -BEGIN - CALL stock.log_add('travel', NEW.id, OLD.id); - - IF !(NEW.shipped <=> OLD.shipped) THEN - UPDATE entry - SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) - WHERE travelFk = NEW.id; - END IF; -/* - IF !(ABS(NEW.isDelivered) <=> ABS(OLD.isDelivered)) - THEN - INSERT INTO vn2008.travel_dits SET - idaccion_dits = 89, - Id_Trabajador = account.myUser_getId(), - Id_Ticket = NEW.id, - value_old = OLD.isDelivered, - value_new = NEW.isDelivered; - 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 `travelClonedWeekly` --- - -DROP TABLE IF EXISTS `travelClonedWeekly`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `travelClonedWeekly` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `weekStart` tinyint(3) unsigned NOT NULL, - `weekEnd` tinyint(3) unsigned NOT NULL, - `warehouseOutFk` smallint(6) unsigned NOT NULL, - `warehouseInFk` smallint(6) unsigned NOT NULL, - `agencyModeFk` int(11) NOT NULL, - `weekDay` tinyint(3) unsigned NOT NULL, - `duration` tinyint(3) unsigned NOT NULL, - `ref` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `supplierFk` int(11) DEFAULT NULL, - `kg` decimal(10,0) unsigned DEFAULT NULL, - `travelFk` int(11) unsigned DEFAULT NULL COMMENT 'Travel origen para clonar ademas sus entradas', - PRIMARY KEY (`id`), - KEY `travelClonedWeekly_FK` (`warehouseOutFk`), - KEY `travelClonedWeekly_FK_1` (`warehouseInFk`), - KEY `travelClonedWeekly_FK_2` (`agencyModeFk`), - KEY `travelClonedWeekly_FK_3` (`supplierFk`), - KEY `travelClonedWeekly_FK_4` (`travelFk`), - CONSTRAINT `travelClonedWeekly_FK` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travelClonedWeekly_FK_1` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travelClonedWeekly_FK_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travelClonedWeekly_FK_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `travelClonedWeekly_FK_4` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `travelLog` --- - -DROP TABLE IF EXISTS `travelLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `travelLog` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `originFk` int(10) unsigned NOT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, - `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), - KEY `userFk` (`userFk`), - CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `travelObservation` --- - -DROP TABLE IF EXISTS `travelObservation`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `travelObservation` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `originFk` int(11) NOT NULL, - `userFk` int(11) NOT NULL, - `description` text COLLATE utf8_unicode_ci NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `travelRecalc` --- - -DROP TABLE IF EXISTS `travelRecalc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `travelRecalc` ( - `travelFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`travelFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Travels to recalc it''s entry count'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `travelThermograph` --- - -DROP TABLE IF EXISTS `travelThermograph`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `travelThermograph` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `thermographFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `created` date NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL, - `travelFk` int(10) unsigned DEFAULT NULL, - `temperature` enum('COOL','WARM','DRY') COLLATE utf8_unicode_ci DEFAULT NULL, - `result` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `dmsFk` int(11) DEFAULT NULL, - `temperatureFk` varchar(10) CHARACTER SET utf8 DEFAULT 'cool' COMMENT 'En la versión de Agosto de Salix se empezará a usar este campo y se actualizaran los anteriores mirando temperature.', - PRIMARY KEY (`id`), - KEY `thermograph_fk_idx` (`thermographFk`), - KEY `gestdoc_fk_idx` (`dmsFk`), - KEY `travel_id` (`travelFk`), - KEY `warehouse_id` (`warehouseFk`), - KEY `travelThermographTemperatureFgn` (`temperatureFk`), - CONSTRAINT `travelThermographDmsFgn` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travelThermographTemperatureFgn` FOREIGN KEY (`temperatureFk`) REFERENCES `temperature` (`code`), - CONSTRAINT `travelThermographThermographFgn` FOREIGN KEY (`thermographFk`) REFERENCES `thermograph` (`id`) ON UPDATE CASCADE, - CONSTRAINT `travelThermographTravelFgn` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`), - CONSTRAINT `travelThermographWarehouseFgn` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registra cada termografo que se ha introducido en cada travel'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travelThermograph_beforeInsert` - BEFORE INSERT ON `travelThermograph` - FOR EACH ROW -BEGIN - - IF NEW.temperature IS NULL THEN - SET NEW.temperature = UCASE(NEW.temperatureFk); - 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 `trolley` --- - -DROP TABLE IF EXISTS `trolley`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `trolley` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned DEFAULT NULL, - `coupled` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `trolley_FK` (`workerFk`), - CONSTRAINT `trolley_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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 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; - --- --- 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` ( - `userFk` int(10) unsigned NOT NULL, - `warehouseFk` smallint(6) DEFAULT NULL, - `companyFk` smallint(5) unsigned DEFAULT NULL, - `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - PRIMARY KEY (`userFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuración de usuario en Salix'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `userLog` --- - -DROP TABLE IF EXISTS `userLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `userLog` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `originFk` int(10) unsigned NOT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, - `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), - KEY `userFk` (`userFk`), - CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `userPhone` --- - -DROP TABLE IF EXISTS `userPhone`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `userPhone` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `userFk` int(10) unsigned NOT NULL, - `typeFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `phone` varchar(25) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `UserFk_Phone` (`userFk`,`typeFk`,`phone`), - KEY `fgnTypeFk` (`typeFk`), - CONSTRAINT `fgnTypeFk` FOREIGN KEY (`typeFk`) REFERENCES `userPhoneType` (`code`) ON UPDATE CASCADE, - CONSTRAINT `fgnUserFk` 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 `userPhoneType` --- - -DROP TABLE IF EXISTS `userPhoneType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `userPhoneType` ( - `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `vehicle` --- - -DROP TABLE IF EXISTS `vehicle`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vehicle` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `numberPlate` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `model` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `tradeMark` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', - `m3` double DEFAULT NULL, - `isActive` tinyint(4) NOT NULL DEFAULT '1', - `warehouseFk` smallint(6) unsigned DEFAULT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `deliveryPointFk` int(11) DEFAULT '6' COMMENT 'Direccion para Buscaman', - `isKmTruckRate` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Computar km como camión en el cálculo de salario de reparto', - `photo` blob, - `chassis` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'numero de bastidor', - `fuelTypeFk` int(11) DEFAULT NULL, - `ppeFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `empresa_id` (`companyFk`), - KEY `provinceFk_idx` (`warehouseFk`), - KEY `vehicle_deliveryPointFk_idx` (`deliveryPointFk`), - KEY `vehicle_FK` (`fuelTypeFk`), - KEY `vehicle_FK_1` (`ppeFk`), - CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, - CONSTRAINT `vehicle_FK` FOREIGN KEY (`fuelTypeFk`) REFERENCES `fuelType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `vehicle_FK_1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE, - CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `vehicleDms` --- - -DROP TABLE IF EXISTS `vehicleDms`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vehicleDms` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `vehicleFk` int(10) unsigned NOT NULL, - `dmsFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `vehicleDms_FK` (`vehicleFk`), - KEY `vehicleDms_FK_1` (`dmsFk`), - CONSTRAINT `vehicleDms_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `vehicleDms_FK_1` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Gestion documental de vehicle'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `vehicleEvent` --- - -DROP TABLE IF EXISTS `vehicleEvent`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vehicleEvent` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `started` date DEFAULT NULL, - `finished` date DEFAULT NULL, - `vehicleStateFk` int(11) DEFAULT NULL, - `description` varchar(250) COLLATE utf8_unicode_ci NOT NULL, - `vehicleFk` int(11) NOT NULL, - `userFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `vehicleEvent_FK` (`vehicleStateFk`), - KEY `vehicleEvent_FK_1` (`userFk`), - CONSTRAINT `vehicleEvent_FK` FOREIGN KEY (`vehicleStateFk`) REFERENCES `vehicleState` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `vehicleEvent_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `vehicleInvoiceIn` --- - -DROP TABLE IF EXISTS `vehicleInvoiceIn`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vehicleInvoiceIn` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `vehicleFk` int(10) unsigned NOT NULL, - `invoiceInFk` mediumint(8) unsigned NOT NULL, - `amount` decimal(10,2) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `vehicleInvoiceIn_FK` (`vehicleFk`), - KEY `vehicleInvoiceIn_FK_1` (`invoiceInFk`), - CONSTRAINT `vehicleInvoiceIn_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`), - CONSTRAINT `vehicleInvoiceIn_FK_1` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `vehicleNotes` --- - -DROP TABLE IF EXISTS `vehicleNotes`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vehicleNotes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `vehicleFk` int(10) unsigned NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `note` text COLLATE utf8_unicode_ci NOT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `vehicleNotes_FK_1` (`userFk`), - KEY `vehicleNotes_FK` (`vehicleFk`), - CONSTRAINT `vehicleNotes_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`), - CONSTRAINT `vehicleNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `vehicleState` --- - -DROP TABLE IF EXISTS `vehicleState`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `vehicleState` ( - `id` int(11) NOT NULL, - `state` varchar(100) 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 `volumeConfig` --- - -DROP TABLE IF EXISTS `volumeConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `volumeConfig` ( - `palletM3` decimal(10,2) DEFAULT NULL COMMENT 'metros cúbicos', - `trolleyM3` decimal(10,2) DEFAULT NULL COMMENT 'metros cúbicos', - `dutchCompressionRate` double NOT NULL DEFAULT '1', - `standardFlowerBox` int(11) NOT NULL COMMENT 'en litros', - `minCompressionRate` decimal(10,2) DEFAULT '0.30' COMMENT 'minimo permitido por la empresa', - `ccLength` int(11) NOT NULL DEFAULT '130' COMMENT 'longitud útil para la carga de un CC, en cm', - `ccWidth` int(11) NOT NULL DEFAULT '60' COMMENT 'ancho útil para la carga en un CC, en cm', - `sorterPallet_m3` decimal(5,1) NOT NULL DEFAULT '2.0' COMMENT 'volumen minimo para extraer pallet del sorter', - `minTicketVolume` int(11) NOT NULL DEFAULT '75' COMMENT 'volumen mínimo, en litros, para que un pedido sea preparable', - `shelveVolume` int(11) DEFAULT '200' COMMENT 'volumen en litros de una bandeja standard, a efectos de los sacadores', - `minTicketValue` int(11) NOT NULL DEFAULT '50' -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='almacena el valor standard para volumenes convencionales de Verdnatura, en metros cúbicos'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `wagon` --- - -DROP TABLE IF EXISTS `wagon`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `wagon` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `volume` int(11) NOT NULL DEFAULT '150' COMMENT 'Volumen en litros', - `plate` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Matrícula', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `wagonVolumetry` --- - -DROP TABLE IF EXISTS `wagonVolumetry`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `wagonVolumetry` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `level` int(10) unsigned NOT NULL DEFAULT '0', - `lines` int(10) unsigned NOT NULL DEFAULT '1', - `liters` int(10) unsigned NOT NULL DEFAULT '0', - `height` int(10) unsigned NOT NULL DEFAULT '20', - `wagonFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `wagonVolumetry_FK` (`wagonFk`), - CONSTRAINT `wagonVolumetry_FK` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `warehouse` --- - -DROP TABLE IF EXISTS `warehouse`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `warehouse` ( - `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, - `code` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, - `isFeedStock` tinyint(1) unsigned NOT NULL DEFAULT '0', - `addressName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `delay` double NOT NULL DEFAULT '0.004', - `hasAvailable` tinyint(4) NOT NULL DEFAULT '0', - `isForTicket` tinyint(2) unsigned zerofill NOT NULL DEFAULT '00', - `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', - `labelZone` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'almacenes donde hay produccion', - `hasComission` tinyint(4) NOT NULL DEFAULT '0', - `isInventory` tinyint(2) NOT NULL DEFAULT '0', - `isComparative` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Si esta a true,en la comparativa muestra el stock de este almacen, cuando no se especifica almacen.', - `valuatedInventory` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Determina si se incluye en el informe de inventario valorado', - `isManaged` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Se añaden los cubos de expedition a la tabla ticketPackaging', - `hasConfectionTeam` tinyint(1) unsigned NOT NULL DEFAULT '0', - `hasStowaway` tinyint(1) NOT NULL DEFAULT '0', - `hasDms` tinyint(1) NOT NULL DEFAULT '0', - `pickUpAgencyModeFk` int(11) DEFAULT NULL, - `isBuyerToBeEmailed` tinyint(2) NOT NULL DEFAULT '0', - `aliasFk` smallint(5) unsigned DEFAULT NULL, - `labelReport` int(11) DEFAULT NULL, - `hasUbications` tinyint(1) NOT NULL DEFAULT '1', - `hasProduction` tinyint(1) NOT NULL DEFAULT '0', - `addressFk` int(11) DEFAULT NULL, - `hasMachine` tinyint(1) NOT NULL DEFAULT '0', - `isLogiflora` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Este almacén acepta productos de Logiflora', - `isBionic` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `name_UNIQUE` (`name`), - KEY `Id_Paises` (`countryFk`), - KEY `isComparativeIdx` (`isComparative`), - KEY `warehouse_ibfk_1_idx` (`aliasFk`), - KEY `warehouse_FK` (`addressFk`), - CONSTRAINT `warehouse_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`), - CONSTRAINT `warehouse_ibfk_2` FOREIGN KEY (`aliasFk`) REFERENCES `warehouseAlias` (`id`) ON DELETE SET NULL ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterInsert` - AFTER INSERT ON `warehouse` - FOR EACH ROW -BEGIN - IF NEW.isFeedStock THEN - INSERT INTO warehouseAlias(`name`) VALUES(NEW.`name`); - INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) - VALUES(NEW.id,LAST_INSERT_ID()); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterUpdate` - AFTER UPDATE ON `warehouse` - FOR EACH ROW -BEGIN - IF NEW.isFeedStock IS TRUE and OLD.isFeedStock IS FALSE then - INSERT INTO warehouseAlias(`name`) VALUES(NEW.`name`); - INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) - VALUES(NEW.id,LAST_INSERT_ID()); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Table structure for table `warehouseAlias` --- - -DROP TABLE IF EXISTS `warehouseAlias`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `warehouseAlias` ( - `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, - `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `name_UNIQUE` (`name`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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, - `warehouseFk` smallint(6) DEFAULT NULL, - `street` varchar(255) DEFAULT NULL, - `geoFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `workCenter_geoFk_idx` (`geoFk`), - CONSTRAINT `workCenter_geoFk` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workCenterHoliday` --- - -DROP TABLE IF EXISTS `workCenterHoliday`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workCenterHoliday` ( - `workCenterFk` int(11) NOT NULL, - `days` double NOT NULL, - `year` smallint(6) NOT NULL, - PRIMARY KEY (`workCenterFk`,`year`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `worker` --- - -DROP TABLE IF EXISTS `worker`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `worker` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, - `firstName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `lastName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `password__` varchar(50) CHARACTER SET utf8 DEFAULT NULL, - `email__` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - `extension__` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, - `sub` int(11) unsigned DEFAULT NULL, - `user__` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `typeBussines__` varchar(30) CHARACTER SET utf8 DEFAULT 'no dejar vacio' COMMENT 'campo obsoleto, actualmente se rellena en laboral', - `laborCategory__` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `started__` datetime DEFAULT NULL, - `ended__` datetime DEFAULT NULL, - `notes__` varchar(254) COLLATE utf8_unicode_ci DEFAULT NULL, - `photo` blob, - `fi__` varchar(9) COLLATE utf8_unicode_ci DEFAULT NULL, - `address__` varchar(50) COLLATE utf8_unicode_ci NOT NULL, - `birthed__` date NOT NULL, - `maritalStatus__` enum('soltero/a','casado/a') COLLATE utf8_unicode_ci NOT NULL, - `phone` varchar(9) COLLATE utf8_unicode_ci NOT NULL, - `clientFk__` int(11) DEFAULT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - `bossFk` int(11) NOT NULL DEFAULT '103', - `fiDueDate` datetime DEFAULT NULL, - `hasMachineryAuthorized` tinyint(2) DEFAULT '0', - `seniority` date DEFAULT NULL, - `isTodayRelative` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Para el F11. Calcula los problemas de visiblidad en funcion del dia actual', - `isF11Allowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Usuario autorizado para abrir el F11', - `sectorFk` int(11) DEFAULT NULL COMMENT 'Sector que tiene asociado el trabajador.', - `labelerFk` tinyint(3) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `CodigoTrabajador_UNIQUE` (`code`), - UNIQUE KEY `user` (`user__`), - UNIQUE KEY `user_id_UNIQUE` (`userFk`), - UNIQUE KEY `Id_Cliente_Interno` (`clientFk__`), - KEY `sub` (`sub`), - KEY `boss_idx` (`bossFk`), - KEY `worker_FK` (`labelerFk`), - CONSTRAINT `Clientes` FOREIGN KEY (`clientFk__`) REFERENCES `client` (`id`) ON UPDATE CASCADE, - CONSTRAINT `worker_FK` FOREIGN KEY (`labelerFk`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `worker_ibfk_1` FOREIGN KEY (`id`) REFERENCES `account`.`user` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerBosses` --- - -DROP TABLE IF EXISTS `workerBosses`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerBosses` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `bossFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`bossFk`), - KEY `fg_worker_worker_idx` (`workerFk`), - KEY `fg_bossFk_worker_idx` (`bossFk`), - CONSTRAINT `fg_bossFk_worker` FOREIGN KEY (`bossFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `fg_workerFk_worker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `workerBusinessDated` --- - -DROP TABLE IF EXISTS `workerBusinessDated`; -/*!50001 DROP VIEW IF EXISTS `workerBusinessDated`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerBusinessDated` ( - `dated` tinyint NOT NULL, - `business_id` tinyint NOT NULL, - `workerFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `workerBusinessType` --- - -DROP TABLE IF EXISTS `workerBusinessType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerBusinessType` ( - `id` int(4) NOT NULL, - `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - `isFullTime` tinyint(1) NOT NULL DEFAULT '1', - `isPermanent` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Contrato fijo', - `hasHolidayEntitlement` tinyint(1) DEFAULT '1' COMMENT 'Tiene derecho a vacaciones', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `workerCalendar` --- - -DROP TABLE IF EXISTS `workerCalendar`; -/*!50001 DROP VIEW IF EXISTS `workerCalendar`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerCalendar` ( - `businessFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `absenceTypeFk` tinyint NOT NULL, - `dated` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `workerClockLog` --- - -DROP TABLE IF EXISTS `workerClockLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerClockLog` ( - `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 `logWorkerClockoriginFk` (`originFk`), - KEY `logWorkerClockuserFk` (`userFk`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerConfig__` --- - -DROP TABLE IF EXISTS `workerConfig__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerConfig__` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `defaultWorkerFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `defaultWorkerFk` (`defaultWorkerFk`), - CONSTRAINT `workerConfig___ibfk_1` FOREIGN KEY (`defaultWorkerFk`) REFERENCES `worker` (`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 `workerDepartment` --- - -DROP TABLE IF EXISTS `workerDepartment`; -/*!50001 DROP VIEW IF EXISTS `workerDepartment`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerDepartment` ( - `workerFk` tinyint NOT NULL, - `departmentFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerDepartmentTest` --- - -DROP TABLE IF EXISTS `workerDepartmentTest`; -/*!50001 DROP VIEW IF EXISTS `workerDepartmentTest`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerDepartmentTest` ( - `workerFk` tinyint NOT NULL, - `departmentFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `workerDisableExcluded` --- - -DROP TABLE IF EXISTS `workerDisableExcluded`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerDisableExcluded` ( - `workerFk` int(10) unsigned NOT NULL, - `dated` date DEFAULT NULL, - PRIMARY KEY (`workerFk`), - CONSTRAINT `workerDisableExcludedFk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No se deshabilitan hasta la fecha especificada'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerDistributionCategory` --- - -DROP TABLE IF EXISTS `workerDistributionCategory`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerDistributionCategory` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `category` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `workerDistributionCategory_workerFk_idx` (`workerFk`), - CONSTRAINT `workerDistributionCategory_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerDocument` --- - -DROP TABLE IF EXISTS `workerDocument`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerDocument` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `worker` int(10) unsigned DEFAULT NULL, - `document` int(11) DEFAULT NULL, - `isReadableByWorker` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indica si el empleado tiene permiso para acceder al documento', - PRIMARY KEY (`id`), - KEY `workerDocument_ibfk_1` (`worker`), - KEY `workerDocument_ibfk_2` (`document`), - CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `worker` (`userFk`) ON UPDATE CASCADE, - CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `dms` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerEmergencyBoss` --- - -DROP TABLE IF EXISTS `workerEmergencyBoss`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerEmergencyBoss` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `value` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Table to save all responsible people phones', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerHourPrice` --- - -DROP TABLE IF EXISTS `workerHourPrice`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerHourPrice` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dated` date NOT NULL, - `holidayInc` decimal(4,2) DEFAULT NULL, - `nightInc` decimal(4,2) DEFAULT NULL, - `extraInc` decimal(4,2) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerIrpf` --- - -DROP TABLE IF EXISTS `workerIrpf`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerIrpf` ( - `workerFk` int(10) unsigned NOT NULL, - `spouseNif` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `geographicMobilityDate` date DEFAULT NULL, - `disabilityGradeFk` int(11) DEFAULT NULL, - `isDependend` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Acredita la necesidad de ayuda de terceras personas o movilidad reducida', - `familySituation` enum('1','2','3') COLLATE utf8_unicode_ci DEFAULT '1', - `spousePension` decimal(10,2) DEFAULT NULL COMMENT 'Apartado 4 - Pensión compensatoria en favor del conyuge ', - `childPension` decimal(10,2) DEFAULT NULL COMMENT 'Apartado 4 - Anualidades por alimentos en favor de los hijos', - `hasHousingPaymentBefore` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Apartado 5 - Pagos por adquisición o rehabilitación de la vivienda habitual utilizando financiación ajena, con derecho a deducción del IRPF', - `hasHousingPaymentAfter` tinyint(1) NOT NULL DEFAULT '0', - `hasExtendedWorking` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Aprtado 1 - prolongar la actividad laboral', - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`workerFk`), - KEY `workerIrpf_disabilityGradeFk` (`disabilityGradeFk`), - CONSTRAINT `workerIrpf_disabilityGradeFk` FOREIGN KEY (`disabilityGradeFk`) REFERENCES `disabilityGrade` (`id`) ON UPDATE CASCADE, - CONSTRAINT `workerIrpf_wokerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 1 - 4 y 5 '; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerJourney` --- - -DROP TABLE IF EXISTS `workerJourney`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerJourney` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `userFk` int(10) unsigned NOT NULL, - `dated` date NOT NULL, - `total` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceOrdinaryHour` decimal(5,2) NOT NULL DEFAULT '0.00', - `nocturn` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceNocturnHour` decimal(5,2) NOT NULL DEFAULT '0.00', - `holiday` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceHolidayHour` decimal(5,2) NOT NULL DEFAULT '0.00', - `lunch` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceExtraHour` decimal(5,2) NOT NULL DEFAULT '0.00', - `extra` decimal(5,2) NOT NULL DEFAULT '0.00', - `contractJourney` decimal(5,2) NOT NULL DEFAULT '0.00', - `priceExtraHoliday` decimal(5,2) NOT NULL DEFAULT '0.00', - `businessFk` int(11) DEFAULT NULL, - `isPaid` tinyint(1) NOT NULL DEFAULT '0', - `isUpdated` tinyint(1) NOT NULL DEFAULT '0', - `permission` decimal(5,2) NOT NULL DEFAULT '0.00', - PRIMARY KEY (`id`), - UNIQUE KEY `userFk_UNIQUE` (`userFk`,`dated`), - KEY `fk_workerJourney_user_idx` (`userFk`), - KEY `workerJourney_businessFk_idx` (`businessFk`), - KEY `workerJourney_dated_idx` (`dated`), - CONSTRAINT `fk_workerJourney_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, - CONSTRAINT `workerJourney_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `postgresql`.`business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `workerLabour` --- - -DROP TABLE IF EXISTS `workerLabour`; -/*!50001 DROP VIEW IF EXISTS `workerLabour`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerLabour` ( - `businessFk` tinyint NOT NULL, - `workerFk` tinyint NOT NULL, - `workCenterFk` tinyint NOT NULL, - `started` tinyint NOT NULL, - `ended` tinyint NOT NULL, - `departmentFk` tinyint NOT NULL, - `payedHolidays` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- 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(10) unsigned 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, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, - `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT 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 `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerMana` --- - -DROP TABLE IF EXISTS `workerMana`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerMana` ( - `workerFk` int(10) unsigned NOT NULL, - `size` int(11) NOT NULL DEFAULT '300', - `amount` int(11) NOT NULL DEFAULT '0', - `pricesModifierRate` double NOT NULL DEFAULT '0', - `isPricesModifierActivated` tinyint(1) NOT NULL DEFAULT '1', - `minRate` decimal(3,2) NOT NULL DEFAULT '-0.05', - `maxRate` decimal(3,2) NOT NULL DEFAULT '0.05', - PRIMARY KEY (`workerFk`), - KEY `fk_mana_spellers_Trabajadores_idx` (`workerFk`), - CONSTRAINT `fk_mana_spellers_Trabajadores` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`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 `workerManaExcluded` --- - -DROP TABLE IF EXISTS `workerManaExcluded`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerManaExcluded` ( - `workerFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`workerFk`), - CONSTRAINT `mana_spellers_excluded_fk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Usuarios que tienen que estar excluidos del cálculo del maná'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `workerMana__` --- - -DROP TABLE IF EXISTS `workerMana__`; -/*!50001 DROP VIEW IF EXISTS `workerMana__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerMana__` ( - `workerFk` tinyint NOT NULL, - `size` tinyint NOT NULL, - `amount` tinyint NOT NULL, - `pricesModifierRate` tinyint NOT NULL, - `isPricesModifierActivated` tinyint NOT NULL, - `minRate` tinyint NOT NULL, - `maxRate` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerMedia` --- - -DROP TABLE IF EXISTS `workerMedia`; -/*!50001 DROP VIEW IF EXISTS `workerMedia`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerMedia` ( - `workerFk` tinyint NOT NULL, - `mediaValue` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `workerMistake` --- - -DROP TABLE IF EXISTS `workerMistake`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerMistake` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `userFk` int(10) unsigned NOT NULL, - `workerMistakeTypeFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `workerMistake_fk1_idx` (`userFk`), - KEY `workerMistake_fk2_idx` (`workerMistakeTypeFk`), - CONSTRAINT `workerMistake_fk1` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `workerMistake_fk2` FOREIGN KEY (`workerMistakeTypeFk`) REFERENCES `workerMistakeType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerMistakeType` --- - -DROP TABLE IF EXISTS `workerMistakeType`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerMistakeType` ( - `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerRelatives` --- - -DROP TABLE IF EXISTS `workerRelatives`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerRelatives` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `isDescendant` tinyint(1) DEFAULT '1' COMMENT 'Descendientes - Ascendientes', - `disabilityGradeFk` int(11) DEFAULT NULL, - `birthed` int(4) NOT NULL, - `adoptionYear` int(4) DEFAULT NULL COMMENT 'Solo en el caso de descendientes', - `isDependend` tinyint(1) DEFAULT '0', - `isJointCustody` tinyint(1) DEFAULT '0' COMMENT 'Solo en el caso de descendientes', - `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `workerRelatives_disabilityGradeFk` (`disabilityGradeFk`), - KEY `workerRelatives_workerFk` (`workerFk`), - CONSTRAINT `workerRelatives_disabilityGradeFk` FOREIGN KEY (`disabilityGradeFk`) REFERENCES `disabilityGrade` (`id`) ON UPDATE CASCADE, - CONSTRAINT `workerRelatives_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `workerIrpf` (`workerFk`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 2 y 3'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerShelving` --- - -DROP TABLE IF EXISTS `workerShelving`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerShelving` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `shelvingFk` varchar(10) CHARACTER SET utf8 NOT NULL, - `collectionFk` int(11) DEFAULT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - PRIMARY KEY (`id`), - KEY `workerShelving_shelving_fk` (`shelvingFk`), - KEY `workerShelving_FK` (`workerFk`), - KEY `workerShelving_FK_1` (`collectionFk`), - CONSTRAINT `workerShelving_FK` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, - CONSTRAINT `workerShelving_shelving_fk` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON UPDATE CASCADE, - CONSTRAINT `workerShelving_worker_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='utilizaremos el id para establecer la prioridad de los carros a asignar'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `workerSpeedExpedition` --- - -DROP TABLE IF EXISTS `workerSpeedExpedition`; -/*!50001 DROP VIEW IF EXISTS `workerSpeedExpedition`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerSpeedExpedition` ( - `ticketFk` tinyint NOT NULL, - `litros` tinyint NOT NULL, - `literLastHour` tinyint NOT NULL, - `litersByMinute` tinyint NOT NULL, - `workerCode` tinyint NOT NULL, - `cajas` tinyint NOT NULL, - `warehouseFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerSpeedSaleTracking` --- - -DROP TABLE IF EXISTS `workerSpeedSaleTracking`; -/*!50001 DROP VIEW IF EXISTS `workerSpeedSaleTracking`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerSpeedSaleTracking` ( - `warehouseFk` tinyint NOT NULL, - `accion` tinyint NOT NULL, - `workerCode` tinyint NOT NULL, - `sumaLitros` tinyint NOT NULL, - `started` tinyint NOT NULL, - `finished` tinyint NOT NULL, - `sumaLitrosLastHour` tinyint NOT NULL, - `litersByMinute` tinyint NOT NULL, - `departmentName` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `workerTeam` --- - -DROP TABLE IF EXISTS `workerTeam`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTeam` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `team` int(11) NOT NULL, - `workerFk` int(10) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `user_idx` (`workerFk`), - KEY `team_idx` (`team`), - CONSTRAINT `user_team` FOREIGN KEY (`workerFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- 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 TABLE `workerTeamCollegues` ( - `workerFk` tinyint NOT NULL, - `collegueFk` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `workerTimeControl` --- - -DROP TABLE IF EXISTS `workerTimeControl`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTimeControl` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `userFk` int(10) unsigned NOT NULL, - `timed` datetime NOT NULL, - `manual` tinyint(4) NOT NULL DEFAULT '0', - `order` int(11) DEFAULT NULL, - `warehouseFk` smallint(6) unsigned DEFAULT NULL, - `direction` enum('in','out','middle') COLLATE utf8_unicode_ci DEFAULT 'middle', - `isSendMail` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Fichadas generadas autómaticamente con el procedimiento vn.workerTimeControl_sendMail', - PRIMARY KEY (`id`), - UNIQUE KEY `userFk_Timed_uniq` (`userFk`,`timed`), - KEY `warehouseFkfk1_idx` (`warehouseFk`), - CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `workerTimeControl_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; -/*!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`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_AI` - AFTER INSERT ON `workerTimeControl` - FOR EACH ROW -BEGIN - IF NEW.timed > DATE_ADD(NOW(), INTERVAL 1 DAY) THEN - CALL util.throw('date in the future'); - END IF; -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Table structure for table `workerTimeControlConfig` --- - -DROP TABLE IF EXISTS `workerTimeControlConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTimeControlConfig` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dayBreak` int(11) NOT NULL, - `dayBreakDriver` int(11) NOT NULL, - `shortWeekBreak` int(11) NOT NULL, - `longWeekBreak` int(11) NOT NULL, - `weekScope` int(11) NOT NULL, - `mailPass` varchar(45) COLLATE utf8_bin NOT NULL, - `mailHost` varchar(45) COLLATE utf8_bin NOT NULL, - `mailSuccessFolder` varchar(45) COLLATE utf8_bin NOT NULL, - `mailErrorFolder` varchar(45) COLLATE utf8_bin NOT NULL, - `mailUser` varchar(45) COLLATE utf8_bin NOT NULL, - `minHoursToBreak` decimal(5,2) unsigned NOT NULL COMMENT 'Horas mínimas que se deben trabajar para añadir descanso remunerado', - `breakHours` decimal(5,2) unsigned NOT NULL COMMENT 'Descanso remunerado', - `hoursCompleteWeek` int(10) unsigned NOT NULL COMMENT 'Horas a realizar por semana para que se considere jornada completa', - `startNightlyHours` time NOT NULL, - `endNightlyHours` time NOT NULL, - `maxTimePerDay` int(11) unsigned NOT NULL COMMENT 'Maximo tiempo transcurrido en segundos desde que se inicia la jornada hasta que se termina', - `breakTime` int(11) DEFAULT NULL COMMENT 'Tiempo de descanso expresado en segundos', - `timeToBreakTime` int(11) DEFAULT NULL COMMENT 'Tiempo mínimo que se debe trabajar para añadir descanso, expresado en segundos', - `dayMaxTime` int(11) DEFAULT NULL COMMENT 'Tiempo máximo desde la entrada hasta la salida, expresado en segundos', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerTimeControlConfig_` --- - -DROP TABLE IF EXISTS `workerTimeControlConfig_`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTimeControlConfig_` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `warehouseFk` smallint(6) unsigned NOT NULL, - `host` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`), - KEY `warehouseFk_1_idx` (`warehouseFk`), - CONSTRAINT `warehouseFk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerTimeControlLog` --- - -DROP TABLE IF EXISTS `workerTimeControlLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTimeControlLog` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `userFk` int(10) NOT NULL, - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de fichadas, se rellena cuando el fichador(tablet) no autoriza el fichaje (PROC:vn.workerTimeControl_check)'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerTimeControlMail` --- - -DROP TABLE IF EXISTS `workerTimeControlMail`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTimeControlMail` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `workerFk` int(10) unsigned NOT NULL, - `year` int(4) NOT NULL, - `week` int(2) NOT NULL, - `state` enum('SENDED','CONFIRMED','REVISE') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'SENDED', - `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha/hora último cambio de estado', - `sendedCounter` int(3) NOT NULL DEFAULT '1' COMMENT 'Número de veces que se ha enviado el correo', - `emailResponse` text COLLATE utf8_unicode_ci, - PRIMARY KEY (`id`), - UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`year`,`week`), - KEY `workerFk_idx` (`workerFk`), - CONSTRAINT `workerTimeControlMail_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda las respuestas de mail de los correos generados automáticamente por la procedimiento workerTimeControl_sendMail'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerTimeControlParams` --- - -DROP TABLE IF EXISTS `workerTimeControlParams`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTimeControlParams` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `dayBreak` int(11) NOT NULL, - `weekBreak` int(11) NOT NULL, - `weekScope` int(11) NOT NULL, - `dayWorkMax` int(11) NOT NULL, - `dayStayMax` int(11) NOT NULL, - `weekMaxBreak` int(11) NOT NULL, - `weekMaxScope` int(11) NOT NULL, - `askInOut` int(11) NOT NULL COMMENT 'Tiempo desde la última fichada que determinará si se pregunta al usuario por la dirección de la fichada', - `mailPass` varchar(45) COLLATE utf8_bin NOT NULL, - `mailHost` varchar(45) COLLATE utf8_bin NOT NULL, - `mailSuccessFolder` varchar(45) COLLATE utf8_bin NOT NULL, - `mailErrorFolder` varchar(45) COLLATE utf8_bin NOT NULL, - `mailUser` varchar(45) COLLATE utf8_bin NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workerTimeControlPin` --- - -DROP TABLE IF EXISTS `workerTimeControlPin`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTimeControlPin` ( - `workerFk` int(10) unsigned NOT NULL, - `pin` varchar(255) COLLATE utf8_unicode_ci NOT NULL, - PRIMARY KEY (`workerFk`), - CONSTRAINT `workerFk_.1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`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 `workerTimeControlSchedule` --- - -DROP TABLE IF EXISTS `workerTimeControlSchedule`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workerTimeControlSchedule` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `time` time DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `punique_trhf` (`time`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `workerTimeControlUserInfo` --- - -DROP TABLE IF EXISTS `workerTimeControlUserInfo`; -/*!50001 DROP VIEW IF EXISTS `workerTimeControlUserInfo`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerTimeControlUserInfo` ( - `userFk` tinyint NOT NULL, - `name` tinyint NOT NULL, - `surname` tinyint NOT NULL, - `user` tinyint NOT NULL, - `password` tinyint NOT NULL, - `bcryptPassword` tinyint NOT NULL, - `departmentFk` tinyint NOT NULL, - `dni` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerTimeControlWorking` --- - -DROP TABLE IF EXISTS `workerTimeControlWorking`; -/*!50001 DROP VIEW IF EXISTS `workerTimeControlWorking`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerTimeControlWorking` ( - `userFk` tinyint NOT NULL, - `timed` tinyint NOT NULL, - `name` tinyint NOT NULL, - `surname` tinyint NOT NULL, - `phone` tinyint NOT NULL, - `workerPhone` tinyint NOT NULL, - `department` tinyint NOT NULL, - `workerCenter` tinyint NOT NULL, - `maxOrder` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerTimeControl_Journey__` --- - -DROP TABLE IF EXISTS `workerTimeControl_Journey__`; -/*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerTimeControl_Journey__` ( - `userFk` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `Journey` tinyint NOT NULL, - `dayName` tinyint NOT NULL, - `name` tinyint NOT NULL, - `firstname` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerTimeJourneyNG` --- - -DROP TABLE IF EXISTS `workerTimeJourneyNG`; -/*!50001 DROP VIEW IF EXISTS `workerTimeJourneyNG`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerTimeJourneyNG` ( - `userFk` tinyint NOT NULL, - `dated` tinyint NOT NULL, - `Journey` tinyint NOT NULL, - `dayName` tinyint NOT NULL, - `name` tinyint NOT NULL, - `firstname` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerWithoutDevice__` --- - -DROP TABLE IF EXISTS `workerWithoutDevice__`; -/*!50001 DROP VIEW IF EXISTS `workerWithoutDevice__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerWithoutDevice__` ( - `workerFk` tinyint NOT NULL, - `Trabajador` tinyint NOT NULL, - `Colecciones` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Temporary table structure for view `workerWithoutTractor` --- - -DROP TABLE IF EXISTS `workerWithoutTractor`; -/*!50001 DROP VIEW IF EXISTS `workerWithoutTractor`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `workerWithoutTractor` ( - `workerFk` tinyint NOT NULL, - `Trabajador` tinyint NOT NULL, - `Colecciones` tinyint NOT NULL, - `created` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `workers20190711` --- - -DROP TABLE IF EXISTS `workers20190711`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workers20190711` ( - `person_id` int(11) NOT NULL DEFAULT '0', - `business_id` int(11) NOT NULL DEFAULT '0', - `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, - `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `Fecha_Inicio` date DEFAULT NULL, - `Fecha_Fin` date DEFAULT NULL, - `departamento` varchar(45) COLLATE utf8_unicode_ci NOT NULL, - `Jornada_Semanal` smallint(6) DEFAULT NULL, - `Codigo_Contrato` int(11) DEFAULT NULL, - `userFk` int(11) NOT NULL, - PRIMARY KEY (`person_id`), - UNIQUE KEY `userFk_UNIQUE` (`userFk`), - UNIQUE KEY `nif_UNIQUE` (`nif`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workers20190711_FichadasAbril` --- - -DROP TABLE IF EXISTS `workers20190711_FichadasAbril`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workers20190711_FichadasAbril` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', - `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, - `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `Fecha` date DEFAULT NULL, - `Hora` int(2) DEFAULT NULL, - `Minuto` int(2) DEFAULT NULL, - `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workers20190711_FichadasJulio11` --- - -DROP TABLE IF EXISTS `workers20190711_FichadasJulio11`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workers20190711_FichadasJulio11` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', - `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, - `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `Fecha` date DEFAULT NULL, - `Hora` int(2) DEFAULT NULL, - `Minuto` int(2) DEFAULT NULL, - `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workers20190711_FichadasJunio` --- - -DROP TABLE IF EXISTS `workers20190711_FichadasJunio`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workers20190711_FichadasJunio` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', - `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, - `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `Fecha` date DEFAULT NULL, - `Hora` int(2) DEFAULT NULL, - `Minuto` int(2) DEFAULT NULL, - `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workers20190711_FichadasMayo` --- - -DROP TABLE IF EXISTS `workers20190711_FichadasMayo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workers20190711_FichadasMayo` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', - `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, - `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `Fecha` date DEFAULT NULL, - `Hora` int(2) DEFAULT NULL, - `Minuto` int(2) DEFAULT NULL, - `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workers20190711_FichadasOctubre` --- - -DROP TABLE IF EXISTS `workers20190711_FichadasOctubre`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workers20190711_FichadasOctubre` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', - `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, - `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `Fecha` date DEFAULT NULL, - `Hora` int(2) DEFAULT NULL, - `Minuto` int(2) DEFAULT NULL, - `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workers20190711_Garrote` --- - -DROP TABLE IF EXISTS `workers20190711_Garrote`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workers20190711_Garrote` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `person_id` int(11) NOT NULL DEFAULT '0', - `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, - `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, - `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, - `Fecha` date DEFAULT NULL, - `Hora` int(2) DEFAULT NULL, - `Minuto` int(2) DEFAULT NULL, - `sumable` double DEFAULT NULL, - `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `workingHours` --- - -DROP TABLE IF EXISTS `workingHours`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `workingHours` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `timeIn` datetime NOT NULL, - `timeOut` datetime DEFAULT NULL, - `userId` int(10) unsigned NOT NULL, - 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHoursBeforeInsert` - BEFORE INSERT ON `workingHours` - FOR EACH ROW -BEGIN - IF (SELECT COUNT(*) FROM workingHours WHERE userId = NEW.userId AND DATE(timeIn) = CURDATE()) > 0 THEN - CALL util.throw ('ALREADY_LOGGED'); - 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 `zone` --- - -DROP TABLE IF EXISTS `zone`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zone` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, - `hour` datetime NOT NULL, - `warehouseFk__` smallint(6) unsigned DEFAULT NULL, - `agencyModeFk` int(11) NOT NULL, - `travelingDays` int(11) NOT NULL DEFAULT '1', - `price` double NOT NULL DEFAULT '0', - `bonus` double NOT NULL DEFAULT '0', - `isVolumetric` tinyint(1) NOT NULL DEFAULT '0', - `inflation` decimal(5,2) NOT NULL DEFAULT '1.00', - `m3Max` decimal(10,2) unsigned DEFAULT NULL, - `itemMaxSize` int(11) DEFAULT NULL COMMENT 'tamaño maximo de los articulos que esa ruta puede transportar', - `code` varchar(45) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `fk_zone_1_idx` (`warehouseFk__`), - KEY `fk_zone_2_idx` (`agencyModeFk`), - KEY `zone_name_idx` (`name`), - CONSTRAINT `fk_zone_1` FOREIGN KEY (`warehouseFk__`) REFERENCES `warehouse` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, - CONSTRAINT `fk_zone_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zoneAgencyMode` --- - -DROP TABLE IF EXISTS `zoneAgencyMode`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneAgencyMode` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `agencyModeFk` int(11) NOT NULL, - `zoneFk` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `zoneAgencyMode_UN` (`agencyModeFk`,`zoneFk`), - KEY `zoneAgencyMode_FK_1` (`zoneFk`), - CONSTRAINT `zoneAgencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `zoneAgencyMode_FK_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='junta agencias con zonas para que al enrutar se puedan proponer tickets.'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zoneClosure` --- - -DROP TABLE IF EXISTS `zoneClosure`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneClosure` ( - `zoneFk` int(11) NOT NULL, - `dated` date NOT NULL, - `hour` time NOT NULL, - PRIMARY KEY (`zoneFk`,`dated`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zoneConfig` --- - -DROP TABLE IF EXISTS `zoneConfig`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneConfig` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `scope` int(10) unsigned NOT NULL, - `forwardDays` int(10) NOT NULL DEFAULT '7' COMMENT 'days forward to show zone_upcomingDeliveries', - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `zoneEstimatedDelivery` --- - -DROP TABLE IF EXISTS `zoneEstimatedDelivery`; -/*!50001 DROP VIEW IF EXISTS `zoneEstimatedDelivery`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `zoneEstimatedDelivery` ( - `zoneFk` tinyint NOT NULL, - `hourTheoretical` tinyint NOT NULL, - `totalVolume` tinyint NOT NULL, - `remainingVolume` tinyint NOT NULL, - `speed` tinyint NOT NULL, - `hourEffective` tinyint NOT NULL, - `minutesLess` tinyint NOT NULL, - `etc` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Table structure for table `zoneEvent` --- - -DROP TABLE IF EXISTS `zoneEvent`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneEvent` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `zoneFk` int(11) NOT NULL, - `type` enum('day','indefinitely','range') NOT NULL, - `dated` date DEFAULT NULL, - `started` date DEFAULT NULL, - `ended` date DEFAULT NULL, - `weekDays` set('mon','tue','wed','thu','fri','sat','sun') NOT NULL, - `hour` datetime DEFAULT NULL, - `travelingDays` int(11) DEFAULT NULL, - `price` decimal(10,2) DEFAULT NULL, - `bonus` decimal(10,2) DEFAULT NULL, - `m3Max` decimal(10,2) unsigned DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `zoneFk` (`zoneFk`,`type`,`dated`), - CONSTRAINT `zoneEvent_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zoneExclusion` --- - -DROP TABLE IF EXISTS `zoneExclusion`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneExclusion` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `zoneFk` int(11) NOT NULL, - `dated` date NOT NULL, - `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - `userFk` int(11) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `zoneFk_2` (`zoneFk`,`dated`), - KEY `zoneFk` (`zoneFk`), - CONSTRAINT `zoneExclusion_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BI` - BEFORE INSERT ON `zoneExclusion` - FOR EACH ROW -BEGIN - - SET NEW.userFk = account.myUser_getId(); - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BU` - BEFORE UPDATE ON `zoneExclusion` - FOR EACH ROW -BEGIN - - SET NEW.userFk = account.myUser_getId(); - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; - --- --- Table structure for table `zoneFilter` --- - -DROP TABLE IF EXISTS `zoneFilter`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneFilter` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `zoneFk` int(11) NOT NULL, - `sizeMax` int(11) DEFAULT NULL COMMENT 'altura máxima en cm', - `itemTypeFk` smallint(5) unsigned NOT NULL, - PRIMARY KEY (`id`), - KEY `zoneFilter_FK` (`zoneFk`), - KEY `zoneFilter_FK_1` (`itemTypeFk`), - CONSTRAINT `zoneFilter_FK` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `zoneFilter_FK_1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='recoge los parámetros para filtrar determinados productos según la zona'; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zoneGeo` --- - -DROP TABLE IF EXISTS `zoneGeo`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneGeo` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `type` set('country','province','town','postCode','autonomy') CHARACTER SET utf8 NOT NULL, - `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, - `parentFk` int(10) unsigned DEFAULT NULL, - `path` varchar(255) 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, - PRIMARY KEY (`id`), - KEY `lft_rgt_depth_idx` (`lft`,`rgt`,`depth`), - KEY `name_idx` (`name`), - KEY `parentFk` (`parentFk`), - KEY `path` (`path`) -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneGeo_beforeInsert` - BEFORE INSERT ON `zoneGeo` - FOR EACH ROW -BEGIN - CALL zoneGeo_checkName(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 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneGeo_beforeUpdate` - BEFORE UPDATE ON `zoneGeo` - FOR EACH ROW -BEGIN - IF !(OLD.`name` <=> NEW.`name`) THEN - CALL zoneGeo_checkName(NEW.`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 */ ; - --- --- Table structure for table `zoneGeoRecalc` --- - -DROP TABLE IF EXISTS `zoneGeoRecalc`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneGeoRecalc` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `isChanged` tinyint(4) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zoneIncluded` --- - -DROP TABLE IF EXISTS `zoneIncluded`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneIncluded` ( - `zoneFk` int(11) NOT NULL, - `geoFk` int(11) NOT NULL, - `isIncluded` tinyint(1) DEFAULT NULL, - PRIMARY KEY (`zoneFk`,`geoFk`), - KEY `geoFk_idx` (`geoFk`), - CONSTRAINT `zoneFk2` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `zoneGeoFk2` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`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 `zoneLog` --- - -DROP TABLE IF EXISTS `zoneLog`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneLog` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT, - `originFk` int(10) NOT NULL, - `userFk` int(10) unsigned DEFAULT NULL, - `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, - `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, - `description` text CHARACTER SET utf8, - `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - `oldInstance` text COLLATE utf8_unicode_ci, - `newInstance` text COLLATE utf8_unicode_ci, - `changedModelId` int(11) DEFAULT NULL, - `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `originFk` (`originFk`), - KEY `userFk` (`userFk`), - CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zonePromo__` --- - -DROP TABLE IF EXISTS `zonePromo__`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zonePromo__` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `zoneFk` int(11) NOT NULL, - `dated` date NOT NULL, - `amount` decimal(10,2) NOT NULL, - `isDone` tinyint(4) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - KEY `zonePromo_fk1_idx` (`zoneFk`), - CONSTRAINT `zonePromo_fk1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Table structure for table `zoneWarehouse` --- - -DROP TABLE IF EXISTS `zoneWarehouse`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `zoneWarehouse` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `zoneFk` int(11) NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `zoneFk` (`zoneFk`,`warehouseFk`), - KEY `warehouseFk` (`warehouseFk`), - CONSTRAINT `zoneWarehouse_fk_warehouse` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, - CONSTRAINT `zoneWarehouse_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Temporary table structure for view `zone_ETD__` --- - -DROP TABLE IF EXISTS `zone_ETD__`; -/*!50001 DROP VIEW IF EXISTS `zone_ETD__`*/; -SET @saved_cs_client = @@character_set_client; -SET character_set_client = utf8; -/*!50001 CREATE TABLE `zone_ETD__` ( - `zoneFk` tinyint NOT NULL, - `HoraTeórica` tinyint NOT NULL, - `volumenTotal` tinyint NOT NULL, - `volumenPendiente` tinyint NOT NULL, - `velocidad` tinyint NOT NULL, - `HoraPráctica` tinyint NOT NULL, - `minutesLess` tinyint NOT NULL, - `etc` tinyint NOT NULL -) ENGINE=MyISAM */; -SET character_set_client = @saved_cs_client; - --- --- Dumping events for database 'vn' --- -/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; -/*!50106 DROP EVENT IF EXISTS `department_doCalc` */; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `department_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-11-15 00:00:00' ON COMPLETION PRESERVE ENABLE DO CALL vn.department_doCalc */ ;; -/*!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 `envialiaThreHoldChecker` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `envialiaThreHoldChecker` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-28 09:52:46' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN - DECLARE vActualNumber BIGINT; - DECLARE vEndRange BIGINT; - DECLARE vIsAlreadyNotified BOOLEAN; - DECLARE vNotificationThrehold INT; - - SELECT actualNumber, endRange, isAlreadyNotified, notificationThrehold - INTO vActualNumber, vEndRange, vIsAlreadyNotified, vNotificationThrehold - FROM envialiaConfig; - - IF (vActualNumber+vNotificationThrehold) >= vEndRange AND - vIsAlreadyNotified = FALSE - THEN - CALL mail_insert( - 'cau@verdnatura.es', - NULL, - 'Hablar con envialia, acercandonos al numero final del rango permitido para las etiquetas', - CONCAT('Numero actual: ', vActualNumber, ' , numero final: ',vEndRange) - ); - UPDATE envialiaConfig SET isAlreadyNotified = TRUE; - END IF; - - IF (vActualNumber+vNotificationThrehold) < vEndRange AND - vIsAlreadyNotified = TRUE - THEN - UPDATE envialiaConfig SET isAlreadyNotified = FALSE; - END IF; - -END */ ;; -/*!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 `mysqlConnectionsSorter_kill` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `mysqlConnectionsSorter_kill` ON SCHEDULE EVERY 1 MINUTE STARTS '2021-10-28 09:56:27' ON COMPLETION NOT PRESERVE ENABLE DO CALL mysqlConnectionsSorter_kill() */ ;; -/*!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 `printQueue_check` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2022-01-28 09:52:46' ON COMPLETION PRESERVE ENABLE DO BEGIN - - DECLARE vCurrentCount INT; - DECLARE vCheckSum INT; - DECLARE vIsAlreadyNotified BOOLEAN; - DECLARE vTableQueue TEXT; - DECLARE vLineQueue TEXT; - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vCur CURSOR FOR - SELECT CONCAT(' - ', IFNULL(pq.id, ''), ' - ', IFNULL(p.path, ''),' - ', IFNULL(lr.name, ''),' - ', IFNULL(e.Estado, ''),' - ', IFNULL(w.firstname, ''), " ", IFNULL(w.lastName, ''),' - ', IFNULL(pq.`error`, ''),' - ') - FROM vn.printingQueue pq - LEFT JOIN vn.worker w ON w.id = pq.worker - LEFT JOIN vn.printer p ON p.id = pq.printer - LEFT JOIN vn.labelReport lr ON lr.id = pq.report - JOIN vn2008.Estados e ON e.Id_Estado = pq.state - LIMIT 30; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum - FROM vn.printingQueue WHERE state = 1; - - SELECT isAlreadyNotified INTO vIsAlreadyNotified - FROM printingQueueCheck; - - IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND - (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND - vIsAlreadyNotified = FALSE AND vCurrentCount > 0 - THEN - - SELECT ' - - - - - - - - ' INTO vTableQueue; - - OPEN vCur; - - l: LOOP - - SET vDone = FALSE; - - FETCH vCur INTO vLineQueue; - - IF vDone THEN - LEAVE l; - END IF; - - SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue; - - END LOOP; - - CLOSE vCur; - - CALL mail_insert( - 'cau@verdnatura.es', - NULL, - 'Servidor de impresion parado', - CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '
Id ColaRuta ImpresoraInformeEstadoTrabajadorError
') - ); - - UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; - END IF; - - IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND - vIsAlreadyNotified = TRUE - THEN - UPDATE printingQueueCheck SET isAlreadyNotified = FALSE; - END IF; - - UPDATE printingQueueCheck - SET lastCount = vCurrentCount, - lastCheckSum = vCheckSum; - -END */ ;; -/*!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 `route_doRecalc` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `route_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2021-07-08 07:32:23' ON COMPLETION PRESERVE ENABLE DO CALL route_doRecalc */ ;; -/*!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 `sale_checkWithoutComponents` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE DO call sale_checkNoComponents(DATE_ADD(NOW(), INTERVAL -10 MINUTE),DATE_ADD(NOW(), INTERVAL -1 MINUTE)) */ ;; -/*!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 `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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticketClosure` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-18 00:30:00' ON COMPLETION NOT PRESERVE DISABLE 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 */ ;; -/*!50106 DROP EVENT IF EXISTS `ticket_doRecalc` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticket_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2022-01-28 09:29:18' ON COMPLETION PRESERVE ENABLE DO CALL ticket_doRecalc */ ;; -/*!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 `travel_doRecalc` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `travel_doRecalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-05-17 10:52:29' ON COMPLETION PRESERVE ENABLE DO CALL travel_doRecalc */ ;; -/*!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 `workerTimeControl_sendMail` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `workerTimeControl_sendMail` ON SCHEDULE EVERY 1 WEEK STARTS '2020-11-25 08:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN - DECLARE vWeek,vYear INT; - - SELECT week,year INTO vWeek,vYear - FROM vn.time - WHERE dated IN (DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY)) - GROUP BY year,week - LIMIT 1; - - CALL vn.workerTimeControl_sendMail(vWeek, vYear, NULL); -END */ ;; -/*!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 `zoneGeo_doCalc` */;; -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_unicode_ci */ ;; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; -/*!50003 SET @saved_time_zone = @@time_zone */ ;; -/*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `zoneGeo_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-09-13 15:30:47' ON COMPLETION PRESERVE ENABLE DO CALL vn.zoneGeo_doCalc */ ;; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 `address_getGeo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `address_getGeo`(vSelf INT) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Returns the geo for the passed address. - * - * @param vSelf The address id - * @return The geo id - */ - DECLARE vGeoFk INT; - - SELECT p.geoFk INTO vGeoFk - FROM address a - JOIN town t ON t.provinceFk = a.provinceFk - JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode - WHERE a.id = vSelf - ORDER BY (a.city SOUNDS LIKE t.`name`) DESC - LIMIT 1; - - RETURN vGeoFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `barcodeToItem` */; -/*!50003 SET @saved_cs_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`@`localhost` FUNCTION `barcodeToItem`(vBarcode VARCHAR(22)) RETURNS int(11) - DETERMINISTIC -BEGIN - -/** - * Obtiene el id del artículo - * - * @param vBarcode código de barras - * - * return id del item - */ - - DECLARE vItemFk INT; - - SELECT id INTO vItemFk - FROM vn.item - WHERE id = vBarcode OR comment = vBarcode - LIMIT 1; - - IF vItemFk THEN - RETURN vItemFk; - END IF; - - SELECT itemFk INTO vItemFk - FROM buy - WHERE id = vBarcode; - - IF vItemFk THEN - RETURN vItemFk; - END IF; - - SELECT itemFk INTO vItemFk - FROM itemBarcode - WHERE code = vBarcode; - - IF vItemFk THEN - RETURN vItemFk; - END IF; - - SELECT i.id INTO vItemFk - FROM vn.item i - WHERE i.name LIKE CONCAT('%',vBarcode,'%') - ORDER BY i.id ASC - LIMIT 1; - - RETURN vItemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `bionicCalcReverse__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `bionicCalcReverse__`(vWarehouse INT, - vMargin DECIMAL(10,3), - vRetailedPrice DECIMAL(10,3), - vM3 DECIMAL(10,3), - vAddress INT, - vAgencyMode INT) RETURNS decimal(10,3) - DETERMINISTIC -BEGIN - - -- OBSOLETO usar catalog_componentReverse JGF 2020-02-26 - DECLARE vGeneralInflationCoeficient INT; - DECLARE vVerdnaturaVolumeBox BIGINT; - DECLARE vClientFk INT; - DECLARE vComponentRecovery VARCHAR(50) DEFAULT 'debtCollection'; - DECLARE vComponentMana VARCHAR(50) DEFAULT 'autoMana'; - DECLARE vComponentPort VARCHAR(50) DEFAULT 'delivery'; - DECLARE vComponentMargin VARCHAR(50) DEFAULT 'margin'; - DECLARE vComponentCost VARCHAR(50) DEFAULT 'purchaseValue'; - DECLARE vComponentCostValue DECIMAL(10,2); - DECLARE vItem INT DEFAULT 98; - DECLARE vItemCarryBox INT; - - CALL util.throw('Obsoleto hablar con Informática'); - - SELECT generalInflationCoeFicient, verdnaturaVolumeBox, itemCarryBox - INTO vGeneralInflationCoeficient, vVerdnaturaVolumeBox, vItemCarryBox - FROM bionicConfig; - - SELECT clientFk INTO vClientFk FROM address WHERE id = vAddress; - - -- Creamos la tabla tmp.bionicComponent - DROP TEMPORARY TABLE IF EXISTS tmp.bionicComponent; - CREATE TEMPORARY TABLE tmp.bionicComponent( - `warehouseFk` smallint(5) unsigned NOT NULL, - `itemFk` int(11) NOT NULL, - `componentFk` int(10) unsigned NOT NULL, - `value` decimal(10,4) NOT NULL, - UNIQUE KEY `itemWarehouseComponent` (`itemFk`,`warehouseFk`,`componentFk`) USING HASH, - KEY `itemWarehouse` (`itemFk`,`warehouseFk`) USING BTREE - ) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - - -- Margin - INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) - SELECT vWarehouse, vItem, id, vMargin - FROM component - WHERE code = vComponentMargin; - - -- Recobro - INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) - SELECT vWarehouse, vItem, c.id, ROUND(LEAST(cr.recobro,0.25), 3) - FROM bi.claims_ratio cr - JOIN component c ON c.code = vComponentRecovery - WHERE cr.Id_Cliente = vClientFk AND cr.recobro > 0.009; - - -- Componente de maná automático, en función del maná acumulado por el comercial. - INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) - SELECT vWarehouse, vItem, co.id, ROUND(ms.prices_modifier_rate, 3) - FROM client c - JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador - JOIN component co ON co.code = vComponentMana - WHERE ms.prices_modifier_activated AND c.id = vClientFk LIMIT 1; - - -- Reparto - INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) - SELECT vWarehouse, vItem, co.id, vGeneralInflationCoeficient - * ROUND( - vM3 - * az.price - * az.inflation - / vVerdnaturaVolumeBox, 4 - ) - FROM agencyMode ag - JOIN address a ON a.id = vAddress AND ag.id = vAgencyMode - JOIN agencyProvince ap ON ap.agencyFk = ag.agencyFk - AND ap.warehouseFk = vWarehouse AND ap.provinceFk = a.provinceFk - JOIN agencyModeZone az ON az.agencyModeFk = vAgencyMode - AND az.zone = ap.zone AND az.itemFk = 71 AND az.warehouseFk = vWarehouse - JOIN component co ON co.code = vComponentPort; - - -- Coste - SELECT vRetailedPrice - SUM(`value`) INTO vComponentCostValue - FROM tmp.bionicComponent; - - INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) - SELECT vWarehouse, vItem, id,vComponentCostValue - FROM component - WHERE code = vComponentCost; - - RETURN vComponentCostValue; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `botanicExport_isUpdatable` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT,vEdiSpecieFk MEDIUMINT, - vCountryFk MEDIUMINT,vRestriction MEDIUMINT) RETURNS int(11) - DETERMINISTIC -BEGIN - DECLARE vIsUpdatable INTEGER; - SELECT COUNT(*) INTO vIsUpdatable - FROM botanicExport - WHERE ediGenusFk = vEdiGenusFk - AND (vEdiSpecieFk = ediSpecieFk OR IFNULL(vEdiSpecieFk,ediSpecieFk) IS NULL) - AND (vCountryFk = countryFk OR IFNULL(vCountryFk,countryFk) IS NULL) - AND vRestriction = restriction; -RETURN vIsUpdatable; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `buy_getUnitVolume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getUnitVolume`(vSelf INT) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Calculates the unit volume occupied by a buy. - * - * @param vSelf The buy id - * @return The unit volume in cubic centimeters - */ - DECLARE vItem INT; - DECLARE vPackaging VARCHAR(10); - DECLARE vPacking INT; - - SELECT itemFk, packageFk, packing - INTO vItem, vPackaging, vPacking - FROM buy - WHERE id = vSelf; - - RETURN IFNULL(ROUND(item_getVolume(vItem, vPackaging) / vPacking), 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 FUNCTION IF EXISTS `buy_getVolume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getVolume`(vSelf INT) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Calculates the volume occupied by a buy. - * - * @param vSelf The buy id - * @return The volume in cubic centimeters - */ - DECLARE vItem INT; - DECLARE vPackaging VARCHAR(10); - - SELECT itemFk, packageFk INTO vItem, vPackaging - FROM buy - WHERE id = vSelf; - - RETURN item_getVolume(vItem, vPackaging); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `buy_hasNotifyPassport__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `buy_hasNotifyPassport__`(vBuyFk INT, vItemFk INT) RETURNS tinyint(1) - READS SQL DATA -BEGIN - DECLARE vHasPassport BOOL; - DECLARE vIsAlreadySent BOOL; - DECLARE vItemCategoryFk INT; - SELECT id INTO vItemCategoryFk FROM itemCategory WHERE code = 'plant'; - - SELECT COUNT(*) INTO vHasPassport - FROM botanicExport be - JOIN itemBotanical ib - ON be.ediGenusFk = ib.genusFk - AND IFNULL(be.ediSpecieFk, ib.specieFk) = ib.specieFk - AND be.`code` = 'phytosanitaryPassport' - JOIN item i ON i.id = ib.itemFk - JOIN itemType it ON it.id = i.typeFk - WHERE ib.itemFk = vItemFk - AND it.categoryFk = vItemCategoryFk; - - IF vHasPassport THEN - SELECT COUNT(*) INTO vIsAlreadySent - FROM mail m - JOIN buy b ON b.id = vBuyFk - WHERE m.`body` LIKE CONCAT('%', b.ektFk, '%') - LIMIT 1; - END IF; - - RETURN vHasPassport AND NOT vIsAlreadySent; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_componentReverse` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `catalog_componentReverse`(vWarehouse INT, - vCost DECIMAL(10,3), - vM3 DECIMAL(10,3), - vAddressFk INT, - vZoneFk INT) RETURNS decimal(10,3) - DETERMINISTIC -BEGIN - /* Calcula los componentes para un cliente a partir de un coste y volumen - * @param vWarehouse - * @param vCost Valor de coste del articulo - * @param vM3 m3 del articulo - * @param vAddressFk - * @param vZoneFk - * @return vRetailedPrice precio de venta sin iva - * @return tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - */ - - DECLARE vBoxVolume BIGINT; - DECLARE vCustomer INT; - DECLARE vComponentRecovery INT DEFAULT 17; - DECLARE vComponentMana INT DEFAULT 39; - DECLARE vDeliveryComponent INT DEFAULT 15; - DECLARE vComponentMargin INT DEFAULT 29; - DECLARE vComponentCost INT DEFAULT 28; - DECLARE vRetailedPrice DECIMAL(10,2); - DECLARE vItem INT DEFAULT 98; - - SELECT volume INTO vBoxVolume - FROM vn.packaging - WHERE id = '94'; - - SELECT clientFk INTO vCustomer FROM address WHERE id = vAddressFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.catalog_component; - CREATE TEMPORARY TABLE tmp.catalog_component ( - `warehouseFk` INT UNSIGNED NOT NULL, - `itemFk` INT NOT NULL, - `componentFk` INT UNSIGNED NOT NULL, - `cost` DECIMAL(10,4) NOT NULL, - INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), - UNIQUE INDEX `itemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC)); - - -- Cost - INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - SELECT vWarehouse, vItem, vComponentCost, vCost - FROM vn.rate - WHERE dated <= CURDATE() - AND warehouseFk = vWarehouse - ORDER BY dated DESC - LIMIT 1; - - -- Margen - -- No se aplica margen, cau 12589 -/* INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - SELECT vWarehouse, vItem, vComponentMargin, (vCost / ((100 - rate2) / 100)) - vCost - FROM vn.rate - WHERE dated <= CURDATE() - AND warehouseFk = vWarehouse - ORDER BY dated DESC - LIMIT 1; - */ - -- Recobro - INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - SELECT vWarehouse, vItem, vComponentRecovery, ROUND(LEAST(recobro,0.25), 3) - FROM bi.claims_ratio - WHERE Id_Cliente = vCustomer AND recobro > 0.009; - - -- Componente de maná automático, en función del maná acumulado por el comercial. - INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - SELECT vWarehouse, vItem, vComponentMana, ROUND(prices_modifier_rate, 3) - FROM client c - JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador - WHERE ms.prices_modifier_activated AND c.id = vCustomer LIMIT 1; - - -- Reparto - INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) - SELECT vWarehouse, vItem, vDeliveryComponent, - ROUND( - vM3 - * (z.price - z.bonus) - * z.inflation - / vBoxVolume, 4 - ) - FROM zone z - WHERE z.id = vZoneFk; - - -- Precio de venta - SELECT SUM(cost) INTO vRetailedPrice - FROM tmp.catalog_component; - - RETURN vRetailedPrice; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientGetDebt` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetDebt`(`vClient` INT, `vDate` DATE) RETURNS decimal(10,2) - READS SQL DATA -BEGIN -/** - * Devuelve el saldo de un cliente. - * - * @param vClient Identificador 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); - DECLARE vHasDebt BOOLEAN; - - SELECT COUNT(*) INTO vHasDebt - FROM `client` c - WHERE c.id = vClient AND c.typeFk = 'normal'; - - IF NOT vHasDebt THEN - RETURN 0; - END IF; - - SET vDate = IFNULL(vDate, CURDATE()); - - SET vDateIni = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET vDateEnd = TIMESTAMP(vDate, '23:59:59'); - - SELECT IFNULL(SUM(t.amount), 0) INTO vDebt - FROM ( - SELECT SUM(IFNULL(totalWithVat,0)) amount - FROM ticket - WHERE clientFk = vClient - AND refFk IS NULL - AND shipped BETWEEN vDateIni AND vDateEnd - UNION ALL - SELECT SUM(amountPaid) amount - FROM receipt - WHERE clientFk = vClient - AND payed > vDateEnd - UNION ALL - SELECT SUM(amount) - FROM clientRisk - WHERE clientFk = vClient - UNION ALL - SELECT CAST(-SUM(amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpvTransaction - WHERE clientFk = vClient - AND receiptFk IS NULL - AND `status` = 'ok' - ) t; - - 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 `clientGetMana` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetMana`(vClient INT) RETURNS decimal(10,2) - DETERMINISTIC -BEGIN -/** - * Devuelve el mana del cliente. - * - * @param vClient Id del cliente - * @return Mana del cliente - */ - DECLARE vMana DECIMAL(10,2); - DECLARE vFromDated DATE; - DECLARE vHasMana BOOLEAN; - DECLARE vManaComponent INT; - DECLARE vAutoManaComponent INT; - DECLARE vManaBank INT; - DECLARE vManaGreugeType INT; - - SELECT id INTO vManaGreugeType FROM greugeType WHERE code = 'mana'; - SELECT id INTO vManaBank FROM bank WHERE code = 'mana'; - SELECT id INTO vManaComponent FROM component WHERE code = 'mana'; - SELECT id INTO vAutoManaComponent FROM component WHERE code = 'autoMana'; - - SELECT COUNT(*) INTO vHasMana - FROM `client` c - WHERE c.id = vClient AND c.typeFk = 'normal'; - - IF NOT vHasMana THEN - RETURN 0; - END IF; - - SELECT max(dated) INTO vFromDated - FROM clientManaCache; - - SELECT sum(mana) INTO vMana - FROM - ( - SELECT mana - FROM clientManaCache - WHERE clientFk = vClient - AND dated = vFromDated - UNION ALL - SELECT s.quantity * value - FROM ticket t - JOIN address a ON a.id = t.addressFk - JOIN sale s on s.ticketFk = t.id - JOIN saleComponent sc on sc.saleFk = s.id - WHERE sc.componentFk IN (vManaComponent, vAutoManaComponent) - AND t.shipped > vFromDated - AND t.shipped < TIMESTAMPADD(DAY,1,CURDATE()) - AND a.clientFk = vClient - UNION ALL - SELECT - amountPaid - FROM receipt r - JOIN `client` c ON c.id = r.clientFk - WHERE r.bankFk = vManaBank - AND r.payed > vFromDated - AND r.payed <= CURDATE() - AND c.id = vClient - UNION ALL - SELECT g.amount - FROM greuge g - JOIN `client` c ON c.id = g.clientFk - WHERE g.greugeTypeFk = vManaGreugeType - AND g.shipped > vFromDated - AND g.shipped <= CURDATE() - AND c.id = vClient - ) sub; - RETURN IFNULL(vMana,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 FUNCTION IF EXISTS `clientGetSalesPerson` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * DEPRECATED: use client_getSalesPerson - **/ - RETURN client_getSalesPerson(vClientFk, vDated); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientTaxArea` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `clientTaxArea`(vClientId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8 - READS SQL DATA -BEGIN -/** - * Devuelve el area de un cliente, - * intracomunitario, extracomunitario o nacional. - * - * @param vClient Id del cliente - * @param vCompanyFk Compañia desde la que se factura - * @return Código de area - */ - 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 = 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'; - END IF; - - 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 `client_getFromPhone` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `client_getFromPhone`(vPhone VARCHAR(255)) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Searchs a customer associated to the phone number. - * - * @param vPhone The phone number - * @return The client id or %NULL if not found - */ - DECLARE vClient INT DEFAULT NULL; - - -- SET vPhone = vPhone COLLATE 'utf8_unicode_ci'; - - DROP TEMPORARY TABLE IF EXISTS tClient; - CREATE TEMPORARY TABLE tClient - ENGINE = MEMORY - SELECT id clientFk - FROM `client` - WHERE phone = vPhone - OR mobile = vPhone - UNION - SELECT clientFk - FROM address - WHERE phone = vPhone - OR mobile = 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.clientFk INTO vClient - FROM tClient t - JOIN `client` c ON c.id = t.clientFk - WHERE c.isActive - LIMIT 1; - - DROP TEMPORARY TABLE tClient; - - 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 `client_getSalesPerson` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Dado un id cliente y una fecha, devuelve su comercial para ese dia, teniendo - * en cuenta la jerarquía de las tablas: 1º la de sharingclient, 2º la de - * sharingcart y tercero la de clientes. - * - * @param vClientFk El id del cliente - * @param vDated Fecha a comprobar - * @return El id del comercial para la fecha dada - **/ - DECLARE vSalesPersonFk INT DEFAULT NULL; - DECLARE vWorkerSubstituteFk INT DEFAULT NULL; - DECLARE vLoop BOOLEAN; - - -- Obtiene el comercial original y el de sharingclient - - SELECT c.salesPersonFk, s.workerFk - INTO vSalesPersonFk, vWorkerSubstituteFk - FROM client c - LEFT JOIN sharingClient s - ON c.id = s.clientFk - AND vDated BETWEEN s.started AND s.ended - WHERE c.id = vClientFk - ORDER BY s.id - LIMIT 1; - - -- Si no hay ninguno en sharingclient busca en sharingcart - - IF vWorkerSubstituteFk IS NOT NULL - THEN - SET vSalesPersonFk = vWorkerSubstituteFk; - ELSEIF vSalesPersonFk IS NOT NULL - THEN - DROP TEMPORARY TABLE IF EXISTS tmp.stack; - CREATE TEMPORARY TABLE tmp.stack - (INDEX (substitute)) - ENGINE = MEMORY - SELECT vSalesPersonFk substitute; - - l: LOOP - SELECT workerSubstitute INTO vWorkerSubstituteFk - FROM sharingCart - WHERE curdate() BETWEEN started AND ended - AND workerFk = vSalesPersonFk - ORDER BY id - LIMIT 1; - - IF vWorkerSubstituteFk IS NULL THEN - LEAVE l; - END IF; - - SELECT COUNT(*) > 0 INTO vLoop - FROM tmp.stack WHERE substitute = vWorkerSubstituteFk; - - IF vLoop THEN - LEAVE l; - END IF; - - INSERT INTO tmp.stack SET - substitute = vWorkerSubstituteFk; - - SET vSalesPersonFk = vWorkerSubstituteFk; - END LOOP; - - DROP TEMPORARY TABLE tmp.stack; - END IF; - - RETURN vSalesPersonFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `client_getSalesPersonByTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonByTicket`(vTicketFk INT) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Dado un id ticket, devuelve su comercial. - * Para más información ir a client_getSalesPerson() - * - * @param vClientFk El id del cliente - * @param vDated Fecha a comprobar - * @return El id del comercial para la fecha dada - **/ - DECLARE vClientFk INT; - DECLARE vDated DATE; - - SELECT clientFk, shipped - INTO vClientFk, vDated - FROM ticket WHERE id = vTicketFk; - - RETURN client_getSalesPerson(vClientFk, vDated); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `client_getSalesPersonCode` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonCode`(vClientFk INT, vDated DATE) RETURNS varchar(3) CHARSET utf8 - DETERMINISTIC -BEGIN -/** - * Dado un id cliente y una fecha, devuelve su comercial. - * Para más información ir a client_getSalesPerson() - * - * @param vClientFk El id del cliente - * @param vDated Fecha a comprobar - * @return El código del comercial para la fecha dada - **/ - DECLARE vWorkerCode CHAR(3); - DECLARE vSalesPersonFk INT; - - SET vSalesPersonFk = client_getSalesPerson(vClientFk, vDated); - - SELECT code - INTO vWorkerCode - FROM worker - WHERE id = vSalesPersonFk; - - RETURN vWorkerCode; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `client_getSalesPersonCodeByTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonCodeByTicket`(vTicketFk INT) RETURNS varchar(3) CHARSET utf8 - DETERMINISTIC -BEGIN -/** - * Dado un id ticket, devuelve su comercial. - * Para más información ir a client_getSalesPerson() - * - * @param vClientFk El id del cliente - * @param vDated Fecha a comprobar - * @return El código del comercial para la fecha dada - **/ - DECLARE vClientFk INT; - DECLARE vDated DATE; - - SELECT clientFk, shipped - INTO vClientFk, vDated - FROM ticket WHERE id = vTicketFk; - - RETURN client_getSalesPersonCode(vClientFk, vDated); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collectionExpeditionLacks` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `collectionExpeditionLacks`(vCollectionFk INT) RETURNS varchar(100) CHARSET utf8 COLLATE utf8_unicode_ci - DETERMINISTIC -BEGIN - - DECLARE vExpeditionLacks BOOL; - DECLARE vAnswer VARCHAR(100) DEFAULT ''; - - SELECT (COUNT(*) > 0) INTO vExpeditionLacks - FROM vn.ticketCollection tc - LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND ISNULL(e.id); - - IF vExpeditionLacks THEN - - SELECT CONCAT('Colección: ',tc.collectionFk,' Tickets: ' , GROUP_CONCAT(tc.ticketFk) ) INTO vAnswer - FROM vn.ticketCollection tc - LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND ISNULL(e.id); - - END IF; - - RETURN vAnswer; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `currentRate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `currentRate`(vCurrencyFk INT, vDated DATE) RETURNS decimal(10,4) - READS SQL DATA -BEGIN - - DECLARE curRate DECIMAL(10,4); - - SELECT value INTO curRate - FROM referenceRate - WHERE dated <= vDated - AND currencyFk = vCurrencyFk - ORDER BY dated DESC - LIMIT 1; - -RETURN curRate; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `deviceProductionUser_accessGranted` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `deviceProductionUser_accessGranted`(vUserFK INT(10) , android_id VARCHAR(50)) RETURNS tinyint(1) - DETERMINISTIC -BEGIN - /* - * Comprueba si el usuario puede entrar en la aplicacion de almacen con ese movil - * - * */ - - /*DECLARE vIsGranted BOOLEAN; - DECLARE vDeviceProductionFk INT(11) DEFAULT NULL; - - SELECT dp.id INTO vDeviceProductionFk - FROM vn.deviceProduction dp - WHERE dp.android_id = android_id; - - IF vDeviceProductionFk THEN - - SELECT COUNT(*) INTO vIsGranted - FROM vn.deviceProductionUser dpu - WHERE dpu.userFk = vUserFK - AND dpu.deviceProductionFk = vDeviceProductionFk; - - RETURN vIsGranted; - END IF;*/ - RETURN 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 FUNCTION IF EXISTS `duaTax_getRate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `duaTax_getRate`(vDua INT, vTaxClass INT) RETURNS decimal(5,2) - DETERMINISTIC -BEGIN - DECLARE vCountryFk INTEGER; - - SELECT s.countryFk INTO vCountryFk - FROM dua d - JOIN supplier s ON s.id = d.companyFk - WHERE d.id = vDua; - - RETURN (SELECT rate - FROM - (SELECT taxClassFk, rate - FROM invoiceInTaxBookingAccount - WHERE effectived <= CURDATE() - AND countryFk = vCountryFk - AND taxClassFk = vTaxClass - ORDER BY effectived DESC - ) ba1 - GROUP BY taxClassFk); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ekt_getEntry` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getEntry`(vEktFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - /** - * Devuelve el numero de entrada para el ekt - * - * @param vEktFk Identificador de edi.ekt - */ - - DECLARE vTravelFk INT; - DECLARE vEntryFk INT DEFAULT 0; - DECLARE vEntryAssignFk INT; - - SET vTravelFk = vn.ekt_getTravel(vEktFk); - - IF vTravelFk THEN - - SELECT ea.id INTO vEntryAssignFk - FROM edi.ekt e - JOIN vn.travel tr ON tr.id = vTravelFk - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - AND IFNULL(ea.sub, e.sub) <=> e.sub - AND IFNULL(ea.kop, e.kop) <=> e.kop - AND IFNULL(ea.pro, e.pro) <=> e.pro - WHERE e.id = vEktFk - ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC - LIMIT 1; - - SELECT MAX(e.id) INTO vEntryFk - FROM vn.entry e - JOIN vn.ektEntryAssign ea ON ea.id = vEntryAssignFk - WHERE e.travelFk = vTravelFk - AND e.sub <=> ea.sub - AND e.kop <=> ea.kop - AND e.pro <=> ea.pro; - - - IF IFNULL(vEntryFk,0) = 0 THEN - - INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk, kop, sub, ref, pro) - SELECT vTravelFk, ea.supplierFk, c.id, cu.id, ea.kop, ea.sub, ea.ref, ea.pro - FROM vn.ektEntryAssign ea - JOIN vn.company c ON c.code = 'VNL' - JOIN vn.currency cu ON cu.code = 'EUR' - WHERE ea.id = vEntryAssignFk; - - SELECT MAX(id) INTO vEntryFk - FROM vn.entry - WHERE travelFk = vTravelFk; - - END IF; - - UPDATE vn.ektEntryAssign - SET entryFk = vEntryFk - WHERE id = vEntryAssignFk; - - ELSE - - SELECT ec.defaultEntry INTO vEntryFk - FROM vn.entryConfig ec; - - INSERT IGNORE INTO vn.entry(id) VALUES(vEntryFk); - - END IF; - - RETURN vEntryFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ekt_getTravel` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getTravel`(vEktFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - DECLARE vTravelFk INT; - DECLARE vEntryAssignFk INT; - - SELECT ea.id INTO vEntryAssignFk - FROM edi.ekt e - JOIN vn.ektEntryAssign ea ON IFNULL(ea.sub, e.sub) <=> e.sub - AND IFNULL(ea.kop, e.kop) <=> e.kop - AND IFNULL(ea.pro, e.pro) <=> e.pro - WHERE e.id = vEktFk - ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC - LIMIT 1; - - SELECT MAX(tr.id) INTO vTravelFk - FROM vn.travel tr - JOIN vn.ektEntryAssign ea ON ea.id = vEntryAssignFk - JOIN edi.ekt e ON e.id = vEktFk - WHERE ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - AND tr.landed = e.fec; - - /* - SELECT tr.id INTO vTravelFk - FROM vn.travel tr - JOIN edi.ekt e ON e.id = vEktFk - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - AND (ea.sub = e.sub OR ea.kop = e.kop OR ea.pro = e.pro) - AND tr.landed = e.fec - ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC - LIMIT 1; - */ - - - - IF NOT vTravelFk THEN - - INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) - SELECT e.fec, e.fec, ea.warehouseInFk, ea.warehouseOutFk, ea.agencyModeFk - FROM edi.ekt e - JOIN vn.ektEntryAssign ea ON ea.kop = e.kop - WHERE e.id = vEktFk - ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC - LIMIT 1; - - SELECT MAX(id) INTO vTravelFk - FROM vn.travel tr - JOIN edi.ekt e ON e.id = vEktFk - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - AND IFNULL(ea.sub, e.sub) <=> e.sub - AND IFNULL(ea.kop, e.kop) <=> e.kop - AND IFNULL(ea.pro, e.pro) <=> e.pro - AND tr.landed = e.fec; - - END IF; - - RETURN vTravelFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entry_calcCommission__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_calcCommission__`( - vCurrentCommission INT, - vTravelFk INT, - vCurrencyFk INT -) RETURNS int(11) - READS SQL DATA -BEGIN - -- DEPRECATED: use entry_getComission - DECLARE vCommission INT; - - IF vCurrencyFk != 2 /* Dollar */ THEN - RETURN vCurrentCommission; - END IF; - - SELECT ROUND(-100 * (1 - (1 / r.rate))) INTO vCommission - FROM travel t - LEFT JOIN vn2008.reference_min r - ON r.moneda_id = vCurrencyFk AND r.`date` <= t.shipped - WHERE t.id = vTravelFk - ORDER BY r.`date` DESC - LIMIT 1; - - SET vCommission = IFNULL(vCommission, 0); - - RETURN vCommission; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entry_getCommission` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission`( - vTravelFk INT, - vCurrencyFk INT, - vSupplierFk INT -) RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE vCommission INT; - DECLARE vCurrentCommission INT; - DECLARE vIsCurrencyUsd INT; - DECLARE vLastEntryFk INT; - - SELECT count(*) INTO vIsCurrencyUsd - FROM currency c - WHERE c.code = 'USD' AND id = vCurrencyFk; - - IF NOT vIsCurrencyUsd THEN - - SELECT e.id INTO vLastEntryFk - FROM vn.entry e - JOIN vn.travel tr ON tr.id = e.travelFk - WHERE e.supplierFk = vSupplierFk - ORDER BY tr.landed DESC - LIMIT 1; - - IF vLastEntryFk THEN - - SELECT commission INTO vCurrentCommission - FROM vn.entry - WHERE id = vLastEntryFk; - - ELSE - - SELECT commission INTO vCurrentCommission - FROM supplier s - WHERE s.id = vSupplierFk; - - END IF; - - RETURN vCurrentCommission; - - ELSE - - SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission - FROM travel t - LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped - WHERE t.id = vTravelFk - ORDER BY r.`dated` DESC - LIMIT 1; - - RETURN IFNULL(vCommission, 0); - - 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 FUNCTION IF EXISTS `entry_getCommission__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission__`( - vTravelFk INT, - vCurrencyFk INT, - vSupplierFk INT -) RETURNS int(11) - READS SQL DATA -BEGIN - -- bernat: working in this file - DECLARE vCommission INT; - DECLARE vCurrentCommission INT; - DECLARE vIsCurrencyUsd INT; - - SELECT count(*) INTO vIsCurrencyUsd - FROM currency c - WHERE c.code = 'USD' AND id = vCurrencyFk; - - IF NOT vIsCurrencyUsd THEN - SELECT commission INTO vCurrentCommission - FROM supplier s - WHERE s.id = vSupplierFk; - RETURN vCurrentCommission; - END IF; - - SELECT ROUND(-100 * (1 - (1 / r.rate))) INTO vCommission - FROM travel t - LEFT JOIN vn2008.reference_min r ON r.moneda_id = vCurrencyFk AND r.`date` <= t.shipped - WHERE t.id = vTravelFk - ORDER BY r.`date` DESC - LIMIT 1; - - RETURN IFNULL(vCommission, 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 FUNCTION IF EXISTS `entry_getCurrency` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCurrency`( - vCurrency INT, - vSupplierFk INT -) RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE vIsDollarAccount BOOL; - - SELECT account LIKE '___4______' INTO vIsDollarAccount - FROM vn.supplier WHERE id = vSupplierFk; - - IF vIsDollarAccount THEN - RETURN 2; - ELSE - RETURN vCurrency; - 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 FUNCTION IF EXISTS `entry_getForLogiflora` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - /** - * Devuelve una entrada para Logiflora. Si no existe la crea. - * - * @param vLanded Fecha de llegada al almacén - * @param vWarehouseFk Identificador de vn.warehouse - */ - - DECLARE vTravelFk INT; - DECLARE vEntryFk INT; - DECLARE previousEntryFk INT; - - SET vTravelFk = vn.travel_getForLogiflora(vLanded, vWarehouseFk); - - IF vLanded THEN - - SELECT IFNULL(MAX(id),0) INTO vEntryFk - FROM vn.entry - WHERE travelFk = vTravelFk - AND isRaid; - - IF NOT vEntryFk THEN - - INSERT INTO vn.entry(travelFk, supplierFk, commission, companyFk, currencyFk, isRaid) - SELECT vTravelFk, s.id, 4, c.id, cu.id, TRUE - FROM vn.supplier s - JOIN vn.company c ON c.code = 'VNL' - JOIN vn.currency cu ON cu.code = 'EUR' - WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN'; - - SELECT MAX(id) INTO vEntryFk - FROM vn.entry - WHERE travelFk = vTravelFk; - - END IF; - - END IF; - - SELECT entryFk INTO previousEntryFk - FROM edi.warehouseFloramondo wf - WHERE wf.warehouseFk = vWarehouseFk; - - IF IFNULL(previousEntryFk,0) != vEntryFk THEN - - DELETE FROM buy WHERE entryFk = previousEntryFk; - - DELETE FROM entry WHERE id = previousEntryFk; - - END IF; - - RETURN vEntryFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expedition_checkRoute` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `expedition_checkRoute`(vPalletFk INT,vExpeditionFk INT) RETURNS tinyint(1) - DETERMINISTIC -BEGIN -/** -* Comprueba si las expediciones del pallet son todas -* de la misma ruta. -* -* @param vExpeditionFk numero de expedition a comprobar -* @param vPalletFk numero de pallet -* @return vHasDistinctRoutes -*/ - DECLARE vRouteFk INT; - DECLARE vHasDistinctRoutes BOOL; - - SELECT t.routeFk INTO vRouteFk - FROM vn.expedition e - JOIN vn.ticket t ON e.ticketFk = t.id - WHERE e.id = vExpeditionFk; - - SELECT COUNT(*) > 0 INTO vHasDistinctRoutes - FROM vn.expeditionScan es - JOIN vn.expedition e ON es.expeditionFk = e.id - JOIN vn.ticket t ON e.ticketFk = t.id - WHERE es.palletFk = vPalletFk - AND t.routeFk <> vRouteFk; - - RETURN vHasDistinctRoutes; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `firstDayOfWeek` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `firstDayOfWeek`(vYear INT, vWeek INT) RETURNS date - DETERMINISTIC -BEGIN -/** - * Returns the date of the first day of the week - * - * @param vYear The year - * @param vWeek The week number - * @return Date of the first day of the week - */ - DECLARE vDate DATE; - - SELECT dated INTO vDate - FROM `time` - WHERE `year` = vYear - AND `week` = vWeek - ORDER BY dated - LIMIT 1; - - RETURN 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 `getAlert3State` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3State`(vTicket INT) RETURNS varchar(45) CHARSET utf8 COLLATE utf8_unicode_ci - READS SQL DATA -BEGIN - DECLARE vDeliveryType INTEGER DEFAULT 0; - DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; - DECLARE vCode VARCHAR(45); - - SELECT am.deliveryMethodFk - INTO vDeliveryType - FROM ticket t - JOIN agencyMode am ON am.id = t.agencyModeFk - WHERE t.id = vTicket; - - CASE vDeliveryType - WHEN 1 THEN -- AGENCIAS - SET vCode = 'DELIVERED'; - - WHEN 2 THEN -- REPARTO - SET vCode = 'ON_DELIVERY'; - - ELSE -- MERCADO, OTROS - SELECT MIN(t.warehouseFk <> w.id) INTO isWaitingForPickUp - FROM ticket t - LEFT JOIN warehouse w - ON w.pickUpagencyModeFk = t.agencyModeFk - WHERE t.id = vTicket; - - IF isWaitingForPickUp THEN - SET vCode = 'WAITING_FOR_PICKUP'; - ELSE - SET vCode = 'DELIVERED'; - END IF; - END CASE; - RETURN 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 */ ; -/*!50003 DROP FUNCTION IF EXISTS `getAlert3StateTest` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3StateTest`(vTicket INT) RETURNS varchar(45) CHARSET latin1 - READS SQL DATA -BEGIN - DECLARE vDeliveryType INTEGER DEFAULT 0; - DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; - DECLARE vCode VARCHAR(45); - - SELECT - a.Vista - INTO vDeliveryType - FROM vn2008.Tickets t - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - WHERE Id_Ticket = vTicket; - - CASE vDeliveryType - WHEN 1 THEN -- AGENCIAS - SET vCode = 'DELIVERED'; - - WHEN 2 THEN -- REPARTO - SET vCode = 'ON_DELIVERY'; - - ELSE -- MERCADO, OTROS - SELECT t.warehouse_id <> w.warehouse_id INTO isWaitingForPickUp - FROM vn2008.Tickets t - LEFT JOIN vn2008.warehouse_pickup w - ON w.agency_id = t.Id_Agencia AND w.warehouse_id = t.warehouse_id - WHERE t.Id_Ticket = vTicket; - - IF isWaitingForPickUp THEN - SET vCode = 'WAITING_FOR_PICKUP'; - ELSE - SET vCode = 'DELIVERED'; - END IF; - END CASE; - RETURN 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 */ ; -/*!50003 DROP FUNCTION IF EXISTS `getAlert3State__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3State__`(vTicket INT) RETURNS varchar(45) CHARSET utf8 COLLATE utf8_unicode_ci - READS SQL DATA -BEGIN - DECLARE vDeliveryType INTEGER DEFAULT 0; - DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; - DECLARE vCode VARCHAR(45); - - SELECT a.Vista - INTO vDeliveryType - FROM vn2008.Tickets t - JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - WHERE Id_Ticket = vTicket; - - CASE vDeliveryType - WHEN 1 THEN -- AGENCIAS - SET vCode = 'DELIVERED'; - - WHEN 2 THEN -- REPARTO - SET vCode = 'ON_DELIVERY'; - - ELSE -- MERCADO, OTROS - SELECT MIN(t.warehouse_id <> w.warehouse_id) INTO isWaitingForPickUp - FROM vn2008.Tickets t - LEFT JOIN vn2008.warehouse_pickup w - ON w.agency_id = t.Id_Agencia - WHERE t.Id_Ticket = vTicket; - - IF isWaitingForPickUp THEN - SET vCode = 'WAITING_FOR_PICKUP'; - ELSE - SET vCode = 'DELIVERED'; - END IF; - END CASE; - RETURN 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 */ ; -/*!50003 DROP FUNCTION IF EXISTS `getDueDate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getDueDate`(vDated DATE, vDayToPay INT) RETURNS date - NO SQL -BEGIN - DECLARE vDued DATE; - - IF vDayToPay = 0 THEN - RETURN vDated; - END IF; - - SET vDued = TIMESTAMPADD(DAY,vDayToPay MOD 30, LAST_DAY(TIMESTAMPADD(MONTH, vDayToPay DIV 30, vDated))); - - RETURN vDued; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getInventoryDate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getInventoryDate`() RETURNS date - DETERMINISTIC -BEGIN - RETURN vn2008.date_inv(); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getNewItemId` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getNewItemId`() RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE newItemId INT; - - SELECT i1.id + 1 INTO newItemId - FROM item i1 - LEFT JOIN item i2 ON i1.id + 1 = i2.id - WHERE i2.id IS NULL - ORDER BY i1.id - LIMIT 1; - - RETURN newItemId; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getNextDueDate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getNextDueDate`(vDated DATE, vGapDays INT, vPayDay INT) RETURNS date - NO SQL -BEGIN - - DECLARE vReturn DATE; - DECLARE vDuaDate DATE; - DECLARE vDuaDateDay INT; - - SELECT TIMESTAMPADD(DAY, vGapDays, vDated) INTO vDuaDate; - - IF vDuaDate = CONCAT(YEAR(vDuaDate), '-03-01') THEN - SET vDuaDate = TIMESTAMPADD (DAY , -1, vDuaDate); - ELSEIF vDuaDate = CONCAT(YEAR(vDuaDate), '-02-29') THEN - SET vDuaDate = TIMESTAMPADD (DAY , -2, vDuaDate); - END IF; - - IF MONTH(vDuaDate) = 2 AND vPayDay = 30 THEN - IF util.isLeapYear(YEAR(vDuaDate)) THEN - SET vPayDay = 29; - ELSE - SET vPayDay = 28; - END IF; - END IF; - - SELECT DAY(vDuaDate) INTO vDuaDateDay; - RETURN TIMESTAMPADD(MONTH, (vDuaDateDay > vPayDay), DATE_FORMAT(vDuaDate, CONCAT('%y/%m/', vPayDay))); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getPlacementReserve` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getPlacementReserve`(vItemFk INT, vWarehouseFk INT) RETURNS varchar(25) CHARSET utf8 - READS SQL DATA -BEGIN - DECLARE vPlacementReserve VARCHAR(25); - - SELECT CONCAT(IFNULL(`code`,'--'), ' / ', IFNULL(reserve,'--')) INTO vPlacementReserve - FROM itemPlacement - WHERE itemFk = vItemFk - AND warehouseFk = vWarehouseFk; - - RETURN vPlacementReserve; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getShipmentHour` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getShipmentHour`(vTicket INT) RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE vShipmentHour INT; - - SELECT HOUR(shipped) INTO vShipmentHour - FROM ticket - WHERE id = vTicket; - - IF vShipmentHour = 0 - THEN - DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; - CREATE TEMPORARY TABLE tmp.production_buffer - ENGINE = MEMORY - SELECT am.agencyFk as agency_id - , t.warehouseFk as warehouse_id - , a.provinceFk as province_id - , 0 as Hora - , 0 as Departure - FROM ticket t - JOIN agencyMode am on am.id = t.agencyModeFk - JOIN address a on a.id = t.addressFk - WHERE t.id = vTicket; - - SELECT Hora INTO vShipmentHour - FROM tmp.production_buffer; - END IF; - - RETURN vShipmentHour; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getSpecialPrice` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getSpecialPrice`(vItemFk int(11),vClientFk int(11)) RETURNS decimal(10,2) - READS SQL DATA -BEGIN - DECLARE price DECIMAL(10,2); - - SELECT rate3 INTO price - FROM vn.priceFixed - WHERE itemFk = vItemFk - AND CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1; - - SELECT `value` INTO price - FROM vn.specialPrice - WHERE itemFk = vItemFk - AND clientFk = vClientFk ; -RETURN price; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getTicketToPrepare` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getTicketToPrepare`(`vWorker` INT, `vWarehouse` INT) RETURNS int(11) - READS SQL DATA -BEGIN -/** - * Devuelve el ticket que debe de preparar el trabajador - * - * @param vWorker Id del trabajador - * @param vWarehouse Id del almacén - * @return Id del ticket - * - * #UPDATED PAK 2019/08/16 - * #PENDING REVIEW - **/ - - DECLARE vToday DATETIME DEFAULT CURDATE(); - DECLARE vYesterday DATETIME; - DECLARE vTodayvMidniight DATETIME DEFAULT midnight(vToday); - DECLARE vTicket INT DEFAULT NULL; - DECLARE PREVIOUS_PREPARATION INT; - DECLARE vHasBeenPreviouslyPrepared INT DEFAULT 0; - - -- Si hay algun ticket previamente seleccionado, y se ha quedado sin empezar, lo recupera en primer lugar. - /* - SELECT i.Id_Ticket INTO vTicket - FROM vncontrol.inter i - JOIN vn.state s ON s.id = i.state_id - LEFT JOIN - (SELECT DISTINCT s.ticketFk - FROM vn.sale s - JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.ticketStateToday tst ON tst.ticket = s.ticketFk - WHERE st.created > CURDATE() - -- AND tst.`code` = 'ON_PREPARATION' - ) sub ON sub.ticketFk = i.Id_Ticket - WHERE odbc_date > CURDATE() - AND s.`code` = 'ON_PREPARATION' - AND i.Id_Trabajador = vWorker - AND sub.ticketFk IS NULL - LIMIT 1; - - IF vTicket IS NULL THEN - */ - SELECT id INTO PREVIOUS_PREPARATION - FROM vn.state - WHERE code LIKE 'PREVIOUS_PREPARATION'; - - SET vYesterday = TIMESTAMPADD(DAY,-1,vToday); - - DROP TEMPORARY TABLE IF EXISTS tmp.workerComercial; - CREATE TEMPORARY TABLE tmp.workerComercial - ENGINE = MEMORY - SELECT workerFk as worker FROM `grant` g - JOIN grantGroup gg ON g.`groupFk` = gg.id - WHERE gg.description = 'Comerciales'; - - DELETE wc.* - FROM tmp.workerComercial wc - JOIN `grant` g ON g.workerFk = wc.worker - JOIN grantGroup gg ON g.`groupFk` = gg.id - WHERE gg.description = 'Gerencia'; - - DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; - CREATE TEMPORARY TABLE tmp.production_buffer - ENGINE = MEMORY - SELECT t.id as ticket - , am.agencyFk as agency_id - , t.warehouseFk as warehouse_id - , a.provinceFk as province_id - , IF (HOUR(t.shipped),HOUR(t.shipped),HOUR(z.`hour`)) as Hora - , HOUR(t.shipped) as Departure - , IF (MINUTE(t.shipped),MINUTE(t.shipped),MINUTE(z.`hour`)) as Minuto - , tls.code - , IFNULL(t.priority,0) loadingOrder - FROM ticket t - JOIN ticketState tls on t.id = tls.ticket - 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 - LEFT JOIN vn.zone z ON z.id = t.zoneFk - WHERE t.shipped BETWEEN vYesterday AND vTodayvMidniight - AND t.warehouseFk = vWarehouse - AND - ( - (tls.code = 'PRINTED' AND wc.worker IS NULL) - OR - (tls.code ='PICKER_DESIGNED' AND tls.worker = vWorker) - OR - (tls.code = 'PRINTED_BACK') - OR - (tls.code = 'PRINTED PREVIOUS') - ); - - - SELECT ticket INTO vTicket - FROM tmp.production_buffer - ORDER BY (code = 'PICKER_DESIGNED') DESC, (code = 'PRINTED PREVIOUS') DESC ,Hora, Minuto, loadingOrder - LIMIT 1; - - -- Aviso de ticket para bajar - SELECT COUNT(*) INTO vHasBeenPreviouslyPrepared - FROM vncontrol.inter - WHERE Id_Ticket = vTicket - AND state_id = PREVIOUS_PREPARATION; - - IF vHasBeenPreviouslyPrepared AND ticketWarehouseGet(vTicket) = 1 THEN - - INSERT IGNORE INTO vn.ticketDown(ticketFk) VALUES(vTicket); - - END IF; - - -- END IF; - - 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 */ ; -/*!50003 DROP FUNCTION IF EXISTS `getTicketTrolleyLabelCount` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getTicketTrolleyLabelCount`(vTicket INT) RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE vLabelCount INT DEFAULT 0; - - SELECT labelCount INTO vLabelCount - FROM ticketTrolley - WHERE ticket = vTicket; - - SET vLabelCount = vLabelCount +1 ; - - REPLACE ticketTrolley(ticket,labelCount) - SELECT vTicket, vLabelCount; - - RETURN vlabelCount; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getUser` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getUser`() RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * @deprecated Use account.userGetId() - */ - RETURN account.userGetId(); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getUserId` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getUserId`(userName varchar(30)) RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE vUser INT; - - SELECT id INTO vUser - FROM account.user - WHERE `name` = userName; - - 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 `getWorkerCode` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getWorkerCode`() RETURNS varchar(3) CHARSET utf8 - READS SQL DATA -BEGIN - DECLARE vUserCode VARCHAR(3) CHARSET utf8 COLLATE utf8_unicode_ci; - - SELECT code INTO vUserCode - FROM worker - WHERE userFk = account.userGetId(); - - RETURN vUserCode; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getWorker__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `getWorker__`() RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * @deprecated Use myWorker_getId() - */ - DECLARE vUser INT; - - SELECT id INTO vUser - FROM worker - WHERE userFk = account.userGetId(); - - 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 `hasAnyNegativeBase` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `hasAnyNegativeBase`() RETURNS tinyint(1) - DETERMINISTIC -BEGIN - -/* Calcula si existe alguna base imponible negativa -* Requiere la tabla temporal vn.ticketToInvoice(id) -* -* returns BOOLEAN -*/ - DECLARE hasAnyNegativeBase BOOLEAN; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - (KEY (ticketFk)) - ENGINE = MEMORY - SELECT id ticketFk - FROM ticketToInvoice; - - CALL ticket_getTax(NULL); - - SELECT COUNT(*) INTO hasAnyNegativeBase - FROM( - SELECT SUM(taxableBase) as taxableBase - FROM tmp.ticketTax - GROUP BY pgcFk - HAVING taxableBase < 0 - ) t; - - DROP TEMPORARY TABLE tmp.ticketTax; - DROP TEMPORARY TABLE tmp.ticket; - - RETURN hasAnyNegativeBase; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `hasAnyNegativeBase__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `hasAnyNegativeBase__`() RETURNS tinyint(1) - DETERMINISTIC -BEGIN - -/* Calcula si existe alguna base imponible negativa -* Requiere la tabla temporal vn.ticketToInvoice(id) -* -* returns BOOLEAN -*/ - - DECLARE vCountry INT; - DECLARE hasAnyNegativeBase BOOLEAN; - - SELECT s.countryFk - INTO vCountry - FROM supplier s - JOIN ticket t ON t.companyFk = s.id - JOIN vn.ticketToInvoice tl ON tl.id = t.id - LIMIT 1; - - SELECT COUNT(*) INTO hasAnyNegativeBase - FROM ( - SELECT SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2)) taxableBase - FROM sale s - JOIN item i ON i.id = s.itemFk - JOIN itemTaxCountry itc - ON itc.itemFk = i.id AND itc.countryFk = vCountry - JOIN vn.ticketToInvoice tl ON tl.id = s.ticketFk - GROUP BY itc.taxClassFk - HAVING taxableBase < 0 - ) t1 ; - - RETURN hasAnyNegativeBase; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `hasItemsInSector` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `hasItemsInSector`(vTicketFk INT, vSectorFk INT) RETURNS tinyint(1) - DETERMINISTIC -BEGIN - - DECLARE vItemCount INT; - - SELECT count(*) INTO vItemCount - FROM vn.sale s - JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - WHERE s.ticketFk = vTicketFk - AND p.sectorFk = vSectorFk; - - RETURN vItemCount; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `hasSomeNegativeBase` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `hasSomeNegativeBase`(vTicket INT) RETURNS tinyint(1) - READS SQL DATA -BEGIN - DECLARE vCountry INT; - DECLARE hasSomeNegativeBase BOOLEAN; - - SELECT s.countryFk - INTO vCountry - FROM supplier s - JOIN ticket t ON t.companyFk = s.id - WHERE t.id = vTicket; - - SELECT COUNT(*) INTO hasSomeNegativeBase - FROM ( - SELECT SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2)) taxableBase - FROM sale s - JOIN item i ON i.id = s.itemFk - JOIN itemTaxCountry itc - ON itc.itemFk = i.id AND itc.countryFk = vCountry - WHERE s.ticketFk = vTicket - GROUP BY itc.taxClassFk - HAVING taxableBase < 0 - ) t1 ; - - RETURN hasSomeNegativeBase; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceOutAmount` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOutAmount`(vInvoiceRef VARCHAR(15)) RETURNS decimal(10,2) - READS SQL DATA -BEGIN - DECLARE totalAmount DECIMAL(10,2); - - SELECT SUM(vat) INTO totalAmount - FROM ( - SELECT iot.vat - FROM invoiceOutTax iot - JOIN invoiceOut io ON io.id = iot.invoiceOutFk - WHERE io.ref = vInvoiceRef - UNION ALL - SELECT ioe.amount - FROM invoiceOutExpence ioe - JOIN invoiceOut io ON io.id = ioe.invoiceOutFk - WHERE io.ref = vInvoiceRef - ) t1; - - RETURN totalAmount; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceOut_getPath` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getPath`(vSelf INT) RETURNS varchar(255) CHARSET utf8 - DETERMINISTIC -BEGIN - DECLARE vIssued DATE; - DECLARE vSerial VARCHAR(15); - - SELECT issued, ref - INTO vIssued, vSerial - FROM invoiceOut WHERE id = vSelf; - - 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 `invoiceSerial` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerial`(vClientFk INT, vCompanyFk INT, vType CHAR(1)) RETURNS char(1) CHARSET utf8 - DETERMINISTIC -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 - */ - DECLARE vTaxArea VARCHAR(25); - DECLARE vSerie CHAR(1); - - IF (SELECT hasInvoiceSimplified FROM client WHERE id = vClientFk) THEN - RETURN 'S'; - END IF; - - SELECT clientTaxArea(vClientFk, vCompanyFk) INTO vTaxArea; - SELECT invoiceSerialArea(vType,vTaxArea) INTO vSerie; - 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 `invoiceSerialArea` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerialArea`(vType CHAR(1), vTaxArea VARCHAR(25)) RETURNS char(1) CHARSET utf8 COLLATE utf8_unicode_ci - DETERMINISTIC -BEGIN - - DECLARE vSerie CHAR(1); - - IF vType = 'R' THEN - SELECT - CASE vTaxArea - WHEN 'CEE' - THEN 'H' - WHEN 'WORLD' - THEN 'E' - WHEN 'NATIONAL' - THEN 'T' - END - INTO vSerie; - -- Factura multiple - ELSEIF vType = 'M' THEN - SELECT - CASE vTaxArea - WHEN 'CEE' - THEN 'H' - WHEN 'WORLD' - THEN 'E' - WHEN 'NATIONAL' - THEN 'M' - END - INTO vSerie; - -- Factura global - ELSEIF vType = 'G' THEN - SELECT - CASE vTaxArea - WHEN 'CEE' - THEN 'V' - WHEN 'WORLD' - THEN 'X' - WHEN 'NATIONAL' - THEN 'A' - END - INTO 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 `isIntrastatEntry` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `isIntrastatEntry`(vEntryFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE isIntrastatOperation BOOL DEFAULT FALSE; - DECLARE vSupplierCountry INT DEFAULT -1; - DECLARE vClientCountry INT DEFAULT -1; - - SELECT c.id INTO vSupplierCountry - FROM vn.country c - JOIN vn.supplier s ON s.countryFk = c.id - JOIN vn.entry e ON e.supplierFk = s.id - WHERE e.id = vEntryFk - AND c.isUeeMember = TRUE; - - SELECT c.id INTO vClientCountry - FROM vn.country c - JOIN vn.supplier s ON s.countryFk = c.id - JOIN vn.company co ON co.id = s.id - JOIN vn.entry e ON e.companyFk = co.id - WHERE e.id = vEntryFk - AND c.isUeeMember = TRUE; - - IF vSupplierCountry != vClientCountry AND vSupplierCountry * vClientCountry > 0 THEN - SET isIntrastatOperation = TRUE; - END IF; - - RETURN isIntrastatOperation; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `isLogifloraDay` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `isLogifloraDay`(vShipped DATE, vWarehouse INT) RETURNS tinyint(1) - DETERMINISTIC -BEGIN - - DECLARE vIsLogifloraDay BOOLEAN; - - SELECT COUNT(*) INTO vIsLogifloraDay - FROM edi.warehouseFloramondo wf - JOIN vn.floramondoConfig fc - WHERE wf.warehouseFk = vWarehouse - AND vShipped BETWEEN DATE(TIMESTAMPADD(DAY, wf.travellingDays , fc.nextLanded)) - AND DATE(TIMESTAMPADD(DAY, wf.travellingDays + wf.dayRange , fc.nextLanded)); - - RETURN vIsLogifloraDay; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `isPalletHomogeneus`(vExpedition INT) RETURNS tinyint(1) - READS SQL DATA -BEGIN - DECLARE vScanId INT; - DECLARE vDistinctRoutesInThePallet INT; - - SELECT scan_id INTO vScanId - FROM vn2008.scan_line - WHERE code = vExpedition - LIMIT 1; - - SELECT COUNT(*) INTO vDistinctRoutesInThePallet - FROM ( - SELECT DISTINCT t.Id_Ruta - FROM vn2008.scan_line sl - JOIN 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 */ ; -/*!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 `itemPacking` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `itemPacking`(vBarcode VARCHAR(22), vWarehouseFk INT) RETURNS int(11) - DETERMINISTIC -BEGIN - - DECLARE vPacking INTEGER DEFAULT 0; - DECLARE vItemFk INTEGER; - - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - SELECT IFNULL(packing,0) INTO vPacking - FROM vn.buy - WHERE id = CAST(vBarcode AS DECIMAL(18,0)); - - - - - IF NOT vPacking THEN - CALL cache.last_buy_refresh(FALSE); - SELECT IFNULL(packing,1) INTO vPacking - FROM - (SELECT packing , created - FROM vn.itemShelving - WHERE itemFk = vItemFk - UNION ALL - SELECT b.packing, landing - FROM vn.buy b - JOIN cache.last_buy lb ON lb.buy_id = b.id - WHERE lb.warehouse_id = vWarehouseFk - AND b.itemFk = vItemFk - ) packings - ORDER BY created desc - LIMIT 1; - - END IF; - - RETURN vPacking; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemPlacementGet` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `itemPlacementGet`(vItemFk INT, vWarehouseFk INT) RETURNS varchar(25) CHARSET utf8 - READS SQL DATA -BEGIN - DECLARE vPlacementReserve VARCHAR(25); - - SELECT CONCAT(IFNULL(`code`,'--'), ' / ', IFNULL(reserve,'--')) - INTO vPlacementReserve - FROM itemPlacement - WHERE itemFk = vItemFk - AND warehouseFk = vWarehouseFk; - - RETURN vPlacementReserve; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingPlacementSupply_ClosestGet` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `itemShelvingPlacementSupply_ClosestGet`(vParkingFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - /* Devuelve el parking más cercano.*/ - DECLARE vColumn INT; - DECLARE vClosestParkingFk INT; - DECLARE vSectorFk INT; - - SELECT p.column, sectorFk INTO vColumn, vSectorFk - FROM vn.parking p - WHERE p.id = vParkingFk; - - SELECT itemShelvingFk INTO vClosestParkingFk - FROM - ( - SELECT ABS(p.column - vColumn) as distance, itemShelvingFk - FROM vn.itemShelvingPlacementSupplyStock ispss - JOIN vn.parking p ON p.id = ispss.parkingFk - JOIN vn.itemPlacementSupplyList ipsl ON ipsl.sectorFk = ispss.sectorFk AND ipsl.itemFk = ispss.itemFk - WHERE p.sectorFk = vSectorFk - AND ipsl.saldo > 0 - ) sub - ORDER BY distance - LIMIT 1; - - RETURN vClosestParkingFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemsInSector_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `itemsInSector_get`(vTicketFk INT, vSectorFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - DECLARE vItemCount INT; - - SELECT count(*) INTO vItemCount - FROM vn.sale s - JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - WHERE s.ticketFk = vTicketFk - AND p.sectorFk = vSectorFk; - - RETURN vItemCount; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemTag_getIntValue` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `itemTag_getIntValue`(vValue VARCHAR(255)) RETURNS int(11) - DETERMINISTIC -BEGIN - IF vValue NOT REGEXP '^-?[0-9]+' THEN - RETURN NULL; - END IF; - - RETURN CAST(vValue AS SIGNED); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `item_getFhImage` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `item_getFhImage`(itemFk INT) RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci - DETERMINISTIC -BEGIN - DECLARE vImageUrl VARCHAR(255); - SELECT sr.PictureReference INTO vImageUrl - FROM vn.buy b - JOIN edi.ekt e ON b.ektFk = e.id - JOIN edi.supplyResponse sr ON sr.Item_ArticleCode =e.`ref` - JOIN vn.item i ON i.id = b.itemFk - WHERE b.itemFk = itemFk - ORDER BY (sr.EmbalageCode = e.package) DESC - LIMIT 1; - RETURN vImageUrl; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `item_getPackage` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `item_getPackage`(vItemFk INT) RETURNS varchar(50) CHARSET utf8 COLLATE utf8_unicode_ci - DETERMINISTIC -BEGIN - - DECLARE vDiameter INT; - DECLARE vPackageFk VARCHAR(50); - DECLARE vCoeficient DOUBLE DEFAULT 1.08; - - SELECT MAX(LEFT(value,3)) INTO vDiameter - FROM vn.itemTag it - JOIN vn.tag t ON t.id = it.tagFk - WHERE it.itemFk = vItemFk - AND t.overwrite = 'diameter'; - - SELECT 8000 + FLOOR(vc.ccLength * vc.ccWidth / (vCoeficient * PI() * (vDiameter / 2) * (vDiameter / 2))) - INTO vPackageFk - FROM vn.volumeConfig vc; - - INSERT IGNORE INTO vn.packaging(id, width, `depth`) - SELECT vPackageFk, - FLOOR(vc.ccWidth / FLOOR(vc.ccWidth / vDiameter)), - FLOOR(vc.ccLength / FLOOR(vc.ccLength / vDiameter)) - FROM vn.volumeConfig vc; - - RETURN vPackageFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `item_getVolume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `item_getVolume`(vSelf INT, vPackaging VARCHAR(10)) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Calculates the volume occupied by an item together - * with its packaging. - * - * @param vSelf The item id - * @param vPackaging The packaging id - * @return The volume in cubic centimeters - */ - DECLARE vVolume INT; - - SELECT SUM(IF(p.volume > 0, - p.volume, - p.width * p.depth * IF(IFNULL(p.height,0), p.height, IFNULL(i.size,60) + 10) - )) INTO vVolume - FROM packaging p - JOIN item i ON i.id = vSelf - WHERE p.id = vPackaging; - - RETURN vVolume; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `lastDayOfWeek` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `lastDayOfWeek`(vYear INT, vWeek INT) RETURNS date - DETERMINISTIC -BEGIN -/** - * Returns the date of the last day of the week - * - * @param vYear The year - * @param vWeek The week number - * @return Date of the first day of the week - */ - DECLARE vDate DATE; - - SELECT dated INTO vDate - FROM `time` - WHERE `year` = vYear - AND `week` = vWeek - ORDER BY dated DESC - LIMIT 1; - - RETURN 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 `machineWorker_Worker` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `machineWorker_Worker`(vWorkerFk VARCHAR(10)) RETURNS varchar(20) CHARSET utf8 COLLATE utf8_unicode_ci - READS SQL DATA -BEGIN -/** - * Comprueba si existen registros en las últimas 12 horas del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo) - * - * @param vWorkerFk id del trabajador - * @return Devuelve REGISTERED/UNREGISTERED en caso de que haya registros - */ - - IF (SELECT COUNT(*) - FROM machineWorker m - WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) AND ISNULL(m.outTimed)) - THEN - RETURN "REGISTERED"; - ELSE - RETURN "UNREGISTERED"; - 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 FUNCTION IF EXISTS `machine_checkPlate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `machine_checkPlate`(vPlate VARCHAR(10)) RETURNS tinyint(1) - READS SQL DATA -BEGIN -/** - * Comprueba si existe matrícula - * - * @param vPlate matrícula del vehículo - * @return Devuelve TRUE en caso de que exista - * - */ - - IF (SELECT COUNT(*) - FROM machine m - WHERE m.plate = vPlate - ) THEN - RETURN TRUE; - ELSE - RETURN 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 FUNCTION IF EXISTS `messageSend` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `messageSend`(vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE result INT; - DECLARE vSenderFk INT; - - SELECT id INTO vSenderFk - FROM account.user WHERE `name` = account.userGetName(); - - RETURN (SELECT messageSendWithUser(vSenderFk, vRecipient, 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 FUNCTION IF EXISTS `messageSendWithUser` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `messageSendWithUser`(vSenderFK INT, vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11) - DETERMINISTIC -BEGIN - - DECLARE vCount INT; - DECLARE vUuid VARCHAR(255); - DECLARE vSendDate DATETIME DEFAULT NOW(); - DECLARE vSender VARCHAR(255) CHARSET utf8; - - SELECT `name` INTO vSender - FROM account.user WHERE id = vSenderFK; - - SET vRecipient = LOWER(vRecipient); - - DROP TEMPORARY TABLE IF EXISTS tRecipients; - CREATE TEMPORARY TABLE tRecipients - SELECT u.name finalRecipient - FROM account.mailAlias a - JOIN account.mailAliasAccount aa ON aa.mailAlias = a.id - JOIN account.user u ON u.id = aa.account - WHERE a.alias = vRecipient COLLATE utf8_unicode_ci - AND u.name != vSender - AND u.active - UNION - SELECT u.name FROM account.user u - WHERE u.name = vRecipient - AND u.active; - - SELECT COUNT(*) INTO vCount FROM tRecipients; - - IF vCount = 0 THEN - RETURN vCount; - END IF; - - SET vUuid = UUID(); - - INSERT INTO message - SET uuid = vUuid, - sender = vSender, - recipient = vRecipient, - message = vMessage, - sendDate = vSendDate; - - INSERT INTO messageInbox (uuid, sender, recipient, finalRecipient, message, sendDate) - SELECT vUuid, vSender, vRecipient, finalRecipient, vMessage, vSendDate - FROM tRecipients; - - DROP TEMPORARY TABLE tRecipients; - RETURN vCount; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `MIDNIGHT` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `MIDNIGHT`(vDate DATE) RETURNS datetime - DETERMINISTIC -BEGIN - RETURN TIMESTAMP(vDate,'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 `myWorker_getId__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `myWorker_getId__`() RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Returns the current worker id or the default worker id - * if current user cannot be retrieved. - * - * @return The worker id - */ - DECLARE vWorker INT; - - SELECT w.id INTO vWorker - FROM worker w, workerConfig__ c - WHERE w.userFk = account.userGetId(); - - RETURN vWorker; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `nz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(vQuantity DOUBLE) RETURNS double - DETERMINISTIC -BEGIN - - DECLARE vResult DOUBLE; - - SET vResult = IFNULL(vQuantity,0); - - RETURN vResult; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `orderTotalVolume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `orderTotalVolume`(vOrderId INT) RETURNS decimal(10,3) - READS SQL DATA -BEGIN - -- Devuelte el volumen total de la orden sumada - DECLARE vWarehouseId INTEGER; - DECLARE vVolume DECIMAL(10,3); - - SELECT IFNULL(SUM(o.amount * ic.cm3delivery)/1000000,0) INTO vVolume - FROM hedera.orderRow o - JOIN item i ON i.id = o.itemFk - JOIN itemCost ic on ic.itemFk = o.itemFk AND ic.warehouseFk = o.warehouseFk - WHERE o.orderFk = vOrderId; - - RETURN vVolume; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `orderTotalVolumeBoxes` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `orderTotalVolumeBoxes`(vOrderId INT) RETURNS decimal(10,3) - READS SQL DATA -BEGIN -/** - * Devuelve el volumen estimado del ticket sumado, en cajas - * - * @param vOrder Id del pedido - */ - DECLARE vVolumeBoxM3 DOUBLE; - DECLARE vOrderTotalVolumeBoxes DECIMAL(10,1); - DECLARE vVnBoxId VARCHAR(10) DEFAULT '94'; - - SELECT volume / 1000000 - INTO vVolumeBoxM3 - FROM packaging - WHERE id = vVnBoxId; - - SET vOrderTotalVolumeBoxes = orderTotalVolume(vOrderId) / vVolumeBoxM3; - - RETURN vOrderTotalVolumeBoxes; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `phytoPassport` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `phytoPassport`(vRef VARCHAR(15)) RETURNS text CHARSET utf8 - DETERMINISTIC -BEGIN -DECLARE vPhyto TEXT CHARSET utf8 COLLATE utf8_unicode_ci; -SELECT - GROUP_CONCAT(i.id, - ':', - ppa.denomination, - ' ', - pp.number, - CHAR(13,10) - SEPARATOR '') fitosanitario - INTO vPhyto -FROM - sale s - JOIN - ticket t ON t.id = s.ticketFk - JOIN - item i ON i.id = s.itemFk - JOIN - plantpassport pp ON pp.producerFk = i.producerFk - JOIN - plantpassportAuthority ppa ON ppa.id = pp.plantpassportAuthorityFk - JOIN - itemBotanicalWithGenus ib ON ib.itemFk = i.id - JOIN - botanicExport be ON be.`code` = 'phytosanitaryPassport' - LEFT JOIN - ediGenus eg ON eg.id = be.ediGenusFk - LEFT JOIN - ediSpecie es ON es.id = be.ediSpecieFk -WHERE - t.refFk = vRef - AND ib.ediBotanic LIKE CONCAT(IFNULL(eg.latinGenusName, ''), - IF(latinSpeciesName > '', - CONCAT(' ', latinSpeciesName), - ''), - '%'); -RETURN vPhyto; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `routeProposal` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal`(vTicketFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - DECLARE vRouteFk INT; - DECLARE vAddressFk INT; - - DECLARE vLanded DATE; - DECLARE vZoneFk INT; - DECLARE vSignificativeFriendship INT DEFAULT 6; - DECLARE vVolumeMax DECIMAL(5,1) DEFAULT 10; - - SELECT addressFk, zoneFk, landed INTO vAddressFk, vZoneFk, vLanded - FROM vn.ticket - WHERE id = vTicketFk; - - -- Se inicia la selección de rutas posibles con aquellas cuyas agencias alguna vez han estado asociadas con nuestra zona - DROP TEMPORARY TABLE IF EXISTS tmp.route; - CREATE TEMPORARY TABLE tmp.route - SELECT r.id routeFk, - zf.friendship zoneFriendship - FROM vn.route r - JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk - WHERE friendship >= vSignificativeFriendship - AND zf.zoneFk = vZoneFk - AND r.created = vLanded - ORDER BY friendship; - - -- Se eliminan aquellas que superan el volumen máximo - DELETE r.* - FROM tmp.route r - JOIN (SELECT routeFk, sum(volume) volume - FROM vn.saleVolume - WHERE landed = vLanded - GROUP BY routeFk) sub ON sub.routeFk = r.routeFk - WHERE sub.volume > vVolumeMax; - - -- Se ordenan las que quedan en función con la afinidad del resto de consignatarios de cada ruta - SELECT routeFk INTO vRouteFk - FROM - (SELECT r.routeFk, r.zoneFriendship, sum(af.friendship) friendshipSum - FROM tmp.route r - LEFT JOIN vn.ticket t ON t.routeFk = r.routeFk - LEFT JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk - GROUP BY routeFk - ORDER BY zoneFriendship DESC, friendshipSum DESC - ) sub - LIMIT 1; - - RETURN vRouteFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `routeProposal_` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal_`(vTicketFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - DECLARE vRouteFk INT; - DECLARE vAddressFk INT; - DECLARE vShipped DATETIME; - - SELECT addressFk, date(shipped) INTO vAddressFk, vShipped - FROM vn.ticket - WHERE id = vTicketFk; - - SELECT routeFk INTO vRouteFk - FROM - (SELECT t.routeFk, sum(af.friendship) friendshipSum - FROM vn.ticket t - JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk - WHERE t.shipped BETWEEN vShipped and MIDNIGHT(vShipped) - AND t.routeFk - GROUP BY routeFk - ORDER BY friendshipSum DESC - ) sub - LIMIT 1; - - RETURN vRouteFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `routeProposal_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal_beta`(vTicketFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - DECLARE vRouteFk INT; - DECLARE vAddressFk INT; - - DECLARE vLanded DATE; - DECLARE vZoneFk INT; - DECLARE vSignificativeFriendship INT DEFAULT 6; - DECLARE vVolumeMax DECIMAL(5,1) DEFAULT 10; - - SELECT addressFk, zoneFk, landed INTO vAddressFk, vZoneFk, vLanded - FROM vn.ticket - WHERE id = vTicketFk; - - -- Se inicia la selección de rutas posibles con aquellas cuyas agencias alguna vez han estado asociadas con nuestra zona - DROP TEMPORARY TABLE IF EXISTS tmp.route; - CREATE TEMPORARY TABLE tmp.route - SELECT r.id routeFk, - zf.friendship zoneFriendship - FROM vn.route r - JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk - WHERE friendship >= vSignificativeFriendship - AND zf.zoneFk = vZoneFk - AND r.created = vLanded - ORDER BY friendship; - - -- Se eliminan aquellas que superan el volumen máximo - DELETE r.* - FROM tmp.route r - JOIN (SELECT routeFk, sum(volume) volume - FROM vn.saleVolume - WHERE landed = vLanded - GROUP BY routeFk) sub ON sub.routeFk = r.routeFk - WHERE sub.volume > vVolumeMax; - - -- Se ordenan las que quedan en función con la afinidad del resto de consignatarios de cada ruta - SELECT routeFk INTO vRouteFk - FROM - (SELECT r.routeFk, r.zoneFriendship, sum(af.friendship) friendshipSum - FROM tmp.route r - LEFT JOIN vn.ticket t ON t.routeFk = r.routeFk - LEFT JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk - GROUP BY routeFk - ORDER BY zoneFriendship DESC, friendshipSum DESC - ) sub - LIMIT 1; - - RETURN vRouteFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `specie_IsForbidden` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `specie_IsForbidden`(vItemFk INT, vAddressFk INT) RETURNS tinyint(1) - READS SQL DATA -BEGIN - - DECLARE vIsForbbiden BOOL; - DECLARE vLeft INT; - - SELECT zg.lft INTO vLeft - FROM vn.address a - JOIN vn.zoneGeo zg ON zg.name = a.postalCode - WHERE a.id = vAddressFk; - - SELECT sgi.isForbidden INTO vIsForbbiden - FROM vn.specieGeoInvasive sgi - JOIN vn.zoneGeo zg ON zg.id = sgi.zoneGeofk - JOIN vn.itemBotanical ib ON ib.genusFk = sgi.genusFk AND sgi.specieFk IN ('sp.',ib.specieFk) - WHERE vLeft BETWEEN zg.lft AND zg.rgt - AND ib.itemFk = vItemFk - ORDER BY zg.`depth` DESC - LIMIT 1; - - RETURN IFNULL(vIsForbbiden, 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 `testCIF` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `testCIF`(vCIF VARCHAR(9)) RETURNS varchar(10) CHARSET utf8 COLLATE utf8_unicode_ci - DETERMINISTIC -BEGIN - - DECLARE vLetraInicial VARCHAR(1); - DECLARE vLetraFinal VARCHAR(1); - DECLARE vParteNumerica VARCHAR(7); - DECLARE vSuma INT DEFAULT 0; - DECLARE vNumero INT DEFAULT 0; - DECLARE i INT DEFAULT 0; - DECLARE vResult BOOL DEFAULT FALSE; - - SET vLetraInicial = SUBSTR(vCIF, 1, 1); - SET vLetraFinal = SUBSTR(vCIF, 9, 1); - SET vParteNumerica = SUBSTR(vCIF, 2, 7); - - WHILE i < 7 DO - - SET i = i + 1; - - SET vNumero = CAST(SUBSTR(vParteNumerica, i, 1) AS DECIMAL(1,0)); - - IF i MOD 2 THEN - - SET vNumero = vNumero * 2; - SET vNumero = vNumero MOD 10 + FLOOR(vNumero/10); - - END IF; - - SET vSuma = vSuma + vNumero; - - END WHILE; - - SET vSuma = vSuma MOD 10; - - IF vSuma > 0 THEN - - SET vSuma = 10 - vSuma; - - END IF; - - -- Comprobación de dígito de control - IF CAST(vLetraFinal AS DECIMAL(1,0)) = vSuma THEN - - SET vResult = TRUE; - - END IF; - - IF vSuma = 0 THEN - - SET vSuma = 10; - - END IF; - - IF CHAR(64 + vSuma) = vLetraFinal THEN - - SET vResult = TRUE; - - END IF; - - -- Sólo se aceptan letras como caracter inicial - IF ASCII(vLetraInicial) < 65 OR ASCII(vLetraInicial) > 87 THEN -- Ha de ser entre la A y la W - - SET vResult = FALSE; - - END IF; - - RETURN vResult; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `testNIE` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `testNIE`(vNIE VARCHAR(9)) RETURNS tinyint(1) - DETERMINISTIC -BEGIN - - DECLARE vIndice INT; - DECLARE vNumero VARCHAR(7); - DECLARE vOperador VARCHAR(9); - DECLARE vParteNumerica DECIMAL(8,0); - DECLARE vLetraInicial VARCHAR(1); - DECLARE vLetraFinal VARCHAR(1); - DECLARE vLetrasFinalesPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; - DECLARE vLetraInicialEsIncorrecta BOOL DEFAULT FALSE; - - SET vLetraInicial = SUBSTR(vNIE, 1, 1); - SET vLetraFinal = SUBSTR(vNIE, 9, 1); - SET vNumero = SUBSTR(vNIE, 2, 7); - - CASE vLetraInicial - - WHEN 'X' THEN - - SET vOperador = "0"; - - WHEN 'Y' THEN - - SET vOperador = "1"; - - WHEN 'Z' THEN - - SET vOperador = "2"; - - ELSE - - SET vLetraInicialEsIncorrecta = TRUE; - - END CASE; - - SET vOperador = CONCAT(vOperador, vNumero); - SET vParteNumerica = CAST(vOperador AS DECIMAL(8,0)); - SET vIndice = Round(vParteNumerica Mod 23, 0) + 1; - - IF SUBSTR(vLetrasFinalesPosibles, vIndice, 1) = vLetraFinal AND vLetraInicialEsIncorrecta = FALSE THEN - - RETURN TRUE; - - ELSE - - RETURN 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 FUNCTION IF EXISTS `testNIF` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `testNIF`(vNIF VARCHAR(9)) RETURNS tinyint(1) - DETERMINISTIC -BEGIN - - DECLARE vIndice INT; - DECLARE vParteNumerica DECIMAL(8,0); - DECLARE vLetra VARCHAR(1); - DECLARE vLetrasPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; - - SET vLetra = SUBSTRING(vNIF, 9, 1); - - SET vParteNumerica = CAST(SUBSTRING(vNIF, 1, 8) AS DECIMAL(8,0)); - - SET vIndice = Round(vParteNumerica MOD 23, 0) + 1; - - If SUBSTRING(vLetrasPosibles, vIndice, 1) = vLetra Then - - RETURN TRUE; - - ELSE - - RETURN 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 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 `ticketPositionInPath` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticketPositionInPath`(vTicketId INT) RETURNS varchar(10) CHARSET utf8 - DETERMINISTIC -BEGIN - - DECLARE vRestTicketsMaxOrder INT; - DECLARE vRestTicketsMinOrder INT; - DECLARE vRestTicketsPacking INT; - DECLARE vMyProductionOrder INT; - DECLARE vPosition VARCHAR(10) DEFAULT 'MID'; - DECLARE vMyPath INT; - DECLARE vMyWarehouse INT; - DECLARE PACKING_ORDER INT; - DECLARE vExpeditionsCount INT; - DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE; - -SELECT `order` - INTO PACKING_ORDER - FROM state - WHERE code = 'PACKING'; - -SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0) - INTO vMyPath, vMyWarehouse, vMyProductionOrder - FROM ticket t - LEFT JOIN ticketState ts on ts.ticket = t.id - WHERE t.id = vTicketId; - -SELECT (ag.`name` = 'VN_VALENCIA') - INTO vIsValenciaPath - FROM vn2008.Rutas r - JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia - JOIN vn2008.agency ag on ag.agency_id = a.agency_id - WHERE r.Id_Ruta = vMyPath; - -IF vIsValenciaPath THEN -- Rutas Valencia - - SELECT COUNT(*) - INTO vExpeditionsCount - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - WHERE t.routeFk = vMyPath; - - SELECT MAX(ts.productionOrder), MIN(ts.productionOrder) - INTO vRestTicketsMaxOrder, vRestTicketsMinOrder - FROM ticket t - LEFT JOIN ticketState ts on t.id = ts.ticket - WHERE t.routeFk = vMyPath - AND t.warehouseFk = vMyWarehouse - AND t.id != vTicketid; - - SELECT COUNT(*) - INTO vRestTicketsPacking - FROM ticket t - LEFT JOIN ticketState ts on t.id = ts.ticket - WHERE ts.productionOrder = PACKING_ORDER - AND t.routeFk = vMyPath - AND t.warehouseFk = vMyWarehouse - AND t.id != vTicketid; - - IF vExpeditionsCount = 1 THEN - SET vPosition = 'FIRST'; - ELSEIF vRestTicketsMinOrder > PACKING_ORDER THEN - SET vPosition = 'LAST'; - ELSEIF vRestTicketsPacking THEN - SET vPosition = 'SHARED'; - ELSE - SET vPosition = 'MID'; - END IF; - -ELSE - SET vPosition = 'MID'; - -END IF; - -RETURN vPosition; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketSplitCounter` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8 - READS SQL DATA -BEGIN - DECLARE vSplitCounter VARCHAR(15); - - SELECT CONCAT(OK,'/',Total, IF(OK = Total ,' LS','')) INTO vSplitCounter - FROM - ( - SELECT count(l.Id_Movimiento) as OK, COUNT(*) as Total - FROM vn.sale s - LEFT JOIN vn2008.movement_label l ON l.Id_Movimiento = s.id - WHERE ticketFk = vTicketFk - ) sub; - - RETURN IFNULL(vSplitCounter,'--'); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketTotalVolume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolume`(vTicketId INT) RETURNS decimal(10,3) - READS SQL DATA -BEGIN - -- Devuelte el volumen total del ticket sumado - - DECLARE vVolume DECIMAL(10,3); - - SELECT SUM(volume) INTO vVolume - FROM saleVolume - WHERE ticketFk = vTicketId; - RETURN vVolume; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketTotalVolumeBoxes` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolumeBoxes`(vTicketId INT) RETURNS decimal(10,1) - DETERMINISTIC -BEGIN - -/* - * Devuelve el volumen estimado del ticket sumado, en cajas - * - * vTicketId Numero de ticket - * - */ - - DECLARE vVolumeBoxM3 DOUBLE; - DECLARE vTicketTotalVolumeBoxes DECIMAL(10,1); - DECLARE vVnBoxId VARCHAR(10) DEFAULT '94'; - - SELECT volume / 1000000 INTO vVolumeBoxM3 FROM packaging WHERE id = vVnBoxId; - - SET vTicketTotalVolumeBoxes = ticketTotalVolume(vTicketId) / vVolumeBoxM3; - - RETURN vTicketTotalVolumeBoxes; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketWarehouseGet` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticketWarehouseGet`(vTicketFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - DECLARE vWarehouseFk INT; - - SELECT warehouseFk INTO vWarehouseFk - FROM ticket - WHERE id = vTicketFk; - - RETURN vWarehouseFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticket_CC_volume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_CC_volume`(vTicketFk INT) RETURNS decimal(10,1) - READS SQL DATA -BEGIN - - DECLARE vCC DECIMAL(10,1); - - SELECT sum(sv.volume * IF(i.itemPackingTypeFk = 'H', vc.dutchCompressionRate, 1)) / (p.volume / 1000000) - INTO vCC - FROM vn.saleVolume sv - JOIN vn.sale s ON s.id = sv.saleFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.packaging p ON p.id = 'CC' - JOIN vn.volumeConfig vc - WHERE sv.ticketFk = vTicketFk; - - RETURN vCC; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticket_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_get`(vParamFk INT) RETURNS int(11) - READS SQL DATA -proc:BEGIN - - /* Devuelve el número de ticket o collection consultando en varias tablas posibles - * - * @param vParamFk Número a validar - * @return vValidFk Identificador validado - */ - - DECLARE vValidFk INT; - - -- Tabla vn.saleGroup - SELECT s.ticketFk INTO vValidFk - FROM vn.sale s - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk - WHERE sg.id = vParamFk - AND sg.created > TIMESTAMPADD(WEEK,-1, CURDATE()) - LIMIT 1; - - IF vValidFk THEN - - RETURN vValidFk; - - LEAVE proc; - - END IF; - - -- Tabla vn.collection - SELECT c.id INTO vValidFk - FROM vn.collection c - WHERE c.id = vParamFk - AND c.created > TIMESTAMPADD(WEEK,-1, CURDATE()); - - IF vValidFk THEN - - RETURN vValidFk; - - LEAVE proc; - - END IF; - - -- Tabla vn.ticket - SELECT t.id INTO vValidFk - FROM vn.ticket t - WHERE t.id = vParamFk - AND t.shipped > TIMESTAMPADD(WEEK,-1, CURDATE()); - - IF vValidFk THEN - - RETURN vValidFk; - - LEAVE proc; - - END IF; - - RETURN 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 FUNCTION IF EXISTS `ticket_getFreightCost` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getFreightCost`(vTicketFk INT) RETURNS decimal(10,2) - DETERMINISTIC -BEGIN -/** - * Devuelve el coste de transportar un ticket. - * - * @vTicketFk Id del ticket a calcular - */ - DECLARE deliveryPrice DECIMAL (10,2); - - IF (SELECT isVolumetric FROM ticket t JOIN zone z ON t.zoneFk = z.id - WHERE t.id = vTicketFk) THEN - SELECT SUM(sv.freight) INTO deliveryPrice - FROM vn.saleVolume sv - WHERE sv.ticketFk = vTicketFk; - ELSE - SELECT SUM((t.zonePrice - t.zoneBonus) * ebv.ratio) INTO deliveryPrice - FROM vn.ticket t - LEFT JOIN expedition e ON e.ticketFk = t.id - JOIN expeditionBoxVol ebv ON ebv.boxFk = e.isBox - WHERE t.id = vTicketFk; - - END IF; - RETURN deliveryPrice; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticket_getWeight` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getWeight`(vTicketFk INT) RETURNS decimal(10,3) - READS SQL DATA -BEGIN -/** - * Devuelve el peso total del ticket - * - * @return Total peso - */ - - DECLARE vWeight DECIMAL(10,3); - - SELECT sum(weight) INTO vWeight - FROM saleVolume - WHERE ticketFk = vTicketFk; - - RETURN vWeight; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticket_getWithParameters` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getWithParameters`(vClientFk INT, vWarehouseFk INT, vShipped DATE, vAddressFk INT, vCompanyFk INT, vAgencyModeFk INT) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Devuelve un ticket con los parametros, en caso de no existir lo crea - * - * @param vClientFk Cliente - * @param vWarehouseFk almacen - * @param vShipped Fecha de preparacion - * @param vAddressFk Consignatario - * @param vCompanyFk Empresa - * @param vAgencyModeFk agencia - */ - - DECLARE vTicket INT; - - SELECT t.id INTO vTicket - FROM vn.ticket t - WHERE (t.clientFk <=> vClientFk OR vClientFk IS NULL) - AND (t.warehouseFk <=> vWarehouseFk OR vWarehouseFk IS NULL) - AND (t.shipped <=> vShipped OR vShipped IS NULL) - AND (t.addressFk <=> vAddressFk OR vAddressFk IS NULL) - AND (t.companyFk <=> vCompanyFk OR vCompanyFk IS NULL) - AND (t.agencyModeFk <=> vAgencyModeFk OR vAgencyModeFk IS NULL) - LIMIT 1; - - IF vTicket IS NULL THEN - CALL vn.ticket_add( - vClientFk, - IFNULL(vShipped, CURDATE()), - vWarehouseFk, - vCompanyFk, - vAddressFk, - vAgencyModeFk, - NULL, - vShipped, - `account`.`myUser_getId`(), - TRUE, - vTicket - ); - END IF; - - 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 */ ; -/*!50003 DROP FUNCTION IF EXISTS `ticket_HasUbication` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_HasUbication`(vTicketFk INT) RETURNS tinyint(1) - READS SQL DATA -BEGIN - - DECLARE hasUbication BOOL; - - SELECT COUNT(*) INTO hasUbication - FROM vn.ticket t - JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - WHERE rm.beachFk - AND t.id = vTicketFk; - - RETURN hasUbication; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `till_new` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `till_new`( - vClient INT - ,vBank INT - ,vAmount DOUBLE - ,vConcept VARCHAR(25) - ,vDated DATE - ,vSerie CHAR(1) - ,vBatch TINYINT - ,vNumber INT - ,vCompany SMALLINT - ,vWorker INT -) RETURNS int(11) - DETERMINISTIC -BEGIN - DECLARE vAccount VARCHAR(12); - DECLARE vSubaccount VARCHAR(12); - DECLARE vAsiento INT DEFAULT NULL; - - -- Inserta el registro en cajas - - INSERT INTO till - SET - workerFk = vWorker - ,bankFk = vBank - ,`in` = vAmount - ,concept = vConcept - ,dated = vDated - ,serie = vSerie - ,isAccountable = vBatch - ,`number` = vNumber - ,companyFk = vCompany; - - -- Inserta los asientos contables - - SELECT account INTO vAccount - FROM bank WHERE id = vBank; - - SELECT accountingAccount INTO vSubaccount - FROM `client` WHERE id = vClient; - - SET vAsiento = xdiario_new - ( - vAsiento - ,vDated - ,vAccount - ,vSubaccount - ,vConcept - ,vAmount - ,0 - ,0 - ,NULL -- Serie - ,NULL -- Factura - ,NULL -- IVA - ,NULL -- Recargo - ,FALSE -- Auxiliar - ,vCompany - ); - DO xdiario_new - ( - vAsiento - ,vDated - ,vSubaccount - ,vAccount - ,vConcept - ,0 - ,vAmount - ,0 - ,NULL -- Serie - ,NULL -- Factura - ,NULL -- IVA - ,NULL -- Recargo - ,FALSE -- Auxiliar - ,vCompany - ); - - RETURN 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 FUNCTION IF EXISTS `timeWorkerControl_getDirection` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME) RETURNS varchar(6) CHARSET utf8 COLLATE utf8_unicode_ci - READS SQL DATA -BEGIN -/** - * Verifica la dirección de la fichada - * @param vUserFk Identificador del trabajador - * @param vTimed Hora de la fichada - * @return Retorna sentido de la fichada 'in, out, middle' - */ - - DECLARE vPrevious DATETIME ; - DECLARE vNext DATETIME ; - DECLARE vPreviousDirection VARCHAR(3) ; - DECLARE vNextDirection VARCHAR(3) ; - DECLARE vDayStayMax INT; - DECLARE vTimedSeconds INT; - DECLARE vLastTimeIn INT; - - SELECT UNIX_TIMESTAMP(vTimed) INTO vTimedSeconds; - - SELECT dayStayMax INTO vDayStayMax - FROM vn.workerTimeControlParams; - - SELECT timed, direction INTO vNext,vNextDirection - FROM vn.workerTimeControl - WHERE userFk = vUserFk - AND direction IN ('in','out') - AND timed > vTimed - ORDER BY timed ASC - LIMIT 1; - - SELECT timed, direction INTO vPrevious, vPreviousDirection - FROM vn.workerTimeControl - WHERE userFk = vUserFk - AND direction IN ('in','out') - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - IF (vTimedSeconds - UNIX_TIMESTAMP(vPrevious) + UNIX_TIMESTAMP(vNext) - vTimedSeconds)<= vDayStayMax AND vPreviousDirection = 'in' AND vNextDirection = 'out' THEN - RETURN 'middle'; - END IF; - - - IF (vTimedSeconds> UNIX_TIMESTAMP(vPrevious)) THEN - IF vPreviousDirection = 'in' THEN - RETURN 'out'; - ELSE - SELECT UNIX_TIMESTAMP(MAX(timed)) INTO vLastTimeIn - FROM vn.workerTimeControl - WHERE userFk = vUserFk - AND direction ='in' - AND timed < vPrevious; - IF vTimedSeconds - vLastTimeIn <= vDayStayMax THEN - RETURN 'out'; - END IF; - END IF; - END IF; - - RETURN 'in'; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `time_getSalesYear` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `time_getSalesYear`(vMonth INT, vYear INT) RETURNS int(11) - DETERMINISTIC -BEGIN -DECLARE vSalesYear INT; -SELECT salesYear INTO vSalesYear -FROM `time` -WHERE `month` = vMonth AND `year` = vYear -LIMIT 1; -RETURN vSalesYear; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `travel_getForLogiflora` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `travel_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11) - READS SQL DATA -BEGIN - - /** - * Devuelve un número de travel para compras de Logiflora a partir de la fecha de llegada y del almacén. - * Si no existe lo genera. - * - * @param vLanded Fecha de llegada al almacén - * @param vWarehouseFk Identificador de vn.warehouse - */ - - DECLARE vTravelFk INT; - - IF vLanded THEN - - SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk - FROM vn.travel tr - JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk - JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk - JOIN vn.agencyMode am ON am.id = tr.agencyFk - WHERE wIn.id = vWarehouseFk - AND wOut.name = 'Holanda' - AND am.name = 'LOGIFLORA' - AND landed = vLanded; - - IF NOT vTravelFk THEN - - INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) - SELECT vLanded, curdate(), vWarehouseFk, wOut.id, am.id - FROM vn.warehouse wOut - JOIN vn.agencyMode am ON am.name = 'LOGIFLORA' - WHERE wOut.name = 'Holanda'; - - SELECT MAX(tr.id) INTO vTravelFk - FROM vn.travel tr - JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk - JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk - WHERE wIn.id = vWarehouseFk - AND wOut.name = 'Holanda' - AND landed = vLanded; - END IF; - - END IF; - - RETURN vTravelFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `validationCode` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `validationCode`(vString VARCHAR(255)) RETURNS int(11) - DETERMINISTIC -BEGIN - - DECLARE vSeed DOUBLE DEFAULT 0; - DECLARE vCode INT; - DECLARE vLength INT; - DECLARE vChar INT; - - SET vLength = length(vString); - - WHILE vLength > 0 DO - - SET vChar = MID(vString,vLength,1); - - SET vSeed = vSeed + ASCII(vChar); - - SET vLength = vLength - 1; - - END WHILE; - - SET vCode = FLOOR(SQRT(vSeed)*1000000) mod 1000; - - RETURN 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 */ ; -/*!50003 DROP FUNCTION IF EXISTS `validationCode_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `validationCode_beta`(vString VARCHAR(255)) RETURNS int(11) - DETERMINISTIC -BEGIN - - DECLARE vSeed DOUBLE DEFAULT 0; - DECLARE vCode INT; - DECLARE vLength INT; - DECLARE vChar INT; - - SET vLength = length(vString); - - WHILE vLength > 0 DO - - SET vChar = MID(vString,vLength,1); - - SET vSeed = vSeed + ASCII(vChar); - - SET vLength = vLength - 1; - - END WHILE; - - SET vCode = FLOOR(SQRT(vSeed)*1000000) mod 1000; - - RETURN 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 */ ; -/*!50003 DROP FUNCTION IF EXISTS `workerIsBoss` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerIsBoss`(vUserId INT) RETURNS int(11) - DETERMINISTIC -BEGIN -/** - * Comprueba por jerarquía si el trabajador actual es jefe - * de un trabajador en concreto. - * - * @param vUserId Id del trabajador que se desea comprobar. - * @return Revuelve verdadero si es jefe del empleado por escala jerárquica. - */ - DECLARE vWorkerId INT; - DECLARE vBossId INT; - - SELECT id INTO vWorkerId - FROM vn.worker - WHERE userFk = vUserId; - IF vWorkerId IS NULL THEN - CALL util.throw('USER_NOT_FOUND'); - END IF; - - DROP TEMPORARY TABLE IF EXISTS tCheckedWorker; - CREATE TEMPORARY TABLE tCheckedWorker - (PRIMARY KEY (workerFk)) - ENGINE = MEMORY - SELECT id workerFk FROM worker LIMIT 0; - LOOP - SELECT bossFk INTO vBossId - FROM vn.worker - WHERE id = vWorkerId; - IF (SELECT COUNT(*) FROM tCheckedWorker WHERE workerFk = vBossId) THEN - CALL util.throw('INFINITE_LOOP'); - END IF; - IF vBossId = vWorkerId THEN - RETURN FALSE; - ELSEIF vBossId = account.myUser_getId() THEN - RETURN TRUE; - ELSE - INSERT INTO tCheckedWorker VALUES (vWorkerId); - SET vWorkerId = vBossId; - END IF; - END LOOP; - DROP TEMPORARY TABLE tCheckedWorker; - 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 `workerMachinery_isRegistered` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerMachinery_isRegistered`(vWorkerFk VARCHAR(10)) RETURNS tinyint(1) - READS SQL DATA -BEGIN -/** - * Comprueba si existen registros en las últimas horas (maxHours de machineWorkerConfig) del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo) - * - * @param vWorkerFk id del trabajador - * @return Devuelve TRUE/FALSE en caso de que haya o no registros - */ - - IF (SELECT COUNT(*) - FROM machineWorker m - WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), NOW()) AND ISNULL(m.outTimed)) - THEN - RETURN TRUE; - ELSE - RETURN 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 FUNCTION IF EXISTS `workerNigthlyHours_calculate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerNigthlyHours_calculate`(vTimeIn DATETIME, vTimeOut DATETIME) RETURNS decimal(5,2) - READS SQL DATA -BEGIN -/** - * Calcula el número decimal de horas nocturnas comprendidas entre 2 horas dadas - * - * @param vTimeIn - * @param vTimeOut - * @return vNigthlyHours - */ - DECLARE vNigthlyHours DECIMAL(5,2); - DECLARE vSecondsPerHour INT(4) DEFAULT 3600; - - SELECT GREATEST(0, TIMESTAMPDIFF(SECOND, - IF(TIME(vTimeIn) BETWEEN endNightlyHours AND startNightlyHours, - CONCAT(DATE(vTimeIn), ' ', startNightlyHours), - vTimeIn), - IF(TIME(vTimeOut) BETWEEN endNightlyHours AND startNightlyHours, - CONCAT(DATE(vTimeOut), ' ', endNightlyHours), - vTimeOut))) / vSecondsPerHour INTO vNigthlyHours - FROM vn.workerTimeControlConfig; - - RETURN vNigthlyHours; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControl_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`( vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) - DETERMINISTIC -BEGIN - DECLARE vDirection VARCHAR(6); - DECLARE vLastIn DATETIME; - DECLARE vDayStayMax INT; - DECLARE vHasDirectionOut INT; - DECLARE vLastInsertedId INT; - - SELECT dayStayMax INTO vDayStayMax - FROM workerTimeControlParams; - - SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; - - IF vDirection = 'out' THEN - - SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in' - AND timed < vTimed; - - UPDATE workerTimeControl wtc - SET wtc.direction = 'middle' - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vLastIn AND vTimed; - - ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - UPDATE workerTimeControl wtc - SET wtc.direction = IF (vHasDirectionOut,'middle','out') - WHERE userFk = vUserFk - AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - END IF; - END IF; - - INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) - VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - - SET vLastInsertedId = LAST_INSERT_ID(); - - CALL workerTimeControlSOWP(vUserFk, vTimed); - - RETURN vLastInsertedId; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_addDirection` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`( vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) - DETERMINISTIC -BEGIN - DECLARE vDirection VARCHAR(6); - DECLARE vLastIn DATETIME; - DECLARE vDayStayMax INT; - DECLARE vHasDirectionOut INT; - DECLARE vLastInsertedId INT; - - SELECT dayStayMax INTO vDayStayMax - FROM workerTimeControlParams; - - SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; - - IF vDirection = 'out' THEN - - SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in' - AND timed < vTimed; - - UPDATE workerTimeControl wtc - SET wtc.direction = 'middle' - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vLastIn AND vTimed; - - ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - UPDATE workerTimeControl wtc - SET wtc.direction = IF (vHasDirectionOut,'middle','out') - WHERE userFk = vUserFk - AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - END IF; - END IF; - - INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) - VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - - SET vLastInsertedId = LAST_INSERT_ID(); - - CALL workerTimeControlSOWP(vUserFk, vTimed); - - RETURN vLastInsertedId; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP FUNCTION IF EXISTS `worker_isWorking` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1) - READS SQL DATA -BEGIN -/** - * Comprueba si el trabajador está trabajando en el momento de la consulta - * @return Devuelve TRUE en caso de que este trabajando. Si se encuentra en un descanso devolverá FALSE - */ - DECLARE vLastIn DATETIME ; - - SELECT MAX(timed) INTO vLastIn - FROM vn.workerTimeControl - WHERE userFk = vWorkerFk AND - direction = 'in'; - - IF (SELECT MOD(COUNT(*),2) - FROM vn.workerTimeControl - WHERE userFk = vWorkerFk AND - timed >= vLastIn - ) THEN - RETURN TRUE; - ELSE - RETURN 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 FUNCTION IF EXISTS `xdiario_new` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `xdiario_new`( - vAsiento INT, - vDated DATE, - vSubaccount VARCHAR(12), - vAccount VARCHAR(12), - vConcept VARCHAR(25), - vDebit DOUBLE, - vCredit DOUBLE, - vEuro DOUBLE, - vSerie CHAR(1), - vInvoice VARCHAR(8), - vVat DOUBLE, - vRe DOUBLE, - vAux TINYINT, - vCompany INT -) RETURNS int(11) - NO SQL -BEGIN - IF vAsiento IS NULL THEN - CALL vn.ledger_next(vAsiento); - END IF; - - INSERT INTO XDiario - SET ASIEN = vAsiento, - FECHA = vDated, - SUBCTA = vSubaccount, - CONTRA = vAccount, - CONCEPTO = vConcept, - EURODEBE = vDebit, - EUROHABER = vCredit, - BASEEURO = vEuro, - SERIE = vSerie, - FACTURA = vInvoice, - IVA = vVat, - RECEQUIV = vRe, - AUXILIAR = IF(vAux = FALSE, NULL, '*'), - MONEDAUSO = 2, - empresa_id = vCompany; - - RETURN vAsiento; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zoneGeo_new` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` FUNCTION `zoneGeo_new`(vType VARCHAR(255), vName VARCHAR(255), vParentFk INT) RETURNS int(11) - NO SQL -BEGIN -/** - * Creates a new node a node from the #zoneGeo table. - * Also sets a mark to force the tree recalculation. - * - * @param vType The node type - * @param vName The node name - * @param vParentFk The parent node identifier - * @return The new node identifier - */ - DECLARE vSelf INT; - - INSERT INTO zoneGeo - SET `type` = vType, - `name` = vName, - parentFk = vParentFk; - - SET vSelf = LAST_INSERT_ID(); - - UPDATE zoneGeoRecalc SET isChanged = TRUE; - - RETURN vSelf; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `addNoteFromDelivery` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `addNoteFromDelivery`(idTicket INT,nota TEXT) -BEGIN - - DECLARE observationTypeFk INT DEFAULT 3; /*3 = REPARTIDOR*/ - - INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) - VALUES (idTicket,observationTypeFk,nota) - ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `addressTaxArea`() - READS SQL DATA -BEGIN -/** - * Devuelve el taxArea para un conjunto de Consignatarios y empresas, - * - * @table tmp.addressCompany(addressFk, companyFk) valores a calcular - * @return tmp.addressTaxArea(addressFk,companyFk) - */ - - DECLARE vSpainCountryCode INT DEFAULT 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; - CREATE TEMPORARY TABLE tmp.addressTaxArea - (PRIMARY KEY (addressFk, companyFk)) - ENGINE = MEMORY - SELECT CASE - WHEN (NOT cClient.isUeeMember OR NOT cSupplier.isUeeMember) AND s.countryFk != c.countryFk THEN - 'WORLD' - WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.isVies THEN - 'CEE' - WHEN a.isEqualizated AND c.countryFk = vSpainCountryCode THEN - 'EQU' - ELSE - 'NATIONAL' - END AS areaFk, ac.addressFk, ac.companyFk - FROM tmp.addressCompany ac - JOIN address a ON a.id = ac.addressFk - JOIN `client` c ON c.id = a.clientFk - JOIN country cClient ON cClient.id = c.countryFk - JOIN supplier s ON s.id = ac.companyFk - JOIN country cSupplier ON cSupplier.id = s.countryFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `agencyHourGetFirstShipped` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetFirstShipped`(vAgencyMode INT, vAddress INT, vWarehouse INT) -BEGIN -/** - * DEPRECATED usar zoneGetFirstShipped -* Devuelve la primera fecha de envio disponible para una agencia en una direccion y un warehouse -* -* @param vAgencyMode id de la agencia en vn.agencyMode -* @param vAddress id de la direccion -* @param vWarehouse id del warehouse -* @return vShipped la primera fecha disponible y vLanded la fecha de llegada/recojida -*/ -DECLARE vAgency INT; -DECLARE vShipped DATE; -DECLARE vLanded DATE DEFAULT CURDATE(); - SELECT agencyFk INTO vAgency FROM agencyMode WHERE id= vAgencyMode; - - l: LOOP - - CALL agencyHourGetShipped(vLanded,vAddress,vAgency); - SELECT shipped INTO vShipped - FROM tmp.agencyHourGetShipped - WHERE warehouseFk = vWarehouse LIMIT 1; - - IF vShipped THEN - LEAVE l; - END IF; - - SET vLanded = DATE_ADD(vLanded, INTERVAL +1 DAY); - - END LOOP; - - SELECT vShipped,vLanded; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `agencyHourGetLanded` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetLanded`(vDated DATE, vAddress INT, vAgency INT, vWarehouse INT) -BEGIN -/** - * DEPRECATED usar zoneGetLanded - * Devuelve una tabla temporal con el dia de recepcion para vDated. - * - * @param vDated Fecha de preparacion de mercancia - * @param vAddress Id de consignatario, %NULL para recogida - * @param vAgency Id agencia - * @table tmp.agencyHourGetLanded Datos de recepción - */ - DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetLanded; - CREATE TEMPORARY TABLE tmp.agencyHourGetLanded - ENGINE = MEMORY - SELECT vWarehouse warehouseFk, landed FROM ( - SELECT * FROM ( - SELECT vWarehouse, TIMESTAMPADD(DAY, ah.substractDay, vDated) landed, ah.substractDay, ah.maxHour - FROM agencyHour ah - LEFT JOIN address a ON a.id = vAddress - WHERE (ah.weekDay = WEEKDAY(TIMESTAMPADD(DAY, ah.substractDay, vDated)) OR ah.weekDay IS NULL) - AND (ah.agencyFk = vAgency OR ah.agencyFk IS NULL) - AND ah.warehouseFk = vWarehouse - AND (ah.provinceFk = a.provinceFk OR ah.provinceFk IS NULL OR vAddress IS NULL) - ORDER BY ( - (ah.weekDay IS NOT NULL) + - (ah.agencyFk IS NOT NULL) + - (- ah.substractDay) + - ((ah.provinceFk IS NOT NULL)*3) - ) DESC - ) t - LIMIT 1 - ) t - WHERE IF(vDated = CURDATE(), t.maxHour > HOUR(NOW()), TRUE) AND t.substractDay < 225; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `agencyHourGetWarehouse` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetWarehouse`(vAddress INT, vDate DATE, vWarehouse INT) -BEGIN -/** - * DEPRECATED usar zoneGetWarehouse - * Devuelve el listado de agencias disponibles para la fecha, - * dirección y warehouuse pasadas - * - * @param vAddress no puede ser NULL - * @param vWarehouse warehouse donde comprobaremos las agencias y fecha - * @param vDate Fecha de recogida - * @table agencyModeWarehouseList Listado de agencias disponibles - */ - DECLARE vAgency INT; - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vCur CURSOR FOR - SELECT DISTINCT a.id - FROM agency a - JOIN agencyHour ah ON ah.agencyFk = a.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - IF vAddress IS NULL - THEN - CALL util.throw ('Address cannot be null'); - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.agencyModeWarehouseList; - CREATE TEMPORARY TABLE tmp.agencyModeWarehouseList ( - id INT NOT NULL, - agency VARCHAR(20), - description VARCHAR(45), - deliveryMethodFk VARCHAR(45), - shipped DATE, - warehouse VARCHAR(45), - PRIMARY KEY(id) - ) - ENGINE = MEMORY; - - OPEN vCur; - FETCH vCur INTO vAgency; - - WHILE NOT vDone - DO - - INSERT INTO tmp.agencyModeWarehouseList - SELECT am.id, am.name, am.description,am.deliveryMethodFk, TIMESTAMPADD(DAY, -ah.substractDay, vDate), w.name - FROM agencyHour ah - LEFT JOIN address a ON a.id = vAddress - JOIN agencyMode am ON am.agencyFk = vAgency - JOIN warehouse w on w.id = ah.warehouseFk - WHERE ah.warehouseFk = vWarehouse - AND (weekDay = WEEKDAY(vDate) - OR weekDay IS NULL) - AND (ah.agencyFk = vAgency - OR ah.agencyFk IS NULL) - AND (ah.provinceFk = a.provinceFk - OR ah.provinceFk IS NULL - OR vAddress IS NULL) - AND TIMESTAMPADD(DAY, -ah.substractDay, vDate) >= CURDATE() - AND IF(TIMESTAMPADD(DAY, -ah.substractDay, vDate) = CURDATE(), ah.maxHour > HOUR(NOW()), TRUE) - ORDER BY ( - (ah.weekDay IS NOT NULL) + - (ah.agencyFk IS NOT NULL) + - ((ah.provinceFk IS NOT NULL) * 3) - ) DESC - LIMIT 1; - - - FETCH vCur INTO vAgency; - END WHILE; - - CLOSE vCur; - - SELECT * FROM tmp.agencyModeWarehouseList; - DROP TEMPORARY TABLE tmp.agencyModeWarehouseList; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `agencyHourListGetShipped` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourListGetShipped`(vDate DATE, vAddress INT, vAgency INT) -BEGIN - /* * DEPRECATED usar zoneGetShipped -*/ - CALL vn.agencyHourGetShipped(vDate, vAddress, vAgency); - - SELECT * FROM tmp.agencyHourGetShipped; - - DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetShipped; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `agencyVolume__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyVolume__`(vDated DATE, vAgency INT) -BEGIN - - SELECT ELT(it.temperature + 1,'Calientes','Frios','Secos') AS Temp, - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.carro / 1000000 ,1) AS DECIMAL(10,2)) AS carros , - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.espai / 1000000,1) AS DECIMAL(10,2)) AS espais - FROM vn.buy b - INNER JOIN vn.entry e ON e.id = b.entryFk - INNER JOIN vn.travel tr ON tr.id = e.travelFk - INNER JOIN vn.volumeConfig vc - INNER JOIN vn.item i ON i.id = b.itemFk - INNER JOIN vn.itemType it ON it.id = i.typeFk - WHERE tr.landed = vDated - AND tr.agencyFk IN (0, vAgency) - GROUP BY Temp; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `available_calc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `available_calc`( - vDate DATE, - vAddress INT, - vAgencyMode INT) -BEGIN -/** - * Calculates the available for all available stores - * according to the given parameters. - * - * @param vDate The delivery date - * @param vAddress The delivery address id - * @param vAgencyMode The shipping agency - * @return tmp.availableCalc(calcFk) The available cache ids - */ - DECLARE vCalcFk INT; - DECLARE vShipment DATE; - DECLARE vWarehouse INT; - DECLARE vDone BOOL; - - DECLARE cWarehouses CURSOR FOR - SELECT warehouseFk, shipped FROM tmp.zoneGetShipped; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - -- Establecemos los almacenes y las fechas que van a entrar al disponible - - CALL vn.zone_getShipped (vDate, vAddress, vAgencyMode, FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.availableCalc; - CREATE TEMPORARY TABLE tmp.availableCalc( - calcFk INT UNSIGNED, - PRIMARY KEY (calcFk) - ) - ENGINE = MEMORY; - - OPEN cWarehouses; - - l: LOOP - SET vDone = FALSE; - FETCH cWarehouses INTO vWarehouse, vShipment; - - IF vDone THEN - LEAVE l; - END IF; - - CALL `cache`.available_refresh(vCalcFk, FALSE, vWarehouse, vShipment); - - INSERT IGNORE INTO tmp.availableCalc - SET calcFk = vCalcFk; - END LOOP; - - CLOSE cWarehouses; - DROP TEMPORARY TABLE tmp.zoneGetShipped; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `available_calc__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `available_calc__`( - vDate DATE, - vAddress INT, - vAgencyMode INT) -BEGIN -/** - * Calculates the available for all available stores - * according to the given parameters. - * - * @param vDate The delivery date - * @param vAddress The delivery address id - * @param vAgencyMode The shipping agency - * @return tmp.availableCalc(calcFk) The available cache ids - */ - DECLARE vCalcFk INT; - DECLARE vShipment DATE; - DECLARE vWarehouse INT; - DECLARE vDone BOOL; - - DECLARE cWarehouses CURSOR FOR - SELECT warehouseFk, shipped FROM tmp.zoneGetShipped; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - -- Establecemos los almacenes y las fechas que van a entrar al disponible - - CALL vn.zone_getShippedWarehouse(vDate, vAddress, vAgencyMode); - - DROP TEMPORARY TABLE IF EXISTS tmp.availableCalc; - CREATE TEMPORARY TABLE tmp.availableCalc( - calcFk INT UNSIGNED, - PRIMARY KEY (calcFk) - ) - ENGINE = MEMORY; - - OPEN cWarehouses; - - l: LOOP - SET vDone = FALSE; - FETCH cWarehouses INTO vWarehouse, vShipment; - - IF vDone THEN - LEAVE l; - END IF; - - CALL `cache`.available_refresh(vCalcFk, FALSE, vWarehouse, vShipment); - - INSERT IGNORE INTO tmp.availableCalc - SET calcFk = vCalcFk; - END LOOP; - - CLOSE cWarehouses; - DROP TEMPORARY TABLE tmp.zoneGetShipped; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `bankPolicy_notifyExpired` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `bankPolicy_notifyExpired`() -BEGIN -/** -* -* Manda correo cuando caduca un seguro -* de los leasing -* -*/ - INSERT INTO mail (receiver,replyTo,subject,body) - SELECT 'administracion@verdnatura.es' receiver, - 'noreply@verdnatura.es' replyTo, - CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') subject, - CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') body - FROM vn.bankPolicy bp - LEFT JOIN vn.supplier s - ON s.id = bp.supplierFk - LEFT JOIN vn.bank b - ON b.id = bp.bankFk - WHERE bp.insuranceExpired = 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 `buyUltimate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimate`(vWarehouseFk SMALLINT, vDated DATE) -BEGIN -/** - * Calcula las últimas compras realizadas hasta una fecha - * - * @param vWarehouseFk Id del almacén - * @param vDated Compras hasta fecha - * @return tmp.buyUltimate - */ - CALL cache.last_buy_refresh (FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; - CREATE TEMPORARY TABLE tmp.buyUltimate - (PRIMARY KEY (itemFk, warehouseFk), - INDEX(itemFk)) - ENGINE = MEMORY - SELECT item_id itemFk, buy_id buyFk, warehouse_id warehouseFk, landing - FROM cache.last_buy - WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL; - - CALL buyUltimateFromInterval(vWarehouseFk, CURDATE(), vDated); - - REPLACE INTO tmp.buyUltimate - SELECT itemFk, buyFk, warehouseFk, landed landing - FROM tmp.buyUltimateFromInterval - WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) - AND landed <= vDated; - - INSERT IGNORE INTO tmp.buyUltimate - SELECT itemFk, buyFk, warehouseFk, landed landing - FROM tmp.buyUltimateFromInterval - WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) - AND landed > vDated; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `buyUltimateFromInterval` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimateFromInterval`(vWarehouseFk SMALLINT, vStarted DATE, vEnded DATE) -BEGIN -/** - * Calcula las últimas compras realizadas - * desde un rango de fechas. - * - * @param vWarehouseFk Id del almacén si es NULL se actualizan todos - * @param vStarted Fecha inicial - * @param vEnded Fecha fin - * @return tmp.buyUltimateFromInterval - */ - IF vEnded IS NULL THEN - SET vEnded = vStarted; - END IF; - - IF vEnded < vStarted THEN - SET vStarted = TIMESTAMPADD(MONTH, -1, vEnded); - END IF; - - -- Item - - DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval; - CREATE TEMPORARY TABLE tmp.buyUltimateFromInterval - (PRIMARY KEY (itemFk, warehouseFk), INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk)) - ENGINE = MEMORY - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - MULTIMAX(t.landed, b.id) buyFk, - MAX(t.landed) landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vStarted AND vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.price2 > 0 - AND NOT b.isIgnored - AND b.quantity > 0 - GROUP BY itemFk, warehouseInFk; - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed > vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.price2 > 0 - AND NOT b.isIgnored - GROUP BY itemFk, warehouseInFk; - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vStarted AND vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.quantity = 0 - GROUP BY itemFk, warehouseInFk; - - - - -- ItemOriginal - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - MULTIMAX(t.landed, b.id) buyFk, - MAX(t.landed) landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vStarted AND vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.price2 > 0 - AND NOT b.isIgnored - AND b.quantity > 0 - AND itemOriginalFk - GROUP BY itemOriginalFk, warehouseInFk; - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed > vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.price2 > 0 - AND NOT b.isIgnored - AND itemOriginalFk - GROUP BY itemOriginalFk, warehouseInFk; - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vStarted AND vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.quantity = 0 - AND itemOriginalFk - GROUP BY itemOriginalFk, warehouseInFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `buyUltimate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimate__`(vWarehouseFk SMALLINT, vDated DATE) -BEGIN -/** - * Calcula las �ltimas compras realizadas hasta una fecha - * - * @param vWarehouseFk Id del almacén - * @param vDated Compras hasta fecha - * @return tmp.buyUltimate - */ - CALL cache.last_buy_refresh (FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; - CREATE TEMPORARY TABLE tmp.buyUltimate - (PRIMARY KEY (itemFk, warehouseFk), - INDEX(itemFk)) - ENGINE = MEMORY - SELECT item_id itemFk, buy_id buyFk, warehouse_id warehouseFk - FROM cache.last_buy - WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL; - - CALL buyUltimateFromInterval(vWarehouseFk, CURDATE(), vDated); - - REPLACE INTO tmp.buyUltimate - SELECT itemFk, buyFk, warehouseFk - FROM tmp.buyUltimateFromInterval - WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) - AND landed <= vDated; - - INSERT IGNORE INTO tmp.buyUltimate - SELECT itemFk, buyFk, warehouseFk - FROM tmp.buyUltimateFromInterval - WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) - AND landed > vDated; - - DROP TEMPORARY TABLE tmp.buyUltimateFromInterval; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_afterUpsert` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_afterUpsert`(vSelf INT) -BEGIN -/** - * Triggered actions when a buy is updated or inserted. - * - * @param vSelf The buy reference - */ - DECLARE vEntryFk INT; - DECLARE vItemFk INT; - DECLARE vPackingOut DECIMAL(10,2); - DECLARE vWarehouse INT; - DECLARE vStandardFlowerBox INT; - DECLARE vWarehouseOut INT; - DECLARE vIsMerchandise BOOL; - DECLARE vIsFeedStock BOOL; - - SELECT b.entryFk, b.itemFk, i.packingOut, ic.merchandise, vc.standardFlowerBox - INTO vEntryFk, vItemFk, vPackingOut, vIsMerchandise, vStandardFlowerBox - FROM buy b - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox - JOIN volumeConfig vc ON TRUE - WHERE b.id = vSelf; - - SELECT t.warehouseInFk, t.warehouseOutFk - INTO vWarehouse, vWarehouseOut - FROM entry e - JOIN travel t ON t.id = e.travelFk - WHERE e.id = vEntryFk; - - IF vIsMerchandise THEN - - REPLACE itemCost SET - itemFk = vItemFk, - warehouseFk = vWarehouse, - cm3 = buy_getUnitVolume(vSelf), - cm3Delivery = IFNULL((vStandardFlowerBox * 1000) / vPackingOut, buy_getUnitVolume(vSelf)); - - UPDATE vn.itemCost ic - JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - SET ic.grams = b.weight * 1000 / b.packing - WHERE ic.itemFk = vItemFk AND - ic.warehouseFk = vWarehouse; - - END IF; - - SELECT isFeedStock INTO vIsFeedStock - FROM warehouse WHERE id = vWarehouseOut AND id <> 13; - - IF vIsFeedStock THEN - INSERT IGNORE INTO producer(`name`) - SELECT es.company_name - FROM buy b - JOIN edi.ekt be ON be.id = b.ektFk - JOIN edi.supplier es ON es.supplier_id = be.pro - WHERE b.id = vSelf; - - 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 `buy_checkGrouping` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_checkGrouping`(vGrouping INT) -BEGIN -/** - * Checks the buy grouping, throws an error if it's invalid. - * - * @param vGrouping The grouping - */ - IF vGrouping = 0 THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Grouping cannot be zero'; - 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 `buy_getVolume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolume`() -BEGIN -/** - * Cálculo de volumen en líneas de compra - * @table tmp.buy(buyFk) - */ - SELECT t.name Temp, - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - item_getVolume(b.itemFk, b.packageFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) carros , - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - item_getVolume(b.itemFk, b.packageFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) espais - FROM buy b - JOIN tmp.buy tb ON tb.buyFk = b.id - JOIN volumeConfig vc - JOIN item i ON i.id = b.itemFk - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN temperature t ON t.code = it.temperatureFk - GROUP BY Temp; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getVolumeByAgency` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolumeByAgency`(vDated DATE, vAgencyFk INT) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.buy; - CREATE TEMPORARY TABLE tmp.buy (buyFk INT NOT NULL, PRIMARY KEY (buyFk)) ENGINE = MEMORY; - - INSERT INTO tmp.buy - SELECT b.id - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed = vDated - AND t.agencyFk IN (0, vAgencyFk); - - CALL buy_getVolume(); - DROP TEMPORARY TABLE tmp.buy; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getVolumeByEntry` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolumeByEntry`(vEntryFk INT) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.buy; - CREATE TEMPORARY TABLE tmp.buy (buyFk INT NOT NULL, PRIMARY KEY (buyFk)) ENGINE = MEMORY; - - INSERT INTO tmp.buy - SELECT b.id - FROM buy b - JOIN entry e ON e.id = b.entryFk - WHERE e.id = vEntryFk; - - CALL buy_getVolume(); - DROP TEMPORARY TABLE tmp.buy; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_notifyPassport__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_notifyPassport__`( - IN vBuyFk INT, - IN vItemFk INT, - IN vStickers SMALLINT, - IN vPacking SMALLINT -) -BEGIN - /*INSERT INTO vn.mail(`subject`,`body`,`sender`) - SELECT 'Solicitar pasaporte', - CONCAT( - 'Etiquetas: ', IFNULL(vStickers, 0), - ', Packing: ', IFNULL(vPacking, 0), - ', Nombre: ', IFNULL(i.`name`, 0), - ', buy_edi: ', IFNULL(e.id, 0), - ', Nombre botánico: ', IFNULL(g.latin_genus_name, ''), ' ', IFNULL(s.latin_species_name, ''), - ', Productor: ',IFNULL(es.company_name, IFNULL(p.`name`, '')) - ) - ,'ekt@verdnatura.es' - FROM item i - LEFT JOIN itemBotanical ib ON ib.itemFk = i.id - LEFT JOIN edi.genus g ON g.genus_id = ib.genusFk - LEFT JOIN edi.specie s ON IFNULL(s.specie_id, ib.specieFk) = ib.specieFk - LEFT JOIN producer p ON p.id = i.producerFk - LEFT JOIN buy b ON b.id = vBuyFk - LEFT JOIN edi.ekt e ON b.ektFk = e.id - LEFT JOIN edi.supplier es ON es.supplier_id = e.pro - WHERE i.id = vItemFk; */ -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_recalcPrices` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPrices`() -BEGIN --- Preparar para que proveedores como el 4 no puedan ser recalculadas sus entradas -/** - * Recalcula los precios para las compras insertadas en tmp.buyRecalc - * - * @param tmp.buyRecalc (id) - */ - DECLARE vLanded DATE; - DECLARE vWarehouseFk INT; - DECLARE vFallo BOOL; - DECLARE vBuyingValue DECIMAL(10,3); - DECLARE vPackageFk VARCHAR(10); - - SELECT t.landed, t.warehouseInFk INTO vLanded, vWarehouseFk - FROM tmp.buyRecalc br - JOIN buy b ON b.id = br.id - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - LIMIT 1; - - CALL vn.rate_getPrices(vLanded, vWarehouseFk); - - -- quitado los cubos a floramondo revisar en buy_tarifas_entry - UPDATE buy b - JOIN tmp.buyRecalc br ON br.id = b.id AND (@buyId := b.id) - LEFT JOIN packaging p ON p.id = b.packageFk - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN itemType it ON it.id = i.typeFk - JOIN travel tr ON tr.id = e.travelFk - JOIN agencyMode am ON am.id = tr.agencyFk - JOIN tmp.rate r - SET b.freightValue = @PF:= - ROUND(IFNULL(((am.m3 * @cm3:= item_getVolume(b.itemFk, b.packageFk)) / 1000000) / b.packing,0),3), - b.comissionValue = @CF:= ROUND(IFNULL(e.commission * b.buyingValue / 100, 0), 3), - b.packageValue = @EF:= IF(p.isPackageReturnable != 0, 0, ROUND(IFNULL(p.`value` / b.packing ,0),3)), - b.price3 = @t3:= IF(r.rate3 = 0, b.buyingValue,ROUND((b.buyingValue + @CF + @EF + @PF) / ((100 - r.rate3 - it.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 - b.price2 = @t2:= round(@t3 * (1 + ((r.rate2 - r.rate3)/100)),2), - b.price2 = @t2:= IF(@t2 <= @t3,@t3 , @t2); - - SELECT (b.buyingValue = b.price2), b.buyingValue, b.packageFk - INTO vFallo, vBuyingValue, vPackageFk - FROM vn.buy b - WHERE b.id = @buyId AND b.buyingValue <> 0.01; - - IF vFallo THEN - - CALL `vn`.`mail_insert`('cau@verdnatura.es', - NULL, - CONCAT('Fallo en buy_recalcPrices buy.id = ', @buyId), - CONCAT( ' @t3 = ', @t3, - ' @t2 = ', @t2, - ' @PF = ', @PF, - ' @EF = ', @EF, - ' @CF = ', @CF, - ' buyingValue = ', vBuyingValue, - ' packageFk = ', vPackageFk - ) - ); - - END IF; - - DROP TEMPORARY TABLE tmp.rate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `buy_updateGrouping` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updateGrouping`(vWarehouseFk INT, vItemFk INT, vGrouping INT) -BEGIN -/** - * Actualiza el grouping de las últimas compras de un artículo - * - * @param vWarehouseFk Id del almacén - * @param vItemFk Id del Artículo - * @param vGrouping Cantidad de grouping - */ - - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); - - UPDATE vn.buy b - JOIN tmp.buyUltimate bu ON b.id = bu.buyFk - SET b.`grouping` = vGrouping - WHERE bu.warehouseFk = vWarehouseFk - AND bu.itemFk = vItemFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_updatePacking` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT) -BEGIN -/** - * Actualiza packing - * - * @param vWarehouseFk warehouse del item - * @param vItemFk id del item - * @param vPacking packing a actualizar - */ - CALL buyUltimate(vWarehouseFk, CURDATE()); - - UPDATE buy b - JOIN tmp.buyUltimate bu ON b.id = bu.buyFk - SET b.packing = vPacking - WHERE bu.warehouseFk = vWarehouseFk - AND bu.itemFk = vItemFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `camaraFutureVolume__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `camaraFutureVolume__`(vWarehouseFk INT, vDateStart DATE, vDateEnd DATE) -BEGIN - - DECLARE vDated DATE; - DECLARE vSectorVolume INT; - DECLARE vLastDayVolume INT; - DECLARE vMinCamara INT; - - SET vDated = vDateStart; - - DROP TEMPORARY TABLE IF EXISTS tmp.camara; - - IF vDateStart = CURDATE() THEN - - CREATE TEMPORARY TABLE tmp.camara - SELECT vDated as dated, - CONCAT('sector ', sectorFk) as place, - FLOOR(SUM(ish.visible * r.cm3)/1000000) as m3 - FROM vn.itemShelving ish - JOIN bi.rotacion r ON r.Id_Article = ish.itemFk AND r.warehouse_id = vWarehouseFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - WHERE s.warehouseFk = vWarehouseFk - GROUP BY p.sectorFk; - - SELECT m3 - INTO vSectorVolume - FROM tmp.camara - WHERE place LIKE 'sector%'; - - CALL cache.visible_refresh(@calc_id, FALSE, 1); - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'nicho', - FLOOR((SUM(v.visible * r.cm3) / 1000000) - vSectorVolume ) as m3 - FROM cache.visible v - JOIN bi.rotacion r ON r.Id_Article = v.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = v.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE calc_id = @calc_id - AND ic.display; - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'entradas', FLOOR(SUM(iei.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_entry_in iei - JOIN bi.rotacion r ON r.Id_Article = iei.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = iei.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE ic.display - AND dat = vDated - AND NOT received - AND NOT isVirtualStock - AND iei.warehouse_id = vWarehouseFk; - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'salidas', FLOOR(SUM(ieo.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_entry_out ieo - JOIN bi.rotacion r ON r.Id_Article = ieo.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = ieo.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE ic.display - AND dat = vDated - AND NOT delivered - AND NOT isVirtualStock - AND ieo.warehouse_id = vWarehouseFk; - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'ventas', FLOOR(SUM(io.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_out io - JOIN bi.rotacion r ON r.Id_Article = io.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = io.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.ticketStateToday tst ON tst.ticket = io.ticketFk - JOIN vn.ticket t ON t.id = io.ticketFk - WHERE ic.display - AND ic.id != 7 - AND t.clientFk NOT IN (200,400,50,450) - AND dat BETWEEN vDated AND util.dayend(vDated) - AND NOT tst.isPicked - AND io.warehouse_id = vWarehouseFk; - - ELSE - - CREATE TEMPORARY TABLE tmp.camara - SELECT vDated as dated, - 'entradas' as place, - FLOOR(SUM(iei.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_entry_in iei - JOIN bi.rotacion r ON r.Id_Article = iei.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = iei.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE ic.display - AND dat = vDated - AND NOT isVirtualStock - AND iei.warehouse_id = vWarehouseFk; - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'salidas', FLOOR(SUM(ieo.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_entry_out ieo - JOIN bi.rotacion r ON r.Id_Article = ieo.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = ieo.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE ic.display - AND dat = vDated - AND ieo.warehouse_id = vWarehouseFk; - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'ventas', FLOOR(SUM(io.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_out io - JOIN bi.rotacion r ON r.Id_Article = io.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = io.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.ticket t ON t.id = io.ticketFk - WHERE ic.display - AND dat BETWEEN vDated AND util.dayend(vDated) - AND ic.id != 7 - AND t.clientFk NOT IN (200,400,50,450) - AND io.warehouse_id = vWarehouseFk; - - END IF; - - -- Resto de dias - WHILE vDated < vDateEnd DO - - SELECT SUM(IFNULL(m3,0)) INTO vLastDayVolume - FROM tmp.camara - WHERE dated = vDated; - - SET vDated = TIMESTAMPADD(DAY, 1, vDated); - - INSERT INTO tmp.camara(dated, place, m3) - VALUES( vDated, 'camara', vLastDayVolume); - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'entradas', FLOOR(SUM(iei.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_entry_in iei - JOIN bi.rotacion r ON r.Id_Article = iei.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = iei.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE ic.display - AND dat = vDated - AND NOT isVirtualStock - AND iei.warehouse_id = vWarehouseFk; - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'salidas', FLOOR(SUM(ieo.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_entry_out ieo - JOIN bi.rotacion r ON r.Id_Article = ieo.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = ieo.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE ic.display - AND dat = vDated - AND ieo.warehouse_id = vWarehouseFk; - - INSERT INTO tmp.camara(dated, place, m3) - SELECT vDated, 'ventas', FLOOR(SUM(io.amount * r.cm3) / 1000000) as m3 - FROM vn2008.item_out io - JOIN bi.rotacion r ON r.Id_Article = io.item_id AND r.warehouse_id = vWarehouseFk - JOIN vn.item i ON i.id = io.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.ticket t ON t.id = io.ticketFk - WHERE ic.display - AND dat BETWEEN vDated AND util.dayend(vDated) - AND ic.id != 7 - AND t.clientFk NOT IN (200,400,50,450) - AND io.warehouse_id = vWarehouseFk; - - END WHILE; - - SELECT min(m3) INTO vMinCamara - FROM - (SELECT dated, sum(m3) m3 - FROM tmp.camara - GROUP BY dated) sub; - - UPDATE tmp.camara - SET m3 = m3 - vMinCamara - WHERE place = 'camara'; - - SELECT camara.* FROM tmp.camara; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `carrosOficialesANoOficiales__` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `carrosOficialesANoOficiales__`() -BEGIN - -DECLARE done BOOL DEFAULT FALSE; -DECLARE vClientFk INT; -DECLARE vQuantity INT; -DECLARE vTicketFk INT; -DECLARE vAgencyTypeFk INT DEFAULT 628; - - -DECLARE rs CURSOR FOR - SELECT clientFk, sum(quantity) as carros - FROM `ticketPackaging` tp - JOIN ticket t ON t.id = tp.ticketFk - WHERE packagingFk = 'cc' - and t.shipped between '2017-10-30' AND '2019-01-06 23:59:59' - group by clientFk - having carros != 0; - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN rs; - -FETCH rs INTO vClientFk, vQuantity; - --- WHILE NOT done DO - - CALL vn.ticketCreate(vClientFk, '2019-01-06', 13, 442, NULL, vAgencyTypeFk, NULL, '2019-01-01', vTicketFk); - - INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) - VALUES (vTicketFk, 'cc', - VQuantity); - - INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) - VALUES (vTicketFk, 'dc', VQuantity); - - INSERT INTO vn.sale(ticketFk, itemFk, concept) - VALUES (vTicketFk, 90, 'Regularización CCs 2019'); - - CALL vn.`ticketStateUpdate`(vTicketFk, 'DELIVERED'); -- entregado - --- FETCH rs INTO vClientFk, vQuantity; - --- END WHILE; - - -CLOSE rs; - -SELECT vTicketFk; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_calcFromItem` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calcFromItem`( - vLanded DATE, - vAddressFk INT, - vAgencyModeFk INT, - vItemFk INT) -BEGIN -/** - * Calculates available and price for a single item. - * - * @param vItemFk The item id - * @return tmp.ticketCalculateItem - * @return tmp.ticketComponentPrice - * @return tmp.ticketComponent - * @return tmp.ticketLot - * @return tmp.zoneGetShipped - */ - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY - SELECT vItemFk itemFk; - - CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); - DROP TEMPORARY TABLE 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 `catalog_calculate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) -BEGIN -/** - * Calcula los articulos disponibles y sus precios - * - * @table tmp.item(itemFk) Listado de artículos a calcular - * @param vLanded Fecha de recepcion de mercancia - * @param vAddressFk Id del consignatario - * @param vAgencyModeFk Id de la agencia - * @return tmp.ticketCalculateItem(itemFk, available, producer, - * item, size, stems, category, inkFk, image, origin, price) - * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) - * @return tmp.ticketComponent - * @return tmp.ticketComponentPrice - */ - - DECLARE vAvailableCalc INT; - -- DECLARE vAvailableNoRaidsCalc INT; - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vZoneFk INT; - DECLARE vDone BOOL; - DECLARE cTravelTree CURSOR FOR - SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot( - `warehouseFk` smallint(5) unsigned NOT NULL, - `itemFk` int(11) NOT NULL, - `available` double DEFAULT NULL, - `buyFk` int(11) DEFAULT NULL, - `fix` tinyint(3) unsigned DEFAULT '0', -- este campo parece obsoleto - `zoneFk` int(11) NOT NULL, - KEY `itemFk` (`itemFk`), - KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH - ) ENGINE=MEMORY DEFAULT CHARSET=utf8; - - CALL catalog_componentPrepare(); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; - CREATE TEMPORARY TABLE tmp.ticketCalculateItem( - itemFk INT(11) NOT NULL, - available INT(11), - producer VARCHAR(50), - item VARCHAR(50), - size INT(10) UNSIGNED, - stems INT(11), - category VARCHAR(3), - inkFk VARCHAR(3), - image VARCHAR(50), - origin VARCHAR(3), - price DECIMAL(10,2), - priceKg DECIMAL(10,2), - `grouping` INT(10) UNSIGNED, - PRIMARY KEY `itemFk` (`itemFk`) - ) ENGINE = MEMORY DEFAULT CHARSET=utf8; - - OPEN cTravelTree; - - l: LOOP - SET vDone = FALSE; - FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped; - - IF vDone THEN - LEAVE l; - END IF; - - CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped); - -- CALL `cache`.availableNoRaids_refresh (vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped); - CALL vn.buyUltimate(vWarehouseFk, vShipped); - - INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk) - SELECT vWarehouseFk, - a.item_id, - IFNULL(a.available, 0), - bu.buyFk, - vZoneFk - FROM `cache`.available a - /*LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id - AND anr.calc_id = vAvailableNoRaidsCalc*/ - JOIN tmp.item i ON i.itemFk = a.item_id - JOIN vn.item it ON it.id = i.itemFk - JOIN vn.`zone` z ON z.id = vZoneFk - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id - LEFT JOIN edi.supplyResponse sr ON sr.ID = it.supplyResponseFk - LEFT JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID - LEFT JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - LEFT JOIN (SELECT isVNHSupplier, isEarlyBird, TRUE AS itemAllowed - FROM vn.addressFilter af - JOIN (SELECT ad.provinceFk, p.countryFk, ad.isLogifloraAllowed - FROM vn.address ad - JOIN vn.province p ON p.id = ad.provinceFk - WHERE ad.id = vAddressFk - ) sub2 ON sub2.provinceFk <=> IFNULL(af.provinceFk, sub2.provinceFk) - AND sub2.countryFk <=> IFNULL(af.countryFk, sub2.countryFk) - AND sub2.isLogifloraAllowed <=> IFNULL(af.isLogifloraAllowed, sub2.isLogifloraAllowed) - WHERE vWarehouseFk = af.warehouseFk - AND (vShipped < af.beforeDated - OR ISNULL(af.beforeDated) - OR vShipped > af.afterDated - OR ISNULL(af.afterDated)) - ) sub ON sub.isVNHSupplier = v.isVNHSupplier - AND (sub.isEarlyBird = mp.isEarlyBird OR ISNULL(sub.isEarlyBird)) - JOIN vn.agencyMode am ON am.id = vAgencyModeFk - JOIN vn.agency ag ON ag.id = am.agencyFk - JOIN vn.itemType itt ON itt.id = it.typeFk - JOIN vn.itemCategory itc on itc.id = itt.categoryFk - JOIN vn.address ad ON ad.id = vAddressFk - LEFT JOIN vn.clientItemType cit - ON cit.clientFk = ad.clientFk - AND cit.itemTypeFk = itt.id - LEFT JOIN vn.clientItemCategory cic - ON cic.clientFk = ad.clientFk - AND cic.itemCategoryFk = itc.id - WHERE a.calc_id = vAvailableCalc - AND a.available > 0 - AND (sub.itemAllowed OR NOT it.isFloramondo /*OR anr.available > 0*/) - AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize) - AND (itc.isReclining OR ISNULL(it.`size`) OR it.`size` < z.itemMaxSize OR ISNULL(z.itemMaxSize)) - AND NOT (cit.isAllowed <=> FALSE) - AND (ISNULL(cic.itemCategoryFk) OR cit.isAllowed); - - DROP TEMPORARY TABLE tmp.buyUltimate; - - CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - INSERT INTO tmp.ticketCalculateItem ( - itemFk, - available, - producer, - item, - size, - stems, - category, - inkFk, - image, - origin, - price, - priceKg, - `grouping`) - SELECT - tl.itemFk, - SUM(tl.available) available, - p.name producer, - i.name item, - i.size size, - i.stems, - i.category, - i.inkFk, - i.image, - o.code origin, - bl.price, - bl.priceKg, - bl.`grouping` - FROM tmp.ticketLot tl - JOIN item i ON tl.itemFk = i.id - LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible - JOIN origin o ON o.id = i.originFk - JOIN ( - SELECT price, itemFk, priceKg, MIN(`grouping`) `grouping` - FROM ( - SELECT price, itemFk, priceKg, `grouping` - FROM tmp.ticketComponentPrice - WHERE warehouseFk = vWarehouseFk - ORDER BY (rate = 2) DESC - ) sub - GROUP BY itemFk - ) bl ON bl.itemFk = tl.itemFk - WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk - GROUP BY tl.itemFk - ON DUPLICATE KEY UPDATE available = available + VALUES(available); - - END LOOP; - - CLOSE cTravelTree; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_componentCalculate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentCalculate`( vZoneFk INT, - vAddressFk INT, - vShipped DATE, - vWarehouseFk INT) -BEGIN - /** - * Calcula los componentes de los articulos de tmp.ticketLot - * - * @param vZoneFk para calcular el transporte - * @param vAddressFk Consignatario - * @param vShipped dia de salida del pedido - * @param vWarehouseFk warehouse de salida del pedido - * @table tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk) - * @table tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - * - * @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - */ - - DECLARE vClientFk INT; - DECLARE vIsFrenchVNHBuyer BOOLEAN DEFAULT FALSE; - DECLARE vVNHWarehouseFk INT DEFAULT 7; - DECLARE vFrenchDiscount DECIMAL(3,2) DEFAULT 0.12; - DECLARE visAnyVolumeAllowed BOOL; - - SELECT clientFk INTO vClientFK - FROM address - WHERE id = vAddressFk; - - SELECT (c.country = 'FRANCIA' AND vWarehouseFk = vVNHWarehouseFk) - INTO vIsFrenchVNHBuyer - FROM vn.country c - JOIN vn.province p ON p.countryFk = c.id - JOIN vn.address a ON a.provinceFk = p.id - WHERE a.id = vAddressFk; - - - -- Se eliminan los productos de tamaños no convencionales, salvo agencias que lo permitan - SELECT a.isAnyVolumeAllowed INTO visAnyVolumeAllowed - FROM vn.agency a - JOIN vn.agencyMode am ON am.agencyFk = a.id - JOIN vn.`zone`z ON z.agencyModeFk = am.id - WHERE z.id = vZoneFk; - - IF NOT vIsAnyVolumeAllowed THEN - - DELETE tl.* - FROM tmp.ticketLot tl - JOIN vn.item i ON i.id = tl.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - WHERE it.isUnconventionalSize; - - END IF; - - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate; - - CREATE TEMPORARY TABLE tmp.ticketComponentCalculate - (PRIMARY KEY (itemFk, warehouseFk)) - ENGINE = MEMORY - SELECT - tl.itemFk, - tl.warehouseFk, - tl.available, - -- IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) rate2, - IF(i.hasMinPrice, GREATEST(i.minPrice,IFNULL(pf.rate2, b.price2)),IFNULL(pf.rate2, b.price2)) rate2, - IF(i.hasMinPrice, GREATEST(i.minPrice,IFNULL(pf.rate3, b.price3)),IFNULL(pf.rate3, b.price3)) rate3, - -- @minPrice := IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) rate3, - -- TRUE AS minPrice, - IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing, - IFNULL(pf.`grouping`, b.`grouping`) `grouping`, - ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, - tl.buyFk, - i.typeFk, - IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping - FROM tmp.ticketLot tl - JOIN buy b ON b.id = tl.buyFk - JOIN item i ON i.id = tl.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN specialPrice sp ON sp.itemFk = i.id - AND sp.clientFk = vClientFk - LEFT JOIN ( - SELECT * FROM ( - SELECT pf.itemFk, - pf.`grouping`, - pf.packing, - pf.box, - pf.rate2, - pf.rate3, - zw.warehouseFk - FROM priceFixed pf - JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk - AND zw.warehouseFk IN (pf.warehouseFk,0) - WHERE vShipped BETWEEN pf.started AND pf.ended - ORDER BY pf.itemFk, pf.warehouseFk DESC - ) tpf - GROUP BY tpf.itemFk, tpf.warehouseFk - ) pf ON pf.itemFk = tl.itemFk - AND pf.warehouseFk = tl.warehouseFk - WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 - AND ic.merchandise - AND tl.zoneFk = vZoneFk - AND tl.warehouseFk = vWarehouseFk; - - -- Coste - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - c2.id, - b.buyingValue + b.freightValue + b.packageValue + b.comissionValue - FROM tmp.ticketComponentCalculate tcc - JOIN vn.component c2 ON c2.code = 'purchaseValue' - JOIN buy b ON b.id = tcc.buyFk; - - -- Margen - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - c2.id, - tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue - FROM tmp.ticketComponentCalculate tcc - JOIN vn.component c2 ON c2.code = 'margin' - JOIN buy b ON b.id = tcc.buyFk; - - -- Promo Francia - IF vIsFrenchVNHBuyer THEN - - INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT - tcc.warehouseFk, - tcc.itemFk, - c2.id, - - vFrenchDiscount * (b.buyingValue + b.freightValue + b.packageValue + b.comissionValue) / ( 1 - vFrenchDiscount) - FROM tmp.ticketComponentCalculate tcc - JOIN vn.component c2 ON c2.code = 'frenchOffer' - JOIN buy b ON b.id = tcc.buyFk; - - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase; - CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY - SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk - FROM tmp.ticketComponent tc - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk - GROUP BY tc.itemFk, warehouseFk; - - -- RECOBRO - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, tcb.itemFk, c2.id, - ROUND(tcb.base * - LEAST( - MAX(GREATEST(IFNULL(cr.priceIncreasing,0), - IFNULL(cr1.priceIncreasing,0), - IFNULL(cr2.priceIncreasing,0)) - ), - 0.25), - 3) - FROM tmp.ticketComponentBase tcb - JOIN vn.component c2 ON c2.code = 'debtCollection' - JOIN claimRatio cr ON cr.clientFk = vClientFk - LEFT JOIN clientYoke cy1 ON cy1.leftOx = cr.clientFk - LEFT JOIN claimRatio cr1 ON cr1.clientFk = cy1.rightOx - LEFT JOIN clientYoke cy2 ON cy2.rightOx = cr.clientFk - LEFT JOIN claimRatio cr2 ON cr2.clientFk = cy2.leftOx - WHERE GREATEST(IFNULL(cr.priceIncreasing,0), IFNULL(cr1.priceIncreasing,0), IFNULL(cr2.priceIncreasing,0)) > 0.009 - GROUP BY tcb.itemFk; - - -- Mana auto - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, tcb.itemFk, c2.id, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto - FROM tmp.ticketComponentBase tcb - JOIN `client` c on c.id = vClientFk - JOIN workerMana wm ON c.salesPersonFk = wm.workerFk - JOIN vn.component c2 ON c2.code = 'autoMana' - WHERE wm.isPricesModifierActivated - HAVING manaAuto <> 0; - - -- Precios especiales - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcb.warehouseFk, - tcb.itemFk, - c2.id, - GREATEST( - IFNULL(ROUND(tcb.base * c2.tax, 4), 0), - IF(i.hasMinPrice, i.minPrice,0) - tcc.rate3 - ) cost - FROM tmp.ticketComponentBase tcb - JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount' - JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - JOIN vn.item i ON i.id = tcb.itemFk - WHERE sp.value IS NULL - AND i.supplyResponseFk IS NULL; - - -- Venta por paquetes - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 - FROM tmp.ticketComponentCalculate tcc - JOIN vn.component c2 ON c2.code = 'salePerPackage' - JOIN buy b ON b.id = tcc.buyFk - LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk - WHERE sp.value IS NULL; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.zone (INDEX (id)) - ENGINE = MEMORY - SELECT vZoneFk id; - - CALL zone_getOptionsForShipment(vShipped, TRUE); - - -- Reparto - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFK, - tcc.itemFk, - c2.id, - z.inflation * ROUND(ic.cm3delivery * (IFNULL(zo.price,5000) - IFNULL(zo.bonus,0)) / (1000 * vc.standardFlowerBox) , 4) cost - FROM tmp.ticketComponentCalculate tcc - JOIN item i ON i.id = tcc.itemFk - JOIN tmp.zoneOption zo ON zo.zoneFk = vZoneFk - JOIN zone z ON z.id = vZoneFk - JOIN agencyMode am ON am.id = z.agencyModeFk - JOIN vn.volumeConfig vc - JOIN vn.component c2 ON c2.code = 'delivery' - LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk - AND ic.itemFk = tcc.itemFk - HAVING cost <> 0; - - DROP TEMPORARY TABLE tmp.zoneOption; - /* - -- Extra reparto - INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) - SELECT tcc.warehouseFk, tcc.itemFk, c2.id, ap.packagingValue cost - FROM tmp.ticketComponentCalculate tcc - JOIN vn.addressForPackaging ap - JOIN vn.component c2 ON c2.code = 'bagged' - WHERE ap.addressFk = vAddressFk; - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy; - CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY - SELECT * FROM tmp.ticketComponent; - - -- Precio especial - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - c2.id, - sp.value - SUM(tcc.cost) sumCost - FROM tmp.ticketComponentCopy tcc - JOIN component c ON c.id = tcc.componentFk - JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk - JOIN vn.component c2 ON c2.code = 'specialPrices' - WHERE c.classRate IS NULL - AND tcc.warehouseFk = vWarehouseFk - GROUP BY tcc.itemFk, tcc.warehouseFk - HAVING ABS(sumCost) > 0.001; - - -- Rappel - INSERT INTO tmp.ticketComponent - SELECT tcc.warehouseFk, - tcc.itemFk, - IFNULL(c.componentFk ,c2.id), - SUM(tcc.cost) * ((1/(1-c.rappel/100)) -1) sumCost - FROM tmp.ticketComponentCopy tcc - JOIN vn.clientChain cc ON cc.clientFk = vClientFk - JOIN vn.`chain` c ON c.id = cc.chainFk - JOIN vn.component c2 ON c2.code = 'rappel' - WHERE tcc.warehouseFk = vWarehouseFk - GROUP BY tcc.itemFk, tcc.warehouseFk; - - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum; - CREATE TEMPORARY TABLE tmp.ticketComponentSum - (INDEX (itemFk, warehouseFk)) - ENGINE = MEMORY - SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate - FROM tmp.ticketComponent tc - JOIN component c ON c.id = tc.componentFk - GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; - CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY - SELECT tcc.warehouseFk, - tcc.itemFk, - 1 rate, - IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`, - CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, - CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 1) = 1 - AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT - tcc.warehouseFk, - tcc.itemFk, - 2 rate, - tcc.packing `grouping`, - SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2 - AND tcc.packing > 0 AND tcc.available >= tcc.packing) - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT - tcc.warehouseFk, - tcc.itemFk, - 3 rate, - tcc.available `grouping`, - SUM(tcs.sumCost) price, - SUM(tcs.sumCost) / weightGrouping priceKg - FROM tmp.ticketComponentCalculate tcc - JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk - AND tcs.warehouseFk = tcc.warehouseFk - WHERE IFNULL(tcs.classRate, 3) = 3 - GROUP BY tcs.warehouseFk, tcs.itemFk; - - INSERT INTO tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) - SELECT * FROM ( - SELECT * FROM tmp.ticketComponentRate ORDER BY price - ) t - GROUP BY itemFk, warehouseFk, `grouping`; - - DROP TEMPORARY TABLE - tmp.ticketComponentCalculate, - tmp.ticketComponentSum, - tmp.ticketComponentBase, - tmp.ticketComponentRate, - tmp.ticketComponentCopy; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_componentPrepare` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPrepare`() -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent; - CREATE TEMPORARY TABLE tmp.ticketComponent ( - `warehouseFk` INT UNSIGNED NOT NULL, - `itemFk` INT NOT NULL, - `componentFk` INT UNSIGNED NOT NULL, - `cost` DECIMAL(10,4) NOT NULL, - INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), - UNIQUE `fkItemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC) - )ENGINE=MEMORY DEFAULT CHARSET=utf8; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice; - CREATE TEMPORARY TABLE tmp.ticketComponentPrice ( - `warehouseFk` INT UNSIGNED NOT NULL, - `itemFk` INT NOT NULL, - `rate` INT NOT NULL, - `grouping` INT UNSIGNED NOT NULL, - `price` DECIMAL(10,4) NOT NULL, - `priceKg` DECIMAL(10,4), - INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), - UNIQUE `fkItemWarehouseRate` (`itemFk` ASC, `warehouseFk` ASC, `rate` ASC) - )ENGINE=MEMORY DEFAULT CHARSET=utf8; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_componentPurge` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPurge`() -BEGIN - DROP TEMPORARY TABLE - tmp.ticketComponentPrice, - tmp.ticketComponent, - tmp.ticketLot; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `catalog_test` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_test`() -proc: BEGIN -/** - * Calcula los articulos disponibles y sus precios - * - * @table tmp.item(itemFk) Listado de artículos a calcular - * @param vLanded Fecha de recepcion de mercancia - * @param vAddressFk Id del consignatario - * @param vAgencyModeFk Id de la agencia - * @return tmp.ticketCalculateItem(itemFk, available, producer, - * item, size, stems, category, inkFk, image, origin, price) - * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) - * @return tmp.ticketComponent - * @return tmp.ticketComponentPrice - * @return tmp.zoneGetShipped - */ - DECLARE vLanded DATE DEFAULT DATE_ADD(CURDATE(),INTERVAL 2 DAY); - DECLARE vAddressFk INT DEFAULT 24526; - DECLARE vAgencyModeFk INT DEFAULT 639; - DECLARE vAvailableCalc INT; - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vZoneFk INT; - DECLARE vDone BOOL; - DECLARE cTravelTree CURSOR FOR - SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY - SELECT 10 itemFk; - -- Establece los almacenes y las fechas que van a entrar al disponible -SELECT 1; - CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); -SELECT 2; - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot( - `warehouseFk` smallint(5) unsigned NOT NULL, - `itemFk` int(11) NOT NULL, - `available` double DEFAULT NULL, - `buyFk` int(11) DEFAULT NULL, - `fix` tinyint(3) unsigned DEFAULT '0', - `zoneFk` int(11) NOT NULL, - KEY `itemFk` (`itemFk`), - KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH - ) ENGINE=MEMORY DEFAULT CHARSET=utf8; - CALL catalog_componentPrepare(); - -SELECT 3; - DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; - CREATE TEMPORARY TABLE tmp.ticketCalculateItem( - itemFk INT(11) NOT NULL, - available INT(11), - producer VARCHAR(50), - item VARCHAR(50), - size INT(10) UNSIGNED, - stems INT(11), - category VARCHAR(3), - inkFk VARCHAR(3), - image VARCHAR(50), - origin VARCHAR(3), - price DECIMAL(10,2), - priceKg DECIMAL(10,2), - PRIMARY KEY `itemFk` (`itemFk`) - ) ENGINE = MEMORY DEFAULT CHARSET=utf8; - - OPEN cTravelTree; - - l: LOOP - SET vDone = FALSE; - FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped; - - IF vDone THEN - LEAVE l; - END IF; - - CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped); -SELECT '4', vWarehouseFk, vShipped ; - CALL buyUltimate (vWarehouseFk, vShipped); -SELECT 5; - INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk) - SELECT vWarehouseFk, - i.item_id, - IFNULL(i.available, 0), - bu.buyFk, - vZoneFk - FROM `cache`.available i - JOIN tmp.item br ON br.itemFk = i.item_id - LEFT JOIN item it ON it.id = i.item_id - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.item_id - WHERE i.calc_id = vAvailableCalc - AND i.available > 0; - - DROP TEMPORARY TABLE tmp.buyUltimate; - - CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); -SELECT 6; - INSERT INTO tmp.ticketCalculateItem ( - itemFk, - available, - producer, - item, - size, - stems, - category, - inkFk, - image, - origin, - price, - priceKg) - SELECT - tl.itemFk, - SUM(tl.available) available, - p.name producer, - i.name item, - i.size size, - i.stems, - i.category, - i.inkFk, - i.image, - o.code origin, - bl.price, - bl.priceKg - FROM tmp.ticketLot tl - JOIN item i ON tl.itemFk = i.id - LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible - JOIN origin o ON o.id = i.originFk - JOIN ( - SELECT * - FROM (SELECT price, itemFk, priceKg - FROM tmp.ticketComponentPrice - WHERE warehouseFk = vWarehouseFk - ORDER BY (rate = 2) DESC) sub - GROUP BY itemFk - ) bl ON bl.itemFk = tl.itemFk - WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk - GROUP BY tl.itemFk - ON DUPLICATE KEY UPDATE available = available + VALUES(available); - - END LOOP; - - CLOSE cTravelTree; - DROP TEMPORARY TABLE tmp.item; -SELECT 7; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() -BEGIN - DECLARE vDateShort DATETIME; - DECLARE vOneYearAgo DATE; - DECLARE vFourYearsAgo DATE; - DECLARE v18Month DATE; - DECLARE v26Month DATE; - DECLARE v3Month DATE; - DECLARE vTrashId varchar(15); - - SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET vOneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE()); - SET vFourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE()); - SET v18Month = TIMESTAMPADD(MONTH, -18,CURDATE()); - SET v26Month = TIMESTAMPADD(MONTH, -26,CURDATE()); - SET v3Month = TIMESTAMPADD(MONTH, -3, CURDATE()); - - DELETE FROM ticketParking WHERE created < vDateShort; - DELETE FROM routesMonitor WHERE dated < vDateShort; - DELETE FROM workerTimeControlLog WHERE created < vDateShort; - DELETE FROM `message` WHERE sendDate < vDateShort; - DELETE FROM messageInbox WHERE sendDate < vDateShort; - DELETE FROM messageInbox WHERE sendDate < vDateShort; - DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo; - DELETE FROM itemShelving WHERE created < CURDATE() AND visible = 0; - DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE()); - DELETE FROM entryLog WHERE creationDate < vDateShort; - DELETE IGNORE FROM expedition WHERE created < v26Month; - DELETE FROM sms WHERE created < v18Month; - DELETE FROM saleTracking WHERE created < vOneYearAgo; - DELETE tobs FROM ticketObservation tobs - JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,CURDATE()); - DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo; - DELETE FROM sharingCart where ended < vDateShort; - DELETE FROM sharingClient where ended < vDateShort; - DELETE tw.* FROM ticketWeekly tw - LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL; - DELETE FROM claim WHERE ticketCreated < vFourYearsAgo; - DELETE FROM message WHERE sendDate < vDateShort; - -- Robert ubicacion anterior de trevelLog comentario para debug - DELETE sc FROM saleChecked sc - JOIN sale s ON sc.saleFk = s.id WHERE s.created < vDateShort; - DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month; - DELETE bm - FROM buyMark bm - JOIN buy b ON b.id = bm.id - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed <= vDateShort; - DELETE FROM stowaway WHERE created < v3Month; - DELETE FROM vn.buy WHERE created < vDateShort AND entryFk = 9200; - DELETE FROM vn.itemShelvingLog WHERE created < vDateShort; - DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort; - - -- Equipos duplicados - DELETE w.* - FROM workerTeam w - JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated - FROM workerTeam - GROUP BY team,workerFk - HAVING duplicated - ) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id; - - DELETE sc - FROM saleComponent sc - JOIN sale s ON s.id= sc.saleFk - JOIN ticket t ON t.id= s.ticketFk - WHERE t.shipped < v18Month; - - DELETE c - FROM vn.claim c - JOIN vn.claimState cs ON cs.id = c.claimStateFk - WHERE cs.description = "Anulado" AND - c.created < vDateShort; - DELETE - FROM vn.expeditionTruck - WHERE ETD < v3Month; - - -- borrar travels sin entradas - DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; - CREATE TEMPORARY TABLE tmp.thermographToDelete - SELECT th.id,th.dmsFk - FROM vn.travel t - LEFT JOIN vn.entry e ON e.travelFk = t.id - JOIN vn.travelThermograph th ON th.travelFk = t.id - WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL; - - SELECT dt.id into vTrashId - FROM vn.dmsType dt - WHERE dt.code = 'trash'; - - UPDATE tmp.thermographToDelete th - JOIN vn.dms d ON d.id = th.dmsFk - SET d.dmsTypeFk = vTrashId; - - DELETE th - FROM tmp.thermographToDelete tmp - JOIN vn.travelThermograph th ON th.id = tmp.id; - - DELETE t - FROM vn.travel t - LEFT JOIN vn.entry e ON e.travelFk = t.id - WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL; - - -- borrar entradas sin compras - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; - CREATE TEMPORARY TABLE tmp.entryToDelete - SELECT e.* - FROM vn.entry e - LEFT JOIN vn.buy b ON b.entryFk = e.id - JOIN vn.entryConfig ec ON e.id != ec.defaultEntry - WHERE e.dated < TIMESTAMPADD(MONTH, -3, CURDATE()) AND b.entryFK IS NULL; - - DELETE e - FROM vn.entry e - JOIN tmp.entryToDelete tmp ON tmp.id = e.id; - - -- borrar de route registros menores a 4 años - DROP TEMPORARY TABLE IF EXISTS tmp.routeToDelete; - CREATE TEMPORARY TABLE tmp.routeToDelete - SELECT * - FROM vn.route r - WHERE created < TIMESTAMPADD(YEAR,-4,CURDATE()); - - UPDATE tmp.routeToDelete tmp - JOIN vn.dms d ON d.id = tmp.gestdocFk - SET d.dmsTypeFk = vTrashId; - - DELETE r - FROM tmp.routeToDelete tmp - JOIN vn.route r ON r.id = tmp.id; - - -- borrar registros de dua y awb menores a 2 años - DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete; - CREATE TEMPORARY TABLE tmp.duaToDelete - SELECT * - FROM vn.dua - WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE()); - - UPDATE tmp.duaToDelete tm - JOIN vn.dms d ON d.id = tm.gestdocFk - SET d.dmsTypeFk = vTrashId; - - DELETE d - FROM tmp.duaToDelete tmp - JOIN vn.dua d ON d.id = tmp.id; - - DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,CURDATE()); - - -- Borra los ficheros gestDoc - INSERT INTO vn.printServerQueue(priorityFk, labelReportFk)VALUES(1,11); - - -- Borra los registros de collection y ticketcollection - DELETE FROM vn.collection WHERE created < vDateShort; - - DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; - DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete; - - DELETE FROM travelLog WHERE creationDate < v3Month; - - CALL shelving_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 `clean_logiflora` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clean_logiflora`() -BEGIN - /* partir en 2 procedimientos, uno que borre compras y otro articulos - * item_clean, buy_clean - * */ - - DECLARE vMaxDated DATE DEFAULT TIMESTAMPADD(DAY, - 7, CURDATE()); - DECLARE vDone INT DEFAULT FALSE; - DECLARE vBuyFk INT; - DECLARE cur1 CURSOR FOR SELECT id FROM tmp.buy; - DECLARE cur2 CURSOR FOR SELECT id FROM tmp.item; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.buy; - - CREATE TEMPORARY TABLE tmp.buy - ENGINE = MEMORY - SELECT b.id - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.agencyMode am ON am.id = tr.agencyFk - WHERE b.quantity = 0 - AND am.name = 'LOGIFLORA' - AND e.isRaid; - - OPEN cur1; - - read_loop: LOOP - - SET vDone = FALSE; - - FETCH cur1 INTO vBuyFk; - - IF vDone THEN - LEAVE read_loop; - END IF; - - DELETE FROM vn.buy WHERE id = vBuyFk; - - END LOOP; - - CLOSE cur1; - - DROP TEMPORARY TABLE tmp.buy; - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - - CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY - SELECT DISTINCT i.id - FROM vn.item i - LEFT JOIN hedera.orderRow o ON o.itemFk = i.id - LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.buy b ON b.itemFk = i.id - WHERE i.supplyResponseFk - AND o.id IS NULL - AND b.id IS NULL - AND s.id IS NULL - AND i.created < vMaxDated; - - OPEN cur2; - - read_loop: LOOP - - SET vDone = FALSE; - - FETCH cur2 INTO vBuyFk; - - IF vDone THEN - LEAVE read_loop; - END IF; - - DELETE FROM vn.item WHERE id = vBuyFk; - - END LOOP; - - CLOSE cur2; - - DROP TEMPORARY TABLE 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 `clearShelvingList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clearShelvingList`(vShelvingFk VARCHAR(8)) -BEGIN - - UPDATE vn.itemShelving - SET visible = 0, available = 0 - WHERE shelvingFk COLLATE utf8_unicode_ci =vShelvingFk 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 `clientCreate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientCreate`( - vFirstname VARCHAR(50), - vSurnames VARCHAR(50), - vFi VARCHAR(9), - vAddress TEXT, - vPostcode CHAR(5), - vCity VARCHAR(25), - vProvinceFk SMALLINT(5), - vCompanyFk SMALLINT(5), - vPhone VARCHAR(11), - vEmail VARCHAR(255), - vUserFk INT) -BEGIN -/** - * Create new client - * - */ - DECLARE vPayMethodFk INT DEFAULT 4; - DECLARE vDueDay INT DEFAULT 5; - DECLARE vDefaultCredit DECIMAL(10, 2) DEFAULT 300.00; - DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1; - DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE; - DECLARE vMandateTypeFk INT DEFAULT 2; - - INSERT INTO `client` ( - id, - name, - street, - fi, - phone, - email, - provinceFk, - city, - postcode, - socialName, - payMethodFk, - dueDay, - credit, - isTaxDataChecked, - hasCoreVnl, - isEqualizated) - VALUES ( - vUserFk, - CONCAT('TR ', vFirstname, ' ', vSurnames), - vAddress, - TRIM(vFi), - vPhone, - vEmail, - vProvinceFk, - vCity, - vPostcode, - CONCAT(vSurnames, ' ', vFirstname), - vPayMethodFk, - vDueDay, - vDefaultCredit, - vIsTaxDataChecked, - vHasCoreVnl, - FALSE - ) ON duplicate key update - payMethodFk = vPayMethodFk, - dueDay = vDueDay, - credit = vDefaultCredit, - isTaxDataChecked = vIsTaxDataChecked, - hasCoreVnl = vHasCoreVnl, - isActive = TRUE; - - IF (SELECT COUNT(*) FROM mandate WHERE clientFk = vUserFk AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk) = 0 THEN - INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) - VALUES (vUserFk, vCompanyFk, vMandateTypeFk); - 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 `clientDebtSpray` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientDebtSpray`(vClientFk INT) -BEGIN - - /* Reparte el saldo de un cliente en greuge en la cartera que corresponde, y desasigna el comercial - * - * - */ - - DECLARE vClientDebt DOUBLE; - - SELECT vn.clientGetDebt(vClientFk, CURDATE()) INTO vClientDebt; - - INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) - VALUES (vClientFk, 'Saldo pendiente', vClientDebt, CURDATE(), 5); - - CALL vn.clientGreugeSpray(vClientFk, TRUE, '', TRUE); - - INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) - SELECT vClientFk, 'Liquidación cliente', sum(amount), CURDATE(), 5 - FROM vn.greuge - WHERE clientFk = vClientFk; - - UPDATE vn.client - SET salesPersonFk = NULL - WHERE id = vClientFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientFreeze` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `clientFreeze`() -BEGIN -/** - * Congela diariamente aquellos clientes que son morosos sin recobro, - * pero que no sean trabajadores, - * y que el riesgo no sea menor que cero - * hasta que no se gire la remesa no se congelan a los clientes de giro - */ - - DECLARE vIsRemittanced BOOLEAN; - - SELECT id into vIsRemittanced - FROM receipt - WHERE invoiceFk LIKE 'REMESA%' - AND payed > util.firstDayOfMonth(CURDATE()) - limit 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - SELECT clientFk - FROM bs.defaulter - WHERE created = CURDATE() - AND amount; - - CALL clientGetDebt(CURDATE()); - - UPDATE client c - JOIN bi.defaulters d ON d.client = c.id AND d.date = CURDATE() - JOIN config ON TRUE - LEFT JOIN account.`user` u ON u.id = c.id AND u.active - LEFT JOIN worker w ON w.id = u.id - LEFT JOIN recovery r ON r.clientFk = c.id AND r.finished IS NULL - LEFT JOIN payMethod pm ON pm.id = c.payMethodFk - LEFT JOIN tmp.risk rk ON rk.clientFk = c.id - SET c.isFreezed = TRUE, - d.frozened = CURDATE(), - u.active = FALSE - WHERE (d.amount > config.defaultersMaxAmount - AND rk.risk > 0) - AND c.typeFk = 'normal' - AND r.id IS NULL - AND w.id IS NULL - AND (vIsRemittanced OR pm.code <> 'bankDraft'); - - DROP TEMPORARY TABLE tmp.clientGetDebt; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientGetDebt` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `clientGetDebt`(vDate DATE) -BEGIN -/** - * Calcula el riesgo para los clientes activos - * - * @table tmp.clientGetDebt(clientFk) - * @param vDate Fecha maxima de los registros - * @return tmp.risk - */ - DECLARE vStarted DATETIME DEFAULT TIMESTAMPADD(DAY, -35, CURDATE()); - DECLARE vEnded DATETIME; - - SET vEnded = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); - - DROP TEMPORARY TABLE IF EXISTS tClientRisk; - CREATE TEMPORARY TABLE tClientRisk - ENGINE = MEMORY - SELECT cr.clientFk, SUM(cr.amount) amount - FROM clientRisk cr - JOIN tmp.clientGetDebt c ON c.clientFk = cr.clientFk - GROUP BY cr.clientFk; - - INSERT INTO tClientRisk - SELECT c.clientFk, SUM(r.amountPaid) - FROM receipt r - JOIN tmp.clientGetDebt c ON c.clientFk = r.clientFk - WHERE r.payed > vEnded - GROUP BY c.clientFk; - - INSERT INTO tClientRisk - SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpvTransaction t - JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk - WHERE t.receiptFk IS NULL - AND t.status = 'ok' - GROUP BY t.clientFk; - - INSERT INTO tClientRisk - SELECT t.clientFk, totalWithVat - FROM ticket t - JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk - WHERE refFk IS NULL - AND shipped BETWEEN vStarted AND vEnded; - - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - CREATE TEMPORARY TABLE tmp.risk - (PRIMARY KEY (clientFk)) - ENGINE = MEMORY - SELECT clientFk, SUM(amount) risk - FROM client c - JOIN tClientRisk cr ON cr.clientFk = c.id - GROUP BY c.id; - - DROP TEMPORARY TABLE tClientRisk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientGetDebtDiary` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGetDebtDiary`(vClientFK INT, vCompanyFk INT) -BEGIN -/** - * Devuelve el registro de deuda - * - * @param vClientFK Id del cliente - * @param vCompanyFk Id de la empresa - */ - DECLARE vDone BOOL; - DECLARE vDate DATETIME; - DECLARE vTotalBalance DOUBLE DEFAULT 0.00; - DECLARE vCreated DATETIME; - DECLARE vIssued DATETIME; - DECLARE vBalance DOUBLE DEFAULT 0.00; - DECLARE cur CURSOR FOR - SELECT - created, - issued, - ROUND(amount, 2) AS balance - FROM invoiceOut - WHERE clientFk = vClientFk AND companyFk = vCompanyFk - UNION ALL - SELECT - created, - payed, - ROUND(-1 * amountPaid, 2) AS balance - FROM receipt - WHERE clientFk = vClientFk AND companyFk = vCompanyFk - ORDER BY issued, created; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - OPEN cur; - - proc: LOOP - SET vDone = FALSE; - - FETCH cur INTO vCreated, vIssued, vBalance; - - IF vDate IS NULL THEN - SET vDate=vIssued; - END IF; - - IF vDone THEN - LEAVE proc; - END IF; - - SET vTotalBalance = vTotalBalance + vBalance; - - IF CAST(ABS(vTotalBalance) AS UNSIGNED) = 0 THEN - SET vDate = vIssued; - SET vDone = TRUE; - END IF; - END LOOP; - - CLOSE cur; - - SELECT - issued, - CAST(debtOut AS DECIMAL(10,2)) debtOut, - CAST(debtIn AS DECIMAL(10,2)) debtIn, - ref, - companyFk, - priority - FROM - (SELECT - NULL AS issued, - SUM(amountUnpaid) AS debtOut, - NULL AS debtIn, - 'Saldo Anterior' AS ref, - companyFk, - 0 as priority - FROM - (SELECT SUM(amount) AS amountUnpaid, companyFk, 0 - FROM invoiceOut - WHERE clientFk = vClientFK - AND issued < vDate - GROUP BY companyFk - - UNION ALL - - SELECT SUM(-1 * amountPaid), companyFk, 0 - FROM receipt - WHERE clientFk = vClientFK - AND payed < vDate - GROUP BY companyFk) AS transactions - GROUP BY companyFk - - UNION ALL - - SELECT - issued, - amount as debtOut, - NULL AS debtIn, - ref, - companyFk, - 1 - FROM invoiceOut - WHERE clientFk = vClientFK - AND issued >= vDate - UNION ALL - - SELECT - r.payed, - NULL as debtOut, - r.amountPaid, - r.invoiceFk, - r.companyFk, - 0 - FROM receipt r - WHERE r.clientFk = vClientFK - AND r.payed >= vDate) t - INNER JOIN `client` c ON c.id = vClientFK - HAVING debtOut <> 0 OR debtIn <> 0 - ORDER BY issued, priority DESC, debtIn; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientGreugeSpray` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGreugeSpray`(IN vClientFk INT, IN onlyForHisOwner BOOL, IN vWorkerCode VARCHAR(3), IN vWithMana BOOLEAN) -BEGIN - - DECLARE vGreuge DECIMAL(10,2); - DECLARE vOwner INT; - DECLARE vTotalSale INT; - DECLARE vGreugeTypeFk INT DEFAULT 5; -- HERENCIA - DECLARE vGreugeTypeMana INT DEFAULT 3;-- Maná - DECLARE vMana DECIMAL(10,2); - - SELECT vn.clientGetMana(vClientFk) INTO vMana; - - IF vWithMana AND vMana THEN - - INSERT INTO vn.greuge( clientFk, - description, - amount, - shipped, - greugeTypeFk) - VALUES( vClientFk, - 'Desasignación', - -1 * vMana, - CURDATE(), - vGreugeTypeMana); - - END IF; - - SELECT sum(amount) INTO vGreuge - FROM vn.greuge - WHERE clientFk = vClientFk; - - IF vGreuge != 0 THEN - - IF LENGTH(vWorkerCode) = 0 THEN - - SELECT salesPersonFk INTO vOwner - FROM vn.client - WHERE id = vClientFk; - - ELSE - - SELECT id INTO vOwner - FROM vn.worker - WHERE code = vWorkerCode COLLATE utf8_general_ci; - - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientList; - CREATE TEMPORARY TABLE tmp.clientList - SELECT DISTINCT t.clientFk, floor(cr.yearSale / 12) AS monthSale - FROM vn.ticket t - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.manaSpellers ms ON ms.worker = c.salesPersonFk - JOIN vn.claimRatio cr ON cr.clientFk = c.id - WHERE ms.worker = IF(onlyForHisOwner, vOwner, ms.worker) - AND t.shipped >= TIMESTAMPADD(MONTH,-1,CURDATE()) - AND c.id != vClientFk - HAVING monthSale > 100; - - SELECT SUM(monthSale) INTO vTotalSale - FROM tmp.clientList; - - INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) - SELECT clientFk, CONCAT('Cliente: ',vClientFk), vGreuge * monthSale / vTotalSale, CURDATE(), vGreugeTypeFk - FROM tmp.clientList - UNION ALL - SELECT vClientFk, 'Reparto greuge', -vGreuge, CURDATE(), vGreugeTypeFk; - - 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 `clientPackagingOverstock` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstock`(vClientFk INT, vGraceDays INT ) -BEGIN - DROP TEMPORARY TABLE IF EXISTS tmp.clientPackagingOverstock; - CREATE TEMPORARY TABLE tmp.clientPackagingOverstock - ENGINE = MEMORY - SELECT itemFk, - sum(GotfromClient) - sum(SenttoClient) as devueltos, - sum(InvoicedtoClient) - sum(InvoicedfromClient) as facturados, - LEAST( - sum(GotfromClient) - sum(SenttoClient), - sum(InvoicedtoClient) - sum(InvoicedfromClient) - ) as abonables - FROM - ( - SELECT t.*, - IF(@month = month, 0, 1) monthEnd, - @month := month - FROM - ( - SELECT x.id as ticketFk, - date(x.shipped) as shipped, - x.itemFk, - IFNULL(cast(sum(x.InvoicedtoClient) as DECIMAL(10,0)),0) InvoicedtoClient, - IFNULL(cast(sum(x.InvoicedfromClient) as DECIMAL(10,0)),0) InvoicedfromClient, - IFNULL(cast(sum(x.SenttoClient) as DECIMAL(10,0)),0) SenttoClient, - IFNULL(cast(sum(x.GotfromClient) as DECIMAL(10,0)),0) GotfromClient, - i.name as concept, - x.refFk as invoice, - month(shipped) month, - x.companyFk - FROM - ( - SELECT t.id, - t.shipped, - IFNULL(pe.equivalentFk, s.itemFk) itemFk, - IF(s.quantity > 0, s.quantity, NULL) InvoicedtoClient, - IF(s.quantity < 0, -s.quantity, NULL) InvoicedfromClient, - NULL SenttoClient, - NULL GotfromClient, - t.refFk, - @month := 0 month, - t.companyFk - FROM sale s - JOIN ticket t on t.id = s.ticketFk - JOIN packaging p ON p.itemFk = s.itemFk - LEFT JOIN packageEquivalentItem pe ON pe.itemFk = s.itemFk - WHERE t.clientFk = vClientFk - AND t.shipped > '2017-11-30' - AND p.isPackageReturnable - UNION ALL - SELECT NULL, - '2017-11-30', - IFNULL(pe.equivalentFk, tps.itemFk) itemFk, - tps.sent InvoicedtoClient, - tps.returned InvoicedfromClient, - NULL SenttoClient, - NULL GotfromClient, - 'Histórico', - NULL, - NULL - - FROM ticketPackagingStartingStock tps - LEFT JOIN packageEquivalentItem pe ON pe.itemFk = tps.itemFk - WHERE tps.clientFk = vClientFk - AND tps.isForgetable = FALSE - UNION ALL - SELECT t.id, - t.shipped, - IFNULL(pe.equivalentFk, p.itemFk) itemFk, - NULL, - NULL, - IF(tp.quantity > 0 AND t.shipped <= TIMESTAMPADD(DAY, - vGraceDays, CURDATE()), tp.quantity, NULL) SenttoClient, - IF(tp.quantity < 0, -tp.quantity, NULL) GotfromClient, - NULL AS refFk, - NULL, - t.companyFk - FROM ticketPackaging tp - JOIN ticket t on t.id = tp.ticketFk - JOIN packaging p ON p.id = tp.packagingFk - LEFT JOIN packageEquivalentItem pe ON pe.itemFk = p.itemFk - WHERE t.clientFk = vClientFk - AND t.shipped > '2017-11-21' ) x - - JOIN item i ON x.itemFk = i.id - GROUP BY x.id, x.itemFk - ) t - ORDER BY itemFk, shipped DESC - ) t2 - GROUP BY itemFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientPackagingOverstockReturn` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstockReturn`(vClientFk INT, vGraceDays INT ) -BEGIN - - DECLARE vNewTicket INT DEFAULT 0; - DECLARE vWarehouseFk INT; - -- SET vGraceDays = GREATEST(vGraceDays, 90); - - CALL vn.clientPackagingOverstock(vClientFk,vGraceDays); - - SELECT id INTO vWarehouseFk - FROM vn.warehouse - WHERE hasConfectionTeam; - - CALL vn.ticket_add( - vClientFk - ,CURDATE() - ,vWarehouseFk -- Algemesi - ,442 -- Verdnatura - ,NULL -- address - ,NULL -- agencia - ,NULL -- route - ,CURDATE() - ,account.myUser_getId() - ,TRUE - ,vNewTicket); - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) - SELECT vNewTicket, cpo.itemFk, - cpo.abonables, i.longName, p.price - FROM tmp.clientPackagingOverstock cpo - JOIN vn.item i ON i.id = cpo.itemFk - JOIN vn.packaging p ON p.itemFk = cpo.itemFk - WHERE cpo.abonables > 0; - - INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) - SELECT vNewTicket, p.id, cpo.abonables - FROM tmp.clientPackagingOverstock cpo - JOIN vn.packaging p ON p.itemFk = cpo.itemFk - WHERE cpo.abonables > 0; - - 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 `clientRandomSelection__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRandomSelection__`(vNumero INT) -BEGIN - - DECLARE vClient INT; - - SET @vIndex := 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.client; - - CREATE TEMPORARY TABLE tmp.client - SELECT io.clientFk, - FALSE as isSelected, - @vIndex := @vIndex + 1 id - FROM vn.client c - JOIN vn.invoiceOut io ON io.clientFk = c.id - JOIN vn.address a ON a.clientFk = c.id - JOIN vn.province p ON p.id = a.provinceFk - WHERE p.name = 'MADRID' - AND io.issued = '2019-01-31' - AND a.isDefaultAddress - AND c.name NOT LIKE 'TR %'; - - WHILE vNumero DO - - SET vClient = FLOOR(RAND() * @vIndex + 1); - - IF (SELECT isSelected FROM tmp.client WHERE id = vClient) = FALSE THEN - - UPDATE tmp.client - SET isSelected = TRUE - WHERE id = vClient; - - SET vNumero = vNumero - 1; - - END IF; - - END WHILE; - - SELECT * FROM tmp.client JOIN vn.client c ON c.id = clientFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientRemoveWorker` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRemoveWorker`() -BEGIN - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vClientFk INT; - DECLARE rs CURSOR FOR - SELECT c.clientFk - FROM tmp.clientGetDebt c - LEFT JOIN clientRisk r ON r.clientFk = c.clientFk - GROUP BY c.clientFk - HAVING SUM(IFNULL(r.amount,0)) = 0; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - SELECT cd.id as clientFk - FROM bs.clientDied cd - LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id - JOIN vn.client c ON c.id = cd.id - JOIN vn.province p ON p.id = c.provinceFk - JOIN vn.country co ON co.id = p.countryFk - WHERE cd.Aviso = 'TERCER AVISO' AND - cp.clientFk IS NULL AND - co.country NOT IN ('Portugal','Francia','España exento') AND - c.salesPersonFk IS NOT NULL; - - OPEN rs; - FETCH rs INTO vClientFk; - WHILE NOT vDone DO - CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE); - UPDATE vn.client SET salesPersonFk = NULL WHERE id = vClientFk; - INSERT INTO vn.clientLog (originFk, userFk, `action`, description) - VALUES (vClientFk, account.userGetId(), 'update', CONCAT('Se ha desasignado el cliente por que no ha comprado en 3 meses')); - FETCH rs INTO vClientFk; - END WHILE; - CLOSE rs; - DROP TEMPORARY TABLE tmp.clientGetDebt; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clientRisk_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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2)) -BEGIN - IF vAmount IS NOT NULL - THEN - INSERT INTO clientRisk - SET - clientFk = vClientId, - companyFk = vCompanyId, - amount = vAmount - ON DUPLICATE KEY UPDATE - amount = amount + VALUES(amount); - 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 `client_checkBalance` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `client_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL) -BEGIN - - DECLARE vDateFrom DATE; - SET vDateTo = TIMESTAMP(vDateTo,'23:59:59'); - SELECT util.firstDayOfYear(vDateTo) INTO vDateFrom; - - SELECT s.nickname, c.id , c.accountingAccount , sub1.mysql , sub1.sage, sub1.mysql - sub1.sage diference, sub1.companyFk , c.name - FROM client c - JOIN payMethod pm ON pm.id = c.payMethodFk - JOIN( SELECT sub.companyFk, sub.clientFk, ROUND(SUM(sub.mysql),2) mysql, ROUND(SUM(sub.sage),2) sage - FROM( SELECT io.companyFk, io.clientFk, -io.amount mysql, 0 sage - FROM invoiceOut io - WHERE issued BETWEEN vDateFrom AND vDateTo - UNION ALL - SELECT r.companyFk, r.clientFk, r.amountPaid, 0 sage - FROM receipt r - WHERE payed BETWEEN vDateFrom AND vDateTo - AND IF(vIsConciliated,r.isConciliate, TRUE) = TRUE - UNION ALL - SELECT empresa_id, c.id, 0, ROUND(NZ(Eurohaber) - NZ(Eurodebe),2) sage - FROM bi.XDiario_ALL xd - JOIN client c ON c.accountingAccount = xd.SUBCTA - WHERE xd.Fecha BETWEEN vDateFrom AND vDateTo - )sub - GROUP BY companyFk, clientFk - ) sub1 ON sub1.clientFk = c.id - JOIN supplier s ON s.id = sub1.companyFk - JOIN company co ON co.id = sub1.companyFk - WHERE pm.outstandingDebt - AND co.code <> 'BLK' - HAVING ABS(diference) > 0.05 - ORDER BY c.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 `client_RandomList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `client_RandomList`(vNumber INT) -BEGIN - - DECLARE i INT DEFAULT 0; - DECLARE c INT DEFAULT 0; - DECLARE maxClientFk INT; - - DROP TEMPORARY TABLE IF EXISTS tmp.client; - - CREATE TEMPORARY TABLE tmp.`client` - (id INT AUTO_INCREMENT, - clientFk INT, - isSelected TINYINT(1) NOT NULL DEFAULT 0, - PRIMARY KEY(id), - UNIQUE KEY clientFk (clientFk)) - ENGINE = MEMORY; - - INSERT INTO tmp.client(clientFk) - SELECT DISTINCT clientFk - FROM vn.invoiceOut - WHERE issued > TIMESTAMPADD(MONTH, -2, CURDATE()); - - SELECT max(id) INTO maxClientFk - FROM tmp.client; - - - WHILE i < vNumber DO - - SET i = i + 1; - - WHILE c = 0 DO - - SELECT id INTO c - FROM tmp.client - WHERE id = floor(RAND() * maxClientFk) + 1 - AND isSelected = FALSE - LIMIT 1; - - END WHILE; - - -- SELECT i, maxClientFk, c; - - UPDATE tmp.client - SET isSelected = TRUE - WHERE id = c; - - SET c = 0; - - END WHILE; - - SELECT c.id, c.name FROM tmp.client tc - JOIN vn.client c ON c.id = tc.clientFk - WHERE isSelected - ORDER BY clientFk; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `clonTravelComplete__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clonTravelComplete__`(IN `vTravelFk` INT, IN `vDateStart` DATE, IN `vDateEnd` DATE, IN `vRef` VARCHAR(255)) -BEGIN --- DEPRECATED usar travel_cloneWithEntries. jgallego -/* - * Clona un travel, junto con sus entradas y compras - * @param vTravelFk travel a clonar - * @param vDateStart fecha de salida del nuevo travel - * @param vDateEnd fecha de llegada del nuevo travel - * @param vRef referencia del nuevo travel -*/ - DECLARE vTravelNew INT; - DECLARE vEntryNew INT; - DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE vAuxEntryFk INT; - DECLARE vRsEntry CURSOR FOR - SELECT e.id - FROM entry e - JOIN travel t ON t.id = e.travelFk - WHERE e.travelFk = vTravelFk; - - DECLARE vRsBuy CURSOR FOR - SELECT b.* - FROM buy b - JOIN entry e ON b.entryFk = e.id - WHERE e.travelFk = vTravelNew and b.entryFk = entryNew - ORDER BY e.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg) - SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg - FROM travel - WHERE id = vTravelFk; - - SET vTravelNew = LAST_INSERT_ID(); - SET vDone = FALSE; - OPEN vRsEntry; - FETCH vRsEntry INTO vAuxEntryFk; - - WHILE NOT vDone DO - INSERT INTO entry (supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - travelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk) - SELECT supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - vTravelNew, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk - FROM entry - WHERE id = vAuxEntryFk; - - SET vEntryNew = LAST_INSERT_ID(); - - INSERT INTO buy (entryFk, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked, - weight) - SELECT vEntryNew, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked, - weight - FROM buy - WHERE entryFk = vAuxEntryFk; - - FETCH vRsEntry INTO vAuxEntryFk; - END WHILE; - CLOSE vRsEntry; - 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 `cmr_getByTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_getByTicket`(vTicketFk INT) -BEGIN - - DECLARE vLandingDays INT; - - SELECT landingDays INTO vLandingDays - FROM vn.cmrConfig; - - IF vTicketFk THEN - - IF (SELECT count(ticketFk) FROM vn.cmr WHERE ticketFk = vTicketFk) THEN - - SELECT id FROM vn.cmr WHERE ticketFk = vTicketFk; - - ELSE - - INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, supplierFk, ead) - SELECT vTicketFk, t.companyFk, a.id, t.addressFk, ag.supplierFk, vLandingDays - FROM vn.ticket t - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.agency ag ON ag.id = am.agencyFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.address a ON a.id = w.addressFk - WHERE t.id = vTicketFk; - - SELECT LAST_INSERT_ID(); - - END IF; - - ELSE - - INSERT INTO vn.cmr(created, ead) VALUES(NOW(), NOW() + INTERVAL vLandingDays DAY); - - SELECT LAST_INSERT_ID(); - - END IF; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `cmr_new__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_new__`(vTicketFk INT) -BEGIN - - IF vTicketFk THEN - - IF (SELECT count(ticketFk) FROM vn.cmr WHERE ticketFk = vTicketFk) THEN - - SELECT id FROM vn.cmr WHERE ticketFk = vTicketFk; - - ELSE - - INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, supplierFk) - SELECT vTicketFk, t.companyFk, a.id, t.addressFk, ag.supplierFk - FROM vn.ticket t - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.agency ag ON ag.id = am.agencyFk - JOIN vn.company cm ON cm.id = t.companyFk - JOIN vn.client c ON c.id = cm.clientFk - JOIN vn.address a ON a.clientFk = c.id AND a.isDefaultAddress - WHERE t.id = vTicketFk; - - SELECT LAST_INSERT_ID(); - - END IF; - - ELSE - - INSERT INTO vn.cmr(created) VALUES(NOW()); - - SELECT LAST_INSERT_ID(); - - END IF; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `cmr_sendOverview` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_sendOverview`() -BEGIN -/** - * Insert the monthly CMR summary in vn.mail on the 5th of each month. - */ - - SET SESSION group_concat_max_len = 1000000; --- IF (DAY(CURDATE()) = 5) THEN - INSERT INTO - vn.mail (receiver, - replyTo, - subject, - body) - SELECT - c2.email, - 'cmr@verdnatura.es', - 'Resumen CMR', - CONCAT('
-

Resumen Mensual CMR

- - - - - - - - ' - , GROUP_CONCAT('' ORDER BY c.id SEPARATOR '' ), - '
- Estimado cliente,
- A continuación le enviamos el resumen menual de CMR ',UPPER(MONTHNAME(CURDATE() - INTERVAL 1 MONTH)),' ', YEAR(CURDATE() - INTERVAL 1 MONTH), '.

- Le rogamos que nos devuelva el resumen firmado a cmr@verdnatura.es
-

-
CMRTicket
', c.id, ' ', c.ticketFk, '
- -

- Saludos cordiales, Dpto administración. -

') - FROM vn.cmr c - JOIN vn.address a ON c.addressToFk = a.id - JOIN vn.client c2 ON a.clientFk = c2.id - WHERE c.state = 'Pending' - AND MONTH(c.created) = MONTH(CURDATE() - INTERVAL 1 MONTH) - AND YEAR(c.created) = YEAR(CURDATE() - INTERVAL 1 MONTH) - AND c2.email IS NOT NULL -- No cogemos los CMRs dirigidos a 'Verdnatura' - GROUP BY c2.id; - - -- Actualizamos el estado a 'Enviado' - UPDATE vn.cmr c - SET c.state = 'Sent' - WHERE c.state = 'Pending' - AND MONTH(c.created) = MONTH(CURDATE() - INTERVAL 1 MONTH) - AND YEAR(c.created) = YEAR(CURDATE() - INTERVAL 1 MONTH); --- 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 `collectionOrTicket_printSticker` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `collectionOrTicket_printSticker`(vParam INT, vSectorFk INT) -BEGIN - - /*Imprime una etiqueta amarilla a partir de una colección o ticket - * - * @param vParam colección o ticket a imprimir - * @param vSectorFk id del sector - */ - - DECLARE vLabelReport INT; - - SELECT labelReportFk INTO vLabelReport - FROM sector - WHERE id = vSectorFk; - - IF vLabelReport THEN - - INSERT INTO ticketTrolley(ticket, labelCount) - SELECT ticketFk, 1 - FROM ticketCollection - WHERE collectionFk = vParam OR ticketFK = vParam - ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; - - INSERT INTO printServerQueue(labelReportFk, param1, workerFk) - SELECT vLabelReport, vParam, getUser(); - - 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 `collectionPlacement_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collectionPlacement_get`(vParamFk INT(11), vIsPicker bool) -BEGIN - - /* Devuelve el listado de ubicaciones a las que hay que ir para preparar una colección o ticket - * - * @param vParamFk Identificador de vn.collection o Identificador de vn.ticket - * @param vIsPicker Booleano para distinguer el sacador del revisador - */ - - DECLARE vCalcFk INT; - DECLARE vWarehouseFk INT; - DECLARE vWarehouseAliasFk INT; - DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - ENGINE = MEMORY - SELECT 00000000 as ticketFk, - 00000000 as saleFk, - 00000000 as itemFk, - FALSE as isStowaway, - 0 as quantity; - - INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) - SELECT s.ticketFk, s.id, s.itemFk, FALSE - FROM vn.ticketCollection tc - -- JOIN vn.collection c ON c.id = tc.collectionFk - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - -- JOIN vn.item i ON i.id = s.itemFk - WHERE tc.collectionFk = vParamFk - -- AND (IFNULL(i.itemPackingTypeFk,c.itemPackingTypeFk) = c.itemPackingTypeFk OR ISNULL(c.itemPackingTypeFk)) - UNION ALL - SELECT s.ticketFk, s.id, s.itemFk, FALSE - FROM vn.sale s - WHERE s.ticketFk = vParamFk; - - SELECT t.warehouseFk, w.aliasFk - INTO vWarehouseFk, vWarehouseAliasFk - FROM vn.ticket t - JOIN tmp.sale ts ON ts.ticketFk = t.id - JOIN vn.warehouse w ON w.id = t.warehouseFk - LIMIT 1; - - CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); - - UPDATE tmp.sale ts - JOIN ( SELECT itemFk, sum(visible) as visible - FROM vn.itemShelvingStock iss - JOIN vn.warehouse w ON w.id = iss.warehouseFk - WHERE w.aliasFk = vWarehouseAliasFk - GROUP BY iss.itemFk ) iss ON iss.itemFk = ts.itemFk - SET ts.quantity = iss.visible; - - DROP TEMPORARY TABLE IF EXISTS tmp.sale2; - CREATE TEMPORARY TABLE tmp.sale2 - ENGINE = MEMORY - SELECT * FROM tmp.sale; - - DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; - CREATE TEMPORARY TABLE tmp.`grouping` - (INDEX(itemFk)) - ENGINE = MEMORY - SELECT b.itemFk, - CASE b.groupingMode - WHEN 0 THEN 1 - WHEN 2 THEN b.packing - ELSE b.`grouping` - END AS `grouping` - FROM buy b - JOIN cache.last_buy lb ON lb.buy_id = b.id - WHERE lb.warehouse_id = vWarehouseFk - GROUP BY b.itemFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; - CREATE TEMPORARY TABLE tmp.grouping2 - ENGINE MEMORY - SELECT * FROM tmp.`grouping`; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList; - CREATE TEMPORARY TABLE tmp.salePlacementList - ENGINE MEMORY - - SELECT ts.saleFk, - ts.itemFk, - CAST(0 AS DECIMAL(10,0)) as saleOrder, - IF(ts.isStowaway, - 100000, IF(ish.visible > 0 OR iss.id, 1, 100000)) * p.pickingOrder as `order`, - IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) /* + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW())) */) as priority, - CONCAT( - IF( iss.id, - CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), - ''), - p.`code`) COLLATE utf8_general_ci as placement , - sh.priority shelvingPriority, - sh.code COLLATE utf8_general_ci as shelving, - ish.created, - ish.visible, - IFNULL(IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`),1) as `grouping`, - sc.isPreviousPrepared, - iss.id as itemShelvingSaleFk, - ts.ticketFk - ,iss.id - , st.saleFk as salePreviousPrepared - , iss.userFk - FROM tmp.sale ts - LEFT JOIN (SELECT DISTINCT saleFk - FROM vn.saleTracking st - JOIN vn.state s ON s.id = st.stateFk - WHERE st.isChecked - AND s.semaphore = 1) st ON st.saleFk = ts.saleFk - JOIN vn.itemShelving ish ON ish.itemFk = ts.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - JOIN vn.warehouse w ON w.id = sc.warehouseFk - LEFT JOIN tmp.`grouping` g ON g.itemFk = ts.itemFk - LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = ts.saleFk AND iss.itemShelvingFk = ish.id - LEFT JOIN vn.worker wk ON wk.id = iss.userFk - WHERE w.aliasFk = vWarehouseAliasFk - AND NOT sc.isHideForPickers - HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL - ; - - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_2; - CREATE TEMPORARY TABLE tmp.salePlacementList_2 - ENGINE MEMORY - SELECT saleFk, priority as olderPriority - FROM (SELECT saleFk, priority - FROM tmp.salePlacementList - ORDER BY IF(isPreviousPrepared,2,1), - IF(visible > 0 OR itemShelvingSaleFk,1,2), - IFNULL(shelvingPriority,0) DESC, - priority - ) sub - GROUP BY saleFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_3; - CREATE TEMPORARY TABLE tmp.salePlacementList_3 - ENGINE MEMORY - SELECT s1.saleFk, `order`as saleOrder - FROM tmp.salePlacementList s1 - JOIN tmp.salePlacementList_2 s2 ON s2.saleFk = s1.saleFk AND s2.olderPriority = s1.priority; - - UPDATE tmp.salePlacementList s1 - JOIN tmp.salePlacementList_3 s3 ON s3.saleFk = s1.saleFk - SET s1.saleOrder = s3.saleOrder; - /* - -- Anula el orden de antigüedad y ordena por ubicación - UPDATE tmp.salePlacementList - SET saleOrder = `order`;*/ - - SELECT * - FROM tmp.salePlacementList - ORDER BY saleOrder, - IF(isPreviousPrepared,2,1), - IF(itemShelvingSaleFk,1,2), - IF(vIsPicker, visible = 0, TRUE), - shelvingPriority DESC, -- PAK 05/11/2021 - priority; - - DROP TEMPORARY TABLE - tmp.sale, - tmp.sale2, - tmp.`grouping`, - tmp.grouping2, - tmp.salePlacementList_2, - tmp.salePlacementList_3; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collectionSticker_print` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collectionSticker_print`(vCollectionFk INT, vSectorFk INT) -BEGIN - - /*@deprecated :utilizar collectionOrTicket_printSticker*/ - - DECLARE vLabelReport INT; - - SELECT labelReportFk INTO vLabelReport - FROM vn.sector - WHERE id = vSectorFk; - - IF vLabelReport THEN - - INSERT INTO vn.ticketTrolley(ticket, labelCount) - SELECT ticketFk, 1 - FROM vn.ticketCollection - WHERE collectionFk = vCollectionFk - ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; - - INSERT INTO vn.printServerQueue(labelReportFk, param1, workerFk) - SELECT vLabelReport, vCollectionFk, getUser(); - - 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 `collection_addItem` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_addItem`(vItemFk INT, vQuantity INT, vTicketFk INT) -BEGIN - DECLARE vConcept VARCHAR(50); - DECLARE itemFk INT; - DECLARE vSaleFk INT default 0; - - DECLARE vDescription VARCHAR(50); - DECLARE vItemName VARCHAR(50); - - SELECT barcodeToItem(vItemFk) INTO itemFk; - - SELECT CONCAT(vn.getUser()," ",DATE_FORMAT(NOW( ), "%H:%i" )," ",i.name) INTO vConcept FROM vn.item i WHERE i.id = itemFk; - - SELECT name INTO vItemName FROM vn.item WHERE id = vItemFk; - SELECT CONCAT("Añadido articulo ", vItemName, " cantidad:", vQuantity) INTO vDescription; - - INSERT INTO vn.ticketLog (originFk, userFk, action , description) - VALUES(vTicketFk, vn.getUser(), 'update', vDescription); - - INSERT INTO vn.sale (itemFk,ticketFk,concept,quantity,isAdded) - VALUES (itemFk,vTicketFk,vConcept,vQuantity,1); - - SELECT last_insert_id() INTO vSaleFk; - - CALL vn.sale_calculateComponent(vSaleFk, 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 `collection_get` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `collection_get`(vWorkerFk INT) -BEGIN - - /* Obtiene colección del sacador si tiene líneas pendientes - * - * @param vWorkerFk id del worker - */ - - SELECT c.id AS collectionFk, date(c.created) AS created, count(DISTINCT s.id) totalRow, count(DISTINCT st.id) pickedRow - FROM vn.collection c - JOIN vn.ticketCollection tc on tc.collectionFk = c.id - JOIN vn.sale s on s.ticketFk = tc.ticketFk - JOIN vn.state ss on ss.code = 'PREPARED' - LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id - WHERE c.workerFk = vWorkerFk - AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) - AND s.quantity != 0 - GROUP BY c.id - HAVING totalRow > pickedRow; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collection_getTickets` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_getTickets`(vParamFk INT) -BEGIN -/** - * Selecciona los tickets de una colección/ticket - * @param vParamFk ticketFk/collectionFk - * @return Retorna ticketFk, level, agencyName, warehouseFk, salesPersonFk, observaciones - */ - DECLARE vItemPackingTypeFk VARCHAR(1); - - -- Si los sacadores son los de pruebas, pinta los colores - SELECT itemPackingTypeFk INTO vItemPackingTypeFk - FROM vn.collection - WHERE id = vParamFk; - - SELECT t.id ticketFk, - IF (!(vItemPackingTypeFk <=> 'V'), cc.code,CONCAT(SUBSTRING('ABCDEFGH',tc.wagon, 1),'-',tc.`level` )) `level`, - am.name agencyName, - t.warehouseFk, - w.id salesPersonFk, - IFNULL(tob.description,'') observaciones - FROM vn.ticket t - LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk - LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk -- PAK 23/12/21 - LEFT JOIN vn.collectionColors cc - ON cc.wagon = tc.wagon - AND cc.shelve = tc.`level` - AND cc.trainFk = c2.trainFk -- PAK 23/12/21 - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN vn.client c ON c.id = t.clientFk - LEFT JOIN vn.worker w ON w.id = c.salesPersonFk - LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id - AND tob.observationTypeFk = 1 - WHERE t.id = vParamFk - AND t.shipped >= util.yesterday() - UNION ALL - SELECT t.id ticketFk, - IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`, - am.name agencyName, - t.warehouseFk, - w.id salesPersonFk, - IFNULL(tob.description, '') observaciones - FROM vn.ticket t - JOIN vn.ticketCollection tc ON t.id = tc.ticketFk - LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk -- PAK 23/12/21 - LEFT JOIN vn.collectionColors cc - ON cc.wagon = tc.wagon - AND cc.shelve = tc.`level` - AND cc.trainFk = c2.trainFk -- PAK 23/12/21 - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN vn.client c ON c.id = t.clientFk - LEFT JOIN vn.worker w ON w.id = c.salesPersonFk - LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id - AND tob.observationTypeFk = 1 - WHERE tc.collectionFk = vParamFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collection_get_` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_get_`(vWorkerFk INT) -BEGIN - - /* Obtiene colección del sacador si tiene líneas pendientes - * - * @param vWorkerFk id del worker - */ - - SELECT c.id AS collectionFk, date(c.created) AS created - FROM vn.collection c - LEFT JOIN vn.state s ON c.stateFk = s.id - WHERE c.workerFk = vWorkerFk AND s.code = 'ON_PREPARATION' - AND created >= TIMESTAMPADD(HOUR , -6,NOW()); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collection_kill` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_kill`(vSelf INT) -BEGIN - - /* Elimina una coleccion y coloca sus tickets en OK - * - */ - - INSERT INTO vncontrol.inter(state_id, Id_Ticket) - SELECT s.id, ticketFk - FROM vn.ticketCollection tc - JOIN vn.state s ON s.code = 'OK' - WHERE tc.collectionFk = vSelf; - - DELETE FROM vn.collection - WHERE id = vSelf; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `collection_missingTrash` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_missingTrash`(vSaleFk BIGINT, vQuantity INT, vIsTrash BOOLEAN, vWarehouseFk INT, vNewQuantity INT) -BEGIN - DECLARE vTicketFk INT; - DECLARE vClientFk INT DEFAULT 400; - DECLARE vClientName VARCHAR(50); - DECLARE vConsignatario INT; - DECLARE vOriginalQuantity INT; - DECLARE vDescription VARCHAR(100); - DECLARE vConcept VARCHAR(100); - DECLARE vOrigin INT; - - IF vIsTrash THEN - SELECT 200 INTO vClientFk; - END IF; - - SELECT concept INTO vConcept FROM vn.sale WHERE id = vSaleFk; - SELECT ticketFk INTO vOrigin FROM vn.sale WHERE id = vSaleFk; - SELECT CONCAT("Cambio cantidad ",vConcept," de ", vQuantity ," a ", vNewQuantity) INTO vDescription; - - INSERT INTO vn.ticketLog (originFk, userFk, action , description) - VALUES(vOrigin, vn.getUser(), 'update', vDescription); - - SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; - - IF vTicketFk IS NULL THEN - SELECT c.name , co.id INTO vClientName,vConsignatario - FROM vn.client c - INNER JOIN vn.address co ON c.id = co.clientFk - WHERE c.id = vClientFk - LIMIT 1; - - CALL ticket_add(vClientFk, - NOW(), vWarehouseFk, - 442, - vConsignatario, - NULL, - NULL, - NULL, - account.userGetId(), - TRUE, - vTicketFk); - - SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; - - END IF; - - INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded) - SELECT itemFk, vTicketFk, CONCAT(concept," ",vn.getWorkerCode(), " ",LEFT(CAST(NOW() AS TIME),5)), vQuantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded - FROM vn.sale s WHERE s.id = vSaleFk; - - SELECT quantity INTO vOriginalQuantity FROM vn.sale WHERE id = vSaleFk; - UPDATE vn.sale SET originalQuantity = vOriginalQuantity ,quantity = vNewQuantity WHERE id = vSaleFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collection_newSmartTag` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_newSmartTag`(vSectorFk INT) -proc:BEGIN - - DECLARE vIsPreviousPrepared BOOLEAN; - DECLARE vCollectionFk INT; - DECLARE vWarehouseFk INT; - DECLARE vMaxTickets INT; - DECLARE vStateFk INT; - DECLARE vFirstTicketFk INT; - DECLARE vHour INT; - DECLARE vMinute INT; - DECLARE vWorker INT; - DECLARE vWorkerCode VARCHAR(3); - DECLARE vWagon INT; - DECLARE vWagonCounter INT; - DECLARE vShelve INT; - DECLARE vTicket INT; - DECLARE vTicketToSplit INT; - DECLARE myUserIsSalesPersonRole BOOLEAN; - DECLARE vPrintedTickets INT; - DECLARE vMaxTicketPrinted INT; - DECLARE vItemPackingTypeFk VARCHAR(1); - DECLARE hasAssignedTickets BOOLEAN; - DECLARE vMaxNotReadyCollections INT DEFAULT 0; - DECLARE vNotReadyCollections INT; - DECLARE vSectorCode VARCHAR(20); - DECLARE vWagons INT; - - SELECT w.code, w.id INTO vWorkerCode, vWorker - FROM vn.worker w - WHERE w.id = vn.getUser(); - --- Si hay colecciones sin terminar, sale del proceso - SELECT count(*) INTO vNotReadyCollections - FROM vn.collection c - WHERE c.workerFk = vn.getUser() - AND c.saleTotalCount > c.salePickedCount + 1 - AND c.created > TIMESTAMPADD(HOUR , -5,NOW()); - - IF vMaxNotReadyCollections < vNotReadyCollections THEN - - LEAVE proc; - - END IF; - - -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando - SELECT isPreviousPrepared, warehouseFk, itemPackingTypeFk, code - INTO vIsPreviousPrepared, vWarehouseFk, vItemPackingTypeFk, vSectorCode - FROM vn.sector - WHERE id = vSectorFk; - - -- Cogemos el numero de wagons del trabajador - SELECT COUNT(ws.id) - FROM workerShelving ws - WHERE ws.workerFk = vWorker - AND ws.collectionFk IS NULL - INTO vWagons; - - SET vMaxTicketPrinted = 8 * vWagons; - SET vMaxTickets = 3 * vWagons; - - - IF vIsPreviousPrepared THEN - - LEAVE proc; -- Hasta que tengamos el altillo, vamos a cancelar esta opcion - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'PREVIOUS_PREPARATION'; - ELSE - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'ON_PREPARATION'; - - END IF; - - -- Averiguamos si es comercial el usuario - SELECT FALSE -- (r.name = 'salesPerson') - INTO myUserIsSalesPersonRole - FROM account.user u - JOIN account.role r ON r.id = u.role - WHERE u.id = vn.getUser(); - - -- Se obtiene nº de colección y el buffer con los pedidos preparables - INSERT INTO vn.collection - SET workerFk = account.myUser_getId(), - itemPackingTypeFk = vItemPackingTypeFk; - - SELECT LAST_INSERT_ID() INTO vCollectionFk; - - UPDATE workerShelving - SET collectionFk = vCollectionFk - WHERE workerFk = vWorker - AND collectionFk IS NULL; - - CALL vn.productionControl(vWarehouseFk, 0); - - -- Comprobamos si hay tickets asignados. En ese caso, nos centramos exclusivamente en esos tickets - -- y los sacamos independientemente de problemas o tamaños - SELECT COUNT(*) INTO hasAssignedTickets - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - WHERE s.code = 'PICKER_DESIGNED' - AND pb.workerCode = vWorkerCode - AND LENGTH(pb.problem) = 0; - - IF hasAssignedTickets THEN - - UPDATE vn.collection - SET itemPackingTypeFk = NULL - WHERE id = vCollectionFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; - CREATE TEMPORARY TABLE tmp.ticketToSplit - SELECT pb.ticketFk - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - WHERE s.code = 'PICKER_DESIGNED' - AND pb.workerCode = vWorkerCode - AND LENGTH(pb.problem) = 0 - ORDER BY HH, - mm, - s.`order` DESC, - pb.m3 DESC; - - WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO - - SELECT MIN(ticketFk) INTO vTicketToSplit - FROM tmp.ticketToSplit; - - CALL vn.ticket_splitItemPackingType(vTicketToSplit); - - INSERT INTO vn.ticketCollection(ticketFk, collectionFk) - SELECT ticketFk, vCollectionFk - FROM tmp.ticketIPT; - - DELETE FROM tmp.ticketToSplit - WHERE ticketFk = vTicketToSplit; - - DROP TEMPORARY TABLE tmp.ticketIPT; - - END WHILE; - - CALL vn.productionControl(vWarehouseFk, 0); - - ELSE - - SELECT COUNT(*) INTO vPrintedTickets - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - WHERE pb.shipped = CURDATE() - AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) - AND s.isPreparable - AND (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH) - OR pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV) - OR pb.F > 0 AND vItemPackingTypeFk = 'F' AND ISNULL(pb.collectionF) - OR pb.P > 0 AND vItemPackingTypeFk = 'P' AND ISNULL(pb.collectionP)); - - SET vMaxTicketPrinted = vMaxTicketPrinted - vPrintedTickets; - -- AutoPRINT - - IF vMaxTicketPrinted > 0 THEN - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT s2.id, pb.ticketFk, vn.getUser() - FROM tmp.productionBuffer pb - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.state s ON s.id = pb.state - JOIN vn.state s2 ON s2.code = 'PRINTED_AUTO' - JOIN vn.ticket t ON t.id = pb.ticketFk - WHERE pb.shipped = CURDATE() - AND LENGTH(pb.problem) = 0 - AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) - AND s.isPrintable - AND (pb.m3 > 0.05 OR s.isOK) - AND (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH) - OR pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV) - OR pb.F > 0 AND vItemPackingTypeFk = 'F' AND ISNULL(pb.collectionF) - OR pb.P > 0 AND vItemPackingTypeFk = 'P' AND ISNULL(pb.collectionP)) - AND t.created < TIMESTAMPADD(MINUTE, -10, NOW()) - ORDER BY HH, - mm, - s.`order` DESC, - pb.m3 DESC - LIMIT vMaxTicketPrinted; - - END IF; - - -- Se seleccionan los primeros tickets, asignando colección para dejarlos bloqueados a otros sacadores. - -- Se splitan los tickets preparables, para que solo tengan un tipo de empaquetado - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; - CREATE TEMPORARY TABLE tmp.ticketToSplit - SELECT pb.ticketFk - FROM tmp.productionBuffer pb - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.ticketStateToday tst ON tst.ticket = pb.ticketFk - JOIN vn.state s ON s.id = tst.state - WHERE ( pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH) - OR pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV) - OR pb.F > 0 AND vItemPackingTypeFk = 'F' AND ISNULL(pb.collectionF) - OR pb.P > 0 AND vItemPackingTypeFk = 'P' AND ISNULL(pb.collectionP)) - AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) - AND LENGTH(pb.problem) = 0 - AND s.isPreparable - AND NOT myUserIsSalesPersonRole - ORDER BY pb.HH, pb.mm, s.`order` DESC - LIMIT vMaxTickets; - - WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO - - SELECT MIN(ticketFk) INTO vTicketToSplit - FROM tmp.ticketToSplit; - - CALL vn.ticket_splitItemPackingType(vTicketToSplit); - - INSERT INTO vn.ticketCollection(ticketFk, collectionFk) - SELECT ticketFk, vCollectionFk - FROM tmp.ticketIPT - WHERE itemPackingTypeFk = vItemPackingTypeFk; - - DELETE FROM tmp.ticketToSplit - WHERE ticketFk = vTicketToSplit; - - DROP TEMPORARY TABLE tmp.ticketIPT; - - END WHILE; - - END IF; - - -- Creamos una tabla temporal con los datos que necesitamos para depurar la colección - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT pb.ticketFk, - pb.`lines`, - pb.m3 * 1000 liters, - 0 as height, - 0 as shelve, - 0 as wagon, - pb.productionOrder, - pb.HH, - pb.mm - FROM tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON tc.ticketFk = pb.ticketFk - WHERE tc.collectionFk = vCollectionFk - LIMIT vMaxTickets; - - -- Es importante que el primer ticket se coja en todos los casos - SET vFirstTicketFk = 0; - - SELECT ticketFk, HH, mm - INTO vFirstTicketFk, vHour, vMinute - FROM tmp.ticket - ORDER BY productionOrder DESC, HH, mm - LIMIT 1; - - -- Hay que excluir aquellos que no tengan la misma hora de preparación - DELETE - FROM tmp.ticket - WHERE HH != vHour - OR mm != vMinute; - - -- En el caso de pedidos de más volumen de un carro, la colección será monoticket. Pero si el primer pedido - -- no es monoticket, excluimos a los de más de un carro - IF (SELECT (t.liters > vc.trolleyM3 * 1000) - FROM tmp.ticket t - JOIN vn.volumeConfig vc - WHERE t.ticketFk = vFirstTicketFk) THEN - - DELETE - FROM tmp.ticket - WHERE ticketFk != vFirstTicketFk; - - ELSE - - DELETE t.* - FROM tmp.ticket t - JOIN vn.volumeConfig vc - WHERE t.liters > vc.trolleyM3 * 1000; - - END IF; - - -- Elimina los tickets bloqueados que no se van a preparar - DELETE tc.* - FROM vn.ticketCollection tc - LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND t.ticketFk IS NULL; - - /* - * - * Construccion del tren - * - */ - - -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. - UPDATE tmp.ticket t - JOIN - ( SELECT MAX(i.size) maxHeigth, - tc.ticketFk - FROM vn.ticketCollection tc - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - JOIN vn.item i ON i.id = s.itemFk - WHERE i.itemPackingTypeFk = 'V' - AND tc.collectionFk = vCollectionFk - GROUP BY tc.ticketFk) sub ON sub.ticketFk = t.ticketFk - SET t.height = IFNULL(sub.maxHeigth,0); - - -- Vamos a generar una tabla con todas las posibilidades de asignacion de pedido - DROP TEMPORARY TABLE IF EXISTS tmp.wagonsVolumetry; - CREATE TEMPORARY TABLE tmp.wagonsVolumetry - SELECT cv.`level` as shelve, - 1 as wagon, - cv.`lines`, - cv.liters, - cv.height - FROM vn.collectionVolumetry cv; - - SET vWagonCounter = 1; - - WHILE vWagonCounter < vWagons DO - - SET vWagonCounter = vWagonCounter + 1; - - INSERT INTO tmp.wagonsVolumetry(shelve, wagon, `lines`, liters, height) - SELECT cv.`level` as shelve, - vWagonCounter as wagon, - cv.`lines`, - cv.liters, - cv.height - FROM vn.collectionVolumetry cv - WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H'); - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelve; - CREATE TEMPORARY TABLE tmp.ticketShelve - SELECT ticketFk, shelve, wagon, linesDif, LitersDif, heightDif - FROM ( - SELECT t.ticketFk, - wv.shelve, - wv.wagon, - t.productionOrder, - CAST(wv.`lines` AS SIGNED) - t.`lines` as linesDif, - CAST(wv.liters AS SIGNED) - t.liters as litersDif, - CAST(wv.height AS SIGNED) - t.height as heightDif - FROM tmp.wagonsVolumetry wv - JOIN tmp.ticket t - ) sub - WHERE linesDif >= 0 - AND litersDif >= 0 - AND heightDif >= 0 - ORDER BY productionOrder DESC, linesDif, LitersDif, heightDif ; - - -- Insertamos una opcion virtual para carro completo. Todo ticket tiene que poder entrar en un carro completo.... - INSERT INTO tmp.ticketShelve(ticketFk, shelve, wagon, linesDif, LitersDif, heightDif) - SELECT t.ticketFk, 0, wv.wagon, 999, 999,999 - FROM tmp.ticket t - JOIN tmp.wagonsVolumetry wv - GROUP BY t.ticketFk, wv.wagon; - - SET vWagonCounter = 0; - - WHILE vWagonCounter < vWagons DO - - SET vWagonCounter = vWagonCounter + 1; - - -- Asignamos la primera balda util al primer pedido - IF vWagonCounter = 1 THEN - - SELECT shelve INTO vShelve - FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - AND wagon = vWagonCounter - ORDER BY heightDif, litersDif, linesDif - LIMIT 1; - - ELSE - - SELECT shelve, ticketFk INTO vShelve, vFirstTicketFk - FROM tmp.ticketShelve - WHERE wagon = vWagonCounter - ORDER BY heightDif, litersDif, linesDif - LIMIT 1; - - END IF; - - IF vShelve > 0 THEN - - UPDATE tmp.ticket - SET shelve = vShelve, - wagon = vWagonCounter - WHERE ticketFk = vFirstTicketFk; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - OR (shelve = vShelve AND wagon = vWagonCounter); - - WHILE (SELECT COUNT(*) FROM tmp.ticketShelve WHERE wagon = vWagonCounter) DO - - SELECT ticketFk, shelve - INTO vTicket, vShelve - FROM tmp.ticketShelve - WHERE wagon = vWagonCounter - LIMIT 1; - - UPDATE tmp.ticket - SET shelve = vShelve, - wagon = vWagonCounter - WHERE ticketFk = vTicket; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vTicket - OR (shelve = vShelve AND wagon = vWagonCounter); - - END WHILE; - - ELSE - - UPDATE tmp.ticket - SET shelve = 1, wagon = vWagonCounter - WHERE ticketFk = vFirstTicketFk; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - AND wagon != vWagonCounter; - - END IF; - - END WHILE; - - -- Eliminamos los que se han quedado sin balda - DELETE FROM tmp.ticket WHERE shelve = 0; - - -- Elimina los tickets bloqueados que no se van a preparar - DELETE tc.* - FROM vn.ticketCollection tc - LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND t.ticketFk IS NULL; - - -- Elimina los tickets que ya estan en otra coleccion - DELETE tc.* - FROM vn.ticketCollection tc - JOIN vn.ticketCollection tc2 ON tc2.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND tc2.collectionFk != vCollectionFk; - - -- Actualiza el estado de la colección - UPDATE vn.collection c - JOIN vn.state st ON st.code = 'ON_PREPARATION' - SET c.stateFk = st.id - WHERE c.id = vCollectionFk; - - -- Asigna las bandejas y las smartTags - SET @wagon := 0; - UPDATE vn.ticketCollection tc - JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - JOIN (SELECT @wagon:=@wagon+1 as wagon, ws.shelvingFk - FROM workerShelving ws - WHERE ws.collectionFk = vCollectionFk) sub ON sub.wagon = t.wagon - JOIN smartTag s ON s.shelvingFk = sub.shelvingFk AND s.`level` = t.shelve - SET tc.`level` = t.shelve, tc.wagon = t.wagon, tc.smartTagFk = s.code; - - -- Actualiza el estado de los tickets - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT vStateFk, ticketFk, account.myUser_getId() - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vCollectionFk; - - -- Aviso para la preparacion previa - INSERT INTO vn.ticketDown(ticketFk, collectionFk) - SELECT tc.ticketFk, tc.collectionFk - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vCollectionFk; - - IF (SELECT count(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk) THEN - - CALL vn.salesMerge_byCollection(vCollectionFk); - - UPDATE vn.collection c - JOIN (SELECT count(*) saleTotalCount , - sum(s.isPicked != 0) salePickedCount - FROM vn.ticketCollection tc - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND s.quantity > 0 - ) sub - SET c.saleTotalCount = sub.saleTotalCount, - c.salePickedCount = sub.salePickedCount - WHERE c.id = vCollectionFk; - - SELECT vCollectionFk; - - ELSE - - DELETE FROM vn.collection WHERE id = vCollectionFk; - -- SELECT NULL; - - END IF; - - DROP TEMPORARY TABLE tmp.ticketToSplit; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collection_newWithWagon` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_newWithWagon`(vSectorFk INT, vWagons INT) -proc:BEGIN - - DECLARE vIsPreviousPrepared BOOLEAN; - DECLARE vCollectionFk INT; - DECLARE vWarehouseFk INT; - DECLARE vMaxTickets INT; - DECLARE vStateFk INT; - DECLARE vFirstTicketFk INT; - DECLARE vHour INT; - DECLARE vMinute INT; - DECLARE vWorkerCode VARCHAR(3); - DECLARE vWagon INT; - DECLARE vWagonCounter INT; - DECLARE vShelve INT; - DECLARE vTicket INT; - DECLARE vTicketToSplit INT; - DECLARE vPrintedTickets INT; - DECLARE vMaxTicketPrinted INT; - DECLARE vItemPackingTypeFk VARCHAR(1); - DECLARE hasAssignedTickets BOOLEAN; - DECLARE vMaxNotReadyCollections INT; - DECLARE vNotReadyCollections INT; - DECLARE vTrainFk INT DEFAULT 1; - DECLARE vUserFk INT; - DECLARE vHourMatters BOOL DEFAULT TRUE; - - SELECT pc.ticketPrintedMax * vWagons, pc.ticketTrolleyMax * vWagons, pc.maxNotReadyCollections - INTO vMaxTicketPrinted, vMaxTickets, vMaxNotReadyCollections - FROM vn.productionConfig pc; - /*IF NOT vn.deviceProductionUser_Exists(vUserFk) THEN - - LEAVE proc; - - END IF;*/ - - SELECT w.code, w.id INTO vWorkerCode, vUserFk - FROM vn.worker w - WHERE w.id =account.userGetId(); - - -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando - SELECT isPreviousPrepared, warehouseFk, itemPackingTypeFk - INTO vIsPreviousPrepared, vWarehouseFk, vItemPackingTypeFk - FROM vn.sector - WHERE id = vSectorFk; -- Hola - --- Si está habilitado el modo cazador para las motos, y el usuario no esta registrado, se sale. - - IF (SELECT isTractorHuntingMode FROM vn.deviceProductionConfig dpc) AND vItemPackingTypeFk = 'H' THEN - IF (SELECT COUNT(*) FROM vn.workerWithoutTractor wwt WHERE wwt.workerFk = vUserFk) THEN - CALL util.throw('Usuario no registrado con moto'); - LEAVE proc; - END IF; - END IF; - - --- Si hay colecciones sin terminar, sale del proceso - SELECT count(*) INTO vNotReadyCollections - FROM ( - SELECT count(DISTINCT s.id) totalRow, count(DISTINCT st.id) pickedRow - FROM vn.collection c - JOIN vn.ticketCollection tc ON tc.collectionFk = c.id - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - JOIN vn.state ss ON ss.code = 'PREPARED' - LEFT JOIN vn.saleTracking st ON st.saleFk = s.id AND st.stateFk = ss.id - WHERE c.workerFk = vUserFk - AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) - AND s.quantity != 0 - GROUP BY c.id - HAVING totalRow > pickedRow) sub; - - IF vMaxNotReadyCollections < vNotReadyCollections THEN - - CALL util.throw('Hay colecciones pendientes'); - LEAVE proc; - - END IF; - - IF vIsPreviousPrepared THEN - - CALL util.throw('Es de preparación previa'); - LEAVE proc; -- Hasta que tengamos el altillo, vamos a cancelar esta opcion - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'PREVIOUS_PREPARATION'; - ELSE - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'ON_PREPARATION'; - - END IF; - - CALL vn.productionControl(vWarehouseFk, 0); - - -- Esto hay que corregirlo añadiendo un nuevo parámetro al proc. PAK 23/12/21 - IF vSectorFk = 65 THEN -- Pedidos pequeños - - SET vTrainFk = 2; - - SET vHourMatters = FALSE; - - DELETE pb.* - FROM tmp.productionBuffer pb - JOIN vn.volumeConfig vc - WHERE pb.m3 * 1000 > vc.minTicketVolume; - - END IF; - - -- Se obtiene nº de colección y el buffer con los pedidos preparables - INSERT INTO vn.collection - SET workerFk = vUserFk, - itemPackingTypeFk = vItemPackingTypeFk, - trainFk = vTrainFk; - - SELECT LAST_INSERT_ID() INTO vCollectionFk; - - -- 05/08/2021 PAK Jose Frau pide que los tickets de recogida en Algemesí sólo se saquen si están asignados. - DELETE pb.* - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - WHERE pb.agency = 'REC_ALGEMESI' - AND s.code != 'PICKER_DESIGNED'; - - -- 2/3/2022 PAK Se acuerda con Pepe que los pedidos con riesgo no se sacan aunque se asignen. - DELETE pb.* - FROM tmp.productionBuffer pb - WHERE pb.problem LIKE '%RIESGO%'; - - -- Comprobamos si hay tickets asignados. En ese caso, nos centramos exclusivamente en esos tickets - -- y los sacamos independientemente de problemas o tamaños - SELECT COUNT(*) INTO hasAssignedTickets - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - WHERE s.code = 'PICKER_DESIGNED' - AND pb.workerCode = vWorkerCode; - - IF hasAssignedTickets THEN - - UPDATE vn.collection - SET itemPackingTypeFk = NULL - WHERE id = vCollectionFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; - CREATE TEMPORARY TABLE tmp.ticketToSplit - SELECT pb.ticketFk - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - WHERE s.code = 'PICKER_DESIGNED' - AND pb.workerCode = vWorkerCode - ORDER BY HH, - mm, - s.`order` DESC, - pb.m3 DESC; - - WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO - - SELECT MIN(ticketFk) INTO vTicketToSplit - FROM tmp.ticketToSplit; - - CALL vn.ticket_splitItemPackingType(vTicketToSplit); - - INSERT INTO vn.ticketCollection(ticketFk, collectionFk) - SELECT ticketFk, vCollectionFk - FROM tmp.ticketIPT - WHERE (itemPackingTypeFk = vItemPackingTypeFk) ; - - DELETE FROM tmp.ticketToSplit - WHERE ticketFk = vTicketToSplit; - - DROP TEMPORARY TABLE tmp.ticketIPT; - - END WHILE; - - CALL vn.productionControl(vWarehouseFk, 0); - - ELSE - - SELECT COUNT(*) INTO vPrintedTickets - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.productionConfig pc - WHERE pb.shipped = CURDATE() - AND (pb.ubicacion IS NOT NULL - OR a.isOwn = FALSE ) - AND s.isPreparable - AND ( - (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) - OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) - ) - AND (pc.isPreviousPreparationRequired = FALSE - OR pb.previousWithoutParking = FALSE); - - SET vMaxTicketPrinted = vMaxTicketPrinted - vPrintedTickets; - - -- AutoPRINT - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT s2.id, pb.ticketFk, vUserFk - FROM tmp.productionBuffer pb - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.state s ON s.id = pb.state - JOIN vn.state s2 ON s2.code = 'PRINTED_AUTO' - JOIN vn.ticket t ON t.id = pb.ticketFk - JOIN vn.ticketConfig tc - JOIN vn.productionConfig pc - WHERE pb.shipped = CURDATE() - AND (LENGTH(pb.problem) = 0 - OR (pb.problem = 'PEQUEÑO' AND vTrainFk = 2)) - AND (pb.ubicacion IS NOT NULL - OR a.isOwn = FALSE ) - AND s.isPrintable - AND s.isOK - AND ( - (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) - OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) - ) - AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , NOW()) - AND (pc.isPreviousPreparationRequired = FALSE - OR pb.previousWithoutParking = FALSE) - ORDER BY HH, - mm, - s.`order` DESC, - pb.m3 DESC - LIMIT vMaxTicketPrinted; - - -- Se seleccionan los primeros tickets, asignando colección para dejarlos bloqueados a otros sacadores. - -- Se splitan los tickets preparables, para que solo tengan un tipo de empaquetado - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; - CREATE TEMPORARY TABLE tmp.ticketToSplit - SELECT pb.ticketFk, (pb.H + pb.V = 0) isNeutral - FROM tmp.productionBuffer pb - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.ticketStateToday tst ON tst.ticket = pb.ticketFk - JOIN vn.state s ON s.id = tst.state - JOIN vn.productionConfig pc - WHERE ( - (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) - OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) - ) - AND (pb.ubicacion IS NOT NULL - OR a.isOwn = FALSE ) - AND LENGTH(pb.problem) = 0 - AND s.isPreparable - AND (pc.isPreviousPreparationRequired = FALSE - OR pb.previousWithoutParking = FALSE) - ORDER BY pb.HH, pb.mm, s.`order` DESC - LIMIT vMaxTickets; - - WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO - - SELECT MIN(ticketFk) INTO vTicketToSplit - FROM tmp.ticketToSplit; - - - IF (SELECT isNeutral - FROM tmp.ticketToSplit - WHERE ticketFk = vTicketToSplit) THEN - - INSERT INTO vn.ticketCollection(ticketFk, collectionFk) - VALUES(vTicketToSplit, vCollectionFk); - - ELSE - - CALL vn.ticket_splitItemPackingType(vTicketToSplit); - - INSERT INTO vn.ticketCollection(ticketFk, collectionFk) - SELECT ticketFk, vCollectionFk - FROM tmp.ticketIPT - WHERE itemPackingTypeFk = vItemPackingTypeFk; - - DROP TEMPORARY TABLE tmp.ticketIPT; - - END IF; - - DELETE FROM tmp.ticketToSplit - WHERE ticketFk = vTicketToSplit; - - END WHILE; - - END IF; - - -- Creamos una tabla temporal con los datos que necesitamos para depurar la colección - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT pb.ticketFk, - pb.`lines`, - pb.m3 * 1000 liters, - 0 as height, - 0 as shelve, - 0 as wagon, - 0 AS shelveLiters, - pb.productionOrder, - pb.HH, - pb.mm - FROM tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON tc.ticketFk = pb.ticketFk - WHERE tc.collectionFk = vCollectionFk - LIMIT vMaxTickets; - - -- Voumen de las lineas de los pedidos, de acuerdo con el packingShelve establecido por los controladores - DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelveLiters; - CREATE TEMPORARY TABLE tmp.ticketShelveLiters - SELECT t.ticketFk, SUM(s.quantity * vc.shelveVolume / i.packingShelve) shelveLiters - FROM tmp.ticket t - JOIN vn.sale s ON s.ticketFk = t.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.volumeConfig vc - WHERE i.packingShelve - GROUP BY t.ticketFk; - - UPDATE tmp.ticket t - JOIN tmp.ticketShelveLiters tsl ON tsl.ticketFk = t.ticketFk - SET t.shelveLiters = tsl.shelveLiters; - - -- Es importante que el primer ticket se coja en todos los casos - - SET vFirstTicketFk = 0; - - SELECT ticketFk, HH, mm - INTO vFirstTicketFk, vHour, vMinute - FROM tmp.ticket - ORDER BY productionOrder DESC, HH, mm - LIMIT 1; - - -- Hay que excluir aquellos que no tengan la misma hora de preparación - IF vHourMatters THEN - - DELETE - FROM tmp.ticket - WHERE HH != vHour - OR mm != vMinute; - - END IF; - - -- En el caso de pedidos de más volumen de un carro, la colección será monoticket. Pero si el primer pedido - -- no es monoticket, excluimos a los de más de un carro - IF (SELECT (t.shelveLiters > vc.trolleyM3 * 1000) - FROM tmp.ticket t - JOIN vn.volumeConfig vc - WHERE t.ticketFk = vFirstTicketFk) THEN - - DELETE - FROM tmp.ticket - WHERE ticketFk != vFirstTicketFk; - - ELSE - - DELETE t.* - FROM tmp.ticket t - JOIN vn.volumeConfig vc - WHERE t.shelveLiters > vc.trolleyM3 * 1000; - - END IF; - - -- Elimina los tickets bloqueados que no se van a preparar - DELETE tc.* - FROM vn.ticketCollection tc - LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND t.ticketFk IS NULL; - - -- Construccion del tren - - -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. - UPDATE tmp.ticket t - JOIN - ( SELECT MAX(i.size) maxHeigth, - tc.ticketFk - FROM vn.ticketCollection tc - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - JOIN vn.item i ON i.id = s.itemFk - WHERE i.itemPackingTypeFk = 'V' - AND tc.collectionFk = vCollectionFk - GROUP BY tc.ticketFk) sub ON sub.ticketFk = t.ticketFk - SET t.height = IFNULL(sub.maxHeigth,0); - - -- Vamos a generar una tabla con todas las posibilidades de asignacion de pedido - DROP TEMPORARY TABLE IF EXISTS tmp.wagonsVolumetry; - CREATE TEMPORARY TABLE tmp.wagonsVolumetry - SELECT cv.`level` as shelve, - 1 as wagon, - cv.`lines`, - cv.liters, - cv.height - FROM vn.collectionVolumetry cv - WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') - AND cv.trainFk = vTrainFk; - - SET vWagonCounter = 1; - - WHILE vWagonCounter < vWagons DO - - SET vWagonCounter = vWagonCounter + 1; - - INSERT INTO tmp.wagonsVolumetry(shelve, wagon, `lines`, liters, height) - SELECT cv.`level` as shelve, - vWagonCounter as wagon, - cv.`lines`, - cv.liters, - cv.height - FROM vn.collectionVolumetry cv - WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') - AND cv.trainFk = vTrainFk; - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelve; - CREATE TEMPORARY TABLE tmp.ticketShelve - SELECT ticketFk, shelve, wagon, linesDif, LitersDif, heightDif - FROM ( - SELECT t.ticketFk, - wv.shelve, - wv.wagon, - t.productionOrder, - CAST(wv.`lines` AS SIGNED) - t.`lines` as linesDif, - CAST(wv.liters AS SIGNED) - t.shelveLiters as litersDif, - CAST(wv.height AS SIGNED) - t.height as heightDif - FROM tmp.wagonsVolumetry wv - JOIN tmp.ticket t - ) sub - WHERE linesDif >= 0 - AND litersDif >= 0 - AND heightDif >= 0 - ORDER BY productionOrder DESC, linesDif, LitersDif, heightDif ; - - -- Insertamos una opcion virtual para carro completo. Todo ticket tiene que poder entrar en un carro completo.... - INSERT INTO tmp.ticketShelve(ticketFk, shelve, wagon, linesDif, LitersDif, heightDif) - SELECT t.ticketFk, 0, wv.wagon, 999, 999,999 - FROM tmp.ticket t - JOIN tmp.wagonsVolumetry wv - GROUP BY t.ticketFk, wv.wagon; - - SET vWagonCounter = 0; - - WHILE vWagonCounter < vWagons DO - - SET vWagonCounter = vWagonCounter + 1; - - -- Asignamos la primera balda util al primer pedido - IF vWagonCounter = 1 THEN - - SELECT shelve INTO vShelve - FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - AND wagon = vWagonCounter - ORDER BY heightDif, litersDif, linesDif - LIMIT 1; - - ELSE - - SELECT shelve, ticketFk INTO vShelve, vFirstTicketFk - FROM tmp.ticketShelve - WHERE wagon = vWagonCounter - ORDER BY heightDif, litersDif, linesDif - LIMIT 1; - - END IF; - - IF vShelve > 0 THEN - - UPDATE tmp.ticket - SET shelve = vShelve, - wagon = vWagonCounter - WHERE ticketFk = vFirstTicketFk; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - OR (shelve = vShelve AND wagon = vWagonCounter); - - WHILE (SELECT COUNT(*) FROM tmp.ticketShelve WHERE wagon = vWagonCounter) DO - - SELECT ticketFk, shelve - INTO vTicket, vShelve - FROM tmp.ticketShelve - WHERE wagon = vWagonCounter - LIMIT 1; - - UPDATE tmp.ticket - SET shelve = vShelve, - wagon = vWagonCounter - WHERE ticketFk = vTicket; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vTicket - OR (shelve = vShelve AND wagon = vWagonCounter); - - END WHILE; - - ELSE - - UPDATE tmp.ticket - SET shelve = 1, wagon = vWagonCounter - WHERE ticketFk = vFirstTicketFk; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - AND wagon != vWagonCounter; - - END IF; - - END WHILE; - - -- Eliminamos los que se han quedado sin balda - DELETE FROM tmp.ticket WHERE shelve = 0; - - -- Elimina los tickets bloqueados que no se van a preparar - DELETE tc.* - FROM vn.ticketCollection tc - LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND t.ticketFk IS NULL; - - -- Elimina los tickets que ya estan en otra coleccion - DELETE tc.* - FROM vn.ticketCollection tc - JOIN vn.ticketCollection tc2 ON tc2.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND tc2.collectionFk != vCollectionFk; - - -- Actualiza el estado de la colección - UPDATE vn.collection c - JOIN vn.state st ON st.code = 'ON_PREPARATION' - SET c.stateFk = st.id - WHERE c.id = vCollectionFk; - - -- Asigna las bandejas - UPDATE vn.ticketCollection tc - JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - SET tc.level = t.shelve, - tc.wagon = t.wagon, - tc.itemCount = t.`lines`, - tc.liters = t.shelveLiters; - - -- Actualiza el estado de los tickets - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT vStateFk, ticketFk, vUserFk - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vCollectionFk; - - -- Aviso para la preparacion previa - INSERT INTO vn.ticketDown(ticketFk, collectionFk) - SELECT tc.ticketFk, tc.collectionFk - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vCollectionFk; - - IF (SELECT count(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk) THEN - - CALL vn.salesMerge_byCollection(vCollectionFk); - - UPDATE vn.collection c - JOIN (SELECT count(*) saleTotalCount , - sum(s.isPicked != 0) salePickedCount - FROM vn.ticketCollection tc - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND s.quantity > 0 - ) sub - SET c.saleTotalCount = sub.saleTotalCount, - c.salePickedCount = sub.salePickedCount - WHERE c.id = vCollectionFk; - - SELECT vCollectionFk; - - ELSE - - CALL util.throw('No ha sido posible obtener colección'); - DELETE FROM vn.collection WHERE id = vCollectionFk; - - END IF; - - DROP TEMPORARY TABLE - tmp.ticketToSplit, - tmp.ticketShelveLiters, - tmp.ticket, - tmp.wagonsVolumetry, - tmp.ticketShelve, - tmp.productionBuffer; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collection_newWithWagon_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_newWithWagon_beta`(vUserFk INT, vSectorFk INT, vWagons INT) -proc:BEGIN - - DECLARE vIsPreviousPrepared BOOLEAN; - DECLARE vCollectionFk INT; - DECLARE vWarehouseFk INT; - DECLARE vMaxTickets INT; - DECLARE vStateFk INT; - DECLARE vFirstTicketFk INT; - DECLARE vHour INT; - DECLARE vMinute INT; - DECLARE vWorkerCode VARCHAR(3); - DECLARE vWagon INT; - DECLARE vWagonCounter INT; - DECLARE vShelve INT; - DECLARE vTicket INT; - DECLARE vTicketToSplit INT; - DECLARE vPrintedTickets INT; - DECLARE vMaxTicketPrinted INT; - DECLARE vItemPackingTypeFk VARCHAR(1); - DECLARE hasAssignedTickets BOOLEAN; - DECLARE vMaxNotReadyCollections INT DEFAULT 0; - DECLARE vNotReadyCollections INT; - DECLARE vTrainFk INT DEFAULT 1; - DECLARE vNow DATETIME; - - SELECT ticketPrintedMax * vWagons, ticketTrolleyMax * vWagons, pc.maxNotReadyCollections , NOW() - INTO vMaxTicketPrinted, vMaxTickets, vMaxNotReadyCollections, vNow - FROM vn.productionConfig pc; - - SELECT w.code INTO vWorkerCode - FROM vn.worker w - WHERE w.id = vUserFk; - - -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando - SELECT isPreviousPrepared, warehouseFk, itemPackingTypeFk - INTO vIsPreviousPrepared, vWarehouseFk, vItemPackingTypeFk - FROM vn.sector - WHERE id = vSectorFk; -- Hola - --- Si está habilitado el modo cazador para las motos, y el usuario no esta registrado, se sale. - - IF (SELECT isTractorHuntingMode FROM vn.deviceProductionConfig dpc) AND vItemPackingTypeFk = 'H' THEN - IF (SELECT COUNT(*) FROM vn.workerWithoutTractor wwt WHERE wwt.workerFk = vUserFk) THEN - CALL util.throw('Usuario no registrado con moto'); - LEAVE proc; - END IF; - END IF; - --- Si hay colecciones sin terminar, sale del proceso - SELECT count(*) INTO vNotReadyCollections - FROM ( - SELECT count(DISTINCT s.id) totalRow, count(DISTINCT st.id) pickedRow - FROM vn.collection c - JOIN vn.ticketCollection tc ON tc.collectionFk = c.id - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - JOIN vn.state ss ON ss.code = 'PREPARED' - LEFT JOIN vn.saleTracking st ON st.saleFk = s.id AND st.stateFk = ss.id - WHERE c.workerFk = vUserFk - AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) - AND s.quantity != 0 - GROUP BY c.id - HAVING totalRow > pickedRow) sub; - -call util.debugAdd('wargo',CONCAT('vMaxNotReadyCollections ', vMaxNotReadyCollections)); -call util.debugAdd('wargo',CONCAT('vNotReadyCollections ',vNotReadyCollections)); - - IF vMaxNotReadyCollections < vNotReadyCollections THEN - - CALL util.throw('Hay colecciones pendientes'); - LEAVE proc; - - END IF; - - IF vIsPreviousPrepared THEN - - CALL util.throw('Es de preparación previa'); - LEAVE proc; -- Hasta que tengamos el altillo, vamos a cancelar esta opcion - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'PREVIOUS_PREPARATION'; - - ELSE - - SELECT id INTO vStateFk - FROM vn.state - WHERE `code` = 'ON_PREPARATION'; - - END IF; - - CALL vn.productionControl(vWarehouseFk, 0); - - -- Esto hay que corregirlo añadiendo un nuevo parámetro al proc. PAK 23/12/21 - IF vSectorFk = 65 THEN -- Pedidos pequeños - - SET vTrainFk = 2; - - DELETE pb.* - FROM tmp.productionBuffer pb - JOIN vn.volumeConfig vc - WHERE pb.m3 * 1000 > vc.minTicketVolume; - - END IF; - - -- Se obtiene nº de colección y el buffer con los pedidos preparables - INSERT INTO vn.collection - SET workerFk = vUserFk, - itemPackingTypeFk = vItemPackingTypeFk, - trainFk = vTrainFk; - - SELECT LAST_INSERT_ID() INTO vCollectionFk; - - -- 05/08/2021 PAK Jose Frau pide que los tickets de recogida en Algemesí sólo se saquen si están asignados. - DELETE pb.* - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - WHERE pb.agency = 'REC_ALGEMESI' - AND s.code != 'PICKER_DESIGNED'; - - -- 2/3/2022 PAK Se acuerda con Pepe que los pedidos con riesgo no se sacan aunque se asignen. - DELETE pb.* - FROM tmp.productionBuffer pb - WHERE pb.problem LIKE '%RIESGO%'; - - -- Comprobamos si hay tickets asignados. En ese caso, nos centramos exclusivamente en esos tickets - -- y los sacamos independientemente de problemas o tamaños - SELECT COUNT(*) INTO hasAssignedTickets - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - WHERE s.code = 'PICKER_DESIGNED' - AND pb.workerCode = vWorkerCode; - - IF hasAssignedTickets THEN - - UPDATE vn.collection - SET itemPackingTypeFk = NULL - WHERE id = vCollectionFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; - CREATE TEMPORARY TABLE tmp.ticketToSplit - SELECT pb.ticketFk - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - WHERE s.code = 'PICKER_DESIGNED' - AND pb.workerCode = vWorkerCode - ORDER BY HH, - mm, - s.`order` DESC, - pb.m3 DESC; - - WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO - - SELECT MIN(ticketFk) INTO vTicketToSplit - FROM tmp.ticketToSplit; - - CALL vn.ticket_splitItemPackingType(vTicketToSplit); - - INSERT INTO vn.ticketCollection(ticketFk, collectionFk) - SELECT ticketFk, vCollectionFk - FROM tmp.ticketIPT - WHERE (itemPackingTypeFk = vItemPackingTypeFk) ; - - DELETE FROM tmp.ticketToSplit - WHERE ticketFk = vTicketToSplit; - - DROP TEMPORARY TABLE tmp.ticketIPT; - - END WHILE; - - CALL vn.productionControl(vWarehouseFk, 0); - - ELSE - - SELECT COUNT(*) INTO vPrintedTickets - FROM tmp.productionBuffer pb - JOIN vn.state s ON s.id = pb.state - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.productionConfig pc - WHERE pb.shipped = CURDATE() - AND (pb.ubicacion IS NOT NULL - OR a.isOwn = FALSE ) - AND s.isPreparable - AND ( - (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) - OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) - ) - AND (pc.isPreviousPreparationRequired = FALSE - OR pb.previousWithoutParking = FALSE); - -call util.debugAdd('wargo',CONCAT('vMaxTicketPrinted ', vMaxTicketPrinted)); -call util.debugAdd('wargo',CONCAT('vPrintedTickets ',vPrintedTickets)); - - SET vMaxTicketPrinted = vMaxTicketPrinted - vPrintedTickets; - - -- AutoPRINT - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT s2.id, pb.ticketFk, vUserFk - FROM tmp.productionBuffer pb - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.state s ON s.id = pb.state - JOIN vn.state s2 ON s2.code = 'PRINTED_AUTO' - JOIN vn.ticket t ON t.id = pb.ticketFk - JOIN vn.ticketConfig tc - JOIN vn.productionConfig pc - WHERE pb.shipped = CURDATE() - AND (LENGTH(pb.problem) = 0 - OR (pb.problem = 'PEQUEÑO' AND vTrainFk = 2)) - AND (pb.ubicacion IS NOT NULL - OR a.isOwn = FALSE ) - AND s.isPrintable - AND s.isOK - AND ( - (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) - OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) - ) - AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , NOW()) - AND (pc.isPreviousPreparationRequired = FALSE - OR pb.previousWithoutParking = FALSE) - ORDER BY HH, - mm, - s.`order` DESC, - pb.m3 DESC - LIMIT vMaxTicketPrinted; - - -- Se seleccionan los primeros tickets, asignando colección para dejarlos bloqueados a otros sacadores. - -- Se splitan los tickets preparables, para que solo tengan un tipo de empaquetado - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; - CREATE TEMPORARY TABLE tmp.ticketToSplit - SELECT pb.ticketFk, IFNULL((pb.H + pb.V = 0),TRUE) isNeutral - FROM tmp.productionBuffer pb - JOIN vn.agencyMode am ON am.id = pb.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.ticketStateToday tst ON tst.ticket = pb.ticketFk - JOIN vn.state s ON s.id = tst.state - JOIN vn.productionConfig pc - WHERE ( - (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) - OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) - OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) - ) - AND (pb.ubicacion IS NOT NULL - OR a.isOwn = FALSE ) - AND LENGTH(pb.problem) = 0 - AND s.isPreparable - AND (pc.isPreviousPreparationRequired = FALSE - OR pb.previousWithoutParking = FALSE) - ORDER BY pb.HH, pb.mm, s.`order` DESC - LIMIT vMaxTickets; - -call util.debugAdd('wargo',CONCAT('tmp.ticketToSplit ', (SELECT COUNT(*) FROM tmp.ticketToSplit))); - - WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO - - SELECT MIN(ticketFk) INTO vTicketToSplit - FROM tmp.ticketToSplit; - - - IF (SELECT isNeutral - FROM tmp.ticketToSplit - WHERE ticketFk = vTicketToSplit) THEN - - INSERT INTO vn.ticketCollection(ticketFk, collectionFk) - VALUES(vTicketToSplit, vCollectionFk); - -call util.debugAdd('wargo',CONCAT('neutral ', vTicketToSplit)); - - ELSE - - CALL vn.ticket_splitItemPackingType(vTicketToSplit); - - INSERT INTO vn.ticketCollection(ticketFk, collectionFk) - SELECT ticketFk, vCollectionFk - FROM tmp.ticketIPT - WHERE itemPackingTypeFk = vItemPackingTypeFk; - -call util.debugAdd('wargo',CONCAT('NO neutral ', - (SELECT ticketFk FROM tmp.ticketIPT WHERE itemPackingTypeFk = vItemPackingTypeFk))); - - DROP TEMPORARY TABLE tmp.ticketIPT; - - END IF; - - DELETE FROM tmp.ticketToSplit - WHERE ticketFk = vTicketToSplit; - - END WHILE; - - END IF; - -call util.debugAdd('wargo',CONCAT('vn.ticketCollection ', - (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); - - -- Creamos una tabla temporal con los datos que necesitamos para depurar la colección - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT pb.ticketFk, - pb.`lines`, - pb.m3 * 1000 liters, - 0 as height, - 0 as shelve, - 0 as wagon, - 0 AS shelveLiters, - pb.productionOrder, - pb.HH, - pb.mm - FROM tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON tc.ticketFk = pb.ticketFk - WHERE tc.collectionFk = vCollectionFk - LIMIT vMaxTickets; - - -- Voumen de las lineas de los pedidos, de acuerdo con el packingShelve establecido por los controladores - DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelveLiters; - CREATE TEMPORARY TABLE tmp.ticketShelveLiters - SELECT t.ticketFk, SUM(s.quantity * vc.shelveVolume / i.packingShelve) shelveLiters - FROM tmp.ticket t - JOIN vn.sale s ON s.ticketFk = t.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.volumeConfig vc - WHERE i.packingShelve - GROUP BY t.ticketFk; - - UPDATE tmp.ticket t - JOIN tmp.ticketShelveLiters tsl ON tsl.ticketFk = t.ticketFk - SET t.shelveLiters = tsl.shelveLiters; - - -- Es importante que el primer ticket se coja en todos los casos - - SET vFirstTicketFk = 0; - - SELECT ticketFk, HH, mm - INTO vFirstTicketFk, vHour, vMinute - FROM tmp.ticket - ORDER BY productionOrder DESC, HH, mm - LIMIT 1; - -call util.debugAdd('wargo',CONCAT('vFirstTicketFk ', vFirstTicketFk)); -call util.debugAdd('wargo',CONCAT('vHour ', vHour)); -call util.debugAdd('wargo',CONCAT('vMinute ', vMinute)); - -call util.debugAdd('wargo',CONCAT('tmp.ticket ', (SELECT COUNT(*) FROM tmp.ticket))); - - -- Hay que excluir aquellos que no tengan la misma hora de preparación - DELETE - FROM tmp.ticket - WHERE HH != vHour - OR mm != vMinute; - -call util.debugAdd('wargo',CONCAT('tmp.ticket misma hora ', (SELECT COUNT(*) FROM tmp.ticket))); - - -- En el caso de pedidos de más volumen de un carro, la colección será monoticket. Pero si el primer pedido - -- no es monoticket, excluimos a los de más de un carro - IF (SELECT (t.shelveLiters > vc.trolleyM3 * 1000) - FROM tmp.ticket t - JOIN vn.volumeConfig vc - WHERE t.ticketFk = vFirstTicketFk) THEN - - DELETE - FROM tmp.ticket - WHERE ticketFk != vFirstTicketFk; - - ELSE - - DELETE t.* - FROM tmp.ticket t - JOIN vn.volumeConfig vc - WHERE t.shelveLiters > vc.trolleyM3 * 1000; - - END IF; - -call util.debugAdd('wargo',CONCAT('tmp.ticket volumen ', (SELECT COUNT(*) FROM tmp.ticket))); - - -- Elimina los tickets bloqueados que no se van a preparar - DELETE tc.* - FROM vn.ticketCollection tc - LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND t.ticketFk IS NULL; - -call util.debugAdd('wargo',CONCAT('vn.ticketCollection ', - (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); - - -- Construccion del tren - - -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. - UPDATE tmp.ticket t - JOIN - ( SELECT MAX(i.size) maxHeigth, - tc.ticketFk - FROM vn.ticketCollection tc - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - JOIN vn.item i ON i.id = s.itemFk - WHERE i.itemPackingTypeFk = 'V' - AND tc.collectionFk = vCollectionFk - GROUP BY tc.ticketFk) sub ON sub.ticketFk = t.ticketFk - SET t.height = IFNULL(sub.maxHeigth,0); - - -- Vamos a generar una tabla con todas las posibilidades de asignacion de pedido - DROP TEMPORARY TABLE IF EXISTS tmp.wagonsVolumetry; - CREATE TEMPORARY TABLE tmp.wagonsVolumetry - SELECT cv.`level` as shelve, - 1 as wagon, - cv.`lines`, - cv.liters, - cv.height - FROM vn.collectionVolumetry cv - WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') - AND cv.trainFk = vTrainFk; - - SET vWagonCounter = 1; - - WHILE vWagonCounter < vWagons DO - - SET vWagonCounter = vWagonCounter + 1; - - INSERT INTO tmp.wagonsVolumetry(shelve, wagon, `lines`, liters, height) - SELECT cv.`level` as shelve, - vWagonCounter as wagon, - cv.`lines`, - cv.liters, - cv.height - FROM vn.collectionVolumetry cv - WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') - AND cv.trainFk = vTrainFk; - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelve; - CREATE TEMPORARY TABLE tmp.ticketShelve - SELECT ticketFk, shelve, wagon, linesDif, LitersDif, heightDif - FROM ( - SELECT t.ticketFk, - wv.shelve, - wv.wagon, - t.productionOrder, - CAST(wv.`lines` AS SIGNED) - t.`lines` as linesDif, - CAST(wv.liters AS SIGNED) - t.shelveLiters as litersDif, - CAST(wv.height AS SIGNED) - t.height as heightDif - FROM tmp.wagonsVolumetry wv - JOIN tmp.ticket t - ) sub - WHERE linesDif >= 0 - AND litersDif >= 0 - AND heightDif >= 0 - ORDER BY productionOrder DESC, linesDif, LitersDif, heightDif ; - - -- Insertamos una opcion virtual para carro completo. Todo ticket tiene que poder entrar en un carro completo.... - INSERT INTO tmp.ticketShelve(ticketFk, shelve, wagon, linesDif, LitersDif, heightDif) - SELECT t.ticketFk, 0, wv.wagon, 999, 999,999 - FROM tmp.ticket t - JOIN tmp.wagonsVolumetry wv - GROUP BY t.ticketFk, wv.wagon; - - SET vWagonCounter = 0; - - WHILE vWagonCounter < vWagons DO - - SET vWagonCounter = vWagonCounter + 1; - - -- Asignamos la primera balda util al primer pedido - IF vWagonCounter = 1 THEN - - SELECT shelve INTO vShelve - FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - AND wagon = vWagonCounter - ORDER BY heightDif, litersDif, linesDif - LIMIT 1; - - ELSE - - SELECT shelve, ticketFk INTO vShelve, vFirstTicketFk - FROM tmp.ticketShelve - WHERE wagon = vWagonCounter - ORDER BY heightDif, litersDif, linesDif - LIMIT 1; - - END IF; - - IF vShelve > 0 THEN - - UPDATE tmp.ticket - SET shelve = vShelve, - wagon = vWagonCounter - WHERE ticketFk = vFirstTicketFk; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - OR (shelve = vShelve AND wagon = vWagonCounter); - - WHILE (SELECT COUNT(*) FROM tmp.ticketShelve WHERE wagon = vWagonCounter) DO - - SELECT ticketFk, shelve - INTO vTicket, vShelve - FROM tmp.ticketShelve - WHERE wagon = vWagonCounter - LIMIT 1; - - UPDATE tmp.ticket - SET shelve = vShelve, - wagon = vWagonCounter - WHERE ticketFk = vTicket; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vTicket - OR (shelve = vShelve AND wagon = vWagonCounter); - - END WHILE; - - ELSE - - UPDATE tmp.ticket - SET shelve = 1, wagon = vWagonCounter - WHERE ticketFk = vFirstTicketFk; - - DELETE FROM tmp.ticketShelve - WHERE ticketFk = vFirstTicketFk - AND wagon != vWagonCounter; - - END IF; - - END WHILE; - - -- Eliminamos los que se han quedado sin balda - DELETE FROM tmp.ticket WHERE shelve = 0; - - -- Elimina los tickets bloqueados que no se van a preparar - DELETE tc.* - FROM vn.ticketCollection tc - LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND t.ticketFk IS NULL; - -call util.debugAdd('wargo',CONCAT('vn.ticketCollection bloqueados ', - (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); - - -- Elimina los tickets que ya estan en otra coleccion - DELETE tc.* - FROM vn.ticketCollection tc - JOIN vn.ticketCollection tc2 ON tc2.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND tc2.collectionFk != vCollectionFk; - -call util.debugAdd('wargo',CONCAT('vn.ticketCollection otra coleccion ', - (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); - - -- Actualiza el estado de la colección - UPDATE vn.collection c - JOIN vn.state st ON st.code = 'ON_PREPARATION' - SET c.stateFk = st.id - WHERE c.id = vCollectionFk; - - -- Asigna las bandejas - UPDATE vn.ticketCollection tc - JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk - SET tc.level = t.shelve, - tc.wagon = t.wagon, - tc.itemCount = t.`lines`, - tc.liters = t.shelveLiters; - - -- Actualiza el estado de los tickets - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT vStateFk, ticketFk, vUserFk - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vCollectionFk; - - -- Aviso para la preparacion previa - INSERT INTO vn.ticketDown(ticketFk, collectionFk) - SELECT tc.ticketFk, tc.collectionFk - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vCollectionFk; - - SELECT * FROM util.debug - where variable = 'wargo' - and created >= vNow - order by created; - - IF (SELECT count(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk) THEN - - CALL vn.salesMerge_byCollection(vCollectionFk); - - UPDATE vn.collection c - JOIN (SELECT count(*) saleTotalCount , - sum(s.isPicked != 0) salePickedCount - FROM vn.ticketCollection tc - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND s.quantity > 0 - ) sub - SET c.saleTotalCount = sub.saleTotalCount, - c.salePickedCount = sub.salePickedCount - WHERE c.id = vCollectionFk; - - SELECT vCollectionFk; - - ELSE - - DELETE FROM vn.collection WHERE id = vCollectionFk; - - CALL util.throw('No se ha obtenido colección'); - - END IF; - - DROP TEMPORARY TABLE - tmp.ticketToSplit, - tmp.ticketShelveLiters, - tmp.ticket, - tmp.wagonsVolumetry, - tmp.ticketShelve, - tmp.productionBuffer; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `collection_printSticker` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_printSticker`(vCollection INT) -BEGIN - - /*Imprime una etiqueta amarilla a partir de una colección - * - * @param vCollection colección - * @param vPrinterFk id de la impresora - */ - - DECLARE vLabelReportFk INT; - DECLARE vLabelerFk INT; - - - SELECT s.labelReportFk, w.labelerFk INTO vLabelReportFk, vLabelerFk - FROM worker w - LEFT JOIN sector s ON s.id= w.sectorFk - WHERE w.id=account.myUser_getId() ; - - - IF vLabelReportFk AND vLabelerFk THEN - - INSERT INTO ticketTrolley(ticket, labelCount) - SELECT ticketFk, 1 - FROM ticketCollection - WHERE collectionFk = vCollection - ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; - - INSERT INTO printServerQueue(labelReportFk, param1, workerFk,printerFk) - SELECT vLabelReportFk, vCollection, getUser(),vLabelerFk; - - 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 `collection_updateSale` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_updateSale`( - vSaleFk INT, - vOriginalQuantity INT, - vWorkerFk INT, - vStateFk INT, - vTicketFk INT) -BEGIN - - DECLARE vNumPrepared INT; - DECLARE vNumTotal INT; - - REPLACE INTO vn.saleTracking(saleFk,isChecked, originalQuantity, workerFk, actionFk,stateFk) - VALUES(vSaleFk,1,vOriginalQuantity,vWorkerFk,vStateFk,vStateFk); - - UPDATE vn.sale SET isPicked = 1 - WHERE id = vSaleFk; - - SELECT COUNT(s.id) INTO vNumPrepared - FROM vn.sale s - WHERE s.ticketFk = vTicketFk AND s.isPicked = 1; - - SELECT COUNT(s.id) INTO vNumTotal - FROM vn.sale s - WHERE s.ticketFk = vTicketFk; - - IF vNumPrepared = vNumTotal THEN - - INSERT INTO vncontrol.inter - SET state_id = vStateFk, Id_Ticket = vTicketFk, Id_Trabajador = vWorkerFk; - - CALL vn.collection_update(vTicketFk); - - 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 `company_getFiscaldata` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getFiscaldata`(workerFk INT) -BEGIN - -DECLARE vCompanyFk INT; - - SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk) - INTO vCompanyFk - FROM vn.routeConfig rc - LEFT JOIN userConfig uc ON uc.userFk = workerFk; - - - SELECT - s.name AS name , - s.NIF AS nif , - s.street AS street , - s.city AS city , - s.postCode AS postCode - - FROM vn.company c - JOIN vn.worker w ON w.id = c.workerManagerFk - JOIN vn.supplier s ON s.id = c.id - WHERE c.id = vCompanyFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `conveyorExpedition_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `conveyorExpedition_Add`(vStarted DATETIME, vEnded DATETIME) -BEGIN - - - DECLARE startingMinute INT; - - TRUNCATE vn.conveyorExpedition; - - INSERT INTO vn.conveyorExpedition( expeditionFk, - created, - length, - width, - height, - routeFk, - productionMinute, - truck, - criterion, - conveyorBuildingClassFk) - SELECT e.id, - e.created, - 10 * p.depth as depth, - 10 * p.width as width, - 10 * p.height as height, - IFNULL(t.routeFk,am.agencyFk) routeFk, - hour(e.created) * 60 + minute(e.created), - IFNULL(et.description , a.name), - IFNULL(t.routeFk,am.agencyFk) criterion, - IFNULL(p.conveyorBuildingClassFk , pc.defaultConveyorBuildingClass) - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.packaging p ON p.id = e.packagingFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk - LEFT JOIN vn.agency a ON a.id = am.agencyFk - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk - JOIN vn.packagingConfig pc - WHERE t.warehouseFk IN (60,1,44) - AND e.created BETWEEN vStarted AND vEnded - AND p.height < 140 - AND p.width < 60 - AND p.depth < 125; - - SELECT MIN(productionMinute) INTO startingMinute - FROM vn.conveyorExpedition ce ; - - UPDATE vn.conveyorExpedition - SET productionMinute = productionMinute - startingMinute; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `copyComponentsFromSaleList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `copyComponentsFromSaleList`(vTargetTicketFk INT) -BEGIN - -/* Copy sales and components to the target ticket -* -* ¡¡¡¡ Requires tmp.saleList(saleFk, itemFk, quantity, concept, price, discount, orden) !!!!! -* -* param VTargetTicketFk id del ticket a rellenar -*/ - - INSERT INTO vn.sale(ticketFk, itemFk, quantity,concept,price,discount) - SELECT vTargetTicketFk, itemFk, quantity,concept,price,discount - FROM tmp.saleList - ORDER BY orden; - - SET @order = 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.newSaleList; - - CREATE TEMPORARY TABLE tmp.newSaleList - SELECT id as saleFk, @order := @order + 1 as orden - FROM vn.sale - WHERE ticketFk = vTargetTicketFk - ORDER BY saleFk; - - INSERT INTO vn.saleComponent(saleFk,componentFk,value) - SELECT ns.saleFk, sc.componentFk, sc.value - FROM vn.saleComponent sc - JOIN tmp.saleList s ON s.saleFk = sc.saleFk - JOIN tmp.newSaleList ns ON ns.orden = s.orden; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `createPedidoInterno` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `createPedidoInterno`(vItemFk INT,vQuantity INT) -BEGIN - - - UPDATE vn.item SET upToDown = vQuantity WHERE id = vItemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `cristalBall__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `cristalBall__`() -BEGIN -/* -*se utiliza en campaña -* sirve para tener un control del stock en Silla y fuentes -* -*/ - -DECLARE vLastDate DATETIME DEFAULT '2019-10-30 23:59'; -DECLARE vWarehouse INT DEFAULT 1; -DECLARE vPalletVolume INT DEFAULT 2200000; - -SELECT date(sub2.dat) dat, - sub2.longName, - sub2.size, - sub2.subName, - cast(sub2.entra as decimal(10,1)) as entra, - cast(sub2.sale as decimal(10,1)) as sale, - sub2.itemFk, - @saldo := entra + sale + ifnull(fue.pal,0) + IF(sub2.itemFk = @item, @saldo, 0) as saldo, - @item := sub2.itemFk as kk, - cast(fue.pal as decimal(10,1)) as pal -FROM -( - SELECT * FROM - ( - SELECT e.dat, - e.item_id as itemFk, - i.longName, - i.size, - i.subName, - sum(e.amount * r.cm3) / vPalletVolume as entra, - 0 as sale - FROM vn2008.item_entry_in e - JOIN vn.item i ON i.id = e.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN bi.rotacion r ON r.Id_Article = e.item_id AND r.warehouse_id = e.warehouse_id - WHERE e.dat BETWEEN CURDATE() AND vLastDate - AND e.warehouse_id = vWarehouse - AND ic.display - AND e.isVirtualStock is FALSE - GROUP BY e.dat, e.item_id - - UNION ALL - - SELECT s.dat, - s.item_id as itemFk, - i.longName, - i.size, - i.subName, - 0 as entra, - sum(s.amount * r.cm3) / vPalletVolume as sale - FROM vn2008.item_out s - JOIN vn.item i ON i.id = s.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN bi.rotacion r ON r.Id_Article = s.item_id AND r.warehouse_id = s.warehouse_id - WHERE s.dat BETWEEN CURDATE() AND vLastDate - AND s.warehouse_id = vWarehouse - AND ic.display - GROUP BY date(s.dat), s.item_id - - UNION ALL - - SELECT util.yesterday(), - @item := st.item_id as itemFk, - i.longName, - i.size, - i.subName, - st.amount * r.cm3 / vPalletVolume , - @saldo := 0 - FROM cache.stock st - JOIN vn.item i ON i.id = st.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN bi.rotacion r ON r.Id_Article = st.item_id AND r.warehouse_id = st.warehouse_id - WHERE st.warehouse_id = vWarehouse - AND ic.display - - ) sub - ORDER BY itemFk, dat, entra DESC) sub2 - LEFT JOIN - ( - SELECT itemFk, - - sum(ish.visible ) * r.cm3 / vPalletVolume as pal - FROM vn.itemShelving ish - JOIN bi.rotacion r ON r.Id_Article = ish.itemFk AND r.warehouse_id = 1 - LEFT JOIN vn.shelving sh ON sh.code = ish.shelvingFk - LEFT JOIN vn.parking p ON p.id = sh.parkingFk - WHERE (sh.code = 'FUE' OR p.code = 'FUE-PI') - GROUP BY itemFk) fue ON fue.itemFk = sub2.itemFk AND sub2.dat = util.yesterday() - ; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `crypt` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `crypt`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255) ) -BEGIN - - DECLARE vEncryptedText VARCHAR(255) DEFAULT ''; - - DECLARE vKeyLength INT; - DECLARE vKeyPosition INT DEFAULT 1; - DECLARE vKeyChar VARCHAR(1); - - DECLARE vTextLength INT; - DECLARE vTextPosition INT DEFAULT 1; - DECLARE vTextChar VARCHAR(1); - - DECLARE vEncryptedChar VARCHAR(1); - DECLARE vEncryptedCharPosition INT; - - DECLARE vChain VARCHAR(255) DEFAULT '#$.-_0123456789abcdefghijklmnopqrstuvwxyz'; - DECLARE vChainTextPosition INT; - DECLARE vChainKeyPosition INT; - DECLARE vChainLength INT; - - DECLARE vInvalidadChars VARCHAR(255) DEFAULT ''; - - SET vTextLength = LENGTH(vText); - SET vKeyLength = LENGTH(vKey); - SET vChainLength = LENGTH(vChain); - - WHILE vTextPosition <= vTextLength DO - - SET vTextChar = MID(vText,vTextPosition,1); - SET vKeyChar = MID(vKey,vKeyPosition,1); - - SET vChainTextPosition = LOCATE(vTextChar, vChain); - SET vInvalidadChars = IF(vChainTextPosition, vInvalidadChars, CONCAT(vInvalidadChars,vTextChar)); - SET vChainKeyPosition = LOCATE(vKeyChar, vChain); - SET vEncryptedCharPosition = vChainTextPosition + vChainKeyPosition; - - IF vEncryptedCharPosition > vChainLength THEN - - SET vEncryptedCharPosition = vEncryptedCharPosition - vChainLength; - - END IF; - - SET vEncryptedChar = MID(vChain, vEncryptedCharPosition,1); - - SET vEncryptedText = CONCAT(vEncryptedText, vEncryptedChar); - - SET vKeyPosition = IF(vKeyPosition = vKeyLength, 1,vKeyPosition + 1); - SET vTextPosition = vTextPosition + 1; - - END WHILE; - - SET vResult = IF(LENGTH(vInvalidadChars), CONCAT('Caracteres no válidos: ',vInvalidadChars),vEncryptedText); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `cryptOff` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `cryptOff`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255)) -BEGIN - - DECLARE vUncryptedText VARCHAR(255) DEFAULT ''; - - DECLARE vKeyLength INT; - DECLARE vKeyPosition INT DEFAULT 1; - DECLARE vKeyChar VARCHAR(1); - - DECLARE vTextLength INT; - DECLARE vTextPosition INT DEFAULT 1; - DECLARE vTextChar VARCHAR(1); - - DECLARE vUncryptedChar VARCHAR(1); - DECLARE vUncryptedCharPosition INT; - - DECLARE vChain VARCHAR(255) DEFAULT '#$.-_0123456789abcdefghijklmnopqrstuvwxyz'; - DECLARE vChainTextPosition INT; - DECLARE vChainKeyPosition INT; - DECLARE vChainLength INT; - - SET vTextLength = LENGTH(vText); - SET vKeyLength = LENGTH(vKey); - SET vChainLength = LENGTH(vChain); - - WHILE vTextPosition <= vTextLength DO - - SET vTextChar = MID(vText,vTextPosition,1); - SET vKeyChar = MID(vKey,vKeyPosition,1); - - SET vChainTextPosition = LOCATE(vTextChar, vChain); - SET vChainKeyPosition = LOCATE(vKeyChar, vChain); - SET vUncryptedCharPosition = vChainTextPosition - vChainKeyPosition; - - IF vUncryptedCharPosition < 1 THEN - - SET vUncryptedCharPosition = vUncryptedCharPosition + vChainLength; - - END IF; - - SET vUncryptedChar = MID(vChain, vUncryptedCharPosition,1); - - SET vUncryptedText = CONCAT(vUncryptedText, vUncryptedChar); - - SET vKeyPosition = IF(vKeyPosition = vKeyLength, 1,vKeyPosition + 1); - SET vTextPosition = vTextPosition + 1; - - END WHILE; - - SET vResult = vUncryptedText; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `dayMinuteWorker` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `dayMinuteWorker`(vDateFrom DATETIME, vDateTo DATETIME) -BEGIN - - DECLARE vDateStart DATE DEFAULT vDateFrom; - DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDateTo); - - SET @ordr := 0; - SET @user := 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.dayMinuteWorker; - CREATE TEMPORARY TABLE tmp.dayMinuteWorker - SELECT sub3.id, - sub3.hh AS `Hour`, - sub3.mm AS Minut, - sub3.userFk, - sub3.code AS workerCode, - sub3.firstname AS name, - sub3.lastName AS surnames, - sub3.workcenterFk AS center, - w.name AS centerName, - w2.name AS warehouseName, - w2.hasProduction AS production - FROM postgresql.workcenter w - JOIN(SELECT id, - hh, - mm, - userFk, - code, - firstname, - lastName, - @ordr := IF(@user != userFk,0,@ordr), - IF(@ordr MOD 2, 'presente','--') AS state, - @ordr := IFNULL(sub2.`order`,@ordr), - @user := IFNULL(sub2.`userFk`,@user), - workcenterFk - FROM(SELECT dm.id, - dm.hh, - dm.mm, - users.userFk, - sub.`order`, - users.code, - firstName, - lastName, - users.workcenterFk - FROM dayMinute dm - JOIN(SELECT DISTINCT wtc.userFk , - code , - firstName, - lastName, - wl.workCenterFk - FROM vn.workerTimeControl wtc - JOIN vn.worker w ON w.userFk = wtc.userFk - JOIN vn.workerLabour wl ON wl.workerFK = w.id - AND wtc.timed BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) - WHERE wtc.timed BETWEEN vDateStart AND vDateEnd - ) users - LEFT JOIN(SELECT `order`, - wtc.userFk, - hour(wtc.timed) * 100 + minute(wtc.timed) as dayMinuteFk - FROM vn.workerTimeControl wtc - WHERE wtc.timed BETWEEN vDateStart AND vDateEnd - ORDER BY wtc.userFk, `order` - ) sub ON sub.dayMinuteFk = dm.id AND sub.userFk = users.userFk - ORDER BY userFk,dm.id - ) sub2 - ) sub3 ON sub3.workcenterFk = w.workcenter_id - JOIN vn.warehouse w2 ON w2.id = w.warehouseFk - WHERE state = 'presente' - AND sub3.id BETWEEN HOUR(vDateFrom) *100 + MINUTE(vDateFrom) - AND HOUR(vDateTo) *100 + MINUTE(vDateTo); - - END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `department_calcTree` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `department_calcTree`() -BEGIN -/** - * Calculates the #path, #lft, #rgt, #sons and #depth columns of - * the #department table. To build the tree, it uses the #parentFk - * column. - */ - DECLARE vIndex INT DEFAULT 0; - DECLARE vSons INT; - - DROP TEMPORARY TABLE IF EXISTS tNestedTree; - CREATE TEMPORARY TABLE tNestedTree - SELECT id, path, lft, rgt, depth, sons - FROM department LIMIT 0; - - SET max_sp_recursion_depth = 5; - CALL department_calcTreeRec(NULL, '/', 0, vIndex, vSons); - SET max_sp_recursion_depth = 0; - - UPDATE department z - JOIN tNestedTree t ON t.id = z.id - SET z.path = t.path, - z.lft = t.lft, - z.rgt = t.rgt, - z.depth = t.depth, - z.sons = t.sons; - - DROP TEMPORARY TABLE tNestedTree; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `department_calcTreeRec` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `department_calcTreeRec`( - vSelf INT, - vPath VARCHAR(255), - vDepth INT, - INOUT vIndex INT, - OUT vSons INT -) -BEGIN -/** - * Calculates and sets the #path, #lft, #rgt, #sons and #depth - * columns for all children of the passed node. Once calculated - * the last node rgt index and the number of sons are returned. - * To update it's children, this procedure calls itself recursively - * for each one. - * - * @vSelf The node identifier - * @vPath The initial path - * @vDepth The initial depth - * @vIndex The initial lft index - * @vSons The number of direct sons - */ - DECLARE vChildFk INT; - DECLARE vLft INT; - DECLARE vMySons INT; - DECLARE vDone BOOL; - DECLARE vChildren CURSOR FOR - SELECT id FROM department - WHERE (vSelf IS NULL AND parentFk IS NULL) - OR (vSelf IS NOT NULL AND parentFk = vSelf); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SET vSons = 0; - - OPEN vChildren; - myLoop: LOOP - SET vDone = FALSE; - FETCH vChildren INTO vChildFk; - - IF vDone THEN - LEAVE myLoop; - END IF; - - SET vIndex = vIndex + 1; - SET vLft = vIndex; - SET vSons = vSons + 1; - - CALL department_calcTreeRec( - vChildFk, - CONCAT(vPath, vChildFk, '/'), - vDepth + 1, - vIndex, - vMySons - ); - - SET vIndex = vIndex + 1; - - INSERT INTO tNestedTree - SET id = vChildFk, - path = vPath, - lft = vLft, - rgt = vIndex, - depth = vDepth, - sons = vMySons; - END LOOP; - CLOSE vChildren; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `department_doCalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `department_doCalc`() -proc: BEGIN -/** - * Recalculates the department tree. - */ - DECLARE vIsChanged BOOL; - - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('vn.department_doCalc'); - RESIGNAL; - END; - - IF !GET_LOCK('vn.department_doCalc', 0) THEN - LEAVE proc; - END IF; - - SELECT isChanged INTO vIsChanged - FROM department_recalc; - - IF vIsChanged THEN - UPDATE department_recalc SET isChanged = FALSE; - CALL vn.department_calcTree; - END IF; - - DO RELEASE_LOCK('vn.department_doCalc'); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `department_getHasMistake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getHasMistake`() -BEGIN - -/** - * Obtiene los sectores a los cuales les ponemos errores - * - */ - - SELECT id, name - FROM department - WHERE hasToMistake <> 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 `department_getLeaves` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getLeaves`( - vParentFk INT, - vSearch VARCHAR(255) -) -BEGIN - DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; - - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes - (UNIQUE (id)) - ENGINE = MEMORY - SELECT id FROM department LIMIT 0; - - IF vIsSearch THEN - SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - - INSERT INTO tNodes - SELECT id FROM department - WHERE (vIsNumber AND `name` = vSearch) - OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) - LIMIT 1000; - END IF; - - IF vParentFk IS NULL THEN - DROP TEMPORARY TABLE IF EXISTS tChilds; - CREATE TEMPORARY TABLE tChilds - ENGINE = MEMORY - SELECT id FROM tNodes; - - DROP TEMPORARY TABLE IF EXISTS tParents; - CREATE TEMPORARY TABLE tParents - ENGINE = MEMORY - SELECT id FROM department LIMIT 0; - - myLoop: LOOP - DELETE FROM tParents; - INSERT INTO tParents - SELECT parentFk id - FROM department g - JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - - INSERT IGNORE INTO tNodes - SELECT id FROM tParents; - - IF ROW_COUNT() = 0 THEN - LEAVE myLoop; - END IF; - - DELETE FROM tChilds; - INSERT INTO tChilds - SELECT id FROM tParents; - END LOOP; - - DROP TEMPORARY TABLE - tChilds, - tParents; - END IF; - - IF !vIsSearch THEN - INSERT IGNORE INTO tNodes - SELECT id FROM department - WHERE parentFk <=> vParentFk; - END IF; - - SELECT d.id, - d.`name`, - d.parentFk, - d.sons - FROM department d - JOIN tNodes n ON n.id = d.id - ORDER BY depth, `name`; - - DROP TEMPORARY TABLE tNodes; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `deviceLog_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(100)) -BEGIN -/* - * Inserta registro en tabla devicelog el log del usuario conectado - * @param vAppName es el nombre de la app - * @param vAppVersion es la versión de la app - * @param vAndroid_id es el android_id del dispositivo que se ha logueado - */ - - INSERT INTO deviceLog (userFK, nameApp, versionApp, android_id) - VALUES(vWorkerFk, vAppName, vAppVersion, vAndroid_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 `deviceProductionUser_exists` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_exists`(vUserFk INT) -BEGIN - -/* SELECT COUNT(*) AS UserExists - FROM vn.deviceProductionUser dpu - WHERE dpu.userFk = vUserFk;*/ - SELECT 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 `deviceProductionUser_getWorker` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_getWorker`(vAndroid_id VARCHAR(50)) -BEGIN -/** - * Selecciona si hay registrado un device con un android_id - * - * @param vAndroid_id el número android_id del dispositivo - * - */ - SELECT 103; -/* SELECT account.user_getNameFromId(dpu.userFk) - FROM deviceProductionUser dpu - JOIN deviceProduction dp ON dpu.deviceProductionFk = dp.id - WHERE dp.android_id = vAndroid_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 `deviceProduction_getnameDevice` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProduction_getnameDevice`(vAndroid_id VARCHAR(50)) -BEGIN -/** - * Selecciona el id del dispositivo que corresponde al vAndroid_id - * - * @param vAndroid_id el número android_id del dispositivo - * - */ - - SELECT dp.id - FROM deviceProduction dp - WHERE dp.android_id = vAndroid_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 `device_checkLogin` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `device_checkLogin`(vUserFk INT, vAndroidID VARCHAR(50)) -BEGIN - -/* - * Comprueba si está registrado el dispositivo mediante su androidId - * - * @param vUSerFk el id del user - * @param vAndroidID es el identificador android_id del dispositivo - */ - DECLARE vIsAuthorized BOOL DEFAULT TRUE; - DECLARE vIsDepartment BOOL; - DECLARE vIsAllUsersAllowed BOOL; - DECLARE vMessage VARCHAR(200); - - SELECT dpc.isAllUsersallowed INTO vIsAllUsersAllowed - FROM vn.deviceProductionConfig dpc; - - IF NOT vIsAllUsersAllowed THEN - - SELECT COUNT(*) INTO vIsDepartment - FROM vn.workerDepartment dp - JOIN department d ON d.id = dp.departmentFk - WHERE dp.workerFk = vUserFk AND d.hasToCheckLogin; - - IF vIsDepartment THEN - SELECT COUNT(*) INTO vIsAuthorized - FROM vn.deviceProductionUser dpu - JOIN vn.deviceProduction dp ON dp.id = dpu.deviceProductionFk - WHERE dpu.userFk = vUserFk - AND dp.android_id = vAndroidID; - - IF NOT vIsAuthorized THEN - SET vMessage = 'Usuario no autorizado'; - END IF; - END IF; - - END IF; - - SELECT vIsAuthorized,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 `device_checkLogin__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `device_checkLogin__`(vUserFk INT, vAndroidID VARCHAR(50)) -BEGIN - -/* - * Comprueba si está registrado el dispositivo mediante su androidId - * - * @param vUSerFk el id del user - * @param vAndroidID es el identificador android_id del dispositivo - */ - DECLARE vIsAuthorized BOOL DEFAULT TRUE; - DECLARE vIsDepartment BOOL; - DECLARE vMessage VARCHAR(200); - - SELECT COUNT(*) INTO vIsDepartment - FROM vn.workerDepartment dp - JOIN department d ON d.id = dp.departmentFk - WHERE dp.workerFk = vUserFk AND d.name = "PRODUCCION"; - - IF vIsDepartment THEN - - SELECT COUNT(*) INTO vIsAuthorized - FROM vn.deviceProductionUser dpu - JOIN vn.deviceProduction dp ON dp.id = dpu.deviceProductionFk - WHERE dpu.userFk = vUserFk - AND dp.android_id = vAndroidID; - - - IF NOT vIsAuthorized THEN - - SET vMessage = 'Usuario no autorizado'; - - END IF; - - END IF; - - - #vIsAuthorized = TRUE; #Descomentar esta linea si se quiere quitar la comprobación de autorizacion - SELECT vIsAuthorized,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 `duaEntryValueUpdate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `duaEntryValueUpdate`(vDuaFk INT) -BEGIN - - UPDATE duaEntry de - JOIN - ( SELECT b.entryFk, sum(b.quantity * b.buyingValue) as total - FROM buy b - JOIN duaEntry de ON de.entryFk = b.entryFk - WHERE duaFk = vDuaFk - GROUP BY b.entryFk - ) sub ON sub.entryFk = de.entryFk - - LEFT JOIN - (SELECT e.id, sum(iit.taxableBase) as euros - FROM entry e - JOIN invoiceInTax iit ON iit.invoiceInFk = e.invoiceInFk - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk - GROUP BY e.id - ) sub2 ON sub2.id = de.entryFk - - SET de.value = sub.total, - de.euroValue = sub2.euros - WHERE duaFk = vDuaFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `duaInvoiceInBooking` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(vDuaFk INT) -BEGIN - - DECLARE done BOOL DEFAULT FALSE; - DECLARE vInvoiceFk INT; - DECLARE vASIEN BIGINT DEFAULT 0; - DECLARE vCounter INT DEFAULT 0; - - DECLARE rs CURSOR FOR - SELECT e.invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - JOIN invoiceIn ii ON ii.id = e.invoiceInFk - WHERE de.duaFk = vDuaFk - AND de.customsValue - AND ii.isBooked = FALSE; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - UPDATE invoiceIn ii - JOIN entry e ON e.invoiceInFk = ii.id - JOIN duaEntry de ON de.entryFk = e.id - JOIN dua d ON d.id = de.duaFk - SET ii.isBooked = TRUE, - ii.booked = IFNULL(ii.booked,d.booked), - ii.operated = IFNULL(ii.operated,d.operated), - ii.issued = IFNULL(ii.issued,d.issued), - ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), - e.isConfirmed = TRUE - WHERE d.id = vDuaFk; - - SELECT IFNULL(ASIEN,0) INTO vASIEN - FROM dua - WHERE id = vDuaFk; - - FETCH rs INTO vInvoiceFk; - - WHILE NOT done DO - - CALL invoiceInBookingMain(vInvoiceFk); - - IF vCounter > 0 OR vASIEN > 0 THEN - - UPDATE vn2008.XDiario x - JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN - SET x.ASIEN = vASIEN; - - ELSE - - SELECT lastBookEntry INTO vASIEN FROM vn.ledgerConfig; - - END IF; - - SET vCounter = vCounter + 1; - - FETCH rs INTO vInvoiceFk; - - END WHILE; - - CLOSE rs; - - UPDATE dua - SET ASIEN = vASIEN - WHERE id = vDuaFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `duaInvoiceInBooking__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking__`(vDuaFk INT) -BEGIN - DECLARE done BOOL DEFAULT FALSE; - DECLARE vInvoiceFk INT; - DECLARE vASIEN BIGINT DEFAULT 0; - DECLARE vCounter INT DEFAULT 0; - - DECLARE rs CURSOR FOR - SELECT e.invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - JOIN invoiceIn ii ON ii.id = e.invoiceInFk - WHERE de.duaFk = vDuaFk - AND de.customsValue - AND ii.isBooked = FALSE; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - UPDATE invoiceIn ii - JOIN entry e ON e.invoiceInFk = ii.id - JOIN duaEntry de ON de.entryFk = e.id - JOIN dua d ON d.id = de.duaFk - SET ii.isBooked = TRUE, - ii.booked = IFNULL(ii.booked,d.booked), - ii.operated = IFNULL(ii.operated,d.operated), - ii.issued = IFNULL(ii.issued,d.issued), - ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), - e.isConfirmed = TRUE - WHERE d.id = vDuaFk; - - SELECT IFNULL(ASIEN,0) INTO vASIEN - FROM dua - WHERE id = vDuaFk; - - FETCH rs INTO vInvoiceFk; - - WHILE NOT done DO - - CALL invoiceInBookingMain(vInvoiceFk); - - IF vCounter > 0 OR vASIEN > 0 THEN - - UPDATE XDiario x - JOIN config c ON c.ASIEN = x.ASIEN - SET x.ASIEN = vASIEN; - - ELSE - - SELECT ASIEN INTO vASIEN FROM config; - - END IF; - - SET vCounter = vCounter + 1; - - FETCH rs INTO vInvoiceFk; - - END WHILE; - - CLOSE rs; - - UPDATE dua - SET ASIEN = vASIEN - WHERE id = vDuaFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `duaParcialMake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `duaParcialMake`(vDuaFk INT) -BEGIN - - DECLARE vNewDuaFk INT; - - INSERT INTO dua(awbFk,companyFk) - SELECT awbFk,companyFk - FROM dua - WHERE id = vDuaFk; - - SELECT LAST_INSERT_ID() INTO vNewDuaFk; - - INSERT INTO duaEntry(duaFk, entryFk, value, customsValue) - SELECT vNewDuaFk, entryFk, value, value - customsValue - FROM duaEntry - WHERE duaFk = vDuaFk - AND value != customsValue; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `duaTaxBooking` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTaxBooking`(vDuaFk INT) -BEGIN - DECLARE vBookNumber INT; - DECLARE vBookDated DATE; - DECLARE vDiff DECIMAL(10,2); - DECLARE vApunte BIGINT; - - SELECT ASIEN, IFNULL(bookEntried, CURDATE()) INTO vBookNumber, vBookDated - FROM dua - WHERE id = vDuaFk; - - IF vBookNumber IS NULL OR NOT vBookNumber THEN - CALL ledger_next(vBookNumber); - END IF; - - -- Apunte de la aduana - - INSERT INTO XDiario( - ASIEN, - FECHA, - SUBCTA, - CONCEPTO, - EUROHABER, - SERIE, - empresa_id, - CLAVE, - FACTURA) - - SELECT - vBookNumber, - d.bookEntried, - '4700000999', - CONCAT('DUA ',d.`code`), - sum(dt.base * dt.rate / 100) EUROHABER, - 'R', - d.companyFk, - vDuaFk, - vDuaFk - FROM duaTax dt - JOIN dua d ON d.id = dt.duaFk - WHERE dt.duaFk = vDuaFk; - - -- Apuntes por tipo de IVA y proveedor - - INSERT INTO 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, - vBookDated FECHA, - tr.account SUBCTA, - '4330002067' CONTRA, - sum(dt.tax) EURODEBE, - sum(dt.base) BASEEURO, - CONCAT('DUA nº',d.code) CONCEPTO, - d.id FACTURA, - dt.rate IVA, - '*' AUXILIAR, - 'D' SERIE, - d.issued FECHA_EX, - d.operated FECHA_OP, - d.code FACTURAEX, - 1 NFACTICK, - 1 L340, - TRUE LDIFADUAN, - 1 TIPOCLAVE, - 1 TIPOEXENCI, - 1 TIPONOSUJE, - 5 TIPOFACT, - 1 TIPORECTIF, - IF(s.countryFk IN (30, 1), 1, 4) TERIDNIF, - s.nif TERNIF, - s.name TERNOM, - d.companyFk, - d.booked FECREGCON - FROM duaTax dt - JOIN dua d ON dt.duaFk = d.id - JOIN (SELECT account, rate - FROM - (SELECT rate, account - FROM invoiceInTaxBookingAccount ta - WHERE ta.effectived <= vBookDated - AND taxAreaFk = 'WORLD' - ORDER BY ta.effectived DESC - ) tba - GROUP BY rate - ) tr ON tr.rate = dt.rate - JOIN supplier s ON s.id = d.companyFk - WHERE d.id = vDuaFk - GROUP BY dt.rate; - - SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte - FROM XDiario - WHERE ASIEN = vBookNumber; - - UPDATE XDiario - SET BASEEURO = 100 * (EURODEBE - vDiff) / IVA, - EURODEBE = EURODEBE - vDiff - WHERE id = vApunte; - - UPDATE dua - SET ASIEN = vBookNumber - WHERE id = vDuaFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `duaTaxBooking__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTaxBooking__`(vDuaFk INT) -BEGIN - DECLARE vBookNumber INT; - DECLARE vBookDated DATE; - DECLARE vDiff DECIMAL(10,2); - DECLARE vApunte BIGINT; - - SELECT ASIEN, IFNULL(bookEntried, CURDATE()) INTO vBookNumber, vBookDated - FROM dua - WHERE id = vDuaFk; - - IF vBookNumber IS NULL OR NOT vBookNumber THEN - CALL ledger_next(vBookNumber); - END IF; - - -- Apunte de la aduana - - INSERT INTO XDiario( - ASIEN, - FECHA, - SUBCTA, - CONCEPTO, - EUROHABER, - SERIE, - empresa_id, - CLAVE, - FACTURA) - - SELECT - vBookNumber, - d.bookEntried, - '4700000999', - CONCAT('DUA ',d.code), - sum(di.amount * tr.rate / 100) EUROHABER, - 'R', - d.companyFk, - vDuaFk, - vDuaFk - FROM duaIntrastat di - JOIN intrastat ist ON ist.id = di.intrastatFk - JOIN (SELECT rate, taxClassFk - FROM - (SELECT rate, taxClassFk - FROM invoiceInTaxBookingAccount ta - WHERE ta.effectived <= vBookDated - ORDER BY ta.effectived DESC - ) tba - GROUP BY taxClassFk - ) tr ON tr.taxClassFk = ist.taxClassFk - JOIN dua d ON d.id = di.duaFk - WHERE di.duaFk = vDuaFk; - - -- Apuntes por tipo de IVA y proveedor - - INSERT INTO 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, - vBookDated FECHA, - tr.account SUBCTA, - '4330002067' CONTRA, - sum(dt.tax) EURODEBE, - sum(dt.base) BASEEURO, - CONCAT('DUA nº',d.code) CONCEPTO, - d.id FACTURA, - dt.rate IVA, - '*' AUXILIAR, - 'D' SERIE, - d.issued FECHA_EX, - d.operated FECHA_OP, - d.code FACTURAEX, - 1 NFACTICK, - 1 L340, - TRUE LDIFADUAN, - 1 TIPOCLAVE, - 1 TIPOEXENCI, - 1 TIPONOSUJE, - 5 TIPOFACT, - 1 TIPORECTIF, - IF(s.countryFk IN (30, 1), 1, 4) TERIDNIF, - s.nif TERNIF, - s.name TERNOM, - d.companyFk, - d.booked FECREGCON - FROM duaTax dt - JOIN dua d ON dt.duaFk = d.id - JOIN (SELECT account, rate - FROM - (SELECT rate, account - FROM invoiceInTaxBookingAccount ta - WHERE ta.effectived <= vBookDated - AND taxAreaFk = 'WORLD' - ORDER BY ta.effectived DESC - ) tba - GROUP BY rate - ) tr ON tr.rate = dt.rate - JOIN supplier s ON s.id = d.companyFk - WHERE d.id = vDuaFk - GROUP BY dt.rate; - - SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte - FROM XDiario - WHERE ASIEN = vBookNumber; - - UPDATE XDiario - SET BASEEURO = 100 * (EURODEBE - vDiff) / IVA, - EURODEBE = EURODEBE - vDiff - WHERE id = vApunte; - - UPDATE dua - SET ASIEN = vBookNumber - WHERE id = vDuaFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `duaTaxUpdate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTaxUpdate__`(vDuaFk INT) -BEGIN - - DECLARE vSPAIN INT DEFAULT 1; - DECLARE vDated DATE; - DECLARE vTotalDUABase DECIMAL(10,2); - - SELECT IFNULL(operated, CURDATE()) INTO vDated - FROM dua - WHERE id = vDuaFk; - - SELECT sum(amount) INTO vTotalDUABase - FROM duaIntrastat - WHERE duaFk = vDuaFk; - - DELETE FROM duaTax - WHERE duaFk = vDuaFk; - - INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base) - SELECT vDuaFk, supplierFk, taxClassFk, sum(sub.Base) as Base - FROM intrastat ist - JOIN - (SELECT - e.supplierFk, - i.intrastatFk, - CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) * di.amount/ tei.Base AS DECIMAL(10,2)) as Base - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN duaEntry de ON de.entryFk = e.id - JOIN - ( - SELECT i.intrastatFk, - CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) AS DECIMAL(10,2)) as Base - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk - GROUP BY i.intrastatFk - - ) tei ON tei.intrastatFk = i.intrastatFk - JOIN - ( - SELECT intrastatFk, sum(amount) as amount - FROM duaIntrastat - WHERE duaFk = vDuaFk - GROUP BY intrastatFK - ) di ON di.intrastatFk = i.intrastatFk - WHERE de.duaFk = vDuaFk - GROUP BY e.supplierFk, i.intrastatFk - HAVING Base - ) sub ON ist.id = sub.intrastatFk - GROUP BY ist.taxClassFk, sub.supplierFk; - - UPDATE duaTax dt - JOIN - (SELECT taxClassFk, rate - FROM - (SELECT taxClassFk, rate - FROM invoiceInTaxBookingAccount - WHERE effectived <= vDated - AND countryFk = vSPAIN - ORDER BY effectived DESC - ) ba1 - GROUP BY taxClassFk - ) ba2 ON dt.taxClassFk = ba2.taxClassFk - SET dt.rate = ba2.rate, - dt.tax = dt.base * ba2.rate / 100; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `duaTax_doRecalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTax_doRecalc`(vDuaFk INT) -BEGIN -/** - * Borra los valores de duaTax y los vuelve a crear en base a la tabla duaEntry - * - * @param vDuaFk Id del dua a recalcular -**/ - DELETE FROM duaTax - WHERE duaFk = vDuaFk; - - INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base) - SELECT vDuaFk, supplierFk, taxClassFk, sum(sub.Base) as Base - FROM intrastat ist - JOIN - (SELECT - e.supplierFk, - i.intrastatFk, - CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) * di.amount/ tei.Base AS DECIMAL(10,2)) as Base - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN duaEntry de ON de.entryFk = e.id - JOIN - ( - SELECT i.intrastatFk, - CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) AS DECIMAL(10,2)) as Base - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk - GROUP BY i.intrastatFk - - ) tei ON tei.intrastatFk = i.intrastatFk - JOIN - ( - SELECT intrastatFk, sum(amount) as amount - FROM duaIntrastat - WHERE duaFk = vDuaFk - GROUP BY intrastatFK - ) di ON di.intrastatFk = i.intrastatFk - WHERE de.duaFk = vDuaFk - GROUP BY e.supplierFk, i.intrastatFk - HAVING Base - ) sub ON ist.id = sub.intrastatFk - GROUP BY ist.taxClassFk, sub.supplierFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ediTables_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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ediTables_Update`() -BEGIN - - INSERT IGNORE INTO vn.genus(name) - SELECT latin_genus_name - FROM edi.genus ; - - INSERT IGNORE INTO vn.specie(name) - SELECT LCASE(latin_species_name) - FROM edi.specie ; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ektEntryAssign_setEntry` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ektEntryAssign_setEntry`() -BEGIN - -DECLARE done INT DEFAULT FALSE; -DECLARE vEntryFk INT; -DECLARE vTravelFk INT; -DECLARE vId INT; -DECLARE vLanded DATE DEFAULT CURDATE(); - -DECLARE cur1 CURSOR FOR SELECT id FROM vn.ektEntryAssign; - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - IF HOUR(NOW()) > 12 THEN - - SET vLanded = TIMESTAMPADD(DAY,1,vLanded); - - END IF; - -OPEN cur1; - - read_loop: LOOP - - SET done = FALSE; - SET vEntryFk = 0; - - FETCH cur1 INTO vId; - - IF done THEN - LEAVE read_loop; - END IF; - - SELECT IFNULL(e.id,0) INTO vEntryFk - FROM vn.entry e - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - AND ea.supplierFk = e.supplierFk - WHERE ea.id = vId - AND tr.landed = vLanded - LIMIT 1; - - IF NOT vEntryFk THEN - - SELECT IFNULL(e.id,0) INTO vEntryFk - FROM vn.entry e - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - WHERE ea.id = vId - AND tr.landed = vLanded - AND ea.supplierFk IS NULL - LIMIT 1; - - END IF; - - IF NOT vEntryFk THEN - - SET vTravelFk = 0; - - SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk - FROM vn.travel tr - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - WHERE ea.id = vId - AND tr.landed = vLanded; - - IF NOT vTravelFk THEN - - INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) - SELECT vLanded, vLanded, warehouseInFk, warehouseOutFk, agencyModeFk - FROM vn.ektEntryAssign - WHERE id = vId; - - SELECT MAX(tr.id) INTO vTravelFk - FROM vn.travel tr - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - WHERE ea.id = vId - AND tr.landed = vLanded; - - END IF; - - INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk) - SELECT vTravelFk, IFNULL(ea.supplierFk,s.id), c.id, cu.id - FROM vn.supplier s - JOIN vn.company c ON c.code = 'VNL' - JOIN vn.currency cu ON cu.code = 'EUR' - JOIN vn.ektEntryAssign ea ON ea.id = vId - WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN'; - - SELECT MAX(id) INTO vEntryFk - FROM vn.entry - WHERE travelFk = vTravelFk; - - END IF; - - UPDATE vn.ektEntryAssign - SET entryFk = vEntryFk - WHERE id = vId; - - END LOOP; - - CLOSE cur1; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ekt_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_add__`(vPutOrderFk INT) -BEGIN - -/** - * Añade ekt para las ordenes de compra de proveedores que no envian el ekt por email - * - * @param vPutOrderFk PutOrderId de donde coger los datos - **/ - - INSERT INTO edi.ekt(entryYear, - deliveryNumber, - fec, - hor, - item, - pac, - qty, - ori, - cat, - pro, - pri, - package, - s1, - s2, - s3, - s4, - s5, - s6, - putOrderFk, - `ref`, - kop) - SELECT year(curdate()) entryYear, - p.id deliveryNumber , - CURDATE() fec, - CURTIME() hor, - i.longName item, - sr.NumberOfItemsPerCask pac, - p.quantity qty, - o.code ori, - i.category cat, - mp.supplierFk pro, - sr.Price pri, - sr.EmbalageCode package, - i.value5 s1, - i.value6 s2, - i.value7 s3, - i.value8 s4, - i.value9 s5, - i.value10 s6, - p.id putOrderFk, - sr.Item_ArticleCode, - sr.vmpID - FROM edi.putOrder p - JOIN edi.supplyResponse sr ON sr.ID = p.supplyResponseID - JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - JOIN vn.item i ON i.supplyResponseFk = sr.ID - JOIN vn.origin o ON o.id = i.originFk - WHERE p.id = vPutOrderFk; - - CALL edi.ekt_load(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 `energyMeter_record` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `energyMeter_record`(vInput INT, vActiveTime INT) -BEGIN - DECLARE vConsumption INT; - - SELECT consumption INTO vConsumption - FROM energyInput - WHERE input = vInput; - - INSERT INTO vn.energyMeter - SET - `input` = vInput, - `period` = DATE_FORMAT(NOW(), '%Y-%m-%d %H:00:00'), - `activeTime` = vActiveTime, - `consumption` = CAST(IFNULL((vConsumption / 3600) * vActiveTime, 0) AS DECIMAL(10,2)) - ON DUPLICATE KEY UPDATE - `activeTime` = `activeTime` + vActiveTime, - `consumption` = `consumption` + CAST(VALUES(`consumption`) AS DECIMAL(10,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 PROCEDURE IF EXISTS `entryConverter__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entryConverter__`(IN `vEntry` INT) -BEGIN - - DECLARE vWarehouseIn INT; - DECLARE vWarehouseOut INT; - DECLARE vTravel INT; - - DECLARE done BOOL DEFAULT FALSE; - - DECLARE vId_Entrada INT; - DECLARE vId_Article INT; - DECLARE vEtiquetas INT; - DECLARE vId_Cubo VARCHAR(10); - DECLARE vPacking INT; - DECLARE vGrouping INT; - DECLARE vCantidad INT; - DECLARE vCostefijo DECIMAL(10,3); - DECLARE vPortefijo DECIMAL(10,3); - DECLARE vEmbalajefijo DECIMAL(10); - DECLARE vComisionfija DECIMAL(10,3); - DECLARE vCaja INT; - DECLARE vNicho VARCHAR(5); - DECLARE vTarifa1 DECIMAL(10,2); - DECLARE vTarifa2 DECIMAL(10,2); - DECLARE vTarifa3 DECIMAL(10,2); - DECLARE vPVP DECIMAL(10,2); - DECLARE vCompra INT; - - DECLARE rs CURSOR FOR - SELECT - b.Id_Entrada, - b.Id_Article, - b.Etiquetas, - b.Id_Cubo, - b.Packing, - b.`grouping`, - b.Cantidad, - b.Costefijo, - b.Portefijo, - b.Embalajefijo, - b.Comisionfija, - b.caja, - b.Nicho, - b.Tarifa1, - b.Tarifa2, - b.Tarifa3, - b.PVP - FROM vn2008.Compres b - JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article - WHERE Id_Entrada = vEntry; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT warehouseInFk, warehouseOutFk, tr.id - INTO vWarehouseIn, vWarehouseOut, vTravel - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - WHERE e.id = vEntry; - - UPDATE travel - SET warehouseInFk = vWarehouseOut, - warehouseOutFk = vWarehouseIn - WHERE id = vTravel; - - UPDATE vn2008.Compres c - LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article - SET Etiquetas = 0, Cantidad = 0 - WHERE c.Id_Entrada = vEntry - AND ic.espItemFk IS NULL; - - OPEN rs; - - DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry; - - FETCH rs INTO - vId_Entrada, - vId_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP; - - WHILE NOT done DO - - -- Primero la linea original con las cantidades invertidas - INSERT INTO vn2008.Compres - ( - Id_Entrada, - Id_Article, - Etiquetas, - Id_Cubo, - Packing, - `grouping`, - Cantidad, - Costefijo, - Portefijo, - Embalajefijo, - Comisionfija, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP - ) - VALUES - ( - vId_Entrada, - vId_Article, - - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP); - - -- Ahora la linea nueva, con el item genérico - INSERT INTO vn2008.Compres - ( - Id_Entrada, - Id_Article, - Etiquetas, - Id_Cubo, - Packing, - `grouping`, - Cantidad, - Costefijo, - Portefijo, - Embalajefijo, - Comisionfija, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP - ) - SELECT - vId_Entrada, - genItemFk as Id_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP - FROM itemConversor - WHERE espItemFk = vId_Article; - - SELECT LAST_INSERT_ID() - INTO vCompra; - - REPLACE vn2008.Compres_mark(Id_Compra,`comment`) - SELECT vCompra, vId_Article; - - - FETCH rs INTO - vId_Entrada, - vId_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP; - - END WHILE; - - - CLOSE rs; - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entryDelivered` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entryDelivered`(vDated DATE, vEntryFk INT) -BEGIN - - DECLARE vTravelFk INT; - - SELECT travelFk INTO vTravelFk - FROM vn.entry - WHERE id = vEntryFk; - - IF (SELECT COUNT(*) FROM vn.entry WHERE travelFk = vTravelFk) = 1 THEN - - UPDATE vn.travel SET shipped = LEAST(shipped, vDated), landed = vDated - WHERE id = vTravelFk; - - ELSE - - INSERT INTO vn.travel(shipped, landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived) - SELECT LEAST(shipped, vDated), vDated, warehouseInFk, warehouseOutFk, agencyFk, CONCAT(account.userGetName(),' ', vEntryFk), TRUE, TRUE - FROM vn.travel WHERE id = vTravelFk; - - SELECT LAST_INSERT_ID() INTO vTravelFk; - - UPDATE vn.entry - SET travelFk = vTravelFk - WHERE id = vEntryFk; - - 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 `entryPrepare__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entryPrepare__`(IN `idE` BIGINT) -BEGIN - SELECT - b.quantity / b.packing AS Paquetes, - b.packing AS `Grouping`, - barcode, - 'ASEGURADO' AS asegurado, - ic.name, - ic.order, - s.name AS Consignatario, - e.supplierFk AS Id_Cliente, - e.isOrdered, - e.isConfirmed, - 10 AS Calidad, - LPAD(IFNULL(cpd.id, ip.code), - 5, - '0') AS path, - b.entryFk AS Id_Ticket, - t.landed AS Fecha, - b.itemFk, - b.quantity, - i.name AS Concepte, - i.size, - i.inkFk, - i.category, - o.code AS Origen, - 0 AS Bultos, - wIn.`name` AS Tipo, - 0 AS OK, - 0 AS Reservado, - i.stems, - b.id AS Id_Movimiento, - ip.code, - 'PEDIDO ASEGURADO' AS MSG, - 0 AS Seguro, - i.image, - pr.name AS producer - FROM vn.buy b - JOIN vn.entry e ON b.entryFk = e.id - JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk - JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk - JOIN vn.item i ON i.id = b.itemFk - JOIN vn.itemType it ON it.id =i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.packaging pkg ON pkg.id = b.packageFk - LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk - LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.supplier s ON s.id = e.supplierFk - LEFT JOIN vn.producer pr on pr.id = i.producerFk - LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway - WHERE - NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid - AND e.id = 158772 - AND i.typeFk IS NOT NULL - AND ic.display IS NOT 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 `entrySplit_move__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entrySplit_move__`() -BEGIN - - /* CREATED PAK 08/09/2019 - * PENDING REVIEW - * - * - */ - - DROP TEMPORARY TABLE IF EXISTS itemList; - - CREATE TEMPORARY TABLE itemList - SELECT DISTINCT b.itemFk, es.delayedFk, es.receivedFk - FROM vn.buy b - JOIN vn.entrySplit es ON es.delayedFk = b.entryFk - JOIN vn.itemPlacement ip ON ip.itemFk = b.itemFk - WHERE ip.modificationDate > CURDATE(); - - INSERT INTO itemList - SELECT DISTINCT ish.itemFk, es.delayedFk, es.receivedFk - FROM vn.buy b - JOIN vn.entrySplit es ON es.delayedFk = b.entryFk - JOIN vn.itemShelving ish ON ish.itemFk = b.itemFk - WHERE ish.created > CURDATE(); - - - UPDATE vn.buy b - JOIN vn.itemList il ON il.delayedFk = b.entryFk AND b.itemFk = il.itemFk - SET b.entryFk = il.receivedFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entryToTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entryToTicket`(vEntryFk INT, vTicketFk INT) -BEGIN - - INSERT INTO vn.sale(ticketFk, itemFk, concept, quantity) - SELECT vTicketFk, b.itemFk, i.longname, b.quantity - FROM vn.buy b - JOIN vn.item i ON i.id = b.itemFk - WHERE b.entryFk = vEntryFk; - - CALL vn.ticket_recalcComponents(vTicketFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entryVolume__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entryVolume__`(vEntryFk INT) -BEGIN - - SELECT ELT(it.temperature + 1,'Calientes','Frios','Secos') AS Temp, - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.carro / 1000000 ,1) AS DECIMAL(10,2)) AS carros , - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.espai / 1000000,1) AS DECIMAL(10,2)) AS espais - FROM vn.buy b - INNER JOIN vn.entry e ON e.id = b.entryFk - INNER JOIN vn.travel tr ON tr.id = e.travelFk - INNER JOIN vn.volumeConfig vc - INNER JOIN vn.item i ON i.id = b.itemFk - INNER JOIN vn.itemType it ON it.id = i.typeFk - WHERE e.id = vEntryFk - GROUP BY Temp; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entryWithItem`(vShipmentWarehouse INT, vLandingWarehouse INT,vSale INT, vVolume INT, netCost DECIMAL(10,2), vInOutDate DATE) -BEGIN - - DECLARE vTravel INT; - DECLARE vEntry INT; - DECLARE vBucket VARCHAR(10); - DECLARE vSupplierFk INT; - - SET vSupplierFk = IF (vLandingWarehouse = 1, 850, 963); - -- seleccionamos travel - SELECT t.id, e.id INTO vTravel, vEntry - FROM travel t LEFT JOIN entry e ON t.id = e.travelFk - WHERE t.landed = vInOutDate AND t.shipped = vInOutDate AND t.warehouseOutFk = vShipmentWarehouse - AND t.warehouseInFk = vLandingWarehouse AND t.agencyFk IS NULL AND e.supplierFk = vSupplierFk - LIMIT 1; - - -- creamos el travel si es necesario - IF IFNULL(vTravel, FALSE) = FALSE THEN - INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk) - VALUES (vInOutDate, vInOutDate, vLandingWarehouse, vShipmentWarehouse); - SELECT LAST_INSERT_ID() INTO vTravel; - END IF; - - -- creamos la Entrada si es necesario - IF IFNULL(vEntry, FALSE) = FALSE THEN - INSERT INTO entry (supplierFk, travelFk) - VALUES (vSupplierFk, vTravel); -- proveedor 'CONFECCION ARTIFICIAL' - SELECT LAST_INSERT_ID() INTO vEntry; - END IF; - - -- creamos el cubo si es necesario - SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; - IF vBucket IS NULL THEN - INSERT INTO packaging (id, volume) - VALUES (CONCAT('dm',vVolume/1000), vVolume); - -- SELECT LAST_INSERT_ID() INTO vBucket; - SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; - END IF; - - INSERT INTO buy(itemFk,quantity, entryFk, packageFk, packing, stickers, buyingValue, price2, price3) - SELECT itemFk, - quantity, - vEntry, - vBucket, - 1 packing, - quantity, - netCost, - s.price, - s.price - FROM sale s - WHERE s.id = vSale; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entryWithItem__`(IN `vShipmentWarehouse` INT, IN `vLandingWarehouse` INT, IN `vSale` INT, IN `vVolume` INT, IN netCost DECIMAL(10,2), IN `vInOutDate` DATE) -BEGIN - - DECLARE vTravel INT; - DECLARE vEntry INT; - DECLARE vBucket VARCHAR(10); - DECLARE vAgencyDirectFromProvider INT DEFAULT 15; - DECLARE vSupplierFk INT DEFAULT 963; - - - -- seleccionamos travel - SELECT t.id, e.id INTO vTravel, vEntry - FROM travel t LEFT JOIN entry e ON t.id = e.travelFk - WHERE t.landed = vInOutDate AND t.shipped = vInOutDate AND t.warehouseOutFk = vShipmentWarehouse - AND t.warehouseInFk = vLandingWarehouse AND t.agencyFk = vAgencyDirectFromProvider AND e.supplierFk = vSupplierFk - LIMIT 1; - - -- creamos el travel si es necesario - IF IFNULL(vTravel, FALSE) = FALSE THEN - INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyFk) - VALUES (vInOutDate, vInOutDate, vLandingWarehouse, vShipmentWarehouse, vAgencyDirectFromProvider); - SELECT LAST_INSERT_ID() INTO vTravel; - END IF; - - -- creamos la Entrada si es necesario - IF IFNULL(vEntry, FALSE) = FALSE THEN - INSERT INTO entry (supplierFk, travelFk) - VALUES (vSupplierFk, vTravel); -- proveedor 'CONFECCION ARTIFICIAL' - SELECT LAST_INSERT_ID() INTO vEntry; - END IF; - - -- creamos el cubo si es necesario - SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; - IF vBucket IS NULL THEN - INSERT INTO packaging (id, volume) - VALUES (CONCAT('dm',vVolume/1000), vVolume); - -- SELECT LAST_INSERT_ID() INTO vBucket; - SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; - END IF; - - INSERT INTO buy(itemFk,quantity, entryFk, packageFk, packing, `grouping`, stickers, buyingValue, price2, price3) - SELECT itemFk, - quantity, - vEntry, - vBucket, - 1 packing, - 1 `grouping`, - quantity, - netCost, - s.price, - s.price - FROM sale s - WHERE s.id = vSale; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entry_clone` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `entry_clone`(vSelf INT) -BEGIN - -/* - * Clona una entrada - * - * @param vSelf Identificador de vn.entry - */ - - DECLARE vNewEntryFk INT; - - CALL vn.entry_cloneWithoutBuy(vSelf, vNewEntryFk); - - INSERT INTO vn.buy( entryFk, - itemFk, - quantity, - buyingValue, - freightValue, - isIgnored, - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - workerFk, - weight, - itemOriginalFk) - SELECT vNewEntryFk, - itemFk, - quantity, - buyingValue, - freightValue, - isIgnored, - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - workerFk, - weight, - itemOriginalFk - FROM vn.buy b - WHERE b.entryFk = vSelf; - - SELECT vNewEntryFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entry_cloneWithoutBuy` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `entry_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT) -BEGIN - -/** - * Clona una entrada sin compras - * - * @param vSelf Identificador de vn.entry - * - * @return vNewEntryFk Identificador de la nueva entrada - */ - - START TRANSACTION; - - INSERT INTO vn.entry(supplierFk, - dated, - isInventory, - notes, - isRaid, - commission, - travelFk, - currencyFk, - companyFk, - loadPriority) - SELECT supplierFk, - dated, - isInventory, - notes, - isRaid, - commission, - travelFk, - currencyFk, - companyFk, - loadPriority - FROM vn.entry e - WHERE e.id = vSelf; - - SET vNewEntryFk = LAST_INSERT_ID(); - - 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 `entry_fixMisfit` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_fixMisfit`(vSelf INT) -BEGIN - - /* Arregla el descuadre de una entrada, agregando registros en vn.buy para compensar la diferencia - * entre las etiquetas impresas y las etiquetas esperadas - * - */ - - INSERT INTO vn.buy(entryFk, itemFk) - SELECT vSelf, i.id - FROM vn.item i - WHERE i.description = 'MISFIT' - LIMIT 1; - - INSERT INTO vn.buy(entryFk, - itemFk, - quantity, - buyingValue, - freightValue, - isIgnored, - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - location, - packageFk, - price1, - price2, - price3, - minPrice, - producer) - SELECT vSelf, - itemFk, - (printedStickers - stickers) * packing AS quantity, - buyingValue, - freightValue, - TRUE isIgnored, - printedStickers - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - location, - packageFk, - price1, - price2, - price3, - minPrice, - producer - FROM vn.buy b - WHERE b.entryFk = vSelf - AND b.printedStickers != b.stickers; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entry_getRate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_getRate`(vEntry INT) -BEGIN - DECLARE vLanded DATE; - DECLARE vWarehouseFk INT; - - -- Obtiene fecha de llegada y almacén entrante - - SELECT landed, warehouseInFk INTO vLanded, vWarehouseFk - FROM vn.travel t - JOIN vn.entry e ON t.id = e.travelFk - WHERE e.id = vEntry; - - -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén - - DROP TEMPORARY TABLE IF EXISTS tmp.rate; - CREATE TEMPORARY TABLE tmp.rate - ENGINE = MEMORY - SELECT * FROM - ( - SELECT * FROM - ( - SELECT rate0, rate1, rate2, rate3 - FROM vn.rate - WHERE dated <= vLanded - AND warehouseFk = vWarehouseFk - ORDER BY dated DESC - - ) sub - UNION ALL - SELECT rate0, rate1, rate2, rate3 - FROM rateConfig - ) sub2 - 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 `entry_moveNotPrinted` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `entry_moveNotPrinted`(vSelf INT, vDays INT, vChangeEntry BOOL, OUT vNewEntryFk INT) -BEGIN - - /** - * Crea una entrada a futuro y divide las lineas de vn.buy de la entrada original en función - * de las etiquetas impresas - * - * @param vSelf Identificador de vn.entry - * @param vDays Número de dias a futuro que se quiere la nueva entrada - * - * @return vNewEntryFk Identificador de la nueva entrada - */ - - DECLARE vNewTravelFk INT; - DECLARE vTravelFk INT; - - SELECT travelFk INTO vTravelFk - FROM vn.entry - WHERE id = vSelf; - - CALL vn.travel_clone(vTravelFk, vDays, vNewTravelFk); - - CALL vn.entry_cloneWithoutBuy(vSelf, vNewEntryFk); - - UPDATE vn.entry e - SET e.travelFk = vNewTravelFk, - e.evaNotes = CONCAT('No impresas de: ', vSelf, ' ', IFNULL(e.evaNotes,'')) - WHERE e.id = vNewEntryFk; - - UPDATE vn.buy b - SET b.entryFk = vNewEntryFk - WHERE b.printedStickers = 0 - AND b.entryFk = vSelf; - - INSERT INTO vn.buy( entryFk, - itemFk, - quantity, - buyingValue, - freightValue, - isIgnored, - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - workerFk, - weight, - itemOriginalFk) - SELECT vNewEntryFk, - itemFk, - ((stickers - printedStickers) * packing) quantity, - buyingValue, - freightValue, - isIgnored, - (stickers - printedStickers) stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - workerFk, - weight, - itemOriginalFk - FROM vn.buy b - WHERE b.entryFk = vSelf - AND b.printedStickers != b.stickers; - - IF vChangeEntry THEN - UPDATE vn.buy - SET stickers = printedStickers, - quantity = printedStickers * packing - WHERE entryFk = vSelf; - 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 `entry_recalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_recalc`() -BEGIN -/** - * Comprueba que las ventas creadas entre un rango de fechas tienen componentes - * - * @param vCreatedFrom inicio del rango - * @param vCreatedTo fin del rango - */ - DECLARE v_done BOOL DEFAULT FALSE; - DECLARE vEntryFk INTEGER; - - DECLARE vCur CURSOR FOR - SELECT id FROM tmp.recalcEntryCommision; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; - - OPEN vCur; - - l: LOOP - SET v_done = FALSE; - FETCH vCur INTO vEntryFk; - - IF v_done THEN - LEAVE l; - END IF; - - CALL vn2008.buy_tarifas_entry(vEntryFk); - END LOOP; - - CLOSE vCur; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entry_splitByShelving` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT) -BEGIN -/** - * Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr�cula - * - * @param vShelvingFk Identificador de vn.shelving - * @param vFromEntryFk Entrada origen - * @param vToEntryFk Entrada destino - */ - DECLARE vBuyFk INT; - DECLARE ishStickers INT; - DECLARE buyStickers INT; - DECLARE vDone BOOLEAN DEFAULT FALSE; - - DECLARE cur CURSOR FOR - SELECT bb.id buyFk, - FLOOR(ish.visible / ish.packing) AS ishStickers, - bb.stickers buyStickers - FROM vn.itemShelving ish - JOIN (SELECT b.id, b.itemFk, b.stickers - FROM vn.buy b - WHERE b.entryFk = vFromEntryFk - ORDER BY b.stickers DESC) bb ON bb.itemFk = ish.itemFk - AND bb.stickers >= FLOOR(ish.visible / ish.packing) - WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci - GROUP BY ish.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - -- Cantidades de la matrícula que exceden la de las entradas - SELECT ish.itemFk, - i.longName, - FLOOR(ish.visible / ish.packing) AS etiEnMatricula, - bb.stickers etiEnEntrada - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - LEFT JOIN (SELECT b.id, b.itemFk, b.stickers - FROM vn.buy b - WHERE b.entryFk = vFromEntryFk - ORDER BY b.stickers DESC) bb ON bb.itemFk = ish.itemFk - WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci - AND IFNULL(bb.stickers,0) < FLOOR(ish.visible / ish.packing) - GROUP BY ish.id; - - OPEN cur; - - read_loop: LOOP - SET vDone = FALSE; - - FETCH cur INTO vBuyFk, ishStickers, buyStickers; - - IF vDone THEN - LEAVE read_loop; - END IF; - - IF ishStickers = buyStickers THEN - UPDATE vn.buy - SET entryFk = vToEntryFk - WHERE id = vBuyFk; - ELSE - UPDATE vn.buy - SET stickers = stickers - ishStickers, - quantity = stickers * packing - WHERE id = vBuyFk; - - INSERT INTO vn.buy(entryFk, - itemFk, - quantity, - buyingValue, - freightValue, - isIgnored, - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - location, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - workerFk, - isChecked, - isPickedOff, - ektFk, - weight, - deliveryFk, - itemOriginalFk) - SELECT - vToEntryFk, - itemFk, - ishStickers * packing, - buyingValue, - freightValue, - isIgnored, - ishStickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - location, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - ishStickers, - workerFk, - isChecked, - isPickedOff, - ektFk, - weight, - deliveryFk, - itemOriginalFk - FROM vn.buy - WHERE id = vBuyFk; - - END IF; - END LOOP; - - CLOSE cur; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `entry_splitMisfit` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitMisfit`(vSelf INT) -BEGIN - - /* Divide una entrada, pasando los registros que ha insertado vn.entry_fixMisfit de la entrada original - * a la nueva - */ - - DECLARE vNewEntryFk INT; - DECLARE vBuyFk INT; - - SELECT MAX(b.id) INTO vBuyFk - FROM vn.buy b - JOIN vn.item i ON i.id = b.itemFk - WHERE b.entryFk = vSelf - AND i.description = 'MISFIT'; - - INSERT INTO vn.entry(supplierFk, dated, notes, travelFk, currencyFk, companyFk) - SELECT supplierFk, dated, CONCAT('E:',vSelf), travelFk, currencyFk, companyFk - FROM vn.entry e - WHERE e.id = vSelf; - - SET vNewEntryFk = LAST_INSERT_ID(); - - UPDATE vn.buy b - SET b.entryFk = vNewEntryFk - WHERE b.entryFk = vSelf - AND b.id > vBuyFk; - - SELECT vNewEntryFk; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `errorProduction_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_add`(vAction VARCHAR(25), vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * Fill in the errorProduction table - */ - - DECLARE vDepartment VARCHAR(255); - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; - DROP TEMPORARY TABLE IF EXISTS tmp.total; - DROP TEMPORARY TABLE IF EXISTS tmp.itemPickerErrors; - DROP TEMPORARY TABLE IF EXISTS tmp.errorsByClaim; - DROP TEMPORARY TABLE IF EXISTS tmp.volume; - DROP TEMPORARY TABLE IF EXISTS tmp.errorsByChecker; - - CASE - WHEN vAction = 'SACAR' THEN - SET vDepartment = 'Sacadores'; - WHEN vAction = 'ENCAJAR' THEN - SET vDepartment = 'Encajadores'; - WHEN vAction = 'CONTROLAR' THEN - SET vDepartment = 'Revisadores'; - END CASE; - - IF (vDepartment = 'Encajadores') THEN - CREATE TEMPORARY TABLE tmp.total - ENGINE = MEMORY - SELECT e.workerFk, - COUNT(DISTINCT t.id) ticketCount, - COUNT(s.id) lineCount - FROM expedition e - JOIN ticket t ON e.ticketFk = t.id - JOIN sale s ON s.ticketFk = t.id - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo - GROUP BY e.workerFk; - ELSE - CREATE TEMPORARY TABLE tmp.total - ENGINE = MEMORY - SELECT st.workerFk, - COUNT(DISTINCT t.id) ticketCount, - COUNT(s.id) lineCount - FROM saleTracking st - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - JOIN sale s ON s.id = st.saleFk - JOIN ticket t ON s.ticketFk = t.id - WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND a.accion = vAction - GROUP BY st.workerFk; - END IF; - - CALL timeControl_calculateAll(vDatedFrom, vDatedTo); - - - CREATE TEMPORARY TABLE tmp.errorsByClaim - ENGINE = MEMORY - SELECT COUNT(c.ticketFk) errors, - cd.workerFk - FROM claimDevelopment cd - JOIN claim c ON cd.claimFk = c.id - JOIN ticket t ON c.ticketFk = t.id - JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo - AND cr.description = vDepartment - GROUP BY cd.workerFk; - - CREATE TEMPORARY TABLE tmp.volume - ENGINE = MEMORY - SELECT SUM(w.volume) volume, - w.workerFk - FROM bs.workerProductivity w - WHERE w.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY w.workerFk; - - CREATE TEMPORARY TABLE tmp.errorsByChecker - ENGINE = MEMORY - SELECT sub1.workerFk, COUNT(id) errors - FROM ( - SELECT st.workerFk, - t.id - FROM saleMistake sm - JOIN saleTracking st ON sm.saleFk = st.saleFk - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - JOIN sale s ON s.id = sm.saleFk - JOIN ticket t on t.id = s.ticketFk - WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) - AND a.accion = vAction - GROUP BY s.ticketFk - ) sub1 - GROUP BY sub1.workerFk; - - INSERT INTO errorProduction(userFk, firstname, lastname, rol, ticketNumber, lineNumber, error, volume, hourStart, hourEnd, hourWorked, dated) - SELECT w.id, - w.firstName, - w.lastName, - vDepartment, - t.ticketCount totalTickets, - t.lineCount, - IFNULL(ec.errors,0) + IFNULL(ec2.errors,0) errors, - IF(vDepartment = 'Revisadores', NULL, v.volume) volume, - SUBSTRING(tc.timed, 1, 5) hourStart, - SUBSTRING(tc.timed, LENGTH(tc.timed)-4, 5) hourEnd, - IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) hourWorked, - vDatedFrom dated - FROM tmp.total t - LEFT JOIN worker w ON w.id = t.workerFk - LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk - LEFT JOIN tmp.errorsByClaim ec ON ec.workerFk = t.workerFk - LEFT JOIN tmp.volume v ON v.workerFk = t.workerFk - LEFT JOIN tmp.errorsByChecker ec2 ON ec2.workerFk = t.workerFk - GROUP BY w.id; - - IF (vDepartment = 'Sacadores') THEN - CREATE TEMPORARY TABLE tmp.itemPickerErrors -- Errores de los sacadores, derivadores de los revisadores - ENGINE = MEMORY - SELECT COUNT(c.ticketFk) errors, - tt.workerFk - FROM claimDevelopment cd - JOIN claim c ON cd.claimFk = c.id - JOIN ticket t ON c.ticketFk = t.id - JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id - JOIN ticketTracking tt ON tt.ticketFk = t.id - JOIN state s ON s.id = tt.stateFk - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo - AND cr.description = 'Revisadores' - AND s.code = 'ON_PREPARATION' - GROUP BY workerFk; - - UPDATE errorProduction ep - JOIN tmp.itemPickerErrors ipe ON ipe.workerFk = ep.userFk - SET ep.error = ep.error + ipe.errors - WHERE vDatedFrom = ep.dated AND ep.rol = 'Sacadores'; - - END IF; - - DROP TEMPORARY TABLE tmp.timeControlCalculate; - DROP TEMPORARY TABLE tmp.total; - DROP TEMPORARY TABLE IF EXISTS tmp.itemPickerErrors; - DROP TEMPORARY TABLE tmp.errorsByClaim; - DROP TEMPORARY TABLE tmp.volume; - DROP TEMPORARY TABLE tmp.errorsByChecker; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `errorProduction_addLauncher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_addLauncher`() -BEGIN - DECLARE vDatedFrom DATETIME; - DECLARE vDatedTo DATETIME; - - SELECT DATE_SUB(CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; - - CALL vn.errorProduction_add('SACAR', vDatedFrom, vDatedTo); - CALL vn.errorProduction_add('ENCAJAR', vDatedFrom, vDatedTo); - CALL vn.errorProduction_add('CONTROLAR', vDatedFrom, vDatedTo); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `errorProduction_addLauncher__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_addLauncher__`() -BEGIN - DECLARE vDatedFrom DATETIME; - DECLARE vDatedTo DATETIME; - - IF (DAY(CURDATE()) = 5) THEN - SELECT util.firstDayOfMonth(DATE_SUB(CURDATE(),INTERVAL 1 MONTH)), CONCAT(LAST_DAY(DATE_SUB(CURDATE(),INTERVAL 1 MONTH)),' 23:59:59') INTO vDatedFrom, vDatedTo; - - CALL vn.errorProduction_add('SACAR' ,'Sacadores','PREPARED', vDatedFrom, vDatedTo); - CALL vn.errorProduction_add('ENCAJAR' ,'Encajadores','PACKED', vDatedFrom, vDatedTo); - CALL vn.errorProduction_add('CONTROLAR' ,'Revisadores','CHECKED', vDatedFrom, vDatedTo); - 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 `errorProduction_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_add__`(vAction VARCHAR(25), vDepartment VARCHAR(25), vStateCode VARCHAR(25) CHARSET utf8, vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - /** - * Fill in the errorProduction table. - */ - DROP TEMPORARY TABLE IF EXISTS tmp.total; - - IF (vDepartment = 'Encajadores') - THEN - CREATE TEMPORARY TABLE tmp.total - ENGINE = MEMORY - SELECT e.workerFk, Count(DISTINCT t.id) AS ticketCount - FROM expedition e - JOIN ticket t ON e.ticketFk = t.id - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo - GROUP BY e.workerFk; - ELSE - CREATE TEMPORARY TABLE tmp.total - ENGINE = MEMORY - SELECT st.workerFk, Count(DISTINCT t.id) AS ticketCount - FROM state ss - JOIN vn.saleTracking st ON st.stateFk = ss.id - JOIN vn.sale s ON s.id = st.saleFk - JOIN ticket t ON s.ticketFk = t.id - WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND ss.code = vStateCode - GROUP BY st.workerFk; - END IF; - - - INSERT INTO errorProduction(userFk, firstname, lastname, rol, ticketNumber, error, ratio, volume, month, year) - SELECT sub1.id, sub1.firstName, sub1.lastName, - CASE - WHEN vDepartment = 'Encajadores' THEN 'Encajador' - WHEN vDepartment = 'Sacadores' THEN 'Sacador' - ELSE 'Revisador' - END AS rol, - CAST(sub1.totalTickets AS DECIMAL(10,0)) AS totalTickets, - CAST(IFNULL(sub1.errors,0) + IFNULL(sub2.errors,0) AS DECIMAL(10,0)) AS errors, - ((IFNULL(sub1.errors,0) + IFNULL(sub2.errors,0))/sub1.totalTickets)*100 AS ratio, - IF(vDepartment = 'Revisadores', NULL, volume) AS volume, - MONTH(vDatedFrom) AS month, - YEAR(vDatedFrom) AS year - FROM( - SELECT w.id, w.code, w.firstName, w.lastName, t.ticketCount AS totalTickets, sub.errors, sub2.volume - FROM tmp.total AS t - JOIN worker w ON w.id = t.workerFk - LEFT JOIN ( - SELECT COUNT(c.ticketFk) AS errors, cd.workerFk - FROM claimDevelopment cd - JOIN claim c ON cd.claimFk = c.id - JOIN ticket t ON c.ticketFk = t.id - JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = vDepartment - GROUP BY cd.workerFk - )sub ON t.workerFk = sub.workerFk - LEFT JOIN ( -- Añadir volume - SELECT SUM(w.volume) AS volume, w.workerFk - FROM bs.workerProductivity w - INNER JOIN vn.`role` r ON r.id=w.roleFk - WHERE IF(vDepartment = 'Encajadores', r.name='packager', r.name='itemPicker') AND w.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY w.workerFk) sub2 ON w.id = sub2.workerFk - GROUP BY w.code) sub1 - LEFT JOIN( - SELECT sub1.workerFk, COUNT(id) AS errors - FROM ( - SELECT st.workerFk, t.id - FROM vn.saleMistake sm - JOIN vn.saleTracking st ON sm.saleFk = st.saleFk - JOIN state ss ON ss.id = st.stateFk - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - JOIN vn.sale s ON s.id = sm.saleFk - JOIN vn.ticket t on t.id = s.ticketFk - WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND a.accion = vAction AND ss.code = vStateCode - GROUP BY s.ticketFk - ) sub1 - GROUP BY sub1.workerFk) sub2 ON sub2.workerFk = sub1.id; - - DROP TEMPORARY TABLE tmp.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 `expeditionGetFromRoute` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionGetFromRoute`( - vExpeditionFk INT) -BEGIN -/** - * Get all expeditions from route - */ - DECLARE vRouteFk INT DEFAULT 0; - - SELECT t.routeFk INTO vRouteFk - FROM vn.expedition exp - INNER JOIN ticket t on t.id = exp.ticketFk - WHERE exp.id = vExpeditionFk; - -SELECT exp.id, exp.ticketFk, exp.checked, t.routeFk,t.packages AS bultos , ts.alertLevel, a.street, a.city,a.postalCode,a.id AS addressFk,w.name AS warehouse - FROM vn.expedition exp - INNER JOIN ticket t ON t.id = exp.ticketFk - INNER JOIN vn.ticketState ts ON ts.ticketFk = exp.ticketFk - LEFT JOIN vn.address a ON t.addressFk = a.id - LEFT JOIN vn.warehouse w ON t.warehouseFk = w.id - WHERE t.routeFk = vRouteFk AND exp.isBox > 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 `expeditionPallet_Del` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_Del`(vPalletFk INT) -BEGIN - - DELETE FROM vn.expeditionPallet - WHERE id = vPalletFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionPallet_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_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_List`(vTruckFk INT) -BEGIN - - SELECT ep.id Pallet, - count(DISTINCT t.routeFk) Rutas, - count(DISTINCT e.id) Eti - FROM vn.expeditionPallet ep - LEFT JOIN vn.expeditionScan es ON es.palletFk = ep.id - LEFT JOIN vn.expedition e ON e.id = es.expeditionFk - LEFT JOIN vn.ticket t ON t.id = e.ticketFk - WHERE ep.truckFk = vTruckFk - GROUP BY ep.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 `expeditionPallet_printLabel` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_printLabel`(vPalletFk INT) -BEGIN - - DECLARE vLabel INT; - DECLARE vPrinterFk INT; - - UPDATE vn.expeditionPallet - SET isPrint = FALSE - WHERE id = vPalletFk; - - SELECT s.labelReportFk, w.labelerFk INTO vLabel, vPrinterFK - FROM worker w - LEFT JOIN sector s ON s.id= w.sectorFk - WHERE w.id=account.myUser_getId() ; - - INSERT INTO printServerQueue (printerFk, labelReportFk, statusFk, param1, workerFk) - VALUES(vPrinterFK, vLabel, 1, vPalletFk, account.myUser_getId()); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_PrintSet` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_PrintSet`(vPalletFk INT,vSectorFk INT) -BEGIN - - DECLARE vLabel INT; - DECLARE vPrinterFk INT; - - UPDATE vn.expeditionPallet - SET isPrint = FALSE - WHERE id = vPalletFk; - - SELECT labelReportFk - INTO vLabel - FROM sector - WHERE id=vSectorFk; - - SELECT printerFk - INTO vPrinterFk - FROM sector - WHERE id=vSectorFk; - - - INSERT INTO vn2008.Colas -(Id_Cola, Id_Impresora, Id_Prioridad, Id_Informe, Id_Estado, Hora_Inicio, Hora_Fin, Cola, Id_Trabajador, Cola2, Cola3, error) -VALUES(NULL, vPrinterFK, NULL, vLabel, 1, NULL, NULL, vPalletFk, NULL, vSectorFk, NULL, 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 `expeditionPallet_View` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `expeditionPallet_View`(vPalletFk INT) -BEGIN - - SELECT ep.id Pallet, - t.routeFk Rutas, - count(*) Cajas - FROM vn.expeditionPallet ep - LEFT JOIN vn.expeditionScan es ON es.palletFk = ep.id - LEFT JOIN vn.expedition e ON e.id = es.expeditionFk - LEFT JOIN vn.ticket t ON t.id = e.ticketFk - WHERE ep.id = vPalletFk - GROUP BY t.routeFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionScan_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Add`(vPalletFk INT, vTruckFk INT) -BEGIN - - DECLARE vTotal INT DEFAULT 0; - - IF vPalletFk = 0 THEN -- Nuevo pallet - - INSERT INTO vn.expeditionPallet(truckFk) - VALUES(vTruckFk); - - SELECT LAST_INSERT_ID() INTO vPalletFk; - - END IF; - - SELECT COUNT(expeditionFk) INTO vTotal FROM vn.expeditionScan WHERE palletFk = vPalletFk; - - IF vTotal <> 0 THEN - SELECT expeditionFk, - palletFk - FROM vn.expeditionScan - WHERE palletFk = vPalletFk; - ELSE - SELECT 0 expeditionFk,vPalletFk palletFk; - 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 `expeditionScan_Del` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Del`(vScanFk INT) -BEGIN - - DELETE FROM vn.expeditionScan - WHERE id = vScanFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionScan_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_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_List`(vPalletFk INT) -BEGIN - - SELECT es.id, - t.routeFk Ruta, - t.id Ticket, - e.counter Caja, - es.expeditionFk - FROM vn.expeditionScan es - JOIN vn.expedition e ON e.id = es.expeditionFk - JOIN vn.ticket t ON t.id = e.ticketFk - WHERE es.palletFk = vPalletFk - ORDER BY Ruta, Ticket, Caja; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionScan_Put` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Put`(vPalletFk INT, vExpeditionFk INT) -BEGIN - - REPLACE vn.expeditionScan(expeditionFk, palletFk) - VALUES(vExpeditionFk, vPalletFk); - - SELECT LAST_INSERT_ID() INTO vPalletFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionState_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`@`localhost` PROCEDURE `expeditionState_add`(vParam INT, vStateCode VARCHAR(100)) -BEGIN - - /** - * Inserta nuevos registros en la tabla vn.expeditionState, segun el parámetro - * - * @param vParam Identificador de vn.expedition o de vn.route - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - - IF (SELECT COUNT(*) FROM vn.route r WHERE r.id = vParam) THEN - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT e.id, est.id - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.expeditionStateType est ON est.code = vStateCode - WHERE t.routeFk = vParam; - - ELSE - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT vParam, est.id - FROM vn.expeditionStateType est - WHERE est.code = vStateCode; - - 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 `expeditionState_addByAdress` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100)) -BEGIN - - /** - * Inserta nuevos registros en la tabla vn.expeditionState - * - * @param vAdressFk Identificador de vn.ticket - * @param vRouteFk Identificador de vn.route - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT e.id, est.id - FROM vn.expedition e - JOIN vn.expeditionStateType est ON est.code = vStateCode - JOIN vn.ticket t ON t.id = e.ticketFk - WHERE t.addressFk = vAdressFk AND t.routeFk = vRouteFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionState_addByExpedition` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `expeditionState_addByExpedition`(vExpeditionFk INT, vStateCode VARCHAR(100)) -BEGIN - - /** - * Inserta nuevos registros en la tabla vn.expeditionState - * - * @param vExpeditionFk Identificador de vn.expedition - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT vExpeditionFk, est.id - FROM vn.expeditionStateType est - WHERE est.code = vStateCode; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionState_addByPallet` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByPallet`(vPalletFk INT, vStateCode VARCHAR(100)) -BEGIN -/** - * Inserta nuevos registros en la tabla vn.expeditionState - * - * @param vPalletFk Identificador de vn.expedition - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - DROP TEMPORARY TABLE IF EXISTS tmp.expeditionScan; - CREATE TEMPORARY TABLE tmp.expeditionScan - SELECT expeditionFk, est.id typeFk - FROM vn.expeditionScan e - JOIN vn.expeditionStateType est ON est.code = vStateCode - WHERE e.palletFk = vPalletFk; - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT expeditionFk, typeFk - FROM tmp.expeditionScan; - - DROP TEMPORARY TABLE IF EXISTS tmp.expeditionScan; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionState_addByRoute` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100)) -BEGIN - - /** - * Inserta nuevos registros en la tabla vn.expeditionState, por rutas - * - * @param vRouteFk Identificador de vn.route - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT e.id, est.id - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.expeditionStateType est ON est.code = vStateCode - WHERE t.routeFk = vRouteFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionTruck_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45)) -BEGIN - - INSERT INTO vn.expeditionTruck(ETD,description) - VALUES(CONCAT(CURDATE(), ' ', vHour), vDescription); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionTruck_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_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_List`() -BEGIN - - SELECT id truckFk, - ETD, - description Destino - FROM vn.expeditionTruck - WHERE ETD BETWEEN CURDATE() AND util.dayend(CURDATE()) - ORDER BY ETD; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expeditionUpdateChecked` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionUpdateChecked`( - vExpeditionFk INT, vChecked INT) -BEGIN -/** - * Get all expeditions from route - */ - - UPDATE vn.expedition exp - SET exp.checked = vChecked - WHERE exp.id = vExpeditionFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expedition_getFromRoute` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getFromRoute`(vRouteFk INT) -BEGIN -/** - * Obtiene las expediciones a partir de una ruta - * @param vRouteFk Id de la ruta - */ - - SELECT e.id, - e.ticketFk, - e.checked, - t.routeFk, - ts.alertLevel, - a.street, - a.city, - a.postalCode, - t.addressFk, - a.nickname, - sub2.itemPackingTypeConcat, - est.code - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - JOIN ticketState ts ON ts.ticketFk = e.ticketFk - JOIN address a ON t.addressFk = a.id - LEFT JOIN warehouse w ON t.warehouseFk = w.id - LEFT JOIN (SELECT sub.ticketFk, - CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeConcat - FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - WHERE t.routeFk = vRouteFk - GROUP BY t.id,i.itemPackingTypeFk)sub - GROUP BY sub.ticketFk - ) sub2 ON sub2.ticketFk = t.id - LEFT JOIN expeditionStateType est ON est.id = e.stateTypeFk - WHERE t.routeFk = vRouteFk AND e.isBox <> 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 `expedition_getState` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getState`(vExpeditionFk INT) -BEGIN - - DECLARE vTicketsPendientes INT; - DECLARE vEtiquetasTotales INT; - DECLARE vEtiquetasEscaneadas INT; - DECLARE vRouteFk INT; - - SELECT t.routeFk INTO vRouteFk - FROM vn.ticket t - JOIN vn.expedition e ON e.ticketFk = t.id - WHERE e.id = vExpeditionFk; - - SELECT COUNT(*) INTO vTicketsPendientes - FROM vn.ticket t - LEFT JOIN vn.expedition e ON e.ticketFk = t.id - WHERE t.routeFk = vRouteFk - AND ISNULL(e.id); - - SELECT COUNT(*) INTO vEtiquetasTotales - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - WHERE t.routeFk = vRouteFk; - - SELECT COUNT(*) INTO vEtiquetasEscaneadas - FROM vn.expeditionScan es - JOIN vn.expedition e ON e.id = es.expeditionFk - JOIN vn.ticket t ON t.id = e.ticketFk - WHERE t.routeFk = vRouteFk; - - SELECT e.ticketFk ticket, - t.nickname cliente, - a.city ciudad, - p.name provincia, - z.name zonaTicket, - am.name zonaRuta, - t.routeFk ruta, - rm.beachFk ubicacion, - et.ETD , - et.description camion, - vTicketsPendientes AS ticketsPendientes, - vEtiquetasTotales AS etiquetasTotales, - vEtiquetasEscaneadas AS etiquetasEscaneadas - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.`zone`z ON z.id = t.zoneFk - LEFT JOIN vn.route r ON r.id = t.routeFk - LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk - WHERE e.id = vExpeditionFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `expedition_StateGet` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_StateGet`(vExpeditionFk INT) -BEGIN - - /* Devuelve una "ficha" con todos los datos relativos a la expedición - * - * param vExpeditionFk - */ - - DECLARE vTicketsPendientes INT; - DECLARE vEtiquetasTotales INT; - DECLARE vEtiquetasEscaneadas INT; - DECLARE vEtiquetasLeidasSorter INT; - DECLARE vRouteFk INT; - - SELECT t.routeFk INTO vRouteFk - FROM vn.ticket t - JOIN vn.expedition e ON e.ticketFk = t.id - WHERE e.id = vExpeditionFk; - - SELECT COUNT(*) INTO vTicketsPendientes - FROM vn.ticket t - LEFT JOIN vn.expedition e ON e.ticketFk = t.id - WHERE t.routeFk = vRouteFk - AND ISNULL(e.id); - - SELECT COUNT(*) INTO vEtiquetasTotales - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - WHERE t.routeFk = vRouteFk; - - SELECT COUNT(*) INTO vEtiquetasEscaneadas - FROM vn.expeditionScan es - JOIN vn.expedition e ON e.id = es.expeditionFk - JOIN vn.ticket t ON t.id = e.ticketFk - WHERE t.routeFk = vRouteFk; - - SELECT COUNT(*) INTO vEtiquetasLeidasSorter - FROM srt.expedition e - JOIN vn.expedition ve ON ve.id = e.id - LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id - JOIN vn.ticket t ON t.id = ve.ticketFk - WHERE t.routeFk = vRouteFk - AND e.created != e.updated - AND ISNULL(es.expeditionFk); - - - SELECT e.ticketFk ticket, - t.nickname cliente, - a.city ciudad, - p.name provincia, - z.name zonaTicket, - am.name zonaRuta, - t.routeFk ruta, - rm.beachFk ubicacion, - et.ETD , - et.description camion, - vTicketsPendientes AS ticketsPendientes, - vEtiquetasTotales AS etiquetasTotales, - vEtiquetasEscaneadas AS etiquetasEscaneadas, - vEtiquetasLeidasSorter AS etiquetasSorter - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.`zone`z ON z.id = t.zoneFk - LEFT JOIN vn.route r ON r.id = t.routeFk - LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id - LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk - WHERE e.id = vExpeditionFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `faultsReview` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `faultsReview`(vWarehouseFk INT) -BEGIN - - DECLARE vCalcVisibleFk INT; - - CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - - DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; - - CREATE TEMPORARY TABLE tmp.itemShelvingRadar - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT iss.itemFk, - i.size, - i.subName producer, - SUM(IF(s.sonFk, iss.visible,0)) upstairs, - SUM(IF(s.sonFk, 0, iss.visible)) downstairs, - v.visible - FROM vn.itemShelvingStock iss - JOIN vn.sector s ON s.id = iss.sectorFk - JOIN vn.item i on i.id = iss.itemFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk - WHERE iss.warehouseFk = vWarehouseFk - GROUP BY iss.itemFk; - - SELECT ishr.*, sub.longName, - CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho, - CAST(sub.fault AS DECIMAL(10,0)) as faltas - FROM tmp.itemShelvingRadar ishr - JOIN (SELECT s.itemFk, s.quantity as fault, s.concept as longName - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.client c ON c.id = t.clientFk - WHERE c.typeFk = 'loses' COLLATE utf8_unicode_ci - AND s.isPicked = FALSE - AND date(t.shipped) = CURDATE() - AND t.warehouseFk = vWarehouseFk - ) sub ON sub.itemFk = ishr.itemFk - ; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `faultsReview_isChecked` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `faultsReview_isChecked`(vItemFk INT, vWarehouseFk INT) -BEGIN - - UPDATE vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.client c ON c.id = t.clientFk - SET s.isPicked = TRUE - WHERE c.typeFk = 'loses' COLLATE utf8_unicode_ci - AND date(t.shipped) = CURDATE() - AND t.warehouseFk = vWarehouseFk - AND s.itemFk = vItemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `freelance_getInfo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `freelance_getInfo`(workerFk INT) -BEGIN - SELECT s.name, s.street, s.city, s.nif, s.postCode - FROM route r - JOIN agencyMode am ON r.agencyModeFk = am.id - JOIN agency a ON am.agencyFk = a.id - JOIN supplier s ON a.supplierFk = s.id - WHERE r.workerFk = workerFk - ORDER BY r.id DESC - 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 `fustControl` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControl`(vFromDated DATE, vToDated DATE) -BEGIN - - DECLARE vSijsnerClientFk INT DEFAULT 19752; - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SET vDateStart = vFromDated; - SET vDateEnd = util.Dayend(vToDated); - - SELECT p.id FustCode, - CAST(sent.stucks AS DECIMAL(10,0)) FH, - CAST(tp.stucks AS DECIMAL(10,0)) Tickets, - CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner, - CAST(IFNULL(sent.stucks,0) - IFNULL(tp.stucks,0) + IFNULL(sj.stucks,0) AS DECIMAL(10,0)) saldo - FROM vn.packaging p - LEFT JOIN ( - SELECT FustCode, sum(fustQuantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,b.packageFk) FustCode, s.quantity / b.packing AS fustQuantity - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - JOIN vn.packaging p ON p.id = b.packageFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA') sub - GROUP BY FustCode) sent ON sent.FustCode = p.id - LEFT JOIN ( - SELECT FustCode, sum(quantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA' - AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0) sub - GROUP BY FustCode) tp ON tp.FustCode = p.id - LEFT JOIN ( - SELECT FustCode, sum(quantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, 1, vDateStart ) AND TIMESTAMPADD(DAY, 1, vDateEnd ) - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND t.clientFk = vSijsnerClientFk) sub - GROUP BY FustCode) sj ON sj.FustCode = p.id - WHERE sent.stucks - OR tp.stucks - OR sj.stucks; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `fustControlDetail` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControlDetail`(vFromDated DATE, vToDated DATE) -BEGIN - - DECLARE vSijsnerClientFk INT DEFAULT 19752; - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SET vDateStart = vFromDated; - SET vDateEnd = util.Dayend(vToDated); - - SELECT a.nickname shopName, - a.city , - IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, - tp.quantity, - tp.ticketFk, - CONCAT('From ', vFromDated,' to ', vToDated) AS dateRange - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vFromDated AND util.dayend(vToDated) - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA' - AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `fv_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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `fv_pca`() -BEGIN - -DECLARE done INT DEFAULT FALSE; - -DECLARE vTicketFk INT; -DECLARE vSaleFk INT; -DECLARE vClonTicket INT DEFAULT 0; - -DECLARE cur1 CURSOR FOR -SELECT s.ticketFk, s.id - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - WHERE t.shipped BETWEEN '2020-10-18' AND '2020-10-31' - AND it.code IN ('ANT','ANS','ORQ','TRO') - and t.warehouseFk = 1; - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN cur1; - -FETCH cur1 INTO vTicketFk, vSaleFk; - - WHILE done = 0 DO - - SELECT t.id INTO vClonTicket - FROM vn.ticket t - JOIN (SELECT addressFk, shipped FROM vn.ticket WHERE id = vTicketFk) sub USING(addressFk, shipped) - WHERE t.warehouseFk = 44 - LIMIT 1; - - SELECT vTicketFk, vClonTicket; - - IF vClonTicket = 0 THEN - - INSERT INTO ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk - ) - SELECT - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - 44, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk - - FROM ticket - WHERE id = vTicketFk; - - SET vClonTicket = LAST_INSERT_ID(); - - SELECT 'lstID', vClonTicket; - /* - INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) - SELECT vTicketFk, ao.observationTypeFk, ao.description - FROM addressObservation ao - JOIN ticket t ON t.addressFk = ao.addressFk - WHERE t.id = vClonTicket; -*/ - INSERT INTO ticketLog - SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert', - description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk); - - END IF; - - UPDATE vn.sale - SET ticketFk = vClonTicket - WHERE id = vSaleFk; - - SET vClonTicket = 0; - - SET done = 0; - FETCH cur1 INTO vTicketFk, vSaleFk; - - END WHILE; - - CLOSE cur1; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getDayExpeditions` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `getDayExpeditions`() -BEGIN - - SELECT - e.expeditions_id as expeditionFk, - date_format(e.odbc_date,'%Y-%m-%d') as expeditionDate, - e.ticket_id as ticketFk, - t.routeFk as routeFk - FROM vn2008.expeditions e - INNER JOIN vn.ticket t ON t.id = e.ticket_id - WHERE DATE(odbc_date) = 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 `getDeliveryWorkers` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `getDeliveryWorkers`() -BEGIN -SELECT w.id, - concat(p.firstname," ",p.name) AS fullName, - w.code AS workerCode, - pwc.name, - rl.routeFk as routeLoader - FROM postgresql.person AS p - LEFT JOIN vn.worker AS w ON p.id_trabajador=w.id - LEFT JOIN (SELECT MIN(profile_id) AS pid, person_id FROM postgresql.profile GROUP BY person_id) AS pp ON p.person_id=pp.person_id - LEFT JOIN vn2008.profile_labour_payroll AS plp ON pp.pid=plp.profile_id - LEFT JOIN (SELECT MAX(business_id) AS bimax, client_id FROM postgresql.business GROUP BY client_id) AS pbv ON pbv.client_id = plp.profile_id - LEFT JOIN postgresql.business_labour AS pbl ON pbl.business_id = pbv.bimax - LEFT JOIN vn.department AS pd ON pd.id = pbl.department_id - LEFT JOIN postgresql.workcenter AS pwc ON pwc.workcenter_id=pbl.workcenter_id - LEFT JOIN vn.user u ON u.id=w.userFK - LEFT JOIN vn.routeLoadWorker rl ON rl.workerFk = w.id - WHERE p.id_trabajador Is Not Null - AND pd.name='REPARTO' - AND u.active<>0 - ORDER BY pwc.name ASC,p.firstname ASC; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getInfoDelivery` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `getInfoDelivery`(vRouteFk INT) -BEGIN - SELECT s.name, s.street, s.city, s.nif, s.postCode FROM vn.route r - JOIN vn.agencyMode am ON r.agencyModeFk = am.id - JOIN vn.agency a ON am.agencyFk = a.id - JOIN vn.supplier s ON a.supplierFk = s.id - WHERE r.id = vRouteFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getItemUbication` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `getItemUbication`(vItemFk VARCHAR(22)) -BEGIN - - /* - * @deprecated Utilizar itemShelving_getInfo - * - */ - - CALL itemshelving_getInfo(vItemFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getItemVisibleAvailable__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `getItemVisibleAvailable__`( - vItem INT, - vDate DATE, - vWarehouse TINYINT, - vRefresh BOOL) -BEGIN - -- DEPRECADO - UTILIZAR vn.item_getVisibleAvailable() - JSB - 2019-11-20 - CALL item_getVisibleAvailable(vItem, vDate, vWarehouse, vRefresh); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `getPedidosInternos` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `getPedidosInternos`() -BEGIN - - SELECT id,name as description,upToDown as quantity FROM vn.item WHERE upToDown; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `intrastat_data_neto_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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `intrastat_data_neto_Update`(IN vInvoiceInFk INT) -BEGIN - - UPDATE vn2008.intrastat_data id - JOIN ( - SELECT i.intrastatFk, - LEAST(SUM(b.quantity) * IFNULL(it.gramsMax,100000) / 1000, - SUM(ic.cm3 * b.quantity) * IF(i.density, i.density, it.density) / 1000000) as neto - FROM entry e - JOIN travel tr ON tr.id = e.travelFk - JOIN buy b ON b.entryFk = e.id - JOIN item i ON i.id = b.itemFk - join itemType it ON it.id = i.typeFk - JOIN itemCost ic ON ic.itemFk = i.id AND tr.warehouseInFk = ic.warehouseFk - WHERE e.invoiceInFk = vinvoiceInFk - GROUP BY i.intrastatFk) sub ON sub.intrastatFk = id.intrastat_id - SET id.neto = ROUND(sub.neto, 1) - WHERE id.recibida_id = vInvoiceInFk; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `inventoryFailureAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryFailureAdd`() -BEGIN - -DECLARE done BOOL DEFAULT FALSE; -DECLARE vTicketFk INT; - -DECLARE rs CURSOR FOR - SELECT id FROM vn.ticket - WHERE shipped = util.yesterday() - AND clientFk = 400 - AND warehouseFk IN (1,44); - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN rs; - -FETCH rs INTO vTicketFk; - -WHILE NOT done DO - - INSERT INTO vn.inventoryFailure(dated, itemFk, quantity, value, warehouseFk, throwerFk) - SELECT t.shipped, - s.itemFk, - s.quantity, - b.buyingValue + b.freightValue + b.packageValue + b.comissionValue, - t.warehouseFk, - w.id - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN cache.last_buy lb ON lb.warehouse_id = t.warehouseFk AND item_id = s.itemFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.worker w ON w.code = LEFT(s.concept, 3) - WHERE t.id = vTicketFk - AND s.quantity > 0; - - FETCH rs INTO vTicketFk; - -END WHILE; - - -CLOSE rs; - - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `inventoryMake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vDate DATE, vWh INT) -proc: BEGIN -/** - * Recalcula los inventarios de todos los almacenes, si vWh = 0 - * - * @param vDate Fecha de los nuevos inventarios - * @param vWh almacen al cual hacer el inventario - */ - - DECLARE vDone BOOL; - DECLARE vEntryFk INT; - DECLARE vTravelFk INT; - DECLARE vDateLastInventory DATE; - DECLARE vDateYesterday DATETIME DEFAULT TIMESTAMPADD(SECOND,-1,vDate); - - DECLARE cWarehouses CURSOR FOR - SELECT id - FROM warehouse - WHERE isInventory AND vWh IN (0,id); - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - SELECT vDateYesterday; - - OPEN cWarehouses; - SET @isModeInventory := TRUE; - l: LOOP - - SET vDone = FALSE; - FETCH cWarehouses INTO vWh; - - IF vDone THEN - LEAVE l; - END IF; - - SELECT MAX(landed) INTO vDateLastInventory - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - JOIN buy b ON b.entryFk = e.id - WHERE warehouseOutFk = 13 - AND landed < vDate - AND e.supplierFk = 4 - AND warehouseInFk = vWh - AND NOT isRaid; - - IF vDateLastInventory IS NULL THEN - SELECT inventoried INTO vDateLastInventory FROM config; - END IF; - - -- Generamos travel, si no existe. - SET vTravelFK = 0; - - SELECT id INTO vTravelFk - FROM travel - WHERE warehouseOutFk = 13 - AND warehouseInFk = vWh - AND landed = vDate - AND agencyFk = 53 - AND ref = 'inventario' - LIMIT 1; - - IF NOT vTravelFK THEN - - INSERT INTO travel SET - warehouseOutFk = 13, - warehouseInFk = vWh, - shipped = vDate, - landed = vDate, - agencyFk = 53, - ref = 'inventario', - isDelivered = TRUE, - isReceived = TRUE; - - SELECT LAST_INSERT_ID() INTO vTravelFk; - - END IF; - - -- Generamos entrada si no existe, o la vaciamos. - SET vEntryFk = 0; - - SELECT id INTO vEntryFk - FROM entry - WHERE supplierFk = 4 - AND travelFk = vTravelFk; - - IF NOT vEntryFk THEN - - INSERT INTO entry SET - supplierFk = 4, - isConfirmed = TRUE, - isOrdered = TRUE, - travelFk = vTravelFk; - - SELECT LAST_INSERT_ID() INTO vEntryFk; - - ELSE - - DELETE FROM buy WHERE entryFk = vEntryFk; - - END IF; - - -- Preparamos tabla auxilar - DROP TEMPORARY TABLE IF EXISTS tmp.inventory; - - CREATE TEMPORARY TABLE tmp.inventory - ( - itemFk INT(11) NOT NULL PRIMARY KEY, - quantity int(11) DEFAULT '0', - buyingValue decimal(10,3) DEFAULT '0.000', - freightValue decimal(10,3) DEFAULT '0.000', - packing int(11) DEFAULT '0', - `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', - groupingMode tinyint(4) NOT NULL DEFAULT 0 , - comissionValue decimal(10,3) DEFAULT '0.000', - packageValue decimal(10,3) DEFAULT '0.000', - packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', - price1 decimal(10,2) DEFAULT '0.00', - price2 decimal(10,2) DEFAULT '0.00', - price3 decimal(10,2) DEFAULT '0.00', - minPrice decimal(10,2) DEFAULT '0.00', - producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - INDEX (itemFK)) - ENGINE = MEMORY ; - - -- Compras - INSERT INTO tmp.inventory(itemFk,quantity) - SELECT b.itemFk, sum(b.quantity) - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - WHERE tr.warehouseInFk = vWh - AND tr.landed BETWEEN vDateLastInventory - AND vDateYesterday - AND NOT isRaid - GROUP BY b.itemFk; - SELECT vDateLastInventory , vDateYesterday; - -- Traslados - INSERT INTO tmp.inventory(itemFk,quantity) - SELECT itemFk, quantityOut - FROM ( - SELECT b.itemFk, -sum(b.quantity) quantityOut - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - WHERE tr.warehouseOutFk = vWh - AND tr.shipped BETWEEN vDateLastInventory - AND vDateYesterday - AND NOT isRaid - GROUP BY b.itemFk - ) sub - ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.quantityOut; - - -- Ventas - INSERT INTO tmp.inventory(itemFk,quantity) - SELECT itemFk, saleOut - FROM ( - SELECT s.itemFk, -sum(s.quantity) saleOut - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE t.warehouseFk = vWh - AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday - GROUP BY s.itemFk - ) sub - ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; - - -- Actualiza valores de la ultima compra - - UPDATE tmp.inventory inv - JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh - JOIN buy b ON b.id = lb.buy_id - SET - inv.buyingValue = b.buyingValue, - inv.freightValue = b.freightValue, - inv.packing = b.packing, - inv.`grouping` = b.`grouping`, - inv.groupingMode = b.groupingMode, - inv.comissionValue = b.comissionValue, - inv.packageValue = b.packageValue, - inv.packageFk = b.packageFk, - inv.price1 = b.price1, - inv.price2 = b.price2, - inv.price3 = b.price3, - inv.minPrice = b.minPrice, - inv.producer = b.producer; - - - INSERT INTO buy( itemFk, - quantity, - buyingValue, - freightValue, - packing, - `grouping`, - groupingMode, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - entryFk) - SELECT itemFk, - GREATEST(quantity,0), - buyingValue, - freightValue, - packing, - `grouping`, - groupingMode, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - vEntryFk - FROM tmp.inventory; - - SELECT vWh, count(*), NOW() FROM tmp.inventory; - - -- DROP TEMPORARY TABLE tmp.inventory; - - END LOOP; - - CLOSE cWarehouses; - - UPDATE config SET inventoried = vDate; - SET @isModeInventory := FALSE; - - DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; - CREATE TEMPORARY TABLE tmp.entryToDelete - (INDEX(entryId) USING BTREE) ENGINE = MEMORY - SELECT e.id as entryId, - t.id as travelId - FROM vn.travel t - JOIN vn.entry e ON e.travelFk = t.id - WHERE e.supplierFk = 4 - AND t.shipped <= TIMESTAMPADD(DAY, -2, TIMESTAMPADD(DAY, -10, CURDATE())) - AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, CURDATE())); - - DELETE e - FROM vn.entry e - JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id; - - DELETE IGNORE t - FROM vn.travel t - JOIN tmp.entryToDelete tmp ON tmp.travelId = 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 `inventoryMakeLauncher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMakeLauncher`() -BEGIN -/** - * Recalcula los inventarios de todos los almacenes. - */ - - call vn.inventoryMake(TIMESTAMPADD(DAY, -10, CURDATE()), 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 `inventoryMake__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake__`(vDate DATE, vWh INT) -proc: BEGIN -/** - * bernat WORKING IN THIS FILE - * Recalcula los inventarios de todos los almacenes, si vWh = 0 - * - * @param vDate Fecha de los nuevos inventarios - */ - - DECLARE vDone BOOL; - DECLARE vEntryFk INT; - DECLARE vTravelFk INT; - DECLARE vDateTime DATETIME DEFAULT TIMESTAMP(vDate, '00:00:00'); - DECLARE vDeleteDate DATE DEFAULT TIMESTAMPADD(DAY, -2, vDate); - DECLARE vDateLastInventory DATE; - DECLARE vDateYesterday DATETIME DEFAULT TIMESTAMPADD(SECOND,-1,vDate); - - DECLARE cWarehouses CURSOR FOR - SELECT id FROM vn.warehouse WHERE isInventory AND vWh IN (0,id); - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - SELECT vDateYesterday; - - OPEN cWarehouses; - SET @isModeInventory := TRUE; - l: LOOP - - SET vDone = FALSE; - FETCH cWarehouses INTO vWh; - - IF vDone THEN - LEAVE l; - END IF; - - SELECT MAX(landed) INTO vDateLastInventory - FROM vn.travel tr - JOIN vn.entry e ON e.travelFk = tr.id - JOIN vn.buy b ON b.entryFk = e.id - WHERE warehouseOutFk = 13 - AND landed < vDate - AND e.supplierFk = 4 - AND warehouseInFk = vWh - AND NOT isRaid; - - -- Generamos travel, si no existe. - SET vTravelFK = 0; - - SELECT id INTO vTravelFk - FROM vn.travel - WHERE warehouseOutFk = 13 - AND warehouseInFk = vWh - AND landed = vDate - AND agencyFk = 53 - AND ref = 'inventario' - LIMIT 1; - - IF NOT vTravelFK THEN - - INSERT INTO vn.travel SET - warehouseOutFk = 13, - warehouseInFk = vWh, - shipped = vDateTime, - landed = vDate, - agencyFk = 53, - ref = 'inventario', - isDelivered = TRUE, - isReceived = TRUE; - - SELECT LAST_INSERT_ID() INTO vTravelFk; - - END IF; - - -- Generamos entrada si no existe, o la vaciamos. - SET vEntryFk = 0; - - SELECT id INTO vEntryFk - FROM vn.entry - WHERE supplierFk = 4 - AND travelFk = vTravelFk; - - IF NOT vEntryFk THEN - - INSERT INTO entry SET - supplierFk = 4, - isConfirmed = TRUE, - isOrdered = TRUE, - travelFk = vTravelFk; - - SELECT LAST_INSERT_ID() INTO vEntryFk; - - ELSE - - DELETE FROM vn.buy WHERE entryFk = vEntryFk; - - END IF; - - -- Preparamos tabla auxilar - DROP TEMPORARY TABLE IF EXISTS tmp.inventory; - - CREATE TEMPORARY TABLE tmp.inventory - ( - itemFk INT(11) NOT NULL PRIMARY KEY, - quantity int(11) DEFAULT '0', - buyingValue decimal(10,3) DEFAULT '0.000', - freightValue decimal(10,3) DEFAULT '0.000', - packing int(11) DEFAULT '0', - `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', - groupingMode tinyint(4) NOT NULL DEFAULT 0 , - comissionValue decimal(10,3) DEFAULT '0.000', - packageValue decimal(10,3) DEFAULT '0.000', - packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', - price1 decimal(10,2) DEFAULT '0.00', - price2 decimal(10,2) DEFAULT '0.00', - price3 decimal(10,2) DEFAULT '0.00', - minPrice decimal(10,2) DEFAULT '0.00', - producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, - INDEX (itemFK)) - ENGINE = MEMORY ; - - -- Compras - INSERT INTO tmp.inventory(itemFk,quantity) - SELECT b.itemFk, sum(b.quantity) - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - WHERE tr.warehouseInFk = vWh - AND tr.landed BETWEEN vDateLastInventory - AND vDateYesterday - AND NOT isRaid - GROUP BY b.itemFk; - SELECT vDateLastInventory , vDateYesterday; - -- Traslados - INSERT INTO tmp.inventory(itemFk,quantity) - SELECT itemFk, quantityOut - FROM ( - SELECT b.itemFk, -sum(b.quantity) quantityOut - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - WHERE tr.warehouseOutFk = vWh - AND tr.shipped BETWEEN vDateLastInventory - AND vDateYesterday - AND NOT isRaid - GROUP BY b.itemFk - ) sub - ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.quantityOut; - - -- Ventas - INSERT INTO tmp.inventory(itemFk,quantity) - SELECT itemFk, saleOut - FROM ( - SELECT s.itemFk, -sum(s.quantity) saleOut - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - WHERE t.warehouseFk = vWh - AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday - GROUP BY s.itemFk - ) sub - ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; - - -- Actualiza valores de la ultima compra - - UPDATE tmp.inventory inv - JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh - JOIN vn.buy b ON b.id = lb.buy_id - SET - inv.buyingValue = b.buyingValue, - inv.freightValue = b.freightValue, - inv.packing = b.packing, - inv.`grouping` = b.`grouping`, - inv.groupingMode = b.groupingMode, - inv.comissionValue = b.comissionValue, - inv.packageValue = b.packageValue, - inv.packageFk = b.packageFk, - inv.price1 = b.price1, - inv.price2 = b.price2, - inv.price3 = b.price3, - inv.minPrice = b.minPrice, - inv.producer = b.producer; - - - INSERT INTO vn.buy( itemFk, - quantity, - buyingValue, - freightValue, - packing, - `grouping`, - groupingMode, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - entryFk) - SELECT itemFk, - quantity, - buyingValue, - freightValue, - packing, - `grouping`, - groupingMode, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - vEntryFk - FROM tmp.inventory; - - SELECT vWh, count(*), NOW() FROM tmp.inventory; - - -- DROP TEMPORARY TABLE tmp.inventory; - - END LOOP; - - CLOSE cWarehouses; - - UPDATE vn2008.tblContadores SET FechaInventario = vDate; - SET @isModeInventory := FALSE; - - DELETE e, t - FROM vn.travel t - JOIN vn.entry e ON e.travelFk = t.id - WHERE e.supplierFk = 4 - AND t.shipped <= vDeleteDate - AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, 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 `inventory_repair` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `inventory_repair`() -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.lastEntry; - CREATE TEMPORARY TABLE tmp.lastEntry - (PRIMARY KEY (buyFk)) - SELECT - i.id AS itemFk, - w.id AS warehouseFk, - w.name AS warehouse, - tr.landed, - b.id AS buyFk, - b.entryFk, - b.isIgnored, - b.price2, - b.price3, - b.stickers, - b.packing, - b.grouping, - b.groupingMode, - b.weight, - i.stems, - b.quantity, - b.buyingValue, - b.packageFk , - s.id AS supplierFk, - s.name AS supplier - FROM itemType it - RIGHT JOIN (entry e - LEFT JOIN supplier s ON s.id = e.supplierFk - RIGHT JOIN buy b ON b.entryFk = e.id - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN ink ON ink.id = i.inkFk - LEFT JOIN travel tr ON tr.id = e.travelFk - LEFT JOIN warehouse w ON w.id = tr.warehouseInFk - LEFT JOIN origin o ON o.id = i.originFk - ) ON it.id = i.typeFk - LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE (b.packageFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,CURDATE())) AND s.name = 'INVENTARIO'; - - DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk; - CREATE TEMPORARY TABLE tmp.lastEntryOk - (PRIMARY KEY (buyFk)) - SELECT - i.id AS itemFk, - w.id AS warehouseFk, - w.name AS warehouse, - tr.landed, - b.id AS buyFk, - b.entryFk, - b.isIgnored, - b.price2, - b.price3, - b.stickers, - b.packing, - b.grouping, - b.groupingMode, - b.weight, - i.stems, - b.quantity, - b.buyingValue, - b.packageFk , - s.id AS supplierFk, - s.name AS supplier - FROM itemType it - RIGHT JOIN (entry e - LEFT JOIN supplier s ON s.id = e.supplierFk - RIGHT JOIN buy b ON b.entryFk = e.id - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN ink ON ink.id = i.inkFk - LEFT JOIN travel tr ON tr.id = e.travelFk - LEFT JOIN warehouse w ON w.id = tr.warehouseInFk - LEFT JOIN origin o ON o.id = i.originFk - ) ON it.id = i.typeFk - LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE b.packageFk != "--" AND b.price2 != 0 AND b.packing != 0 AND b.buyingValue > 0 AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-2,CURDATE())) - ORDER BY tr.landed DESC; - - DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOkGroup; - CREATE TEMPORARY TABLE tmp.lastEntryOkGroup - (INDEX (warehouseFk,itemFk)) - SELECT * - FROM tmp.lastEntryOk tmp - GROUP BY tmp.itemFk,tmp.warehouseFk; - - UPDATE buy b - JOIN tmp.lastEntry lt ON lt.buyFk = b.id - JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk - SET b.packageFk = eo.packageFk WHERE b.packageFk = "--"; - - UPDATE buy b - JOIN tmp.lastEntry lt ON lt.buyFk = b.id - JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk - SET b.price2 = eo.price2 WHERE b.price2 = 0 ; - - UPDATE buy b - JOIN tmp.lastEntry lt ON lt.buyFk = b.id - JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk - SET b.packing = eo.packing WHERE b.packing = 0; - - UPDATE buy b - JOIN tmp.lastEntry lt ON lt.buyFk = b.id - JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk - SET b.buyingValue = eo.buyingValue WHERE b.buyingValue = 0; - - DROP TEMPORARY TABLE tmp.lastEntry; - DROP TEMPORARY TABLE tmp.lastEntryOk; - DROP TEMPORARY TABLE tmp.lastEntryOkGroup; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceExpenceMake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceExpenceMake`(IN vInvoice INT) -BEGIN -/* Inserta las partidas de gasto correspondientes a la factura - * REQUIERE tabla ticketToInvoice - * @param vInvoice Numero de factura - */ - DELETE FROM invoiceOutExpence - WHERE invoiceOutFk = vInvoice; - - INSERT INTO invoiceOutExpence(invoiceOutFk, expenceFk, amount) - SELECT vInvoice, - expenceFk, - SUM(ROUND(quantity * price * (100 - discount)/100,2)) amount - FROM ticketToInvoice t - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - GROUP BY i.expenceFk - HAVING amount != 0; - - INSERT INTO invoiceOutExpence(invoiceOutFk, expenceFk, amount) - SELECT vInvoice, - tst.expenceFk, - SUM(ROUND(ts.quantity * ts.price ,2)) amount - FROM ticketToInvoice t - JOIN ticketService ts ON ts.ticketFk = t.id - JOIN ticketServiceType tst ON tst.id = ts.ticketServiceTypeFk - HAVING 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 `invoiceExpenceMake__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceExpenceMake__`(IN vInvoice INT) -BEGIN -/* Inserta las partidas de gasto correspondientes a la factura - * REQUIERE tabla ticketToInvoice - * - * @param vInvoice Numero de factura - * - */ - DELETE FROM invoiceOutExpence - WHERE invoiceOutFk = vInvoice; - - INSERT INTO invoiceOutExpence( - invoiceOutFk, - expenceFk, - amount - ) - SELECT - vInvoice, - expenceFk, - SUM(ROUND(quantity * price * (100 - discount)/100,2)) amount - FROM ticketToInvoice t - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - GROUP BY i.expenceFk - HAVING 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 `invoiceFromAddress` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT) -BEGIN - - DECLARE vMinDateTicket DATE DEFAULT TIMESTAMPADD(MONTH, -3, CURDATE()); - - SET vMaxTicketDate = vn2008.DAYEND(vMaxTicketDate); - - DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; - - CREATE TEMPORARY TABLE `ticketToInvoice` - (PRIMARY KEY (`id`)) - ENGINE = MEMORY - SELECT Id_Ticket id FROM vn2008.Tickets WHERE (Fecha BETWEEN vMinDateTicket - AND vMaxTicketDate) AND Id_Consigna = vAddress - AND Factura IS NULL AND empresa_id = vCompany; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceFromClient` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromClient`(IN vMaxTicketDate datetime, IN vClientFk INT, IN vCompanyFk INT) -BEGIN - DECLARE vMinTicketDate DATE DEFAULT TIMESTAMPADD(YEAR, -3, CURDATE()); - SET vMaxTicketDate = util.dayend(vMaxTicketDate); - - DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; - CREATE TEMPORARY TABLE `ticketToInvoice` - (PRIMARY KEY (`id`)) - ENGINE = MEMORY - SELECT id FROM ticket t - WHERE t.clientFk = vClientFk - AND t.refFk IS NULL - AND t.companyFk = vCompanyFk - AND (t.shipped BETWEEN vMinTicketDate AND vMaxTicketDate); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceFromTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromTicket`(IN vTicket INT) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; - - CREATE TEMPORARY TABLE `ticketToInvoice` - (PRIMARY KEY (`id`)) - ENGINE = MEMORY - SELECT id FROM vn.ticket - WHERE id = vTicket AND refFk 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 `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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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),':',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 `invoiceInBookingMain` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `invoiceInBookingMain`(vInvoiceInId INT) -BEGIN - 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' AND ti.Iva <> 'HP DEVENGADO 21 ISP', 1 +(ti.PorcentajeIva/100),1)), - SUM(iit.foreignValue * IF( i.serial= 'R', 1 + (ti.PorcentajeIva/100),1)), - iit.taxableBase/iit.foreignValue - INTO vTotalAmount, vTotalAmountDivisa, vRate - FROM newInvoiceIn i - JOIN invoiceInTax iit ON iit.invoiceInFk = i.id - LEFT JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk; - - CALL vn.ledger_next(vBookNumber); - - -- Apunte del proveedor - - INSERT INTO XDiario(ASIEN, - FECHA, - SUBCTA, - EUROHABER, - CONCEPTO, - CAMBIO, - HABERME, - NFACTICK, - CLAVE, - empresa_id - ) - SELECT - vBookNumber, - n.bookEntried, - s.supplierAccount, - vTotalAmount EUROHABER, - n.conceptWithSupplier, - vRate, - vTotalAmountDivisa, - n.invoicesCount, - vInvoiceInId, - n.companyFk - FROM newInvoiceIn n - JOIN newSupplier s; - - -- Línea de Gastos - INSERT INTO XDiario ( ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - EUROHABER, - CONCEPTO, - CAMBIO, - DEBEME, - HABERME, - 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 AND iit.taxableBase < 0, NULL, ROUND(SUM(iit.taxableBase),2)) EURODEBE, - IF(e.isWithheld AND iit.taxableBase < 0,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 (SELECT * FROM expence e GROUP BY e.id)e ON e.id = iit.expenceFk - WHERE e.name != 'Suplidos Transitarios nacionales' - GROUP BY iit.expenceFk; - - -- Líneas de IVA - - INSERT INTO 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, - IF(n.expenceFkDeductible>0, n.expenceFkDeductible, ti.CuentaIvaSoportado) SUBCTA, - s.supplierAccount CONTRA, - SUM(ROUND(ti.PorcentajeIva * it.taxableBase / 100 /* + 0.0001*/ , 2)) EURODEBE, - SUM(it.taxableBase) BASEEURO, - GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, - vSerialNumber FACTURA, - ti.PorcentajeIva IVA, - IF(isUeeMember AND eWithheld.id IS NULL,'','*') AUXILIAR, - n.serial SERIE, - ttr.ClaveOperacionDefecto, - 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 sage.TiposIva ti ON ti.CodigoIva = it.taxTypeSageFk - JOIN sage.TiposTransacciones ttr ON ttr.CodigoTransaccion = it.transactionTypeSageFk - JOIN invoiceInSerial iis ON iis.code = n.serial - JOIN (SELECT * FROM expence e GROUP BY e.id)e ON e.id = it.expenceFk - LEFT JOIN ( - SELECT eWithheld.id - FROM invoiceInTax hold - JOIN expence eWithheld ON eWithheld.id = hold.expenceFk AND eWithheld.isWithheld - WHERE hold.invoiceInFk = vInvoiceInId LIMIT 1 - ) eWithheld ON TRUE - WHERE it.taxTypeSageFk IS NOT NULL - AND it.taxTypeSageFk NOT IN (22, 90) - GROUP BY ti.PorcentajeIva, e.id; - - -- Línea iva inversor sujeto pasivo - - INSERT INTO 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, - ti.CuentaIvaRepercutido SUBCTA, - s.supplierAccount CONTRA, - SUM(ROUND(ti.PorcentajeIva * it.taxableBase / 100,2)) EUROHABER, - ROUND(SUM(it.taxableBase),2) BASEEURO, - GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, - vSerialNumber FACTURA, - ti.PorcentajeIva IVA, - '*' AUXILIAR, - n.serial SERIE, - ttr.ClaveOperacionDefecto, - 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 sage.TiposIva ti ON ti.CodigoIva = it.taxTypeSageFk - JOIN sage.TiposTransacciones ttr ON ttr.CodigoTransaccion = it.transactionTypeSageFk - JOIN invoiceInSerial iis ON iis.code = n.serial - JOIN (SELECT * FROM expence e GROUP BY e.id)e ON e.id = it.expenceFk - WHERE ti.Iva = 'HP DEVENGADO 21 ISP' OR MID(s.account, 4, 1) = '1' - GROUP BY ti.PorcentajeIva, 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; - - -- Problemas derivados de la precisión en los decimales al calcular los impuestos - UPDATE XDiario - SET EURODEBE = EURODEBE - - (SELECT IF(ABS(sub.difference) = 0.01, sub.difference, 0) - FROM( - SELECT SUM(IFNULL(ROUND(EURODEBE, 2),0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) difference - FROM XDiario - WHERE ASIEN = vBookNumber - )sub - ) - WHERE ASIEN = vBookNumber - AND EURODEBE <> 0 - ORDER BY id DESC - 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 `invoiceInBookingMain__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInBookingMain__`(vInvoiceInId INT) -BEGIN - DECLARE vTotalAmount,vTotalAmountDivisa DECIMAL(10,2); - DECLARE vBookNumber,vSerialNumber INT; - DECLARE vRate DECIMAL(10,4); - DECLARE vSerial VARCHAR(2); - - CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); - - SELECT serial - INTO vSerial - FROM newInvoiceIn; - - SELECT SUM(iit.taxableBase * IF(vSerial = 'R' AND tc.`type` <> 'I', 1 +(tc.rate/100),1)), - SUM(iit.foreignValue * IF(vSerial = '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; - - CALL vn.ledger_next(vBookNumber); - - -- Apunte del proveedor - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - EUROHABER, - CONCEPTO, - CAMBIO, - HABERME, - NFACTICK, - CLAVE, - empresa_id) - SELECT - vBookNumber, - n.bookEntried, - s.supplierAccount, - vTotalAmount EUROHABER, - n.conceptWithSupplier, - vRate, - vTotalAmountDivisa, - n.invoicesCount, - vInvoiceInId, - n.companyFk - FROM newInvoiceIn n - JOIN newSupplier s; - - -- ----------------------------------------------------------- Linea de Gastos - INSERT INTO vn2008.XDiario (ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - EUROHABER, - CONCEPTO, - CAMBIO, - DEBEME, - HABERME, - 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 AND iit.taxableBase < 0, NULL, ROUND(SUM(iit.taxableBase),2)) EURODEBE, - IF(e.isWithheld AND iit.taxableBase < 0,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 - 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 * it.taxableBase / 100 /* + 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 = vInvoiceInId LIMIT 1 - ) eWithheld ON TRUE - WHERE tc.type != '-' - AND tc.isActive - GROUP BY tc.rate, e.id; - - -- 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, - SUM(ROUND(tcLink.rate * it.taxableBase / 100,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 - AND tc.link - JOIN expence e ON e.id = it.expenceFk - AND e.taxTypeFk = tc.taxTypeFk - WHERE tc.isActive - AND (tc.type in('S','I') OR MID(s.supplierAccount,4,1) = '1') - 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; - - -- Problemas derivados de la precisión en los decimales al calcular los impuestos - UPDATE XDiario - SET EURODEBE = EURODEBE - - (SELECT IF(ABS(sub.difference) = 0.01, sub.difference, 0) - FROM(SELECT SUM(IFNULL(ROUND(EURODEBE, 2),0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) difference - FROM XDiario - WHERE ASIEN = vBookNumber - )sub - ) - WHERE ASIEN = vBookNumber - AND EURODEBE <> 0 - ORDER BY id DESC - LIMIT 1; - - /*UPDATE XDiario - SET EURODEBE = EURODEBE - - (SELECT SUM(IFNULL(ROUND(EURODEBE,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) difference - FROM XDiario - WHERE ASIEN = vBookNumber - HAVING ABS(difference) = 0.01) - WHERE ASIEN = vBookNumber - AND EURODEBE <> 0 - ORDER BY id DESC - 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 `invoiceInBookingMain___` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInBookingMain___`(vInvoiceInId INT) -BEGIN - DECLARE vTotalAmount,vTotalAmountDivisa DECIMAL(10,2); - DECLARE vBookNumber,vSerialNumber INT; - DECLARE vRate DECIMAL(10,4); - DECLARE vSerial VARCHAR(2); - - CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); - - SELECT serial - INTO vSerial - FROM newInvoiceIn; - - SELECT SUM(iit.taxableBase * IF(vSerial = 'R' AND tc.`type` <> 'I', 1 +(tc.rate/100),1)), - SUM(iit.foreignValue * IF(vSerial = '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; - - CALL vn.ledger_next(vBookNumber); - - -- Apunte del proveedor - - INSERT INTO vn2008.XDiario( - ASIEN, - FECHA, - SUBCTA, - EUROHABER, - CONCEPTO, - CAMBIO, - HABERME, - NFACTICK, - CLAVE, - empresa_id) - SELECT - vBookNumber, - n.bookEntried, - s.supplierAccount, - vTotalAmount EUROHABER, - n.conceptWithSupplier, - vRate, - vTotalAmountDivisa, - n.invoicesCount, - vInvoiceInId, - n.companyFk - FROM newInvoiceIn n - JOIN newSupplier s; - - -- ----------------------------------------------------------- Linea de Gastos - INSERT INTO vn2008.XDiario (ASIEN, - FECHA, - SUBCTA, - CONTRA, - EURODEBE, - EUROHABER, - CONCEPTO, - CAMBIO, - DEBEME, - HABERME, - 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 AND iit.taxableBase < 0, NULL, ROUND(SUM(iit.taxableBase),2)) EURODEBE, - IF(e.isWithheld AND iit.taxableBase < 0,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 - 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 * it.taxableBase / 100 /* + 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 = vInvoiceInId LIMIT 1 - ) eWithheld ON TRUE - WHERE tc.type != '-' - AND tc.isActive - GROUP BY tc.rate, e.id; - - -- 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, - SUM(ROUND(tcLink.rate * it.taxableBase / 100,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 - AND tc.link - JOIN expence e ON e.id = it.expenceFk - AND e.taxTypeFk = tc.taxTypeFk - WHERE tc.isActive - AND (tc.type in('S','I') OR MID(s.supplierAccount,4,1) = '1') - 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 `invoiceInDueDay_calculate` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(vInvoiceInFk INT) -BEGIN - - IF !(SELECT COUNT(*) - FROM invoiceInDueDay iid - WHERE iid.invoiceInFk = vInvoiceInFk) THEN - - INSERT INTO invoiceInDueDay (invoiceInFk, - dueDated, - amount, - foreignValue) - SELECT vInvoiceInFk, - IF(payDay, - IF(vn.getNextDueDate(issued, detail, payDay) < DATE_ADD(created, INTERVAL 2 DAY), - DATE_ADD(created, INTERVAL 2 DAY), - vn.getNextDueDate(issued, detail, payDay)), - GREATEST(TIMESTAMPADD(DAY, 2, created), TIMESTAMPADD(DAY, detail, issued))), - IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), - IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) - FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detail)) venc, - SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detail)) foreignValue, - s.payDemFk, - ii.companyFk, - COUNT(DISTINCT(pdd.detail)) cont, - s.payDay, - ii.issued, - DATE(ii.created) created - FROM invoiceIn ii - JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id - LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk - JOIN supplier s ON s.id = ii.supplierFk - JOIN supplier s2 ON s2.id = ii.companyFk - JOIN vn.payDemDetail pdd ON pdd.id = s.payDemFk - WHERE ii.id = vInvoiceInFk - GROUP BY ii.id - ) sub - JOIN (SELECT @cont:=0) sub2 - JOIN vn.payDemDetail pdd ON pdd.id = sub.payDemFk - GROUP BY detail; - 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 `invoiceInDueDay_calculate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_calculate__`(vInvoiceInFk INT) -BEGIN - - IF !(SELECT COUNT(*) - FROM invoiceInDueDay iid - WHERE iid.invoiceInFk = vInvoiceInFk) THEN - - INSERT INTO invoiceInDueDay (invoiceInFk, - dueDated, - amount, - foreignValue) - SELECT vInvoiceInFk, - IF(payDay, vn2008.next_venc(issued, detalle, payDay),TIMESTAMPADD(DAY, GREATEST(detalle, 2), issued)), - IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), - IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) - FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detalle)) venc, - SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detalle)) foreignValue, - s.payDemFk, - ii.companyFk, - COUNT(DISTINCT(pdd.detalle)) cont, - s.payDay, - ii.issued - FROM invoiceIn ii - JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id - LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk - JOIN supplier s ON s.id = ii.supplierFk - JOIN supplier s2 ON s2.id = ii.companyFk - JOIN vn2008.pay_dem_det pdd ON pdd.id = s.payDemFk - WHERE ii.id = vInvoiceInFk - GROUP BY ii.id - ) sub - JOIN (SELECT @cont:=0) sub2 - JOIN vn2008.pay_dem_det pdd ON pdd.id = sub.payDemFk - GROUP BY detalle; - 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 `invoiceInDueDay_recalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_recalc`(vInvoiceInFk INT) -BEGIN - - DELETE FROM invoiceInDueDay - WHERE invoiceInFk = vInvoiceInFk; - - CALL invoiceInDueDay_calculate(vInvoiceInFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceInTaxMakeByDua` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT) -BEGIN - - DECLARE done BOOL DEFAULT FALSE; - DECLARE vInvoiceInFk INT; - - DECLARE rs CURSOR FOR - SELECT invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO - - CALL vn2008.recibidaIvaInsert(vInvoiceInFk); - CALL vn2008.recibidaVencimientoReplace(vInvoiceInFk); - - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceInTax_getFromDua` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT) -BEGIN - - DECLARE done BOOL DEFAULT FALSE; - DECLARE vInvoiceInFk INT; - - DECLARE rs CURSOR FOR - SELECT invoiceInFk - FROM entry e - JOIN duaEntry de ON de.entryFk = e.id - WHERE de.duaFk = vDuaFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - FETCH rs INTO vInvoiceInFk; - - WHILE NOT done DO - - CALL invoiceInTax_getFromEntries(vInvoiceInFk); - CALL invoiceInDueDay_calculate(vInvoiceInFk); - - FETCH rs INTO vInvoiceInFk; - - END WHILE; - - CLOSE rs; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceInTax_getFromEntries` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId INT) -BEGIN - DECLARE vRate DOUBLE DEFAULT 1; - DECLARE vDated DATE; - DECLARE vExpenceFk VARCHAR(10); - - SELECT MAX(rr.dated) INTO vDated - FROM referenceRate rr - JOIN invoiceIn ii ON ii.id = vId - WHERE rr.dated <= ii.issued - AND rr.currencyFk = ii.currencyFk ; - - IF vDated THEN - SELECT `value` INTO vRate - FROM referenceRate - WHERE dated = vDated; - END IF; - - SELECT id INTO vExpenceFk - FROM vn.expence - WHERE `name` = 'Adquisición mercancia Extracomunitaria' - GROUP BY id - LIMIT 1; - - DELETE FROM invoiceInTax - WHERE invoiceInFk = vId; - - INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) - SELECT ii.id, - SUM(b.buyingValue * b.quantity) / IFNULL(vRate,1) taxableBase, - vExpenceFk, - IF(ii.currencyFk = 1,NULL,SUM(b.buyingValue * b.quantity )) divisa, - taxTypeSageFk, - transactionTypeSageFk - FROM invoiceIn ii - JOIN entry e ON e.invoiceInFk = ii.id - JOIN supplier s ON s.id = e.supplierFk - JOIN buy b ON b.entryFk = e.id - LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk - AND rr.dated = ii.issued - WHERE ii.id = vId - HAVING taxableBase IS NOT 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 `invoiceOutAgain` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutAgain`(IN vInvoiceRef VARCHAR(15), vTaxArea VARCHAR(25)) -BEGIN - -/* Para tickets ya facturados, vuelve a repetir el proceso de facturación. -* -* @param vInvoiceFk Numero de factura -* @param vTaxArea Numero de factura -*/ - - DECLARE vInvoiceFk INT; - DECLARE vCountry INT; - DECLARE vTaxArea VARCHAR(15); - DECLARE vSpainCountryCode INT DEFAULT 1; - - SELECT id INTO vInvoiceFk - FROM invoiceOut - WHERE ref = vInvoiceRef; - - UPDATE invoiceOut - SET hasPdf = 0 - WHERE id = vInvoiceFk; - - SELECT s.countryFk INTO vCountry - FROM supplier s - JOIN invoiceOut io ON io.companyFk = s.id - WHERE io.id = vInvoiceFk; - - DROP TEMPORARY TABLE IF EXISTS ticketToInvoice; - - CREATE TEMPORARY TABLE ticketToInvoice - SELECT id - FROM ticket - WHERE refFk = vInvoiceRef; - - CALL invoiceExpenceMake(vInvoiceFk); - - CALL invoiceTaxMake(vInvoiceFk,vTaxArea); - - UPDATE invoiceOut io - JOIN ( - SELECT SUM(amount) AS total - FROM invoiceOutExpence - WHERE invoiceOutFk = vInvoiceFk - ) base - JOIN ( - SELECT SUM(vat) AS total - FROM invoiceOutTax - WHERE invoiceOutFk = vInvoiceFk - ) vat - SET io.amount = base.total + vat.total - WHERE io.id = vInvoiceFk; - - CALL vn.invoiceOutBooking(vInvoiceFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceOutBooking` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutBooking`(IN vInvoice INT) -BEGIN -/* Asienta la factura emitida -* -* param vInvoice factura_id -*/ - DECLARE vBookNumber INT; - DECLARE vExpenceConcept VARCHAR(50); - DECLARE vIsUeeMember BOOL DEFAULT TRUE; - DECLARE vSpainCountryFk INT; - DECLARE vOldBookNumber INT; - - SELECT id INTO vSpainCountryFk FROM country WHERE code = 'ES'; - - SELECT ASIEN - INTO vOldBookNumber - FROM XDiario x - JOIN 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 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, - io.issued AS 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 = vSpainCountryFk, vSpainCountryFk, IF(ct.isUeeMember = vIsUeeMember,2,4)) AS TERIDNIF, - CONCAT(IF(ct.isUeeMember = vIsUeeMember AND ct.politicalCountryFk <> vSpainCountryFk,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 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; - - CALL vn.ledger_next(vBookNumber); - - -- Linea del cliente - INSERT INTO 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 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 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 `invoiceOutBookingRange` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutBookingRange`() -BEGIN - -/* Reasentar facturas -*/ - - - DECLARE vInvoice INT; - DECLARE vContador INT DEFAULT 0; - - DECLARE done BOOL DEFAULT FALSE; - - DECLARE rs CURSOR FOR - SELECT io.id - FROM invoiceOut io - WHERE RIGHT(ref,7) BETWEEN 1724215 AND 1724224 - AND serial = 'T'; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - FETCH rs INTO vInvoice; - - WHILE NOT done DO - - CALL invoiceOutBooking(vInvoice); - - FETCH rs INTO vInvoice ; - - SET vContador = vContador + 1; - - IF vContador MOD 50 = 0 THEN - - SELECT CONCAT(vContador, ' de momento') AS FACTURAS_ASENTADAS; - - END IF; - - END WHILE; - - CLOSE rs; - - 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutDelete`(vRef VARCHAR(15)) -BEGIN - DECLARE vAsien INTEGER; - DECLARE vSendMail BOOL; - DECLARE vBody TEXT; - - SELECT ASIEN INTO vAsien - FROM XDiario - WHERE SERIE = SUBSTRING(vRef, 1, 1) - AND FACTURA = SUBSTRING(vRef, 2, LENGTH(vRef)-1) - LIMIT 1; - - SELECT IF(enlazado OR enlazadoSage, TRUE, FALSE), - CONCAT( - ' - - - - - - - ', - GROUP_CONCAT( - CONCAT(' - - - - - - - ' - ) SEPARATOR ' ' - ), - '
FECHASUBCTACONTRACONCEPTOEURODEBEEUROHABER
', IFNULL(FECHA,''), '', IFNULL(SUBCTA,''), '', IFNULL(CONTRA,''), '', IFNULL(CONCEPTO,''), '', IFNULL(EURODEBE,''), '', IFNULL(EUROHABER,''), '
' - ) - INTO vSendMail, vBody - FROM XDiario - WHERE ASIEN = vAsien; - - DELETE FROM XDiario - WHERE ASIEN = vAsien; - - IF vSendMail THEN - CALL mail_insert( - 'administracion@verdnatura.es', - 'noreply@verdnatura.es', - CONCAT('Eliminada factura ' ,vRef), - CONCAT( - '
-

Se ha eliminado el asiento ', vAsien, ' que estaba enlazado en SAGE/CONTAPLUS, vinculado a la factura ', vRef ,'

- ', vBody, '
' - ) - ); - END IF; - - UPDATE ticket - SET refFk = NULL - WHERE refFk = vRef; - - DELETE - FROM invoiceOut - WHERE ref = vRef; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 */ ; -/*!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 `invoiceOutFix_BI_RE_IVA__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutFix_BI_RE_IVA__`() -BEGIN - -DECLARE done BOOL DEFAULT FALSE; -DECLARE vInvoice INT; - -DECLARE rs CURSOR FOR - SELECT factura_id - FROM vn2008.Facturas - WHERE Importe != BI7 + BI16 + RE4 + RE1 + IVA7 + IVA16 - AND Fecha >= '2017-07-01'; - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN rs; - -FETCH rs INTO vInvoice; - -SELECT vInvoice, done; - -WHILE NOT done DO - - UPDATE invoiceOut io - JOIN ( - SELECT SUM(amount) AS total - FROM invoiceOutExpence - WHERE invoiceOutFk = vInvoice - ) base - JOIN ( - SELECT SUM(vat) AS total - FROM invoiceOutTax - WHERE invoiceOutFk = vInvoice - ) vat - SET io.amount = base.total + vat.total - WHERE io.id = vInvoice; - - UPDATE vn2008.Facturas - SET BI16 = 0, - BI7 = 0, - RE1 = 0, - RE4 = 0, - IVA7 = 0, - IVA16 = 0 - WHERE factura_id = vInvoice; - - 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 = vInvoice - AND iot.pgcFk IN ('4770000021' ,'4770000215', '4770000002','4771000000','4770000000','4770000020'); - - UPDATE vn2008.Facturas f - JOIN invoiceOutTax iot ON iot.invoiceOutFk = f.factura_id - SET f.RE4 = iot.vat - WHERE f.factura_id = vInvoice - 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 = vInvoice - 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 = vInvoice - AND iot.pgcFk = '4770000110'; - -FETCH rs INTO vInvoice; - -END WHILE; - - -CLOSE rs; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceOutListByCompany` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE) -BEGIN - -SELECT - c.socialName as RazonSocial, - c.fi as NIF, - io.ref as Factura, - io.serial as Serie, - io.issued as Fecha, - io.amount as Importe, - c.id as Id_Cliente, - iot.taxableBase as Base, - pgc.rate as Tipo, - iot.vat as Cuota, - pgc.name as Concepto - - FROM vn.invoiceOut io - JOIN vn.invoiceOutTax iot ON iot.invoiceOutFk = io.id - JOIN vn.client c ON c.id = io.clientFk - JOIN vn.pgc ON pgc.code = iot.pgcFk - WHERE io.companyFk = vCompany - AND io.issued BETWEEN vStarted AND vEnded - ORDER BY io.ref 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 `invoiceOutTaxAndExpence` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutTaxAndExpence`() -BEGIN - -/* Para tickets ya facturados, vuelve a repetir el proceso de facturación. -* -* @param vInvoice Numero de factura -*/ - - DECLARE vInvoice INT; - DECLARE vInvoiceRef VARCHAR(15); - DECLARE vCountry INT; - DECLARE vTaxArea VARCHAR(15); - DECLARE vContador INT DEFAULT 0; - - DECLARE done BOOL DEFAULT FALSE; - - DECLARE rs CURSOR FOR - SELECT id,ref - FROM invoiceOut io - - WHERE issued >= '2017-07-01' - AND companyFk = 1381 - AND io.amount IS NULL - ; - - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - FETCH rs INTO vInvoice ,vInvoiceRef; - - WHILE NOT done DO - - SELECT s.countryFk - INTO vCountry - FROM supplier s - JOIN invoiceOut io ON io.companyFk = s.id - WHERE io.id = vInvoice; - - SELECT IF(c.isEqualizated 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; - - DROP TEMPORARY TABLE IF EXISTS ticketToInvoice; - - CREATE TEMPORARY TABLE ticketToInvoice - SELECT id - FROM ticket - WHERE refFk = vInvoiceRef; - - CALL invoiceExpenceMake(vInvoice); - CALL invoiceTaxMake(vInvoice,vCountry,vTaxArea); - - FETCH rs INTO vInvoice ,vInvoiceRef; - - SET vContador = vContador + 1; - - IF vContador MOD 50 = 0 THEN - - SELECT CONCAT(vContador, ' de momento') AS FACTURAS_ASENTADAS; - - END IF; - - END WHILE; - - CLOSE rs; - - 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 `invoiceOut_new` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new`( - vSerial VARCHAR(255), - vInvoiceDate DATETIME, - vTaxArea VARCHAR(25), - OUT vNewInvoiceId INT) -BEGIN - -/* Creación de facturas emitidas. -* requiere previamente tabla ticketToInvoice(id). -* -* @param vSerial serie a la cual se hace la factura -* @param vInvoiceDate fecha de la factura -* @param vTaxArea tipo de iva en relacion a la empresa y al cliente -* @param vNewInvoiceId id de la factura que se acaba de generar -* -* @return vNewInvoiceId -*/ - - DECLARE vSpainCountryCode INT DEFAULT 1; - DECLARE vIsAnySaleToInvoice BOOL; - DECLARE vIsAnyServiceToInvoice BOOL; - DECLARE vNewRef VARCHAR(255); - DECLARE vWorker INT DEFAULT account.myUser_getId(); - DECLARE vCompany INT; - DECLARE vSupplier 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 vNewInvoiceInId INT; - DECLARE vIsInterCompany BOOL; - - 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; - - -- 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 - OR t.isDeleted - OR c.hasToInvoice = FALSE; - - SELECT SUM(s.quantity * s.price * (100 - s.discount)/100), ts.id - INTO vIsAnySaleToInvoice, vIsAnyServiceToInvoice - FROM ticketToInvoice t - LEFT JOIN sale s ON s.ticketFk = t.id - LEFT JOIN ticketService ts ON ts.ticketFk = t.id; - - IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice) - AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase()) - THEN - - -- 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 - LEFT 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,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; - - DROP TEMPORARY TABLE tmp.updateInter; - - SELECT ios.isCEE INTO vIsInterCompany - FROM vn.ticket t - JOIN vn.company c ON c.clientFk = t.clientFk - JOIN vn.invoiceOut io ON io.`ref` = t.refFk - JOIN vn.invoiceOutSerial ios ON ios.code = io.serial - WHERE t.refFk = vNewRef; - - IF (vIsInterCompany) THEN - - SELECT vCompany INTO vSupplier; - SELECT id INTO vCompany FROM company WHERE clientFk = vClient; - - INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk) - SELECT vSupplier, vNewRef, vInvoiceDate, vCompany; - - SET vNewInvoiceInId = LAST_INSERT_ID(); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - (KEY (ticketFk)) - ENGINE = MEMORY - SELECT id ticketFk - FROM ticketToInvoice; - - CALL `ticket_getTax`('NATIONAL'); - - SET @vTaxableBaseServices := 0.00; - SET @vTaxCodeGeneral := NULL; - - INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) - SELECT vNewInvoiceInId, @vTaxableBaseServices, sub.expenceFk, sub.taxTypeSageFk , sub.transactionTypeSageFk - FROM ( - SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk, @vTaxCodeGeneral := i.taxClassCodeFk - FROM tmp.ticketServiceTax tst - JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code - WHERE i.isService - HAVING taxableBase - ) sub; - - INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) - SELECT vNewInvoiceInId, SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, @vTaxableBaseServices, 0) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk - FROM tmp.ticketTax tt - JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code - WHERE !i.isService - GROUP BY tt.pgcFk - HAVING taxableBase - ORDER BY tt.priority; - - CALL `vn`.`invoiceInDueDay_calculate`(vNewInvoiceInId); - - INSERT INTO vn2008.intrastat_data (recibida_id, intrastat_id, importe, unidades, Paises_Id, neto) - SELECT - vNewInvoiceInId, - i.intrastatFk, - CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100)) AS DECIMAL(10,2)) importe, - CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL (10 , 2 )) stems, - s2.countryFk, - CAST(SUM(IF(sv.physicalWeight, sv.physicalWeight, i.density * sub.cm3delivery/1000000)) AS DECIMAL(10,2)) neto - FROM vn.sale s - LEFT JOIN (SELECT ic.itemFk, ic.cm3delivery - FROM vn.itemCost ic - WHERE ic.cm3 - GROUP BY ic.itemFk) sub ON s.itemFk = sub.itemFk - LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id - LEFT JOIN vn.ticket t ON s.ticketFk = t.id - LEFT JOIN vn.supplier s2 ON s2.id = t.companyFk - LEFT JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.intrastat it ON it.id = i.intrastatFk - JOIN vn.invoiceOut iOut ON iOut.ref = t.refFk - WHERE iOut.`ref` = vNewRef - GROUP BY i.intrastatFk - ORDER BY i.intrastatFk; - - - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticketAmount; - DROP TEMPORARY TABLE tmp.ticketTax; - DROP TEMPORARY TABLE tmp.ticketServiceTax; - - END IF; - - END IF; - - DROP TEMPORARY TABLE `ticketToInvoice`; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceOut_newFromClient` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_newFromClient`(IN vClientFk int, IN vSerial char(2), IN vMaxShipped date, - IN vCompanyFk int, IN vTaxArea varchar(25), - IN vRef varchar(25), OUT vInvoiceId int) -BEGIN -/** - * Factura los tickets de un cliente hasta una fecha dada - * @param vClientFk Id del cliente a facturar - * @param vSerial Serie de factura - * @param vMaxShipped Fecha hasta la cual cogera tickets para facturar - * @param vCompanyFk Id de la empresa desde la que se factura - * @param vTaxArea Tipo de iva en relacion a la empresa y al cliente, NULL por defecto - * @param vRef Referencia de la factura en caso que se quiera forzar, NULL por defecto - * @return vInvoiceId factura - */ - - DECLARE vIsRefEditable BOOLEAN; - - IF vRef IS NOT NULL THEN - SELECT isRefEditable INTO vIsRefEditable - FROM invoiceOutSerial - WHERE code = vSerial; - - IF NOT vIsRefEditable THEN - CALL util.throw('serial non editable'); - END IF; - END IF; - - CALL invoiceFromClient(vMaxShipped, vClientFk, vCompanyFk); - CALL invoiceOut_new(vSerial, CURDATE(), vTaxArea, vInvoiceId); - - UPDATE invoiceOut - SET `ref` = vRef - WHERE id = vInvoiceId - AND vRef IS NOT NULL; - - IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN - CALL invoiceOutBooking(vInvoiceId); - 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 `invoiceOut_newFromTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_newFromTicket`(IN vTicketFk int, IN vSerial char(2), IN vTaxArea varchar(25), - IN vRef varchar(25), OUT vInvoiceId int) -BEGIN -/** - * Factura un ticket - * @param vTicketFk Id del ticket - * @param vSerial Serie de factura - * @param vTaxArea Area de la factura en caso de querer forzarlo, - * en la mayoria de los casos poner NULL - * @return vInvoiceId - */ - DECLARE vIsRefEditable BOOLEAN; - CALL invoiceFromTicket(vTicketFk); - CALL invoiceOut_new(vSerial, CURDATE(), vTaxArea, vInvoiceId); - - IF vRef IS NOT NULL THEN - SELECT isRefEditable INTO vIsRefEditable - FROM invoiceOutSerial - WHERE code = vSerial; - IF NOT vIsRefEditable THEN - CALL util.throw('serial non editable'); - END IF; - - UPDATE invoiceOut - SET `ref` = vRef - WHERE id = vInvoiceId; - END IF; - - IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN - CALL invoiceOutBooking(vInvoiceId); - 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 `invoiceOut_new__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new__`( - vSerial VARCHAR(255), - vInvoiceDate DATETIME, - vTaxArea VARCHAR(25), - OUT vNewInvoiceId INT) -BEGIN - -/* Creación de facturas emitidas. -* REQUIERE previamente tabla ticketToInvoice. -* -* @param vSerial, vInvoiceDate,vTaxArea -* -* @return vNewInvoiceId -*/ - - DECLARE vSpainCountryCode INT DEFAULT 1; - DECLARE vIsAnySaleToInvoice BOOL; - DECLARE vNewRef VARCHAR(255); - DECLARE vWorker INT DEFAULT account.myUser_getId(); - 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'; - - 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; - - -- 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 - OR t.isDeleted - OR c.hasToInvoice = 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 - LEFT 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,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; - - DROP TEMPORARY TABLE `ticketToInvoice`; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `invoiceTaxMake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceTaxMake`(vInvoice INT, vTaxArea VARCHAR(25)) -BEGIN -/** - * Factura un conjunto de tickets. - * - * @param vInvoice, vTaxAreaFk - * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular - * @return tmp.ticketAmount - * @return tmp.ticketTax Impuesto desglosado para cada ticket. - */ - 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 ticket_getTax(vTaxArea); - - INSERT INTO invoiceOutTax( - invoiceOutFk, - pgcFk, - taxableBase, - vat - ) - SELECT vInvoice, - pgcFk, - SUM(taxableBase) as BASE, - CAST(SUM(taxableBase) * rate / 100 AS DECIMAL (10,2)) - FROM tmp.ticketTax - GROUP BY pgcFk - HAVING BASE - ORDER BY priority; - - 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 `invoiceTaxMake__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceTaxMake__`(vInvoice INT, vTaxArea VARCHAR(25)) -BEGIN -/** - * Factura un conjunto de tickets. - * - * @param vInvoice, vTaxAreaFk - * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular - * @return tmp.ticketAmount - * @return tmp.ticketTax Impuesto desglosado para cada ticket. - */ - 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 ticket_getTax(vTaxArea); - - INSERT INTO invoiceOutTax( - invoiceOutFk, - pgcFk, - taxableBase, - vat - ) - SELECT vInvoice, - pgcFk, - SUM(taxableBase) as BASE, - CAST(SUM(taxableBase) * rate / 100 AS DECIMAL (10,2)) - FROM tmp.ticketTax - GROUP BY pgcFk - HAVING BASE; - - 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 `itemBarcode_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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemBarcode_update`(vItemFk INT,vCode VARCHAR(22), vDelete BOOL) -BEGIN -IF vDelete THEN - DELETE FROM vn.itemBarcode WHERE itemFk = vItemFk AND code = vCode; -ELSE - INSERT INTO vn.itemBarcode(itemFk,code) VALUES (vItemFk,vCode); -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 `itemCard` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemCard`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT, IN isBarcode BOOL) -BEGIN - - /* - * @deprecated: Utilizar item_getInfo - */ - - DECLARE vCacheVisibleFk INT; - DECLARE vCacheAvailableFk INT; - DECLARE vVisibleAltillo INT; - DECLARE vItemFk INT; - - IF isBarcode THEN - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - ELSE - SELECT i.id INTO vItemFk - FROM vn.item i - WHERE i.name LIKE CONCAT('%',vBarcode,'%') - ORDER BY i.id ASC - LIMIT 1; - END IF; - - IF vItemFk IS NULL THEN - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - END IF; - - CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); - CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); - - SELECT SUM(visible) INTO vVisibleAltillo - FROM vn.itemShelvingStock - WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); - - SELECT i.id, - i.longName, - i.tag5, - i.value5, - i.tag6, - i.value6, - i.tag7, - i.value7, - i.image, - i.size, - i.stems, - i.category, - i.minimum as min, - i.upToDown as repo, - p.name as producer, - o.code as origin, - ip.code as nicho, - ip.reserve as reserva, - v.visible - IFNULL(vVisibleAltillo,0) as enNicho, - a.available, - vVisibleAltillo as enAltillo, - v.visible as total, - c.`grouping` as `grouping`, - c.Packing as packing, - CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, - CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, - i.itemPackingTypeFk, - i.comment as referencia - FROM vn.item i - LEFT JOIN vn.producer p ON p.id = i.producerFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.itemPlacement ip ON ip.itemFk = i.id - LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id - LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id - LEFT JOIN ( - SELECT b.itemFk, b2.`grouping`, b2.packing - FROM tmp.buyUltimate b - JOIN vn.buy b2 ON b2.id = b.buyFk - WHERE b.warehouseFk = vWarehouseFk - ) c ON i.id = c.itemFk - WHERE i.id = vItemFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemCard__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemCard__`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT, isBarcode BOOL) -BEGIN - - DECLARE vCacheVisibleFk INT; - DECLARE vCacheAvailableFk INT; - DECLARE vVisibleAltillo INT; - DECLARE vItemFk INT; - - IF isBarcode THEN - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - ELSE - SELECT i.id INTO vItemFk - FROM vn.item i - WHERE i.name LIKE CONCAT('%',vBarcode,'%') - ORDER BY i.id ASC - LIMIT 1; - END IF; - - IF vItemFk IS NULL THEN - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - END IF; - - CALL cache.visible_refresh(vCacheVisibleFk, TRUE,vWarehouseFk); - CALL cache.available_refresh(vCacheAvailableFk, TRUE,vWarehouseFk, CURDATE()); - - SELECT SUM(visible) INTO vVisibleAltillo - FROM vn.itemShelvingStock - WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - - CALL vn2008.item_last_buy_(vWarehouseFk,vItemFk); - - SELECT i.id, - i.longName, - i.tag5, - i.value5, - i.tag6, - i.value6, - i.tag7, - i.value7, - i.image, - i.size, - i.stems, - i.category, - i.minimum as min, - i.upToDown as repo, - p.name as producer, - o.code as origin, - ip.code as nicho, - ip.reserve as reserva, - v.visible - IFNULL(vVisibleAltillo,0) as enNicho, - a.available, - vVisibleAltillo as enAltillo, - v.visible as total, - c.`grouping` as `grouping`, - c.Packing as packing, - CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, - CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, - i.itemPackingTypeFk - FROM vn.item i - LEFT JOIN vn.producer p ON p.id = i.producerFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.itemPlacement ip ON ip.itemFk = i.id - LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id - LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id - LEFT JOIN - (SELECT b.item_id,c.`grouping`,c.Packing - FROM vn2008.t_item_last_buy b - INNER JOIN vn2008.Compres c ON c.Id_Compra = b.buy_id - where b.warehouse_id = vWarehouseFk) c - ON i.id= c.item_id - WHERE i.id = vItemFk; - - DROP TEMPORARY TABLE vn2008.t_item_last_buy; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemDiary__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemDiary__`(IN vItemId INT, IN vWarehouse INT) -BEGIN - DECLARE vDateInventory DATETIME; - DECLARE vCurdate DATE DEFAULT CURDATE(); - DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); - - SELECT vn.barcodeToItem(vItemId) INTO vItemId; - - -- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance - SELECT inventoried INTO vDateInventory FROM config; - SET @a = 0; - SELECT DATE(date) AS date, - alertLevel, - stateName, - origin, - reference, - clientFk, - name, - `in`, - `out`, - @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, - isPicked, - isTicket, - `in` as invalue - FROM - ( SELECT tr.landed as date, - b.quantity as `in`, - NULL as `out`, - IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, - st.name AS stateName, - s.name as name, - e.ref as reference, - e.id as origin, - s.id as clientFk, - TRUE isPicked, - FALSE AS isTicket - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.id = - CASE - WHEN tr.isReceived != FALSE THEN 3 - WHEN tr.isDelivered THEN 1 - ELSE 0 - END - JOIN state st ON st.code = al.code - WHERE tr.landed >= vDateInventory - AND vWarehouse = tr.warehouseInFk - AND b.itemFk = vItemId - AND e.isInventory = 0 - AND e.isRaid = 0 - UNION ALL - - SELECT tr.shipped as date, - NULL as `in`, - b.quantity as `out`, - IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, - st.name AS stateName, - s.name as name, - e.ref as reference, - e.id as origin, - s.id as clientFk, - TRUE isPicked, - FALSE AS isTicket - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN warehouse w ON w.id = tr.warehouseOutFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.id = - CASE - WHEN tr.isReceived != FALSE THEN 3 - WHEN tr.isDelivered THEN 1 - ELSE 0 - END - JOIN state st ON st.code = al.code - WHERE tr.shipped >= vDateInventory - AND vWarehouse =tr.warehouseOutFk - AND s.id <> 4 - AND b.itemFk = vItemId - AND e.isInventory = 0 - AND w.isFeedStock = 0 - AND e.isRaid = 0 - UNION ALL - - SELECT t.shipped as date, - NULL as `in`, - s.quantity as `out`, - al.id as alertLevel, - st.name AS stateName, - t.nickname as name, - t.refFk as reference, - t.id as origin, - t.clientFk, - stk.id as isPicked, -- TRUE as isPicked - TRUE as isTicket - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN ticketState ts ON ts.ticket = t.id - LEFT JOIN state st ON st.code = ts.code - JOIN client c ON c.id = t.clientFk - JOIN alertLevel al ON al.id = - CASE - WHEN t.shipped < vCurdate THEN 3 - WHEN t.shipped > vDayEnd THEN 0 - ELSE IFNULL(ts.alertLevel, 0) - END - LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14 -- comentar - WHERE t.shipped >= vDateInventory - AND s.itemFk = vItemId - AND vWarehouse =t.warehouseFk - ) AS itemDiary - ORDER BY date, isTicket, alertLevel DESC, isPicked DESC, `in` DESC, `out` 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 `itemFreight_Show` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFreight_Show`(vItemFk INT, vWarehouseFk INT) -BEGIN - - SELECT cm3 Volumen_Entrada, - cm3delivery Volumen_Salida, - p.volume Volumen_del_embalaje, - p.width Ancho_del_embalaje, - p.`depth` Largo_del_embalaje, - b.packageFk , - IFNULL(p.height, i.`size`) + 10 Altura, - b.packing Packing_Entrada, - i.packingOut Packing_Salida, - i.id itemFk, - b.id buyFk, - b.entryFk, - w.name warehouseFk - FROM vn.itemCost ic - JOIN vn.item i ON i.id = ic.itemFk - LEFT JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.packaging p ON p.id = b.packageFk - LEFT JOIN vn.warehouse w ON w.id = ic.warehouseFk - WHERE ic.itemFk = vItemFk - AND ic.warehouseFk = vWarehouseFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemFuentesBalance` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFuentesBalance`(vDaysInFuture INT) -BEGIN - - /* Se utiliza para calcular la necesidad de mover mercancia entre el almacén de fuentes y el nuestro - * - * @param vDaysInFuture Rango de dias para calcular entradas y salidas - * - */ - - DECLARE vWarehouseFk INT; - - SELECT s.warehouseFk INTO vWarehouseFk - FROM vn.sector s - WHERE s.code = 'FUENTES_PICASSE'; - - CALL cache.stock_refresh(FALSE); - - SELECT i.id itemFk, - i.longName, - i.size, - i.subName, - v.amount - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as visible, - fue.Fuentes, - alb.Albenfruit, - sale.venta, - IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, - IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) - - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as saldo - FROM vn.item i - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN ( - SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS Fuentes - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - WHERE s.code = 'FUENTES_PICASSE' - GROUP BY ish.itemFk - ) fue ON fue.itemFk = i.id - LEFT JOIN ( - SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS Albenfruit - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - WHERE s.code = 'ALBENFRUIT' - GROUP BY ish.itemFk - ) alb ON alb.itemFk = i.id - LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) - AND warehouse_id = vWarehouseFk - GROUP BY item_id - ) sale ON sale.item_id = i.id - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) - AND warehouse_id = vWarehouseFk - AND isVirtualStock = FALSE - GROUP BY item_id - ) buy ON buy.item_id = i.id - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) - AND warehouse_id = vWarehouseFk - GROUP BY item_id - ) mov ON mov.item_id = i.id - WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) - AND i.itemPackingTypeFk = 'H' - AND ic.shortLife - ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemGetVisibleAvailable__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemGetVisibleAvailable__`( - vItem INT, - vDate DATE, - vWarehouse TINYINT, - vRefresh BOOL) -BEGIN - -- DEPRECADO - UTILIZAR vn.item_getVisibleAvailable() - JSB - 2019-11-20 - CALL item_getVisibleAvailable(vItem, vDate, vWarehouse, vRefresh); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemLastEntries__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemLastEntries__`(IN `vItem` INT, IN `vDays` DATE) -BEGIN - SELECT - w.id AS warehouseFk, - w.name AS warehouse, - tr.landed, - b.entryFk, - b.isIgnored, - b.price2, - b.price3, - b.stickers, - b.packing, - b.`grouping`, - b.groupingMode, - b.weight, - i.stems, - b.quantity, - b.buyingValue, - b.packageFk , - s.id AS supplierFk, - s.name AS supplier - FROM itemType it - RIGHT JOIN (entry e - LEFT JOIN supplier s ON s.id = e.supplierFk - RIGHT JOIN buy b ON b.entryFk = e.id - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN ink ON ink.id = i.inkFk - LEFT JOIN travel tr ON tr.id = e.travelFk - LEFT JOIN warehouse w ON w.id = tr.warehouseInFk - LEFT JOIN origin o ON o.id = i.originFk - ) ON it.id = i.typeFk - LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND DATE_ADD(CURDATE(), INTERVAl + 10 DAY) - ORDER BY tr.landed DESC , b.id 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 `itemPlacementFromTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementFromTicket`(vTicket INT) -BEGIN -/** - * Llama a itemPlacementUpdateVisible - * de los articulos de la tabla temporal tmp.itemPlacement(itemFk) - * @treturn tmp.itemPlacement - * @param vTicket Id del Ticket - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.itemPlacement; - CREATE TEMPORARY TABLE tmp.itemPlacement - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT s.itemFk - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - WHERE t.id = vTicket; - - CALL itemPlacementUpdateVisible(); - - DROP TEMPORARY TABLE tmp.itemPlacement; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemPlacementReloadVisible` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementReloadVisible`() -BEGIN -/** - * Reemplaza únicamente el campo itemPlacement.pickable - * restando al cache.visible los valores de las tablas - * itemShelving y los tickets con estado impreso - * que aun no han sido preparados. - */ - - DECLARE vCalc INT; - DECLARE vTodayIni DATE DEFAULT CURDATE(); - DECLARE vTodayEnd DATETIME DEFAULT util.dayend(vTodayIni); - DECLARE vproductionOrderPrinted INT DEFAULT 4; - DECLARE vWarehouseSillaFv INT DEFAULT 1; - - UPDATE itemPlacement SET pickable = 0; - - CALL cache.visible_refresh(vCalc, FALSE, vWarehouseSillaFv); --- SELECT * FROM cache.visible v; - DROP TEMPORARY TABLE IF EXISTS tmp.itemShelving; - CREATE TEMPORARY TABLE tmp.itemShelving - SELECT itemFk, IFNULL(SUM(visible),0) visible - FROM itemShelving its - GROUP BY its.itemFk; --- SELECT * FROM tmp.itemShelving; - DROP TEMPORARY TABLE IF EXISTS tmp.itemPlacement; - CREATE TEMPORARY TABLE tmp.itemPlacement - SELECT s.itemFk, cast(SUM(s.quantity) AS UNSIGNED) visible - FROM ticket t - JOIN ticketState ts ON ts.ticketFk = t.id AND productionOrder = vproductionOrderPrinted - JOIN sale s ON s.ticketFk = t.id - WHERE t.shipped BETWEEN vTodayIni AND vTodayEnd - GROUP BY s.itemFk; --- SELECT * FROM tmp.itemPlacement; - -/*SELECT v.item_id, vWarehouseSillaFv, v.visible - IFNULL(tis.visible,0) - IFNULL(tip.visible,0) - FROM cache.visible v - LEFT JOIN tmp.itemShelving tis ON tis.itemFk = v.item_id - LEFT JOIN tmp.itemPlacement tip ON tip.itemFk = v.item_id - WHERE v.calc_id = vCalc; - */ - INSERT INTO itemPlacement(itemFk, warehouseFk, pickable) - SELECT v.item_id, vWarehouseSillaFv, v.visible - IFNULL(tis.visible,0) - IFNULL(tip.visible,0) - FROM cache.visible v - LEFT JOIN tmp.itemShelving tis ON tis.itemFk = v.item_id - LEFT JOIN tmp.itemPlacement tip ON tip.itemFk = v.item_id - WHERE v.calc_id = vCalc - ON DUPLICATE KEY UPDATE pickable = VALUES(pickable); - - DROP TEMPORARY TABLE tmp.itemShelving; - DROP TEMPORARY TABLE tmp.itemPlacement; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemPlacementSave` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSave`( - vCode VARCHAR(22), - vPlacement VARCHAR(10), - vWarehouseFk INT ) -BEGIN - DECLARE vItemFk INT; - SET vItemFk = barcodeToItem(vCode); - - IF ASCII(vPlacement) > 57 THEN - INSERT INTO itemPlacement(itemFk, warehouseFk, reserve, pickable) - VALUES(vItemFk, vWarehouseFk, vPlacement, 0) - ON DUPLICATE KEY UPDATE reserve = vPlacement, modificationDate = NOW(); - ELSE - INSERT INTO itemPlacement(itemFk, warehouseFk, code) - VALUES(vItemFk, vWarehouseFk, vPlacement) - ON DUPLICATE KEY UPDATE code = vPlacement, modificationDate = 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 */ ; -/*!50003 DROP PROCEDURE IF EXISTS `itemPlacementSupplyAiming` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT) -BEGIN - - SELECT ish.itemFk, - ish.longName, - ish.size, - ish.subName, - ish.itemShelvingFk, - ish.shelving, - ish.stock, - LEAST(ish.stock,quantity) as total, - CONCAT( - CAST(FLOOR(LEAST(ish.stock,quantity) / ish.packing) AS DECIMAL(10,0)), - ' x ', - ish.packing, - IF ( - LEAST(ish.stock,quantity) MOD ish.packing, - CONCAT(' + ',CAST(LEAST(ish.stock,quantity) MOD ish.packing AS DECIMAL(10,0))), - '' - ), - ' = ', - LEAST(ish.stock,quantity) - ) as proposal - FROM vn.itemShelvingPlacementSupplyStock ish - WHERE ish.shelving = vShelvingFk COLLATE utf8_general_ci - AND ish.itemFk = vItemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemPlacementSupplyCloseOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyCloseOrder`(vId INT, vQuantity INT) -BEGIN - - UPDATE vn.itemPlacementSupply - SET priority = 10 - WHERE id = vId; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemPlacementSupplyGetOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyGetOrder`(vSector INT ) -BEGIN - - DECLARE vId INT; - DECLARE vLastParkingFk INT; - DECLARE vNextParkingFk INT; - - SELECT sh.parkingFk INTO vLastParkingFk - FROM vn.itemShelvingPlacementSupply isps - JOIN vn.itemShelving ish ON ish.id = isps.itemShelvingFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - WHERE isps.userFk = getUser() - ORDER BY isps.created DESC - LIMIT 1; - - SET vNextParkingFk = vn.itemShelvingPlacementSupply_ClosestGet(vLastParkingFk); - - SELECT ipsl.id INTO vId - FROM vn.itemPlacementSupplyList ipsl - JOIN vn.itemShelvingPlacementSupplyStock ispss ON ispss.itemFk = ipsl.itemFk - WHERE ipsl.saldo > 0 - AND (ipsl.repoUserFk is NULL OR ipsl.repoUserFk = getUser()) - AND ipsl.sectorFk = vSector - ORDER BY ipsl.repoUserFk DESC, ipsl.priority DESC, (ispss.parkingFk = vNextParkingFk) DESC, ispss.parking DESC, ipsl.created - LIMIT 1; - - UPDATE vn.itemPlacementSupply - SET repoUserFk = getUser() - WHERE id = vId; - - SELECT * FROM vn.itemPlacementSupplyList - WHERE id = vId - AND sectorFk = vSector; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemPlacementSupplyStockGetTargetList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT) -BEGIN - - /* Devuelve la lista de ubicaciones para itemFk en ese sector. Se utiliza en la preparación previa. - * Este proc se llama a continuacion de ticketToPrePrepare - * - * @param vItemFk Identificador de vn.item - * @param vSectorFk Identificador de vn.sector - */ - - DECLARE vWarehouseAliasFk INT; - - SELECT w.aliasFk INTO vWarehouseAliasFk - FROM vn.sector s - JOIN vn.warehouse w ON w.id = s.warehouseFk - WHERE s.id = vSectorFk; - - SELECT ish.shelvingFk shelving, - p.code parking, - sum(ish.visible) as stockTotal, - ish.created, - p.pickingOrder - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - JOIN vn.warehouse w ON w.id = sc.warehouseFk - WHERE w.aliasFk = vWarehouseAliasFk - AND ish.visible > 0 - AND ish.itemFk = vItemFk - GROUP BY ish.id - ORDER BY sh.priority 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 `itemPlacementUpdateVisible` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementUpdateVisible`() -BEGIN -/** - * Reemplaza únicamente el campo itemPlacement.pickable - * de los articulos de la tabla temporal tmp.itemPlacement(itemFk) - * restando al cache.visible los valores de las tablas - * itemShelving y los tickets con estado impreso - * que aun no han sido preparados. - */ - DECLARE vCalc INT; - DECLARE vTodayIni DATE DEFAULT CURDATE(); - DECLARE vTodayEnd DATETIME DEFAULT util.dayend(vTodayIni); - DECLARE vproductionOrderPrinted INT DEFAULT 4; - DECLARE vWarehouseSillaFv INT DEFAULT 1; - - UPDATE itemPlacement SET pickable = 0; - - CALL cache.visible_refresh(vCalc, FALSE, vWarehouseSillaFv); -SELECT * FROM cache.visible v; - DROP TEMPORARY TABLE IF EXISTS tmp.itemShelving; - CREATE TEMPORARY TABLE tmp.itemShelving - SELECT its.itemFk, IFNULL(SUM(visible),0) visible - FROM itemShelving its - JOIN tmp.itemPlacement tip ON tip.itemFk = its.itemFk - GROUP BY its.itemFk; -SELECT * FROM tmp.itemShelving; - -SELECT s.itemFk, cast(SUM(s.quantity) AS UNSIGNED) visible - FROM ticket t - JOIN ticketState ts ON ts.ticketFk = t.id AND productionOrder = vproductionOrderPrinted - JOIN sale s ON s.ticketFk = t.id - JOIN tmp.itemPlacement tip ON tip.itemFk = s.itemFk - WHERE t.shipped BETWEEN vTodayIni AND vTodayEnd - GROUP BY s.itemFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT s.itemFk, cast(SUM(s.quantity) AS UNSIGNED) visible - FROM ticket t - JOIN ticketState ts ON ts.ticketFk = t.id AND productionOrder = vproductionOrderPrinted - JOIN sale s ON s.ticketFk = t.id - JOIN tmp.itemPlacement tip ON tip.itemFk = s.itemFk - WHERE t.shipped BETWEEN vTodayIni AND vTodayEnd - GROUP BY s.itemFk; -SELECT * FROM tmp.ticket; - -SELECT v.item_id, vWarehouseSillaFv, v.visible - IFNULL(tis.visible,0) - IFNULL(tik.visible,0) - FROM cache.visible v - LEFT JOIN tmp.itemShelving tis ON tis.itemFk = v.item_id - LEFT JOIN tmp.ticket tik ON tik.itemFk = v.item_id - WHERE v.calc_id = vCalc; - - INSERT INTO itemPlacement(itemFk, warehouseFk, pickable) - SELECT v.item_id, vWarehouseSillaFv, v.visible - IFNULL(tis.visible,0) - IFNULL(tik.visible,0) - FROM cache.visible v - LEFT JOIN tmp.itemShelving tis ON tis.itemFk = v.item_id - LEFT JOIN tmp.ticket tik ON tik.itemFk = v.item_id - WHERE v.calc_id = vCalc - ON DUPLICATE KEY UPDATE pickable = VALUES(pickable); - - DROP TEMPORARY TABLE tmp.itemShelving; - DROP TEMPORARY TABLE 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 `itemProposal` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal`(vItemFk INT, vTicketFk INT,vShowType BOOL) -BEGIN - -/** - * Propone articulos disponible ordenado, con la cantidad de veces usado y segun sus caracteristicas - * - * @param vItemFk item id - * @param vTicketFk ticket id - * @param vShowType mostrar tipos - */ - - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vCalcFk INT; - DECLARE vTypeFk INT; - - - DECLARE vTag1 VARCHAR(25); - DECLARE vTag5 VARCHAR(25); - DECLARE vTag6 VARCHAR(25); - DECLARE vTag7 VARCHAR(25); - DECLARE vTag8 VARCHAR(25); - - DECLARE vValue1 VARCHAR(50); - DECLARE vValue5 VARCHAR(50); - DECLARE vValue6 VARCHAR(50); - DECLARE vValue7 VARCHAR(50); - DECLARE vValue8 VARCHAR(50); - - SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket - WHERE id = vTicketFk; - - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE i.id = vItemFk; - - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); - - SELECT i.id itemFk, - i.longName, - i.subName, - i.tag5, - i.value5, - (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, - i.tag6, - i.value6, - (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, - i.tag7, - i.value7, - (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, - i.tag8, - i.value8, - (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, - a.available, - IFNULL(ip.counter,0) counter, - IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity - FROM vn.item i - JOIN cache.available a ON a.item_id = i.id - LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - WHERE a.calc_id = vCalcFk - AND available > 0 - AND IF(vShowType,i.typeFk = vTypeFk,true) - AND i.id != vItemFk - ORDER BY counter DESC, - (t1.name = vTag1 COLLATE utf8_general_ci) DESC, - (it1.value = vValue1 COLLATE utf8_general_ci) DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, - (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, - (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, - (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, - (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, - (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, - (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, - (i.value8 = vValue8 COLLATE utf8_general_ci) 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 `itemProposal_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal_Add`(vSaleFk INT, vMateFk INT, vQuantity INT) -BEGIN -/** - * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones. - * - * @param vSaleFk id de la tabla sale - * @param vMateFk articulo sustituto - * @ param vQuantity cantidad que se va a sustituir - */ - DECLARE vTicketFk INT; - DECLARE vItemFk INT; - DECLARE vWarehouseFk SMALLINT; - DECLARE vDate DATE; - DECLARE vGrouping INT; - DECLARE vBox INT; - DECLARE vPacking INT; - DECLARE vRoundQuantity INT DEFAULT 1; - - SELECT s.ticketFk, LEAST(s.quantity, vQuantity), s.itemFk,t.shipped,t.warehouseFk - INTO vTicketFk, vQuantity, vItemFk,vDate,vWarehouseFk - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - WHERE s.id = vSaleFk; - - UPDATE vn.sale - SET quantity = quantity - vQuantity - WHERE id = vSaleFk; - - CALL vn.buyUltimate(vWarehouseFk, vDate); - - SELECT `grouping`, groupingMode, packing - INTO vGrouping,vBox,vPacking - FROM buy b - JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk - WHERE tmp.itemFk = vMateFk AND tmp.WarehouseFk = vWarehouseFk; - - IF vBox = 2 AND vPacking > 0 THEN - SET vRoundQuantity = vPacking; - END IF; - IF vBox = 1 AND vGrouping > 0 THEN - SET vRoundQuantity = vGrouping; - END IF; - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept) - SELECT vTicketFk, vMateFk, CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName) - FROM vn.item i - WHERE id = vMateFk; - - SELECT LAST_INSERT_ID() INTO vSaleFk; - - CALL vn.sale_calculateComponent(vSaleFk, NULL); - - INSERT INTO vn.itemProposal(itemFk, mateFk, counter) - VALUES(vItemFk, vMateFk, 1) - ON DUPLICATE KEY UPDATE counter = counter + 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 `itemProposal_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal_beta`(vItemFk INT, vTicketFk INT) -BEGIN - - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vCalcFk INT; - DECLARE vTypeFk INT; - DECLARE vResultsMax INT DEFAULT 10; - - DECLARE vTag1 VARCHAR(25); - DECLARE vTag5 VARCHAR(25); - DECLARE vTag6 VARCHAR(25); - DECLARE vTag7 VARCHAR(25); - DECLARE vTag8 VARCHAR(25); - - DECLARE vValue1 VARCHAR(50); - DECLARE vValue5 VARCHAR(50); - DECLARE vValue6 VARCHAR(50); - DECLARE vValue7 VARCHAR(50); - DECLARE vValue8 VARCHAR(50); - - SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket - WHERE id = vTicketFk; - - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE i.id = vItemFk; - - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); - - SELECT i.id itemFk, - i.longName, - i.subName, - i.tag5, - i.value5, - (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, - i.tag6, - i.value6, - (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, - i.tag7, - i.value7, - (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, - i.tag8, - i.value8, - (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, - a.available, - IFNULL(ip.counter,0) counter - FROM vn.item i - JOIN cache.available a ON a.item_id = i.id - LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE a.calc_id = vCalcFk - AND available > 0 - AND i.typeFk = vTypeFk - AND i.id != vItemFk - ORDER BY counter DESC, - (t1.name = vTag1 COLLATE utf8_general_ci) DESC, - (it1.value = vValue1 COLLATE utf8_general_ci) DESC, - (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, - (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, - (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, - (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, - (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, - (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, - (i.value8 = vValue8 COLLATE utf8_general_ci) DESC - LIMIT vResultsMax; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemProposal__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal__`(vItemFk INT, vTicketFk INT) -BEGIN - - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vCalcFk INT; - DECLARE vTypeFk INT; - DECLARE vResultsMax INT DEFAULT 10; - - DECLARE vTag5 VARCHAR(25); - DECLARE vTag6 VARCHAR(25); - DECLARE vTag7 VARCHAR(25); - DECLARE vTag8 VARCHAR(25); - - DECLARE vValue5 VARCHAR(50); - DECLARE vValue6 VARCHAR(50); - DECLARE vValue7 VARCHAR(50); - DECLARE vValue8 VARCHAR(50); - - SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket - WHERE id = vTicketFk; - - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8 - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8 - FROM vn.item i - LEFT JOIN vn.tag t5 ON t5.name = i.tag5 COLLATE utf8_general_ci - LEFT JOIN vn.tag t6 ON t6.name = i.tag6 COLLATE utf8_general_ci - LEFT JOIN vn.tag t7 ON t7.name = i.tag7 COLLATE utf8_general_ci - LEFT JOIN vn.tag t8 ON t8.name = i.tag8 COLLATE utf8_general_ci - WHERE i.id = vItemFk; - - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); - - SELECT i.id itemFk, - i.longName, - i.subName, - i.tag5, - i.value5, - (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, - i.tag6, - i.value6, - (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, - i.tag7, - i.value7, - (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, - i.tag8, - i.value8, - (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, - a.available, - IFNULL(ip.counter,0) counter - FROM vn.item i - JOIN cache.available a ON a.item_id = i.id - LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - WHERE a.calc_id = vCalcFk - AND available > 0 - AND i.typeFk = vTypeFk - AND i.id != vItemFk - ORDER BY counter DESC, - (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, - (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, - (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, - (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, - (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, - (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, - (i.value8 = vValue8 COLLATE utf8_general_ci) DESC - LIMIT vResultsMax; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemProposal__2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal__2`(vItemFk INT, vTicketFk INT) -BEGIN - - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vCalcFk INT; - DECLARE vTypeFk INT; - DECLARE vResultsMax INT DEFAULT 10; - - DECLARE vTag1 VARCHAR(25); - DECLARE vTag5 VARCHAR(25); - DECLARE vTag6 VARCHAR(25); - DECLARE vTag7 VARCHAR(25); - DECLARE vTag8 VARCHAR(25); - - DECLARE vValue1 VARCHAR(50); - DECLARE vValue5 VARCHAR(50); - DECLARE vValue6 VARCHAR(50); - DECLARE vValue7 VARCHAR(50); - DECLARE vValue8 VARCHAR(50); - - SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped - FROM vn.ticket - WHERE id = vTicketFk; - - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE i.id = vItemFk; - - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); - - SELECT i.id itemFk, - i.longName, - i.subName, - i.tag5, - i.value5, - (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, - i.tag6, - i.value6, - (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, - i.tag7, - i.value7, - (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, - i.tag8, - i.value8, - (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, - a.available, - IFNULL(ip.counter,0) counter - FROM vn.item i - JOIN cache.available a ON a.item_id = i.id - LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE a.calc_id = vCalcFk - AND available > 0 - AND i.typeFk = vTypeFk - AND i.id != vItemFk - ORDER BY counter DESC, - (t1.name = vTag1 COLLATE utf8_general_ci) DESC, - (it1.value = vValue1 COLLATE utf8_general_ci) DESC, - (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, - (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, - (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, - (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, - (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, - (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, - (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, - (i.value8 = vValue8 COLLATE utf8_general_ci) DESC - LIMIT vResultsMax; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemRefreshTags` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemRefreshTags`(IN vItem INT) -BEGIN -/** - * Crea la tabla temporal necesaria para el procedimiento item_refreshTags - * - * @param vItem Articulo a modificar - * @param temporary table tmp.item(id) del articulo - **/ - DROP TEMPORARY TABLE IF EXISTS tmp.item; - - CREATE TEMPORARY TABLE tmp.item - SELECT vItem id; - - CALL item_refreshTags(); - - DROP TEMPORARY TABLE 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 `itemSale_byWeek` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSale_byWeek`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT) -BEGIN - - DECLARE vStarted DATE; - DECLARE vEnded DATETIME; - - SELECT MIN(dated), util.dayEnd(MAX(dated)) INTO vStarted, vEnded - FROM `time` t - WHERE CONCAT(vYear, LPAD(vWeek, 2, 0)) = t.period; - - SELECT t.shipped, - w.name warehouse, - s.ticketFk, - c.quality, - t.nickname client, - am.name agencyName, - wk.code salesPerson, - s.itemFk, - IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept, - s.quantity, - s.price, - s.priceFixed, - s.discount, - tls.name stateName, - sb.buyFk, - s.id saleFk, - wk.id salesPersonFk - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN warehouse w ON w.id = t.warehouseFk - JOIN address a ON a.id = t.addressFk - LEFT JOIN agencyMode am ON am.id = t.agencyModeFk - JOIN `client` c ON c.id = a.clientFk - LEFT JOIN worker wk ON wk.id = c.salesPersonFk - LEFT JOIN ticketLastState tls ON tls.ticketFk = t.id - LEFT JOIN saleBuy sb ON sb.saleFk = s.id - LEFT JOIN buy b ON b.id = sb.buyFk - LEFT JOIN item ig ON ig.id = b.itemOriginalFk - WHERE s.itemFk = vItemFk - AND t.shipped BETWEEN vStarted AND vEnded - AND IF(vWarehouseFk = 0, w.hasComission , t.warehouseFk = vWarehouseFk) - ORDER BY t.shipped, 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 `itemSale_byWeek__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSale_byWeek__`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT) -BEGIN - - DECLARE vStarted DATE; - DECLARE vEnded DATETIME; - - SELECT MIN(dated), util.dayEnd(MAX(dated)) INTO vStarted, vEnded - FROM vn.`time` t - WHERE CONCAT(vYear, vWeek) = t.period; - - SELECT - t.shipped, - w.name warehouse, - s.ticketFk, - c.quality, - t.nickname AS client, - am.name AS agencyName, - wk.code AS salesPerson, - s.itemFk, - IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept, - s.quantity, - s.price, - s.priceFixed, - s.discount, - tls.name stateName, - sb.buyFk, - s.id saleFk, - wk.id salesPersonFk - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.address a ON a.id = t.addressFk - LEFT JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.client c ON c.id = a.clientFk - LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk - LEFT JOIN vn.ticketLastState tls ON tls.ticketFk = t.id - LEFT JOIN vn.saleBuy sb ON sb.saleFk = s.id - LEFT JOIN vn.buy b ON b.id = sb.buyFk - LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk - WHERE s.itemFk = vItemFk - AND t.shipped BETWEEN vStarted and vEnded - AND IF(vWarehouseFk = 0, w.hasComission , t.warehouseFk= vWarehouseFk) - ORDER BY t.shipped, 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 `itemSaveMin` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSaveMin`(min INT,vBarcode VARCHAR(22)) -BEGIN - - DECLARE vItemFk INT; - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - UPDATE vn.item SET minimum = min WHERE id = vItemFk; - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemSearchShelving` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSearchShelving`(`vShelvingFk` VARCHAR(3)) -BEGIN - SELECT p.`column` AS col , p.`row` - FROM vn.shelving s - JOIN parking p ON s.parkingFk = p.id - WHERE s.`code` = vShelvingFk 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 `itemShelvingDelete` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingDelete`(vId INT) -BEGIN - - DELETE FROM vn.itemShelving WHERE id = vId; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingEdit__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingEdit__`(vVisible INT,vPacking INT,vId INT) -BEGIN - - /* - * @deprecated: utilizar itemShelving_update - */ - UPDATE vn.itemShelving SET available = vVisible, visible = vVisible, packing = vPacking WHERE id = vId; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingList__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingList__`(IN `vShelvingFk` VARCHAR(8)) -BEGIN - - /* - * @deprecated:Utilizar itemShelving_get - */ - - /*MODIFICADA POR QUIQUE: OBTENEMOS DEEP Y PARKING*/ - SELECT ish.itemFk as item, - IFNULL(i.longName, CONCAT(i.name, ' ',i.size)) as description, - ish.visible as visible, - ceil(ish.visible/ish.packing) as stickers, - ish.packing as packing, - IF (p.`column` IS NULL,"",p.`column`) as col, - IF (p.`row` IS NULL,"",p.`row`) as `row`, - IF (p.`code` IS NULL,"",p.`code`) as `code`, - ish.id, - s.priority - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - INNER JOIN vn.shelving s ON vShelvingFk = s.code COLLATE utf8_unicode_ci - LEFT JOIN vn.parking p ON s.parkingFk = p.id - WHERE ish.shelvingFk COLLATE utf8_unicode_ci =vShelvingFk 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 `itemShelvingLog_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingLog_get`(vShelvingFk VARCHAR(10) ) -BEGIN - -/** - * Devuelve el log de los item en cada carro - * - * @param vShelvingFk Matrícula del carro - * - */ - - SELECT isl.itemShelvingFk, - isl.created, - isl.accion, - isl.itemFk, - isl.shelvingFk, - isl.quantity, - isl.visible, - isl.available, - isl.grouping, - isl.packing, - isl.stars, - item.longName, - item.size, - item.subName, - worker.code, - isl.accion - FROM item - JOIN itemShelvingLog isl ON item.id = isl.itemFk - JOIN worker ON isl.workerFk = worker.id - WHERE shelvingFk = vShelvingFk OR isl.itemFk = vShelvingFk - ORDER BY isl.created 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 `itemShelvingMakeFromDate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vShelve` VARCHAR(2), IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22)) -BEGIN - - DECLARE vItemFk INT; - - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - SELECT itemFk INTO vItemFk - FROM vn.buy b - WHERE b.id = vItemFk; - - IF (SELECT COUNT(*) FROM vn.shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN - - INSERT IGNORE INTO vn.parking(`code`) VALUES(vShelvingFk); - INSERT INTO vn.shelving(`code`, parkingFk) - SELECT vShelvingFk, id - FROM vn.parking - WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; - - END IF; - - IF (SELECT COUNT(*) FROM vn.itemShelving - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk - AND packing = vPacking) = 1 THEN - - UPDATE vn.itemShelving - SET visible = visible+vQuantity, - created = vCreated - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk - AND packing = vPacking; - - ELSE - CALL cache.last_buy_refresh(FALSE); - INSERT INTO itemShelving( itemFk, - shelvingFk, - shelve, - visible, - created, - `grouping`, - packing, - packagingFk) - SELECT vItemFk, - vShelvingFk, - vShelve, - vQuantity, - vCreated, - IF(vGrouping = 0, IFNULL(b.packing, vPacking), vGrouping) `grouping`, - IF(vPacking = 0, b.packing, vPacking) packing, - IF(vPackagingFk = '', b.packageFk, vPackagingFk) packaging - FROM vn.item i - LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - WHERE i.id = vItemFk; - 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 `itemShelvingMake__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMake__`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vShelve` VARCHAR(2), IN `vDeep` INT, IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, IN `vLevel` INT) -BEGIN - - - /* - * @deprecated:utilizar itemShelving_add - */ - - DECLARE vItemFk INT; - - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - /*SELECT itemFk INTO vItemFk - FROM vn.buy b - WHERE b.id = vItemFk;*/ - - IF (SELECT COUNT(*) FROM vn.shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN - - INSERT IGNORE INTO vn.parking(`code`) VALUES(vShelvingFk); - INSERT INTO vn.shelving(`code`, parkingFk) - SELECT vShelvingFk, id - FROM vn.parking - WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; - - END IF; - - IF (SELECT COUNT(*) FROM vn.itemShelving - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk - AND packing = vPacking) = 1 THEN - - UPDATE vn.itemShelving SET quantity = quantity+vQuantity,visible = visible+vQuantity,available = available+vQuantity - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; - - ELSE - CALL cache.last_buy_refresh(FALSE); - INSERT INTO itemShelving( itemFk, - shelvingFk, - shelve, - deep, - quantity, - visible, - available, - `grouping`, - packing, - packagingFk, - level) - - SELECT - vItemFk, - vShelvingFk, - vShelve, - vDeep, - vQuantity, - vQuantity, - vQuantity, - IF(vGrouping = 0, IFNULL(b.packing, vPacking), vGrouping) as `grouping`, - IF(vPacking = 0, b.packing, vPacking) as packing, - IF(vPackagingFk = '', b.packageFk, vPackagingFk) as packaging, - vLevel - FROM vn.item i - LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - WHERE i.id = vItemFk; - 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 `itemShelvingMatch` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMatch`(vEntryFk INT, vAllTravel BOOLEAN, vFromTimed DATETIME, vToTimed DATETIME) -BEGIN - - DECLARE vTravelFk INT; - - SELECT travelFk INTO vTravelFk - FROM entry - WHERE id = vEntryFk; - - SELECT i.id, i.longName, i.size, i.subName, b.stickers, ish.etiquetas, b.printed - FROM item i - JOIN ( - SELECT itemFk, sum(stickers) AS stickers, sum(printedStickers) as printed - FROM buy b - JOIN entry e ON e.id = b.entryFk - WHERE IF(vAllTravel , travelFk = vTravelFk, b.entryFk = vEntryFk) - GROUP BY itemFk - ) b ON b.itemFk = i.id - LEFT JOIN ( - SELECT itemFk, sum(cast(visible / packing AS DECIMAL(10,0))) AS etiquetas - FROM itemShelving ish - JOIN shelving sh ON sh.code = ish.shelvingFk - LEFT JOIN parking pk ON pk.id = sh.parkingFk - WHERE ish.created BETWEEN vFromTimed AND vToTimed - GROUP BY itemFk - ) ish ON ish.itemFk = id - WHERE b.stickers OR ish.etiquetas; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingPlacementSupplyAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingPlacementSupplyAdd`(vItemShelvingFk INT, vItemPlacementSupplyFk INT, vQuantity INT) -BEGIN - - INSERT INTO vn.itemShelvingPlacementSupply( itemShelvingFk, - itemPlacementSupplyFk, - quantity, - userFk) - VALUES (vItemShelvingFk, - vItemPlacementSupplyFk, - vQuantity, - getUser()); - - UPDATE vn.itemShelving - SET visible = visible - vQuantity - WHERE id = vItemShelvingFk; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingProblem` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingProblem`(vSectorFk INT) -BEGIN - - DECLARE vVisibleCache INT; - DECLARE vWarehouseFk INT; - - SELECT warehouseFk INTO vWarehouseFk - FROM vn.sector - WHERE id = vSectorFk; - - CALL cache.visible_refresh (vVisibleCache, FALSE, vWarehouseFk); - - SELECT t.id as ticketFk, - CAST(s.quantity AS DECIMAL(10,0)) as Cantidad, - s.itemFk, - s.concept, - v.visible - GREATEST(0,iss.visible) + IFNULL(sub3.transit,0) as Nicho, - i.subName, - GREATEST(0,iss.visible - IFNULL(sub3.transit,0)) as Altillo, - s.id as saleFk, - IFNULL(sub3.transit,0) transit, - v.visible, s.isPicked, s.reserved, t.shipped, tst.productionOrder, mm.Id_Movimiento - FROM vn.ticket t - JOIN vn.ticketState tst ON tst.ticketFk = t.id - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN cache.visible v ON s.itemFk = v.item_id AND v.calc_id = vVisibleCache - LEFT JOIN vn2008.Movimientos_mark mm ON mm.Id_Movimiento = s.id AND mm.stateFk = 26 - JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id - LEFT JOIN - (SELECT itemFk, sum(saldo) as transit - FROM vn.itemPlacementSupplyList - WHERE saldo > 0 - AND sectorFk = vSectorFk - GROUP BY itemFk) sub3 ON sub3.itemFk = i.id - WHERE v.visible + IFNULL(sub3.transit,0) - GREATEST(0,iss.visible) < s.quantity - AND IFNULL(sub3.transit,0) < s.quantity - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND t.shipped BETWEEN CURDATE() AND MIDNIGHT(CURDATE()) - AND tst.isPreviousPreparable = TRUE - AND t.warehouseFk = vWarehouseFk - AND iss.sectorFk = vSectorFk - AND mm.Id_Movimiento IS NULL - ORDER BY itemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingRadar` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(vSectorFk INT) -proc:BEGIN - - DECLARE vCalcVisibleFk INT; - DECLARE vCalcAvailableFk INT; - DECLARE hasFatherSector BOOLEAN; - DECLARE vBuyerFk INT DEFAULT 0; - DECLARE vWarehouseFk INT DEFAULT 0; - DECLARE vSonSectorFk INT; - DECLARE vWorkerFk INT; - - SELECT s.workerFk - INTO vWorkerFk - FROM vn.sector s - WHERE s.id = vSectorFk; - - IF IFNULL(vWorkerFk,0) THEN - - CALL vn.itemShelvingRadar_Urgent(vWorkerFk); - LEAVE proc; - - end if; - - - SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk - FROM vn.worker w - JOIN vn.sector s ON s.code = w.code - WHERE s.id = vSectorFk; - - SELECT s.id INTO vSectorFk - FROM vn.sector s - WHERE s.warehouseFk = vWarehouseFk - AND s.isMain; - - - SELECT COUNT(*) INTO hasFatherSector - FROM vn.sector - WHERE sonFk = vSectorFk; - - SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk - FROM vn.sector - WHERE id = vSectorFk; - - CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); - - DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; - - IF hasFatherSector THEN - - CREATE TEMPORARY TABLE tmp.itemShelvingRadar - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT * FROM ( - SELECT iss.itemFk, - i.longName, - i.size, - i.subName producer, - IFNULL(a.available,0) available, - SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible,0), 0)) upstairs, - SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs, - IF(it.isPackaging, null, IFNULL(v.visible,0)) as visible, - vSectorFk as sectorFk - - FROM vn.itemShelvingStock iss - JOIN vn.sector s ON s.id = iss.sectorFk - JOIN vn.item i on i.id = iss.itemFk - JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) - LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk - WHERE vSectorFk IN (iss.sectorFk, s.sonFk) - AND it.workerFk != 3366 - - GROUP BY iss.itemFk - - UNION ALL - - SELECT v.item_id, - i.longName, - i.size, - i.subName producer, - IFNULL(a.available,0) as available, - 0 upstairs, - 0 downstairs, - IF(it.isPackaging, NULL, v.visible) visible, - vSectorFk as sectorFk - FROM cache.visible v - JOIN vn.item i on i.id = v.item_id - JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) - LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk - LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk - WHERE v.calc_id = vCalcVisibleFk - AND iss.itemFk IS NULL - AND it.isInventory - ) sub GROUP BY itemFk; - - SELECT ishr.*, - CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho, - CAST(downstairs - IFNULL(notPickedYed,0) AS DECIMAL(10,0)) as pendiente - FROM tmp.itemShelvingRadar ishr - JOIN vn.item i ON i.id = ishr.itemFk - LEFT JOIN (SELECT s.itemFk, sum(s.quantity) as notPickedYed - FROM vn.ticket t - JOIN vn.ticketStateToday tst ON tst.ticket = t.id - JOIN vn.sale s ON s.ticketFk = t.id - WHERE t.warehouseFk = vWarehouseFk - AND tst.alertLevel = 0 - GROUP BY s.itemFk - ) sub ON sub.itemFk = ishr.itemFk - ORDER BY i.typeFk, i.longName - ; - - - ELSE - - CREATE TEMPORARY TABLE tmp.itemShelvingRadar - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT iss.itemFk, - 0 `hour`, - 0 `minute`, - IFNULL(ip.`code`,'--') itemPlacementCode, - i.longName, - i.size, - i.subName producer, - i.upToDown, - IFNULL(a.available,0) available, - IFNULL(v.visible - iss.visible,0) dayEndVisible, - IFNULL(v.visible - iss.visible,0) firstNegative, - IFNULL(v.visible - iss.visible,0) itemPlacementVisible, - IFNULL(i.minimum * b.packing,0) itemPlacementSize, - ips.onTheWay, - iss.visible itemShelvingStock, - IFNULL(v.visible,0) visible, - b.isPickedOff, - iss.sectorFk - FROM vn.itemShelvingStock iss - JOIN vn.item i on i.id = iss.itemFk - LEFT JOIN vn.itemPlacement ip ON ip.itemFk = iss.itemFk AND ip.warehouseFk = vWarehouseFk - LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk - LEFT JOIN (SELECT itemFk, sum(saldo) as onTheWay - FROM vn.itemPlacementSupplyList - WHERE saldo > 0 - GROUP BY itemFk - ) ips ON ips.itemFk = i.id - WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk) - OR iss.sectorFk = vSectorFk; - /* - UPDATE tmp.itemShelvingRadar isr - JOIN vn.itemShelvingStock iss ON iss.itemFk = isr.itemFk - SET isr.dayEndVisible = isr.dayEndVisible + iss.visible, - isr.firstNegative = isr.firstNegative + iss.visible, - isr.itemPlacementVisible = isr.itemPlacementVisible + iss.visible - WHERE iss.sectorFk = vSonSectorFk; - */ - DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime; - CREATE TEMPORARY TABLE tmp.itemOutTime - SELECT *,SUM(amount) quantity - FROM - (SELECT item_id itemFk, - amount, - IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, - IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes - FROM vn2008.item_out io - JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.item_id - JOIN vn.ticket t on t.id= io.ticketFk - JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk - JOIN vn.state s ON s.id = ts.stateFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN (SELECT DISTINCT saleFk - FROM vn.saleTracking st - WHERE st.created > CURDATE() - AND st.isChecked - ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk - WHERE t.warehouseFk = vWarehouseFk - AND s.isPicked = 0 - AND NOT io.Reservado - AND stPrevious.saleFk IS NULL - AND io.dat >= CURDATE() - AND io.dat < CURDATE()+1 - ) sub - GROUP BY itemFk, hours, minutes; - - INSERT INTO tmp.itemShelvingRadar (itemFk) - SELECT itemFk FROM tmp.itemOutTime - ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity, - firstNegative = if (firstNegative < 0, firstNegative, firstNegative + quantity), - `hour` = ifnull(if (firstNegative > 0 , `hour`, hours),0), - `minute` = ifnull(if (firstNegative > 0, `minute`, minutes),0); -/* - UPDATE tmp.itemShelvingRadar - SET itemPlacementVisible = 0, - dayEndVisible = 0, - firstNegative = 0 - WHERE itemPlacementVisible = - itemShelvingStock; - */ - SELECT * FROM tmp.itemShelvingRadar; - - END IF; - - DROP TEMPORARY TABLE tmp.itemShelvingRadar; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingRadar_Entry` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Entry`(vEntryFk INT) -BEGIN - - DECLARE vWarehouseFk INT DEFAULT 1; - DECLARE vCalcVisibleFk INT; - DECLARE vCalcAvailableFk INT; - DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(CURDATE()); - - CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); - CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY - SELECT DISTINCT itemFk - FROM vn.buy - WHERE entryFk = vEntryFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.item2; - CREATE TEMPORARY TABLE tmp.item2 - ENGINE = MEMORY - SELECT * - FROM tmp.item; - - SELECT i.id as itemFk, - i.minimum, - CAST(IFNULL(v.visible,0) - IFNULL(iss.visible,0) AS DECIMAL(10,0)) as enNicho, - CAST(IFNULL(a.available,0) AS DECIMAL(10,0)) as disponible, - CAST(IFNULL(v.visible,0) - IFNULL(iss.visible,0) - ts.todaySold AS DECIMAL(10,0)) as finalDia - FROM vn.item i - JOIN tmp.item ti ON ti.itemFk = i.id - LEFT JOIN cache.visible v ON v.calc_id = vCalcVisibleFk AND v.item_id = i.id - LEFT JOIN cache.available a ON i.id = a.item_id AND a.calc_id = vCalcAvailableFk - LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id - LEFT JOIN ( SELECT s.itemFk, sum(s.quantity) as todaySold - FROM vn.sale s - JOIN tmp.item2 ti ON ti.itemFk = s.itemFk - JOIN vn.ticket t ON t.id = s.ticketFk - LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id - WHERE t.shipped BETWEEN CURDATE() AND vTodayDayEnd - AND t.warehouseFk = vWarehouseFk - AND IFNULL(tst.productionOrder,0) < 5 - GROUP BY s.itemFK - ) ts ON ts.itemFk = i.id; - - - DROP TEMPORARY TABLE tmp.item; - DROP TEMPORARY TABLE tmp.item2; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingRadar_Entry_State_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Entry_State_beta`(vEntryFk INT) -BEGIN - - DECLARE vWarehouseFk INT DEFAULT 1; - DECLARE vCalcVisibleFk INT; - DECLARE vCalcAvailableFk INT; - DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(CURDATE()); - - CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); - CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY - SELECT DISTINCT itemFk - FROM vn.buy - WHERE entryFk = vEntryFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.item2; - CREATE TEMPORARY TABLE tmp.item2 - ENGINE = MEMORY - SELECT * - FROM tmp.item; - - SELECT i.id as itemFk, - CAST(IFNULL(iss.visible,0) - IFNULL(v.visible,0) AS DECIMAL(10,0)) as outShelving - FROM vn.item i - JOIN tmp.item ti ON ti.itemFk = i.id - LEFT JOIN cache.visible v ON v.calc_id = vCalcVisibleFk AND v.item_id = i.id - LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id; - - - DROP TEMPORARY TABLE tmp.item; - DROP TEMPORARY TABLE tmp.item2; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingRadar_Urgent` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Urgent`() -BEGIN -/** - * Devuelve lo mismo que itemShelving_filterBuyer per sin filtrar - */ - DECLARE vCalcVisibleFk INT; - DECLARE vWarehouseFk INT DEFAULT 60; - - CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - - SELECT * FROM - (SELECT sub.itemFk, - sub.longName, - CONCAT(DATE_FORMAT(sub2.etd,'%H:%i'), ' salen ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, - CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, - sub.upstairs, - sub.downstairs, - sub.visible, - sub.sectorFk, - CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho, - sub2.etd - FROM (SELECT iss.itemFk, - CONCAT(i.longName,' ',i.size,' ',IFNULL(i.subName,'') ) longName, - '' size, - CONCAT(iss.parkingCode , ' ', iss.shelvingFk) producer, - 0 upstairs, - SUM(IFNULL(iss.visible,0)) downstairs, - IF(it.isPackaging, null, IFNULL(v.visible,0)) visible, - IFNULL(iss.sectorFk,0) sectorFk - FROM itemShelvingStock iss - JOIN sector s ON s.id = iss.sectorFk - JOIN item i on i.id = iss.itemFk - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = @vCalcVisibleFk - WHERE s.warehouseFk = vWarehouseFk - GROUP BY itemFk - ) sub LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente, MIN(zc.`hour`) etd - FROM sale s - LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk - JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND ISNULL(st.saleFk) - AND ct.code IN ('normal', 'trust') - GROUP BY s.itemFk - ) sub2 ON sub2.itemFk = sub.itemFk - UNION ALL - SELECT v.item_id , - i.longName, - CONCAT(DATE_FORMAT(sub5.etd,'%H:%i'), ' salen ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, - CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, - 0, - 0, - v.visible, - IFNULL(iss.sectorFk,0), - v.visible nicho, - sub5.etd - FROM cache.visible v - JOIN item i ON i.id = v.item_id - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id - LEFT JOIN (SELECT s.itemFk , SUM(s.quantity) pendiente, MIN(zc.`hour`) etd - FROM sale s - LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk - JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND ISNULL(st.saleFk) - AND ct.code IN ('normal', 'trust') - GROUP BY s.itemFk - ) sub5 ON sub5.itemFk = v.item_id - WHERE v.calc_id = @vCalcVisibleFk - AND ISNULL(iss.itemFk) - ) sub3 - WHERE nicho - ORDER BY LEFT(producer,3), etd, producer; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingRadar_Urgent__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Urgent__`(vWorkerFk INT) -BEGIN - DECLARE vCalcVisibleFk INT; - DECLARE vWarehouseFk INT DEFAULT 60; - -- DECLARE vSectorFk INt; - -- DECLARE vFatherSectorFk INT; - - -- Eliminar cuando tengamos programador de Android - - CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - - SELECT * FROM ( - SELECT sub.itemFk, - sub.longName, - CONCAT('Hoy saldrán ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, - CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, - sub.upstairs, - sub.downstairs, - sub.visible, - sub.sectorFk, - CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho - FROM ( - SELECT iss.itemFk, - CONCAT(i.longName,' ',i.size,' ',IFNULL(i.subName,'') ) longName, - '' size, - CONCAT(iss.parkingCode , ' ', iss.shelvingFk) producer, - 0 upstairs, - SUM(IFNULL(iss.visible,0)) downstairs, - IF(it.isPackaging, null, IFNULL(v.visible,0)) as visible, - 0 as sectorFk - FROM vn.itemShelvingStock iss - JOIN vn.sector s ON s.id = iss.sectorFk - JOIN vn.item i on i.id = iss.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk - WHERE s.warehouseFk = vWarehouseFk - AND it.workerFk = vWorkerFk - GROUP BY itemFk - ) sub - LEFT JOIN (SELECT s.itemFk , sum(s.quantity) as pendiente - FROM vn.sale s - LEFT JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.client c on c.id = t.clientFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND ISNULL(st.saleFk) - AND (c.clientTypeFk = 1 OR c.clientTypeFk = 5) - GROUP BY s.itemFk) sub2 ON sub2.itemFk = sub.itemFk - - UNION ALL - - SELECT v.item_id , - i.longName, - CONCAT('Hoy saldrán ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, - CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, - 0, - 0, - v.visible, - 0, - v.visible AS nicho - FROM cache.visible v - JOIN vn.item i ON i.id = v.item_id - JOIN vn.itemType it ON it.id = i.typeFk - LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id - LEFT JOIN (SELECT s.itemFk , sum(s.quantity) as pendiente - FROM vn.sale s - LEFT JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.client c on c.id = t.clientFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND ISNULL(st.saleFk) - AND (c.clientTypeFk = 1 OR c.clientTypeFk = 5) - GROUP BY s.itemFk) sub5 ON sub5.itemFk = v.item_id - WHERE v.calc_id = vCalcVisibleFk - AND ISNULL(iss.itemFk) - AND it.workerFk = vWorkerFk) sub3 - WHERE nicho - ORDER BY producer; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingSaleAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSaleAdd`(vItemShelvingFk INT, saleFk INT, vQuantity INT) -BEGIN - - IF saleFk <> 0 THEN - INSERT INTO vn.itemShelvingSale(itemShelvingFk, - saleFk, - quantity, - userFk) - VALUES (vItemShelvingFk, - saleFk, - vQuantity, - getUser()); - - END IF; - - UPDATE vn.itemShelving - SET visible = (visible - vQuantity) - WHERE id = vItemShelvingFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingSaleSupplyAdd` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `itemShelvingSaleSupplyAdd`(vItemShelvingFk INT, saleFk INT, vQuantity INT) -BEGIN - -/* - * Añade línea a itemShelvingSale y regulariza el carro - * - * @param vItemShelvingFk Id itemShelving - * @param saleFk Id de sale - * @param vQuantity cantidad a regularizar - * - */ - - INSERT INTO itemShelvingSale( itemShelvingFk, - saleFk, - quantity, - userFk) - VALUES ( vItemShelvingFk, - saleFk, - vQuantity, - getUser()); - - UPDATE itemShelving - SET quantity = quantity - vQuantity, - visible = visible - vQuantity, - available = available - vQuantity - WHERE id = vItemShelvingFk; - - UPDATE vn2008.Movimientos_mark - SET valor = 1 - WHERE Id_Movimiento = saleFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingSaleSupplyAddVoz` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSaleSupplyAddVoz`(vItemShelvingFk VARCHAR(50), saleFk INT, vQuantity INT, idMovimiento INT) -BEGIN - DECLARE vItemShelvingFkAux INT; - DECLARE vItemFk INT; - - SELECT itemFk INTO vItemFk FROM vn.sale WHERE id = saleFk; - - SELECT id INTO vItemShelvingFkAux FROM vn.itemShelving WHERE shelvingFk = vItemShelvingFk COLLATE utf8_general_ci AND itemFk = vItemFk; - - INSERT INTO vn.itemShelvingSale( - itemShelvingFk, - saleFk, - quantity, - userFk - ) VALUES ( - vItemShelvingFkAux, - saleFk, - vQuantity, - getUser() - ); - - UPDATE vn.itemShelving - SET visible = visible - vQuantity - WHERE id = vItemShelvingFkAux; - - UPDATE vn2008.Movimientos_mark - SET valor = 1 - WHERE Id_Movimiento = idMovimiento; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingSaleSupplyAdd_` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `itemShelvingSaleSupplyAdd_`(vItemShelvingFk INT, saleFk INT, vQuantity INT,idMovimiento INT) -BEGIN - -INSERT INTO vn.itemShelvingSale( itemShelvingFk, - saleFk, - quantity, - userFk) - VALUES ( vItemShelvingFk, - saleFk, - vQuantity, - getUser()); - - UPDATE vn.itemShelving - SET quantity = quantity - vQuantity, - visible = visible - vQuantity, - available = available - vQuantity - WHERE id = vItemShelvingFk; - - UPDATE vn2008.Movimientos_mark - SET valor = 1 - WHERE Id_Movimiento = idMovimiento; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingTicketSource__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingTicketSource__`(vTicketFk INT) -BEGIN - DECLARE vCalcFk INT; - DECLARE vWarehouseFk INT; - - SELECT warehouseFk INTO vWarehouseFk - FROM vn.ticket - WHERE id = vTicketFk; - SET vCalcFk = cache.ticketShippingCalcIdGet(vWarehouseFk); - - SELECT - s.id, - ubication, - s.quantity, - sis.quantity as Reserved, - s.itemFk, - s.concept, - s.ticketFk, - s.isPicked, - ish.packing, - FLOOR(sis.quantity / ish.packing) as stickers, - sis.quantity MOD ish.packing as rest, - ts.shippingHour, - ts.shippingMinute - FROM vn.saleItemShelving sis - JOIN vn.itemShelving ish ON ish.id = sis.itemShelvingFk - JOIN vn.sale s ON s.id = sis.saleFk - JOIN cache.ticketShipping ts ON ts.calc_id = vCalcFk AND ts.ticketFk = vTicketFk - WHERE s.ticketFk = vTicketFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelvingTransfer` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingTransfer`(vItemShelvingFk INT,shelvingFkD VARCHAR(22)) -BEGIN - - UPDATE vn.itemShelving - SET shelvingFk = shelvingFkD - WHERE id = vItemShelvingFk; - - SELECT 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 `itemShelving_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vShelve VARCHAR(2), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT) -BEGIN - - -/** - * Añade registro o lo actualiza si ya existe. - * - * @param vShelvingFk matrícula del carro - * @param vBarcode el id del registro - * @param vShelve de itemshleving - * @param vQuantity indica la cantidad del producto - * @param vPackagingFk el packaging del producto en itemShelving, NULL para coger el de la ultima compra - * @param vGrouping el grouping del producto en itemShelving, NULL para coger el de la ultima compra - * @param vPacking el packing del producto, NULL para coger el de la ultima compra - * @param vWarehouseFk indica el sector - * - **/ - - DECLARE vItemFk INT; - - SELECT barcodeToItem(vBarcode) INTO vItemFk; - - IF (SELECT COUNT(*) FROM shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN - - INSERT IGNORE INTO parking(code) VALUES(vShelvingFk); - INSERT INTO shelving(code, parkingFk) - SELECT vShelvingFk, id - FROM parking - WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; - - END IF; - - IF (SELECT COUNT(*) FROM itemShelving - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk - AND itemFk = vItemFk - AND packing = vPacking) = 1 THEN - - UPDATE itemShelving - SET visible = visible+vQuantity - WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; - - ELSE - CALL cache.last_buy_refresh(FALSE); - INSERT INTO itemShelving( itemFk, - shelvingFk, - shelve, - visible, - grouping, - packing, - packagingFk) - - SELECT vItemFk, - vShelvingFk, - vShelve, - vQuantity, - IFNULL(vGrouping, b.grouping), - IFNULL(vPacking, b.packing), - IFNULL(vPackagingFk, b.packageFk) - FROM item i - LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN buy b ON b.id = lb.buy_id - WHERE i.id = vItemFk; - 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 `itemShelving_addByClaim` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3)) -BEGIN -/** - * Insert items of claim into itemShelving. - * - * @param vClaimFk The claim - * @param vShelvingFk The shelving - * @table tmp.buyUltimate - */ - DECLARE vWarehouseFk INT; - - SELECT t.warehouseFk INTO vWarehouseFk - FROM claim c - JOIN ticket t ON t.id = c.ticketFk - WHERE c.id = vClaimFk; - - CALL buyUltimate (vWarehouseFk, CURDATE()); - - INSERT INTO itemShelving (itemFk, shelvingFk, quantity, packing, `grouping`, visible) - SELECT s.itemFk, vShelvingFk, cb.quantity, b.packing, b.`grouping`, cb.quantity AS visible - FROM claim c - JOIN claimBeginning cb ON c.id = cb.claimFk - JOIN sale s ON s.id = cb.saleFk - JOIN ticket t ON t.id = s.ticketFk - JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk AND bu.warehouseFk = t.warehouseFk - JOIN buy b ON b.id = bu.buyFk - WHERE c.id = vClaimFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelving_BuyerGet` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_BuyerGet`( ) -BEGIN - - SELECT * FROM vn.buyer; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelving_BuyerTask` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_BuyerTask`(vWorkerFk INT ) -BEGIN - - SELECT ish.id, - ish.itemFk, - i.longName, - i.image, - p.code as parking, - ish.shelvingFk, - ish.visible, - ish.created, - ish.stars - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - WHERE s.warehouseFk = 1 - AND it.workerFk = vWorkerFk - AND ish.stars IS NULL - ORDER BY p.pickingOrder; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelving_filterBuyer` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_filterBuyer`(vBuyerFk INT, vWarehouseFk INT) -proc:BEGIN -/** - * Lista de articulos filtrados por comprador - * - * @param vBuyerFk Comprador a filtrar - * @param vWarehouseFk Warehouse - * @return Lista de articulos - */ - DECLARE vCalcVisibleFk INT; - - IF vBuyerFk = 103 THEN -- hay que arreglarlo despues de la campaña PAK 23/04/2022 - CALL vn.itemShelvingRadar_Urgent(); - LEAVE proc; - END IF; - - CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); - - SELECT * FROM - (SELECT sub.itemFk, - sub.longName, - CONCAT('Hoy saldrán ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, - CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, - sub.upstairs, - sub.downstairs, - sub.visible, - sub.sectorFk, - CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho - FROM (SELECT iss.itemFk, - CONCAT(i.longName,' ',i.size,' ',IFNULL(i.subName,'') ) longName, - '' size, - CONCAT(iss.parkingCode , ' ', iss.shelvingFk) producer, - 0 upstairs, - SUM(IFNULL(iss.visible,0)) downstairs, - IF(it.isPackaging, null, IFNULL(v.visible,0)) visible, - IFNULL(iss.sectorFk,0) sectorFk - FROM itemShelvingStock iss - JOIN sector s ON s.id = iss.sectorFk - JOIN item i on i.id = iss.itemFk - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk - WHERE s.warehouseFk = vWarehouseFk - AND it.workerFk = vBuyerFk - GROUP BY itemFk - ) sub LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente - FROM sale s - LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk - JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND ISNULL(st.saleFk) - AND ct.code IN ('normal', 'trust') - GROUP BY s.itemFk - ) sub2 ON sub2.itemFk = sub.itemFk - UNION ALL - SELECT v.item_id , - i.longName, - CONCAT('Hoy saldrán ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, - CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, - 0, - 0, - v.visible, - IFNULL(iss.sectorFk,0), - v.visible nicho - FROM cache.visible v - JOIN item i ON i.id = v.item_id - JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id - LEFT JOIN (SELECT s.itemFk , SUM(s.quantity) pendiente - FROM sale s - LEFT JOIN saleTracking st ON st.saleFk = s.id - JOIN ticket t ON t.id = s.ticketFk - JOIN client c on c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND ISNULL(st.saleFk) - AND ct.code IN ('normal', 'trust') - GROUP BY s.itemFk - ) sub5 ON sub5.itemFk = v.item_id - WHERE v.calc_id = vCalcVisibleFk - AND ISNULL(iss.itemFk) - AND it.workerFk = vBuyerFk - ) sub3 - WHERE nicho - ORDER BY producer; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelving_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_get`(IN vShelvingFk VARCHAR(8)) -BEGIN -/** - * Lista artículos de itemshelving - * - * @param vShelvingFk matrícula del carro - * - **/ - - SELECT ish.itemFk as item, - IFNULL(i.longName, CONCAT(i.name, ' ', i.size)) as description, - ish.visible as visible, - ceil(ish.visible/ish.packing) as stickers, - ish.packing as packing, - ish.grouping, - IF (p.column IS NULL, "", p.column) as col, - IF (p.row IS NULL, "", p.row) as row, - IF (p.code IS NULL, "", p.code) as code, - ish.id, - s.priority - FROM itemShelving ish - JOIN item i ON i.id = ish.itemFk - INNER JOIN shelving s ON vShelvingFk = s.code COLLATE utf8_unicode_ci - LEFT JOIN parking p ON s.parkingFk = p.id - WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vShelvingFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelving_getInfo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getInfo`(vItemFk VARCHAR(22)) -BEGIN - - /* - * Muestra información realtiva a la ubicación de un ítem - * - * @param vItemFk Id del ítem - * - */ - - SELECT vn.barcodeToItem(vItemFk) INTO vItemFk; - - SELECT pk.code as Parking, - sh.code as Matricula, - ish.visible as visible, - ish.available as Disponible, - ish.level as level, - ish.created as created, - ish.itemFk as itemFk, - sh.priority - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.`code` = ish.shelvingFk - JOIN vn.parking pk ON pk.id = sh.parkingFk - WHERE ish.itemFk = vItemFk - ORDER BY sh.priority DESC, created ASC; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelving_getSaleDate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getSaleDate`(vShelvingFk VARCHAR(3)) -BEGIN - - /* Devuelve la minima fecha en que se necesita cada producto en esa matricula. - * - * @param vShelvingFk Matrícula del carro o pallet - */ - - DECLARE vWarehouseFk INT; - - SELECT warehouseFk INTO vWarehouseFk - FROM shelving s - JOIN parking p ON s.parkingFk = p.id - JOIN sector st ON st.id = p.sectorFk - WHERE s.code = vShelvingFk COLLATE utf8_unicode_ci; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingDistinct; - CREATE TEMPORARY TABLE tmp.itemShelvingDistinct - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT itemFk, SUM(visible) visible - FROM vn.itemShelving - WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci - GROUP BY itemFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT * FROM tmp.itemShelvingDistinct; - - DROP TEMPORARY TABLE IF EXISTS tmp.stockByDay; - CREATE TEMPORARY TABLE tmp.stockByDay - (index (itemFk, dated)) - ENGINE = MEMORY - SELECT t3.amount, dated, - @stock := IF(@itemFk = t3.itemFk, @stock + t3.amount, t3.amount) stock, - @itemFk := t3.itemFk itemFk - FROM ( - SELECT * FROM ( - SELECT t2.* FROM ( - SELECT item_id itemFk, amount, CURDATE() dated - FROM cache.stock - WHERE warehouse_id = vWarehouseFk - UNION ALL - SELECT ish.itemFk, - sum(visible), CURDATE() - FROM vn.itemShelving ish - JOIN shelving sh ON sh.code = ish.shelvingFk - JOIN parking p ON sh.parkingFk = p.id - JOIN sector s ON s.id = p.sectorFk - WHERE s.isReserve - GROUP BY ish.itemFk - UNION ALL - SELECT item_id, sum(iei.amount), dat - FROM vn2008.item_entry_in iei - WHERE dat >= CURDATE() - AND warehouse_id = vWarehouseFk - AND isVirtualStock = FALSE - GROUP BY item_id, dat - UNION ALL - SELECT item_id, sum(ieo.amount), dat - FROM vn2008.item_entry_out ieo - WHERE dat >= CURDATE() - AND warehouse_id = vWarehouseFk - GROUP BY item_id, dat - UNION ALL - SELECT i.itemFk, sum(io.amount), dat - FROM vn2008.item_out io - JOIN tmp.item i ON i.itemFk = io.item_id - WHERE io.dat >= CURDATE() - AND io.warehouse_id = vWarehouseFk - GROUP BY io.item_id, io.dat - ) t2 - JOIN tmp.itemShelvingDistinct ish ON ish.itemFk = t2.itemFk) t - order by t.itemFk, DATE(t.dated), t.amount DESC) t3; - - SELECT sbd.itemFk, i.longName, DATE(dated) dated, ish.visible amount, sbd.stock - FROM tmp.stockByDay sbd - JOIN vn.item i ON i.id = sbd.itemFk - JOIN tmp.itemShelvingDistinct ish ON ish.itemFk = sbd.itemFk - WHERE ish.visible >= sbd.stock - GROUP BY itemFk - ORDER BY dated; - - DROP TEMPORARY TABLE tmp.stockByDay, - tmp.itemShelvingDistinct, - 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 `itemShelving_inventory` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_inventory`(vParkingFromFk INT, vParkingToFk INT) -BEGIN - - /** - * Devuelve un listado de ubicaciones a revisar - * - * @param vParkingFromFk Parking de partida, identificador de vn.parking - * @param vParkingToFk Parking de llegada, identificador de vn.parking - */ - - DECLARE vSectorFk INT; - DECLARE vPickingOrderFrom INT; - DECLARE vPickingOrderTo INT; - - SELECT p.sectorFk, p.pickingOrder INTO vSectorFk, vPickingOrderFrom - FROM vn.parking p - WHERE p.id = vParkingFromFk; - - SELECT p.pickingOrder INTO vPickingOrderTo - FROM vn.parking p - WHERE p.id = vParkingToFk; - - CALL vn.visible_getMisfit(vSectorFk); - - SELECT p.code parking , - ish.shelvingFk , - ish.itemFk, - i.longName, - ish.visible , - ish.visible / ish.packing packs, - ish.packing, - sm.visible - sm.parked faltan - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo - AND p.sectorFk = vSectorFk - ORDER BY p.pickingOrder ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelving_StarsUpdate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_StarsUpdate`(vId INT, vStars INT) -BEGIN - - UPDATE vn.itemShelving - SET stars = vStars - WHERE id = vId; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemShelving_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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_update`(vVisible INT, vPacking INT, vShelf INT ,vGrouping INT ) -BEGIN -/** - * Actualiza itemShelving. - * - * @param vVisible la cantidad visible del registro a actualizar - * @param vShelf el id del registro a actualizar - * @param vPacking el packing del del producto en itemShelving - * @param vGrouping el grouping del producto en itemShelving - */ - UPDATE itemShelving - SET visible = vVisible, - packing = vPacking, - grouping = vGrouping - WHERE id = vShelf; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemStock` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemStock`(vWarehouseFk SMALLINT, vDated DATETIME, vItemFk INT) -BEGIN -/** - * Calcula el stock del vWarehouseFk desde FechaInventario hasta vDated - * @param vWarehouse warehouse id - * @param vDated max date to filter - * @param vItemFk item id - **/ - - - DECLARE vIsLogifloraDay BOOLEAN; - - SET vDated = TIMESTAMP(DATE(vDated), '00:00:00'); - - SELECT vn.isLogifloraDay(vDated, vWarehouseFk) INTO vIsLogifloraDay ; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemList; - CREATE TEMPORARY TABLE tmp.itemList - (UNIQUE INDEX i USING HASH (itemFk)) - ENGINE = MEMORY - SELECT itemFk, SUM(quantity) stock, SUM(quantity) visible, SUM(quantity) available FROM ( - SELECT itemFk, quantity - FROM itemTicketOut - WHERE shipped >= CURDATE() AND shipped < vDated - AND warehouseFk = vWarehouseFk - AND (vItemFk IS NULL OR itemFk = vItemFk) - UNION ALL - SELECT itemFk, quantity - FROM itemEntryIn i - LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk - WHERE i.landed >= CURDATE() AND i.landed < vDated - AND i.warehouseInFk = vWarehouseFk - AND (vItemFk IS NULL OR i.itemFk = vItemFk) - AND (ISNULL(wf.entryFk) OR vIsLogifloraDay) - UNION ALL - SELECT itemFk, quantity - FROM itemEntryOut - WHERE shipped >= CURDATE() AND shipped < vDated - AND warehouseOutFk = vWarehouseFk - AND (vItemFk IS NULL OR itemFk = vItemFk) - ) t - GROUP BY itemFk HAVING stock != 0; - - CALL `cache`.stock_refresh (FALSE); - - INSERT INTO tmp.itemList (itemFk,stock,visible,available) - SELECT item_id,amount,amount,amount - FROM `cache`.stock - WHERE warehouse_id = vWarehouseFk AND (vItemFk IS NULL OR vItemFk = item_id) - ON DUPLICATE KEY UPDATE - stock = stock + VALUES(stock), - visible = visible + VALUES(visible), - available = available + VALUES(available); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemStockUpdate__` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `itemStockUpdate__`( - vItemFk INT, - vWarehouseFk INT, - vNewVisible INT, - vIsTrash BOOLEAN) -BEGIN - - DECLARE vTicketFk INT; - DECLARE vClientFk INT; - DECLARE vCompanyVnlFk INT DEFAULT 442; - DECLARE vVisible INT DEFAULT 0; - DECLARE vCalc INT; - DECLARE vParkedStuff INT; - - SELECT barcodeToItem(vItemFk) INTO vItemFk; - - CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); - - SELECT IFNULL(visible,0) INTO vVisible - FROM cache.visible - WHERE calc_id = vCalc - AND item_id = vItemFk; - - SELECT sum(visible) INTO vParkedStuff - FROM itemShelvingStock - WHERE warehouseFk = vWarehouseFk - AND itemFk = vItemFk; - - SET vNewVisible = vNewVisible + IFNULL(vParkedStuff,0); - - SELECT IF(vIsTrash, 200, 400) INTO vClientFk; - - SELECT t.id INTO vTicketFk - FROM ticket t - JOIN address a ON a.id=t.addressFk - WHERE t.warehouseFk = vWarehouseFk - AND t.clientFk = vClientFk - AND DATE(t.shipped) = CURDATE() - AND a.isDefaultAddress - LIMIT 1; - - IF vTicketFk IS NULL THEN - - CALL ticket_add( - vClientFk, - CURDATE(), - vWarehouseFk, - vCompanyVnlFk, - NULL, - NULL, - NULL, - CURDATE(), - account.userGetId(), - FALSE, - vTicketFk); - - END IF; - - INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vTicketFk, vItemFk, CONCAT(longName,' ', getWorkerCode(), ' ',LEFT(CAST(NOW() AS TIME),5)), vVisible - vNewVisible, 0, 0 - FROM item - WHERE id = vItemFk; - - UPDATE cache.visible - SET visible = vNewVisible - WHERE calc_id = vCalc - AND item_id = vItemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemTagMake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagMake`(vItemFk INT) -BEGIN - -/* * Crea los tags usando la tabla plantilla itemTag - * y si no existe a partir de la ficha del artículo. - * @param vItemFk El item al que se le añaden los tags -*/ - DECLARE vInk VARCHAR(50); - DECLARE vSize INTEGER; - DECLARE vCategory VARCHAR(3); - DECLARE vProducer VARCHAR(50); - DECLARE vOrigin VARCHAR(20); - DECLARE vTypeFk INTEGER; - - DELETE FROM itemTag - WHERE itemFk = vItemFk; - - SELECT typeFk INTO vTypeFk - FROM item - WHERE id = vItemFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT vItemFk, itt.tagFk, NULL, itt.priority - FROM itemTag it - LEFT JOIN itemTypeTag itt ON itt.itemTypeFk = vTypeFk - WHERE it.itemFk = vItemFk; - - IF (SELECT COUNT(*) FROM itemTag WHERE itemFk = vItemFk LIMIT 1) = 0 THEN - - SELECT ik.name, i.size, i.category, p.name, o.name - INTO vInk, vSize, vCategory, vProducer, vOrigin - FROM item i - LEFT JOIN ink ik ON ik.id = i.inkFk - LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible - LEFT JOIN origin o ON o.id = i.originFk - WHERE i.id = vItemFk; - - INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) - VALUES(vItemFk, 1, vInk, 1); - - INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) - VALUES (vItemFk, 8, vSize, 2); - - INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) - VALUES(vItemFk, 47, vCategory, 3); - - INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) - VALUES(vItemFk, 37, vProducer, 4); - - INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) - VALUES(vItemFk, 35, vOrigin, 5); - 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 `itemTagReorder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `itemTagReorder`(itemTypeFk INT) -BEGIN - - SET @isTriggerDisabled = TRUE; - - -- No se puede usar temporary porque da error Error Code: 1137. No puedo reabrir tabla: 'i - DROP TABLE IF EXISTS tmp.item; - CREATE TABLE tmp.item - SELECT DISTINCT i.id - FROM vn.item i - WHERE i.typeFk = itemTypeFk; - - UPDATE itemTag it - JOIN tmp.item i ON i.id = it.itemFk - JOIN vn.item ON item.id = i.id - JOIN itemTypeTag itt ON itt.itemTypeFk = item.typeFk AND itt.tagFk = it.tagFk - SET it.priority = itt.priority - WHERE itt.itemTypeFk = itemTypeFk; - - CALL item_refreshTags(); - - SET @isTriggerDisabled = FALSE; - - DROP TABLE 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 `itemTagReorderByName` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorderByName`(vName VARCHAR(255)) -BEGIN - - SET @isTriggerDisabled = TRUE; - - -- No se puede usar temporary porque da error Error Code: 1137. No puedo reabrir tabla: 'i - DROP TABLE IF EXISTS tmp.item; - CREATE TABLE tmp.item - SELECT DISTINCT i.id - FROM vn.item i - WHERE i.`name` LIKE CONCAT(vName,'%'); - - UPDATE itemTag it - JOIN tmp.item i ON i.id = it.itemFk - JOIN vn.item ON item.id = i.id - JOIN itemTypeTag itt ON itt.itemTypeFk = item.typeFk AND itt.tagFk = it.tagFk - SET it.priority = itt.priority - WHERE itt.itemTypeFk = itemTypeFk; - - CALL item_refreshTags(); - - SET @isTriggerDisabled = FALSE; - - DROP TABLE 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 `itemTagReorderByName__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorderByName__`(vName VARCHAR(255)) -BEGIN - -DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vItem INT; - - DECLARE cur CURSOR FOR - SELECT id - FROM upda; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SET @isTriggerDisabled = TRUE; - - DROP TEMPORARY TABLE IF EXISTS upda; - CREATE TEMPORARY TABLE upda - SELECT DISTINCT i.id - FROM vn.item i - WHERE i.name LIKE CONCAT(vName,'%'); - - UPDATE itemTag it - JOIN item i ON i.id = it.itemFk - JOIN itemTypeTag itt ON itt.itemTypeFk = i.typeFk AND itt.tagFk = it.tagFk - SET it.priority = itt.priority - WHERE itt.itemTypeFk = itemTypeFk; - - OPEN cur; - proc: LOOP - SET vDone = FALSE; - FETCH cur INTO vItem; - IF vDone THEN - LEAVE proc; - END IF; - CALL vn.itemRefreshTags(vItem); - END LOOP; - CLOSE cur; - SET @isTriggerDisabled = 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 `itemTagReorder__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorder__`(itemTypeFk INT) -BEGIN - -DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vItem INT; - - DECLARE cur CURSOR FOR - SELECT id - FROM upda; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SET @isTriggerDisabled = TRUE; - - DROP TEMPORARY TABLE IF EXISTS upda; - create temporary table upda - SELECT DISTINCT i.id - FROM vn.item i - WHERE i.typeFk = itemTypeFk; - - UPDATE itemTag it - JOIN item i ON i.id = it.itemFk - JOIN itemTypeTag itt ON itt.itemTypeFk = i.typeFk AND itt.tagFk = it.tagFk - SET it.priority = itt.priority - WHERE itt.itemTypeFk = itemTypeFk; - - OPEN cur; - proc: LOOP - SET vDone = FALSE; - FETCH cur INTO vItem; - IF vDone THEN - LEAVE proc; - END IF; - CALL vn.itemRefreshTags(vItem); - END LOOP; - CLOSE cur; - SET @isTriggerDisabled = 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 `itemTagReplace__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReplace__`(fromItemFk INT, toItemFk INT) -BEGIN - -/* - * deprecated use itemTag_replace - */ - DELETE FROM itemTag - WHERE itemFk = toItemFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT toItemFk, tagFk, value, priority - FROM itemTag - WHERE itemFk = fromItemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemTag_replace` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100)) -BEGIN - - /* Reemplaza los tags de un artículo por los de otro, así como su imagen - * - * @param vItemFromFk id de vn.item con el artículo del que se toman los tags - * @param vItemToFk id de vn.item con el artículo del que se toman los tags - * @param vPicture imagen del artículo. Opcional. Si no se especifica, hereada la del vItemFromFk - */ - - DELETE FROM vn.itemTag - WHERE itemFk = vItemToFk; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemToFk, tagFk, value, priority - FROM vn.itemTag - WHERE itemFk = vItemFromFk; - - IF ISNULL(vPicture) THEN - - SELECT image INTO vPicture - FROM vn.item - WHERE id = vItemFromFk; - - END IF; - - UPDATE vn.item i - SET i.image = vPicture - WHERE i.id = vItemToFk; - - CALL vn.itemRefreshTags(vItemToFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemTopSeller` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTopSeller`() -BEGIN - DECLARE vCategoryFk INTEGER; - DECLARE vDone INT DEFAULT FALSE; - DECLARE rs CURSOR FOR - SELECT DISTINCT id - FROM vn.itemCategory - WHERE merchandise <> FALSE; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - RESIGNAL; - END; - - DROP TABLE IF EXISTS tmp.topSellerMin; - CREATE TEMPORARY TABLE tmp.topSellerMin ENGINE = MEMORY - SELECT s.itemFk, SUM(s.quantity) AS total, v.tipo_id typeFk - FROM vn.sale s - INNER JOIN bs.ventas v ON v.Id_Movimiento = s.id - WHERE v.fecha BETWEEN TIMESTAMPADD(DAY, - 7, CURDATE()) AND CURDATE() - GROUP BY s.itemFk; - - DROP TABLE IF EXISTS tmp.topSeller; - CREATE TEMPORARY TABLE tmp.topSeller - ( - `id` int(11) NOT NULL DEFAULT '0', - `typeFk` smallint(5) unsigned NOT NULL, - `itemCategoryFk` int(10) unsigned NOT NULL, - `total` bigint(21) NOT NULL DEFAULT '0' - ) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - - OPEN rs; - read_loop: LOOP - FETCH rs INTO vCategoryFk; - - IF vDone THEN - LEAVE read_loop; - END IF; - - INSERT INTO tmp.topSeller - SELECT tsm.itemFk, tsm.typeFk, it.categoryFk, tsm.total - FROM tmp.topSellerMin tsm - INNER JOIN vn.itemType it ON it.id = tsm.typeFk - WHERE it.categoryFk = vCategoryFk - ORDER BY tsm.itemFk ,tsm.total DESC - LIMIT 5; - - END LOOP; - CLOSE rs; - - SELECT i.name ,i.id, i.image, i.typeFk, it.categoryFk AS itemCategoryFk, - ic.name AS itemCategoryName, it.name AS itemTypeName, ts.total - FROM tmp.topSeller ts - INNER JOIN vn.item i ON i.id = ts.id - INNER JOIN vn.itemType it ON it.id = ts.typeFk - INNER JOIN vn.itemCategory ic ON ic.id = it.categoryFk; - - DROP TABLE IF EXISTS topSellerMin; - DROP TABLE IF EXISTS tmp.topSeller; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemTrash` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTrash`( - vItemFk INT, - vWarehouseFk INT, - vQuantity INT, - vIsTrash BOOLEAN) -BEGIN - - DECLARE vTicketFk INT; - DECLARE vClientFk INT; - DECLARE vCompanyVnlFk INT DEFAULT 442; - DECLARE vCalc INT; - - SELECT barcodeToItem(vItemFk) INTO vItemFk; - - SELECT IF(vIsTrash, 200, 400) INTO vClientFk; - - SELECT t.id INTO vTicketFk - FROM ticket t - JOIN address a ON a.id=t.addressFk - WHERE t.warehouseFk = vWarehouseFk - AND t.clientFk = vClientFk - AND DATE(t.shipped) = CURDATE() - AND a.isDefaultAddress - LIMIT 1; - - CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); - - IF vTicketFk IS NULL THEN - - CALL ticket_add( - vClientFk, - CURDATE(), - vWarehouseFk, - vCompanyVnlFk, - NULL, - NULL, - NULL, - CURDATE(), - account.userGetId(), - FALSE, - vTicketFk); - END IF; - - INSERT INTO sale(ticketFk, itemFk, concept, quantity) - SELECT vTicketFk, - vItemFk, - CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(NOW() AS TIME),5)), - vQuantity - FROM item - WHERE id = vItemFk; - - UPDATE cache.visible - SET visible = visible - vQuantity - WHERE calc_id = vCalc - AND item_id = vItemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `itemUpdateTag` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemUpdateTag`(IN vItem BIGINT) -BEGIN - - -UPDATE item i -JOIN producer p ON p.id = i.producerFk -SET i.subName = p.name -WHERE p.isVisible -AND (vItem IS NULL OR vItem = i.id); - -UPDATE item i -JOIN itemTag it ON it.itemFk = i.id -JOIN tag t ON t.id = it.tagFk -SET tag5 = t.name, value5 = it.value -WHERE it.priority = 1 -AND (vItem IS NULL OR vItem = i.id); - -UPDATE item i -JOIN itemTag it ON it.itemFk = i.id -JOIN tag t ON t.id = it.tagFk -SET tag6 = t.name, value6 = it.value -WHERE it.priority = 2 -AND (vItem IS NULL OR vItem = it.itemFk); - -UPDATE item i -JOIN itemTag it ON it.itemFk = i.id -JOIN tag t ON t.id = it.tagFk -SET tag7 = t.name, value7 = it.value -WHERE it.priority = 3 -AND (vItem IS NULL OR vItem = it.itemFk); - -UPDATE item i -JOIN itemTag it ON it.itemFk = i.id -JOIN tag t ON t.id = it.tagFk -SET tag8 = t.name, value8 = it.value -WHERE it.priority = 4 -AND (vItem IS NULL OR vItem = it.itemFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_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 = 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`@`localhost` PROCEDURE `item_clean`(vItemFrom INT, vItemTo INT) -BEGIN - -/* - * Elimina todos los items repetidos y los sustituye por el que tiene menor id - */ - - START TRANSACTION; - - SET @isModeInventory:= TRUE; - - -- Deletes - - UPDATE IGNORE vn.itemCost ic - JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld - SET ic.itemFk = itr.idNew; - - DELETE ic.* - FROM vn.itemCost ic - JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld; - - DELETE rt.* - FROM vn2008.rec_translator rt - JOIN tmp.itemsToReplace itr ON rt.Id_Article = itr.idOld; - - DELETE w.* - FROM bs.waste w - JOIN tmp.itemsToReplace itr ON w.itemFk = itr.idOld; - - DELETE pf.* - FROM vn.priceFixed pf - JOIN tmp.itemsToReplace itr ON pf.itemFk = itr.idOld; - - DELETE imp.* - FROM vn.itemMatchProperties imp - JOIN tmp.itemsToReplace itr ON imp.itemFk = itr.idOld; - - DELETE ib.* - FROM vn.itemBotanical ib - JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; - - DELETE ip.* - FROM vn.itemProposal ip - JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; - - DELETE it.* - FROM vn.itemTag it - JOIN tmp.itemsToReplace itr ON it.itemFk = itr.idOld; - - DELETE ib.* - FROM vn.itemBarcode ib - JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; - - DELETE itc.* - FROM vn.itemTaxCountry itc - JOIN tmp.itemsToReplace itr ON itc.itemFk = itr.idOld; - - DELETE ip.* - FROM vn.itemPlacement ip - JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; - - -- Updates - - UPDATE vn.buy b - JOIN tmp.itemsToReplace itr ON b.itemFk = itr.idOld - SET b.itemFk = itr.idNew; - - UPDATE vn.sale s - JOIN tmp.itemsToReplace itr ON s.itemFk = itr.idOld - SET s.itemFk = itr.idNew; - - UPDATE vn.specialPrice sp - JOIN tmp.itemsToReplace itr ON sp.itemFk = itr.idOld - SET sp.itemFk = itr.idNew; - - UPDATE vn.packaging p - JOIN tmp.itemsToReplace itr ON p.itemFk = itr.idOld - SET p.itemFk = itr.idNew; - - UPDATE vn.packaging p - JOIN tmp.itemsToReplace itr ON p.freightItemFk = itr.idOld - SET p.freightItemFk = itr.idNew; - - UPDATE hedera.orderRow o - JOIN tmp.itemsToReplace itr ON o.itemFk = itr.idOld - SET o.itemFk = itr.idNew; - - UPDATE vn.itemLog il - JOIN tmp.itemsToReplace itr ON il.originFk = itr.idOld - SET il.originFk = itr.idNew; - - UPDATE vn.itemShelving ish - JOIN tmp.itemsToReplace itr ON ish.itemFk = itr.idOld - SET ish.itemFk = itr.idNew; - - UPDATE vn.ticketPackagingStartingStock tpss - JOIN tmp.itemsToReplace itr ON tpss.itemFk = itr.idOld - SET tpss.itemFk = itr.idNew; - - UPDATE vn.inventoryFailure ifa - JOIN tmp.itemsToReplace itr ON ifa.itemFk = itr.idOld - SET ifa.itemFk = itr.idNew; - - UPDATE vn.genericAllocation ga - JOIN tmp.itemsToReplace itr ON ga.itemFk = itr.idOld - SET ga.itemFk = itr.idNew; - - UPDATE vn.itemPlacementSupply ips - JOIN tmp.itemsToReplace itr ON ips.itemFk = itr.idOld - SET ips.itemFk = itr.idNew; - - -- Eliminamos los items repetidos - - DELETE i.* - FROM vn.item i - JOIN tmp.itemsToReplace itr ON i.id = itr.idOld; - - SET @isModeInventory:= FALSE; - - 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 `item_cleanLauncher` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `item_cleanLauncher`() -BEGIN - - DECLARE vItemTo INT DEFAULT 0; - DECLARE vStep INT DEFAULT 500; - DECLARE vCounter INT DEFAULT 0; - DECLARE vItemFrom INT; - DECLARE vItemEnd INT; - - SELECT itemFrom INTO vItemFrom - FROM tmp.itemCleanCount - ORDER BY created DESC - LIMIT 1; - - SET vItemEnd = vItemFrom + 100000; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplaceSource; - CREATE TEMPORARY TABLE tmp.itemsToReplaceSource - SELECT i.id idOld, - i2.id idNew - FROM vn.item i - JOIN ( SELECT i.id, - i.name, - i.subname, - i.value5, - i.value6, - i.value7, - i.value8, - i.value9, - i.value10, - i.NumberOfItemsPerCask, - i.EmbalageCode, - i.quality - FROM vn.item i - LEFT JOIN (SELECT i.id, - sr.NumberOfUnits, - MAX(di.LatestOrderDateTime) lodt - FROM vn.item i - JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk - JOIN edi.deliveryInformation di ON di.supplyResponseID = i.supplyResponseFk - GROUP BY i.id) sub ON sub.id = i.id - WHERE i.id > 170000 - AND (ISNULL(i.supplyResponseFk) - OR sub.NumberOfUnits=0 - OR sub.lodt < NOW()) - GROUP BY i.name, - subname, - value5, - value6, - value7, - value8, - value9, - value10, - NumberOfItemsPerCask, - EmbalageCode, - quality - ORDER BY i.id) i2 ON i2.name <=> i.name - AND i2.subname <=> i.subname - AND i2.value5 <=> i.value5 - AND i2.value6 <=> i.value6 - AND i2.value7 <=> i.value7 - AND i2.value8 <=> i.value8 - AND i2.value9 <=> i.value9 - AND i2.value10 <=> i.value10 - AND i2.NumberOfItemsPerCask <=> i.NumberOfItemsPerCask - AND i2.EmbalageCode <=> i.EmbalageCode - AND i2.quality <=> i.quality - WHERE i.id > 170000 - AND i.id <> i2.id - ORDER BY i2.id; - - WHILE vItemTo < vItemEnd AND NOT (SELECT isStop FROM tmp.stoper) DO - - SET vItemTo = LEAST(vItemEnd, vItemFrom + vStep); - - SELECT COUNT(*) INTO vCounter - FROM tmp.itemsToReplaceSource - WHERE idNew BETWEEN vItemFrom - AND vItemTo; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplace; - CREATE TEMPORARY TABLE tmp.itemsToReplace - SELECT * - FROM tmp.itemsToReplaceSource - WHERE idNew BETWEEN vItemFrom - AND vItemTo; - - CALL vn.item_clean(vItemFrom, vItemTo); - - SET vItemFrom = vItemTo; - - INSERT INTO tmp.itemCleanCount(itemFrom, itemDeleted) - VALUES (vItemFrom, vCounter); - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplace; - DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplaceSource; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getBalance` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getBalance`(IN vItemId int, IN vWarehouse int) -BEGIN - DECLARE vDateInventory DATETIME; - DECLARE vCurdate DATE DEFAULT CURDATE(); - DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); - - SELECT inventoried INTO vDateInventory FROM config; - SET @a = 0; - SET @currentLineFk = 0; - SET @shipped = ''; - - SELECT DATE(@shipped:= shipped) shipped, - alertLevel, - stateName, - origin, - reference, - clientFk, - name, - `in` AS invalue, - `out`, - @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, - @currentLineFk := IF (@shipped < CURDATE() - OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)), - lineFk,@currentLineFk) lastPreparedLineFk, - isTicket, - lineFk, - isPicked, - clientType, - claimFk - FROM - ( SELECT tr.landed AS shipped, - b.quantity AS `in`, - NULL AS `out`, - al.id AS alertLevel, - st.name AS stateName, - s.name AS name, - e.ref AS reference, - e.id AS origin, - s.id AS clientFk, - IF(al.id = 3, TRUE, FALSE) isPicked, - FALSE AS isTicket, - b.id lineFk, - NULL `order`, - NULL AS clientType, - NULL AS claimFk - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.id = - CASE - WHEN tr.landed < CURDATE() THEN 3 - WHEN tr.landed = CURDATE() AND tr.isReceived = TRUE THEN 3 - ELSE 0 - END - JOIN state st ON st.code = al.code - WHERE tr.landed >= vDateInventory - AND vWarehouse = tr.warehouseInFk - AND b.itemFk = vItemId - AND e.isInventory = FALSE - AND e.isRaid = FALSE - UNION ALL - - SELECT tr.shipped, - NULL, - b.quantity, - al.id, - st.name, - s.name, - e.ref, - e.id, - s.id, - IF(al.id = 3, TRUE, FALSE), - FALSE, - b.id, - NULL, - NULL, - NULL - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN warehouse w ON w.id = tr.warehouseOutFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.id = - CASE - WHEN tr.shipped < CURDATE() THEN 3 - WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3 - ELSE 0 - END - JOIN state st ON st.code = al.code - WHERE tr.shipped >= vDateInventory - AND vWarehouse =tr.warehouseOutFk - AND s.id <> 4 - AND b.itemFk = vItemId - AND e.isInventory = FALSE - AND w.isFeedStock = FALSE - AND e.isRaid = FALSE - UNION ALL - - SELECT DATE(t.shipped), - NULL, - s.quantity, - al.id, - st.name, - t.nickname, - t.refFk, - t.id, - t.clientFk, - stk.id, - TRUE, - s.id, - st.`order`, - ct.code, - cb.claimFk - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN ticketState ts ON ts.ticket = t.id - LEFT JOIN state st ON st.code = ts.code - JOIN client c ON c.id = t.clientFk - JOIN clientType ct ON ct.id = c.clientTypeFk - JOIN alertLevel al ON al.id = - CASE - WHEN t.shipped < curdate() THEN 3 - WHEN t.shipped > util.dayEnd(curdate()) THEN 0 - ELSE IFNULL(ts.alertLevel, 0) - END - LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' - LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id - LEFT JOIN claimBeginning cb ON s.id = cb.saleFk - WHERE t.shipped >= vDateInventory - AND s.itemFk = vItemId - AND vWarehouse =t.warehouseFk - ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC - ) AS itemDiary; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getInfo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getInfo`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT) -BEGIN - - /* - * Devuelve información relativa al item correspondiente del vBarcode pasado - * - * @param vBarcode código relativo al ítem - * @param vWarehouseFk código del almacén - */ - - DECLARE vCacheVisibleFk INT; - DECLARE vCacheAvailableFk INT; - DECLARE vVisibleItemShelving INT; - DECLARE vItemFk INT; - - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); - CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); - - SELECT SUM(visible) INTO vVisibleItemShelving - FROM vn.itemShelvingStock - WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); - - SELECT i.id, - i.longName, - i.tag5, - i.value5, - i.tag6, - i.value6, - i.tag7, - i.value7, - i.image, - i.size, - i.stems, - i.category, - i.minimum as min, - p.name as producer, - o.code as origin, - v.visible - IFNULL(vVisibleItemShelving,0) as unlocated, - a.available, - vVisibleItemShelving, - v.visible, - c.`grouping`, - c.packing, - CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, - CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, - i.itemPackingTypeFk, - i.comment as reference - FROM vn.item i - LEFT JOIN vn.producer p ON p.id = i.producerFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id - LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id - LEFT JOIN ( - SELECT b.itemFk, b2.`grouping`, b2.packing - FROM tmp.buyUltimate b - JOIN vn.buy b2 ON b2.id = b.buyFk - WHERE b.warehouseFk = vWarehouseFk - ) c ON i.id = c.itemFk - WHERE i.id = vItemFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getLack` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getLack`(IN vForce BOOLEAN, IN vDays INT) -BEGIN -/** - * Calcula una tabla con el máximo negativo visible para cada producto y almacen - * - * @param vForce Fuerza el recalculo del stock - * @param vDays Numero de dias a considerar -**/ - - CALL `cache`.stock_refresh(vForce); - CALL item_getMinacum(NULL, CURDATE(), vDays, NULL); - CALL item_getMinETD(); - - SELECT i.id itemFk, - i.longName, - w.id warehouseFk, - p.`name` producer, - i.`size`, - i.category, - w.name warehouse, - SUM(IFNULL(sub.amount,0)) lack, - i.inkFk, - IFNULL(im.timed, util.midnight()) timed - FROM (SELECT item_id, - warehouse_id, - amount - FROM cache.stock - WHERE amount > 0 - UNION ALL - SELECT itemFk, - warehouseFk, - amount - FROM tmp.itemMinacum - ) sub - JOIN warehouse w ON w.id = sub.warehouse_id - JOIN item i ON i.id = sub.item_id - LEFT JOIN producer p ON p.id = i.producerFk - JOIN itemType it ON it.id = i.typeFk - JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id - WHERE w.isForTicket - AND it.making IS NULL - AND ic.display <> 0 - AND it.code != 'GEN' - GROUP BY i.id, w.id - HAVING lack < 0; - - DROP TEMPORARY TABLE tmp.itemMinacum; - DROP TEMPORARY TABLE tmp.itemMinETD; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getMinacum` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getMinacum`(IN vWarehouseFk TINYINT, IN vDatedFrom DATETIME, IN vRange INT, IN vItemFk INT) -BEGIN -/** - * Cálculo del mínimo acumulado, para un item si especificado, para todo el stock si es nulo - * - * @param vWarehouseFk -> warehouseFk - * @param vDatedFrom -> fecha inicio - * @param vRange -> número de días a considerar - * @param vItemFk -> Identificador de item - * @return tmp.itemMinacum -*/ - - DECLARE vDatedTo DATETIME; - - SET vDatedFrom = TIMESTAMP(DATE(vDatedFrom), '00:00:00'); - SET vDatedTo = TIMESTAMP(TIMESTAMPADD(DAY, vRange, vDatedFrom), '23:59:59'); - - DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; - - CREATE TEMPORARY TABLE tmp.itemMinacum - (INDEX(itemFk)) - ENGINE = MEMORY - SELECT sub1.itemFk, - sub1.warehouseFk, - minacum(sub1.dated, amount, DATE(vDatedFrom)) amount - FROM (SELECT sub.itemFk, - sub.dated, - SUM(sub.amount) amount, - sub.warehouseFk - FROM (SELECT s.itemFk, - DATE(t.shipped) dated, - -s.quantity amount, - t.warehouseFk - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo - AND s.quantity != 0 - AND (vItemFk IS NULL OR s.itemFk = vItemFk) - AND (vWarehouseFk IS NULL OR t.warehouseFk = vWarehouseFk) - UNION ALL - SELECT b.itemFk, - t.landed, - b.quantity, - t.warehouseInFk - FROM buy b - JOIN entry e ON e.id = b.entryFk - LEFT JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vDatedFrom AND vDatedTo - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND !e.isInventory - AND b.quantity != 0 - AND (vItemFk IS NULL OR b.itemFk = vItemFk) - UNION ALL - SELECT b.itemFk, - t.shipped, - -b.quantity, - t.warehouseOutFk - FROM buy b - JOIN entry e ON e.id = b.entryFk - LEFT JOIN travel t ON t.id = e.travelFk - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo - AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk) - AND !e.isInventory - AND b.quantity != 0 - AND (vItemFk IS NULL OR b.itemFk = vItemFk) - AND !e.isRaid - ) sub - GROUP BY sub.itemFk, sub.dated, sub.warehouseFk - ) sub1 - GROUP BY sub1.itemFk, sub1.warehouseFk - HAVING 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 `item_getMinETD` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getMinETD`() -BEGIN - -/* Devuelve una tabla temporal con la primera ETD, para todos los artículos con salida hoy. - * - * @return tmp.itemMinETD(itemFk, timed) - */ - - DECLARE vMidnight DATETIME DEFAULT util.midnight(); - - DROP TEMPORARY TABLE IF EXISTS tmp.itemMinETD; - - CREATE TEMPORARY TABLE tmp.itemMinETD - (INDEX (itemFk)) - ENGINE = MEMORY - SELECT s.itemFk, MIN(TIME(IFNULL(z.`hour`,vMidnight))) timed - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - LEFT JOIN `zone` z ON z.id = t.zoneFk - WHERE t.shipped BETWEEN CURDATE() AND vMidnight - GROUP BY s.itemFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getSimilar` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getSimilar`(vItemFk INT, vWarehouseFk INT, vDate DATE, vIsShowedByType BOOL) -BEGIN - -/** - * Propone articulos similares para posible cambio, - * ordenado con la cantidad de veces usado y segun sus caracteristicas - * - * @param vItemFk item id - * @param vWarehouseFk warehouse id - * @param vDate fecha para revisar disponible - * @param vIsShowedByType para mostrar solo artículos de ese tipo - */ - - DECLARE vCalcFk INT; - DECLARE vTypeFk INT; - - DECLARE vTag1 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vTag5 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vTag6 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vTag7 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vTag8 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - - DECLARE vValue1 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vValue5 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vValue6 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; - - - SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value - INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 - FROM vn.item i - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - WHERE i.id = vItemFk; - - CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDate); - - SELECT i.id itemFk, - i.longName, - i.subName, - i.tag5, - i.value5, - (i.value5 <=> vValue5) match5, - i.tag6, - i.value6, - (i.value6 <=> vValue6) match6, - i.tag7, - i.value7, - (i.value7 <=> vValue7) match7, - i.tag8, - i.value8, - (i.value8 <=> vValue8) match8, - a.available, - IFNULL(ip.counter,0) counter, - IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity - FROM vn.item i - JOIN cache.available a ON a.item_id = i.id - LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk - LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 - LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - WHERE a.calc_id = vCalcFk - AND available > 0 - AND IF(vIsShowedByType, i.typeFk = vTypeFk, TRUE) - AND i.id != vItemFk - ORDER BY counter DESC, - (t1.name = vTag1) DESC, - (it1.value = vValue1) DESC, - (i.tag6 = vTag6) DESC, - (i.value6 = vValue6) DESC, - (i.tag5 = vTag5) DESC, - (i.value5 = vValue5) DESC, - (i.tag7 = vTag7) DESC, - (i.value7 = vValue7) DESC, - (i.tag8 = vTag8) DESC, - (i.value8 = vValue8) DESC - LIMIT 30; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_GetVisible` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_GetVisible`(vWarehouse SMALLINT, vItem INT) -BEGIN - DECLARE vTomorrow DATETIME DEFAULT TIMESTAMPADD(DAY, 1, CURDATE()); - - INSERT INTO vn2008.tmp_item (item_id, visible) - SELECT item_id, SUM(amount) amount - FROM ( - SELECT i.itemFk AS item_id, quantity AS amount - FROM itemTicketOut i - LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk - JOIN state s ON s.id = ts.stateFk - LEFT JOIN (SELECT DISTINCT saleFk - FROM saleTracking st - JOIN state s ON s.id = st.stateFk - WHERE st.created > CURDATE() - AND (s.isPicked OR st.isChecked) - ) stPrevious ON `stPrevious`.`saleFk` = i.saleFk - WHERE i.warehouseFk = vWarehouse - AND (vItem IS NULL OR i.itemFk = vItem) - AND (s.isPicked OR i.reserved OR stPrevious.saleFk ) - AND i.shipped >= CURDATE() AND i.shipped < vTomorrow - UNION ALL - SELECT iei.itemFk, quantity - FROM itemEntryIn iei - LEFT JOIN itemPlacement ip ON ip.itemFk = iei.itemFk AND ip.warehouseFk = vWarehouse - WHERE (iei.isReceived != FALSE /*OR ip.modificationDate > CURDATE()*/) - AND iei.landed >= CURDATE() AND iei.landed < vTomorrow - AND iei.warehouseInFk = vWarehouse - AND (vItem IS NULL OR iei.itemFk = vItem) - AND iei.isVirtualStock is FALSE - UNION ALL - SELECT itemFk, quantity - FROM itemEntryOut - WHERE isDelivered != FALSE - AND shipped >= CURDATE() AND shipped < vTomorrow - AND warehouseOutFk = vWarehouse - AND (vItem IS NULL OR itemFk = vItem) - ) t - GROUP BY item_id - ON DUPLICATE KEY UPDATE - visible = IFNULL(stock,0) + VALUES(visible); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getVisibleAvailable__` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `item_getVisibleAvailable__`( - vItem INT, - vDate DATE, - vWarehouse TINYINT, - vRefresh BOOL) -BEGIN - DECLARE vVisibleCalc INT; - DECLARE vAvailableCalc INT; - DECLARE vVisibleAltillo INT; - - CALL cache.available_refresh(vAvailableCalc, FALSE /*vRefresh*/ , vWarehouse, vDate); - CALL cache.visible_refresh(vVisibleCalc, FALSE,vWarehouse); - - SELECT SUM(visible) INTO vVisibleAltillo - FROM vn.itemShelvingStock - WHERE itemFk = vItem - AND warehouseFk = vWarehouse; - - IF vRefresh THEN - - DROP TEMPORARY TABLE IF EXISTS vn2008.tmp_item; - CREATE TEMPORARY TABLE vn2008.tmp_item - (PRIMARY KEY (item_id)) - ENGINE = MEMORY - SELECT vItem item_id, 0 stock, 0 visible; - - SELECT i.id, i.longName, i.box, i.typeFk, - i.tag5,i.value5,i.tag6,i.value6,i.tag7,i.value7,i.tag8,i.value8, - ip.code, ip.reserve, - vi.visible - IFNULL(vVisibleAltillo,0) AS visible, - av.available - FROM vn.item i - LEFT JOIN vn.itemPlacement ip - ON i.id = ip.itemFk AND ip.warehouseFk = vWarehouse - LEFT JOIN vn2008.tmp_item v - ON v.item_id = i.id - LEFT JOIN cache.available av - ON av.calc_id = vAvailableCalc AND av.item_id = i.id - LEFT JOIN cache.visible vi - ON vi.calc_id = vVisibleCalc AND vi.item_id = i.id - LEFT JOIN cache.stock st - ON st.warehouse_id = vWarehouse AND st.item_id = i.id - WHERE (vItem IS NULL OR i.id = vItem); - - ELSE - - SELECT i.id, i.longName, i.box, i.typeFk, - i.tag5,i.value5,i.tag6,i.value6,i.tag7,i.value7,i.tag8,i.value8, - ip.code, ip.reserve, - v.visible - IFNULL(vVisibleAltillo,0) AS visible, - av.available - FROM vn.item i - LEFT JOIN vn.itemPlacement ip - ON i.id = ip.itemFk AND ip.warehouseFk = vWarehouse - LEFT JOIN cache.visible v - ON v.item_id = i.id AND v.calc_id = vVisibleCalc - LEFT JOIN cache.available av - ON av.item_id = i.id AND av.calc_id = vAvailableCalc - WHERE (vItem IS NULL OR i.id = vItem); - - 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 `item_refreshTags` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags`() -BEGIN -/** - * Actualiza la tabla item, los campos "cache" de tags - * - * @param temporary table tmp.item(id) del articulo - **/ - - DECLARE done INT DEFAULT FALSE; - DECLARE vItemFk INT; - DECLARE cur1 CURSOR FOR SELECT id FROM tmp.item; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN cur1; - - read_loop: LOOP - - FETCH cur1 INTO vItemFk; - - IF done THEN - LEAVE read_loop; - END IF; - - UPDATE item i - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, IF(it3.`value` = 'A1','',it3.`value`)) - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` AND ta2.`value` != 'Rosa' - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` - SET i.`name` = CONCAT_WS(' ', - IFNULL(ta1.abbreviation,it1.`value`), - IFNULL(ta2.abbreviation,it2.`value`), - IF(i.id > 400000,'',IFNULL(ta3.abbreviation,it3.`value`))) - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 - SET i.subName = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag5 = t.name, value5 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag6 = t.name, value6 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7 - LEFT JOIN tag t ON t.id = it.tagFk - SET i.tag7 = t.name, i.value7 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag8 = t.name, value8 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag9 = t.name, value9 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag10 = t.name, value10 = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag color se modifica también el antiguo campo color - UPDATE item i - JOIN tag t ON t.overwrite = 'inkFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN ink ON ink.`name` = it.`value` - SET i.inkFk = ink.id - WHERE i.id = vItemFk; - - -- Al insertar el tag origen se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'originFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN origin o ON o.`name` = it.`value` - SET i.originFk = o.id - WHERE i.id = vItemFk; - - -- Al insertar el tag medida se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'size' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.size = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag productor se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'producerFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN producer p ON p.`name` = it.`value` - SET i.producerFk = p.id - WHERE i.id = vItemFk; - - -- Al insertar el tag tallos se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'stems' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.stems = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag categoria se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'category' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.category = it.`value` - WHERE i.id = vItemFk; - - -- Comprueba si existe un genérico y lo asigna - CALL vn.item_setGeneric(vItemFk); - - END LOOP; - - CLOSE cur1; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_refreshTags_beta` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags_beta`() -BEGIN -/** - * Actualiza la tabla item, los campos "cache" de tags - * - * @param temporary table tmp.item(id) del articulo - **/ - - DECLARE done INT DEFAULT FALSE; - DECLARE vItemFk INT; - DECLARE cur1 CURSOR FOR SELECT id FROM tmp.item; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN cur1; - - read_loop: LOOP - - FETCH cur1 INTO vItemFk; - - IF done THEN - LEAVE read_loop; - END IF; - - UPDATE item i - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, IF(it3.`value` = 'A1','',it3.`value`)) - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` - SET i.`name` = CONCAT_WS(' ', - IFNULL(ta1.abbreviation,it1.`value`), - IFNULL(ta2.abbreviation,it2.`value`), - IF(i.id > 400000,'',IFNULL(ta3.abbreviation,it3.`value`))) - WHERE i.id = vItemFk; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 - SET i.subName = it.`value`; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag5 = t.name, value5 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag6 = t.name, value6 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7 - LEFT JOIN tag t ON t.id = it.tagFk - SET i.tag7 = t.name, i.value7 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag8 = t.name, value8 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag9 = t.name, value9 = it.`value` - WHERE i.id = vItemFk; - - UPDATE item i - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag10 = t.name, value10 = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag color se modifica también el antiguo campo color - UPDATE item i - JOIN tag t ON t.overwrite = 'inkFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN ink ON ink.`name` = it.`value` - SET i.inkFk = ink.id - WHERE i.id = vItemFk; - - -- Al insertar el tag origen se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'originFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN origin o ON o.`name` = it.`value` - SET i.originFk = o.id - WHERE i.id = vItemFk; - - -- Al insertar el tag medida se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'size' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.size = it.`value` - WHERE i.id = vItemFk; - - -- Al insertar el tag productor se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'producerFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN producer p ON p.`name` = it.`value` - SET i.producerFk = p.id - WHERE i.id = vItemFk; - - -- Al insertar el tag tallos se modifica también en la tabla item - UPDATE item i - JOIN tag t ON t.overwrite = 'stems' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.stems = it.`value` - WHERE i.id = vItemFk; - - END LOOP; - - CLOSE cur1; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_refreshTags__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags__`() -BEGIN -/** - * Actualiza la tabla item, los campos "cache" de tags - * Para actualizar mas de un registro, la tabla NO tiene que ser en memoria - * Error Code: 1137. No puedo reabrir tabla: 'tmpI - * - * @param temporary table tmp.item(id) del articulo - **/ - DROP TEMPORARY TABLE IF EXISTS tmp.itemToRefresh; - CREATE TEMPORARY TABLE tmp.itemToRefresh - SELECT id from tmp.item; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, IF(it3.`value` = 'A1','',it3.`value`)); - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id - LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` - LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id - LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` - LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id - LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` - SET i.`name` = CONCAT_WS(' ', - IFNULL(ta1.abbreviation,it1.`value`), - IFNULL(ta2.abbreviation,it2.`value`), - IF(i.id > 400000,'',IFNULL(ta3.abbreviation,it3.`value`))); - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 - SET i.subName = it.`value`; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag5 = t.name, value5 = it.`value`; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag6 = t.name, value6 = it.`value`; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7 - LEFT JOIN tag t ON t.id = it.tagFk - SET i.tag7 = t.name, i.value7 = it.`value`; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag8 = t.name, value8 = it.`value`; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag9 = t.name, value9 = it.`value`; - - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10 - LEFT JOIN tag t ON t.id = it.tagFk - SET tag10 = t.name, value10 = it.`value`; - - -- Al insertar el tag color se modifica también el antiguo campo color - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - JOIN tag t ON t.overwrite = 'inkFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN ink ON ink.`name` = it.`value` - SET i.inkFk = ink.id; - - -- Al insertar el tag origen se modifica también en la tabla item - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - JOIN tag t ON t.overwrite = 'originFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN origin o ON o.`name` = it.`value` - SET i.originFk = o.id; - - -- Al insertar el tag medida se modifica también en la tabla item - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - JOIN tag t ON t.overwrite = 'size' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.size = it.`value`; - - -- Al insertar el tag productor se modifica también en la tabla item - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - JOIN tag t ON t.overwrite = 'producerFk' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - JOIN producer p ON p.`name` = it.`value` - SET i.producerFk = p.id; - - -- Al insertar el tag tallos se modifica también en la tabla item - UPDATE item i - JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id - JOIN tag t ON t.overwrite = 'stems' - JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id - SET i.stems = it.`value`; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemToRefresh; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_saveReference` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_saveReference`(vBarcode VARCHAR(22), vReference VARCHAR(150)) -BEGIN - -/** - * Actualiza la referencia del item - * - * @param vBarcode del item - * @param vReference referencia a actualizar - */ - - DECLARE vItemFk INT; - - SELECT barcodeToItem(vBarcode) INTO vItemFk; - - UPDATE item SET comment = vReference WHERE id = vItemFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_setCompression__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setCompression__`() -BEGIN - /** - * Actualiza la compression de los articulos con un packing.hasCompressionVariations = TRUE - * - */ - DECLARE done INT DEFAULT FALSE; - DECLARE vBuyFk INT; - DECLARE cur1 CURSOR FOR SELECT b.id - FROM vn.item i - JOIN edi.supplyResponse ii ON i.supplyResponseFk = ii.ID - JOIN vn.packaging p ON p.id = ii.EmbalageCode AND hasCompressionVariations - JOIN vn.itemTag diameter ON diameter.itemFk = i.id - JOIN vn.tag tDiameter ON tDiameter.overwrite = 'diameter' AND tDiameter.id = diameter.tagFk - JOIN vn.itemTag size ON size.itemFk = i.id - JOIN vn.tag tSize ON tSize.overwrite = 'size' AND tSize.id = size.tagFk - JOIN vn.buy b ON b.itemFk = i.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - UPDATE vn.item i - JOIN edi.supplyResponse ii ON i.supplyResponseFk = ii.ID - JOIN vn.packaging p ON p.id = ii.EmbalageCode AND hasCompressionVariations - JOIN vn.itemTag diameter ON diameter.itemFk = i.id - JOIN vn.tag tDiameter ON tDiameter.overwrite = 'diameter' AND tDiameter.id = diameter.tagFk - JOIN vn.itemTag size ON size.itemFk = i.id - JOIN vn.tag tSize ON tSize.overwrite = 'size' AND tSize.id = size.tagFk - SET i.`compression` = (PI() * POW(diameter.`value`/ 2, 2) * size.`value`) - / - ((p.width * p.depth * p.height) / ii.NumberOfItemsPerCask) - WHERE (PI() * POW(diameter.`value`/ 2, 2) * size.`value`) - / - ((p.width * p.depth * p.height) / ii.NumberOfItemsPerCask) <> 0; - - OPEN cur1; - - read_loop: LOOP - SET done = FALSE; - FETCH cur1 INTO vBuyFk; - IF done THEN - LEAVE read_loop; - END IF; - - call vn.buy_afterUpsert(vBuyFk); - - END LOOP; - - CLOSE cur1; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_setGeneric` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setGeneric`(vSelf INT) -BEGIN -/** - * Asigna el código genérico a un item, salvo que sea un código de item genérico. - * - * @param vSelf identificador de vn.item - */ - DECLARE vGenericFk INT; - - SELECT itemFk INTO vGenericFk - FROM ( - SELECT itemFk, (sum(matches) = maxMatches) `match` - FROM ( - SELECT ga.id gaid, - ga.itemFk, - (it.value <=> ga.origin) - + (it.value <=> ga.color) - + (it.value <=> ga.quality) - + (it.value <=> ga.numFlores) - + (it.value <=> ga.category) - + (it.value <=> ga.productor) matches, - !ISNULL(ga.origin) - +!ISNULL(ga.color) - +!ISNULL(ga.quality) - +!ISNULL(ga.numFlores) - +!ISNULL(ga.category) - +!ISNULL(ga.productor) maxMatches - FROM vn.item i - JOIN vn.itemTag it ON it.itemFk = i.id - JOIN vn.genericAllocation ga - ON (i.typeFk = ga.typeFk OR ga.typeFk IS NULL) - AND (i.longName = ga.longName OR ga.longName IS NULL) - AND (i.`size` = ga.`size` OR ga.`size` IS NULL) - AND i.id != ga.itemFk - WHERE i.id = vSelf - AND NOT i.isFloramondo) sub - GROUP BY gaid - HAVING `match`) sub2; - - UPDATE vn.item - SET genericFk = vGenericFk - WHERE id = vSelf; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingShelve` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `item_updatePackingShelve`(vSelf INT, vPacking INT) -BEGIN - - /** - * Actualiza el valor de item.packingShelve - * - * @param vSelf Identificador de vn.item - * @param vPacking Cantidad de unidades de venta que caben en una bandeja - */ - - UPDATE vn.item i - SET i.packingShelve = vPacking - WHERE i.id = vSelf; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingType` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingType`(vItem INT, vItemPackingTypeFk VARCHAR(1)) -BEGIN -/** - * Update the packing type of an item - * - * @param vItem id del item a actualizar - * @param vItemPackingTypeFk packing type - */ - UPDATE item SET itemPackingTypeFk = vItemPackingTypeFk WHERE id = vItem; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_ValuateInventory` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_ValuateInventory`(IN vDated DATE, IN vIsDetailed BOOLEAN) -BEGIN - - DECLARE vInventoried DATE; - DECLARE vHasNotInventory BOOLEAN DEFAULT FALSE; - DECLARE vInventoried2 DATE; - DECLARE vDateDayEnd DATETIME; - - SET vDateDayEnd = util.dayEnd(vDated); - - SELECT landed INTO vInventoried - FROM travel tr - JOIN entry E ON E.travelFk = tr.id - WHERE landed <= vDateDayEnd - AND E.supplierFk = 4 - ORDER BY landed DESC - LIMIT 1; - - SET vHasNotInventory = IF (vInventoried is null, TRUE, FALSE); - - IF vHasNotInventory THEN - - SELECT landed INTO vInventoried2 - FROM travel tr - JOIN entry E ON E.travelFk = tr.id - WHERE landed >= vDated - AND E.supplierFk = 4 - ORDER BY landed ASC - LIMIT 1; - - SET vInventoried = TIMESTAMPADD(DAY,1,vDated); - SET vDateDayEnd = vInventoried2; - - END IF; - - DROP TEMPORARY TABLE IF EXISTS inv; - - CREATE TEMPORARY TABLE inv - (warehouseFk SMALLINT, - Id_Article BIGINT, - cantidad INT, - coste DOUBLE DEFAULT 0, - total DOUBLE DEFAULT 0, - Almacen VARCHAR(20), - PRIMARY KEY (Almacen, Id_Article) USING HASH) - ENGINE = MEMORY; - - IF vHasNotInventory = TRUE THEN - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT tr.warehouseInFk, b.itemFk, SUM(b.quantity), w.`name` - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = warehouseInFk - WHERE landed = vDateDayEnd - AND e.supplierFk = 4 - AND w.valuatedInventory - AND t.isInventory - GROUP BY tr.warehouseInFk, b.itemFk; - - END IF; - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT tr.warehouseInFk, b.itemFk, b.quantity * IF(vHasNotInventory,-1,1), w.`name` - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = tr.warehouseInFk - WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd - AND IF(tr.landed = CURDATE(), tr.isReceived, trUE) - AND NOT e.isRaid - AND w.valuatedInventory - AND t.isInventory - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,-1,1)); - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT tr.warehouseOutFk, b.itemFk, b.quantity * IF(vHasNotInventory,1,-1), w.`name` - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = tr.warehouseOutFk - WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd - AND NOT e.isRaid - AND w.valuatedInventory - AND t.isInventory - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,1,-1)); - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,1,-1), w.`name` - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN `client` c ON c.id = t.clientFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.shipped BETWEEN vInventoried AND vDateDayEnd - AND w.valuatedInventory - AND it.isInventory - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,1,-1); - - IF vDated = CURDATE() THEN -- volver a poner lo que esta aun en las estanterias - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,0,1), w.`name` - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN `client` c ON c.id = t.clientFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.shipped BETWEEN vDated AND vDateDayEnd - AND (s.isPicked <> 0 or t.isLabeled <> 0 ) - AND w.valuatedInventory - AND it.isInventory - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,0,1); - - END IF; - - -- Mercancia en transito - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT tr.warehouseInFk, b.itemFk, b.quantity, CONCAT(wOut.`name`,' - ', wIn.`name`) - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse wIn ON wIn.id = tr.warehouseInFk - JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk - WHERE vDated >= tr.shipped AND vDated < tr.landed - AND NOT isRaid - AND wIn.valuatedInventory - AND t.isInventory - AND e.isConfirmed - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity); - - CALL vn.buyUltimate(NULL,vDateDayEnd); - - UPDATE inv i - JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.Id_Article = bu.itemFk - JOIN buy b ON b.id = bu.buyFk - SET total = i.cantidad * (ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0)), - coste = ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0) - WHERE i.cantidad <> 0; - - DELETE FROM inv WHERE Cantidad IS NULL or Cantidad = 0; - - IF vIsDetailed THEN - - SELECT inv.warehouseFk, - i.id itemFk, - i.longName , - i.size, - inv.Cantidad, - tp.name Tipo, - ic.name Reino, - inv.coste, - cast(inv.total as decimal(10,2)) total, - almacen - FROM inv - JOIN warehouse w on w.id = warehouseFk - JOIN item i ON i.id = inv.Id_Article - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - WHERE w.valuatedInventory - and inv.total > 0 - order by inv.total desc; - - ELSE - - SELECT i.Almacen, ic.name as Reino, cast(i.total as decimal(10,2)) as Euros, w.code as Comprador,it.id - FROM inv i - JOIN warehouse wh on wh.id = warehouseFk - JOIN item it ON it.id = i.Id_Article - JOIN itemType itp ON itp.id = it.typeFk - LEFT JOIN worker w ON w.id = itp.workerFk - JOIN itemCategory ic ON ic.id = itp.categoryFk - WHERE wh.valuatedInventory - AND i.total > 0; - - END IF; - DROP TEMPORARY TABLE tmp.buyUltimate; - DROP TEMPORARY TABLE inv; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_ValuateInventory__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `item_ValuateInventory__`(IN vDated DATE, IN vIsDetailed BOOLEAN) -BEGIN - - DECLARE vInventoried DATE; - DECLARE vHasNotInventory BOOLEAN DEFAULT 0; - DECLARE vInventoried2 DATE; - DECLARE vDateDayEnd DATETIME; - - SET vDateDayEnd = util.dayEnd(vDated); - SELECT landed INTO vInventoried - FROM travel tr - JOIN entry E ON E.travelFk = tr.id - WHERE landed <= vDateDayEnd - AND E.supplierFk = 4 - ORDER BY landed DESC - LIMIT 1; - - SET vHasNotInventory = IF (vInventoried is null, TRUE, FALSE); - - IF vHasNotInventory THEN - - SELECT landed INTO vInventoried2 - FROM travel tr - JOIN entry E ON E.travelFk = tr.id - WHERE landed >= vDated - AND E.supplierFk = 4 - ORDER BY landed ASC - LIMIT 1; - - SET vInventoried = TIMESTAMPADD(DAY,1,vDated); - SET vDateDayEnd = vInventoried2; - - END IF; - - DROP TEMPORARY TABLE IF EXISTS inv; - - CREATE TEMPORARY TABLE inv - (warehouseFk SMALLINT, - Id_Article BIGINT, - cantidad INT, - coste DOUBLE DEFAULT 0, - total DOUBLE DEFAULT 0, - Almacen VARCHAR(20), - PRIMARY KEY (Almacen, Id_Article) USING HASH) - ENGINE = MEMORY; - - IF vHasNotInventory = TRUE THEN - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT tr.warehouseInFk, b.itemFk, SUM(b.quantity), w.`name` - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = warehouseInFk - WHERE landed = vDateDayEnd - AND e.supplierFk = 4 - AND w.valuatedInventory - AND t.isInventory - GROUP BY tr.warehouseInFk, b.itemFk; - - END IF; - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT tr.warehouseInFk, b.itemFk, b.quantity * IF(vHasNotInventory,-1,1), w.`name` - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = tr.warehouseInFk - WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd - AND IF(tr.landed = CURDATE(), tr.isReceived, trUE) - AND NOT e.isRaid - AND w.valuatedInventory - AND t.isInventory - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,-1,1)); - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT tr.warehouseOutFk, b.itemFk, b.quantity * IF(vHasNotInventory,1,-1), w.`name` - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse w ON w.id = tr.warehouseOutFk - WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd - AND NOT e.isRaid - AND w.valuatedInventory - AND t.isInventory - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,1,-1)); - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,1,-1), w.`name` - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN `client` c ON c.id = t.clientFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.shipped BETWEEN vInventoried AND vDateDayEnd - AND w.valuatedInventory - AND it.isInventory - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,1,-1); - - IF vDated = CURDATE() THEN -- volver a poner lo que esta aun en las estanterias - - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,0,1), w.`name` - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN `client` c ON c.id = t.clientFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.shipped BETWEEN vDated AND vDateDayEnd - AND (s.isPicked <> 0 or t.isLabeled <> 0 ) - AND w.valuatedInventory - AND it.isInventory - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,0,1); - - END IF; - - -- Mercancia en transito - INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) - SELECT tr.warehouseInFk, b.itemFk, b.quantity, CONCAT(wOut.`name`,' - ', wIn.`name`) - FROM buy b - JOIN item i ON i.id = b.itemFk - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN itemType t ON t.id = i.typeFk - JOIN warehouse wIn ON wIn.id = tr.warehouseInFk - JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk - WHERE vDated >= tr.shipped AND vDated < tr.landed - AND NOT isRaid - AND wIn.valuatedInventory - AND t.isInventory - AND e.isConfirmed - ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity); - - CALL vn.buyUltimate(NULL,vDateDayEnd); - - UPDATE inv i - JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.Id_Article = bu.itemFk - JOIN buy b ON b.id = bu.buyFk - SET total = i.cantidad * (ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0)), - coste = ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0) - WHERE i.cantidad <> 0; - - DELETE FROM inv WHERE Cantidad IS NULL or Cantidad = 0; - - IF vIsDetailed THEN - - SELECT inv.warehouseFk, i.id, i.name, i.size, inv.Cantidad, tp.code, - tp.categoryFk, inv.coste, cast(inv.total as decimal(10,2)) total,Almacen - FROM inv - JOIN warehouse w on w.id = warehouseFk - JOIN item i ON i.id = inv.Id_Article - JOIN itemType tp ON tp.id = i.typeFk - WHERE w.valuatedInventory - and inv.total > 0 - order by inv.total desc; - - ELSE - - SELECT i.Almacen, ic.name as Reino, cast(i.total as decimal(10,2)) as Euros, w.code as Comprador,it.id - FROM inv i - JOIN warehouse wh on wh.id = warehouseFk - JOIN item it ON it.id = i.Id_Article - JOIN itemType itp ON itp.id = it.typeFk - LEFT JOIN worker w ON w.id = itp.workerFk - JOIN itemCategory ic ON ic.id = itp.categoryFk - WHERE wh.valuatedInventory - AND i.total > 0; - - END IF; - DROP TEMPORARY TABLE tmp.buyUltimate; - DROP TEMPORARY TABLE inv; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ledger_doCompensation` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_doCompensation`(vDated DATE, vCompensationAccount VARCHAR(10) , vBankFk VARCHAR(10), vConcept VARCHAR(255), vAmount DECIMAL(10,2), vCompanyFk INT, vOriginalAccount VARCHAR(10)) -BEGIN -/** - * Compensa un pago o un recibo insertando en contabilidad - * - * @param vDated fecha en la cual se anota - * @param vCompensationAccount cuenta contable contra la que se compensa - * @param vBankFk banco de la compensacion - * @param vConcept descripcion - * @param vAmount cantidad que se compensa - * @param vCompany empresa - * @param vOriginalAccount cuenta contable desde la cual se compensa - * - */ - DECLARE vNewBookEntry INT; - DECLARE vIsClientCompensation INT; - DECLARE vClientFk INT; - DECLARE vSupplierFk INT; - DECLARE vIsOriginalAClient BOOL; - DECLARE vPayMethodCompensation INT; - - CALL ledger_next(vNewBookEntry); - - SELECT COUNT(id) INTO vIsOriginalAClient FROM client WHERE accountingAccount LIKE vOriginalAccount COLLATE utf8_general_ci; - - SELECT id, COUNT(id) INTO vClientFk, vIsClientCompensation - FROM client - WHERE accountingAccount LIKE vCompensationAccount COLLATE utf8_general_ci; - - SET @vAmount1:= 0.0; - SET @vAmount2:= 0.0; - - INSERT INTO XDiario (ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EUROHABER, empresa_id) - VALUES ( vNewBookEntry, - vDated, - vOriginalAccount, - vCompensationAccount, - vConcept, - @vAmount1:= IF( - (vIsOriginalAClient AND vAmount > 0) OR - (NOT vIsOriginalAClient AND vAmount < 0), - 0, - ABS(vAmount) - ), - @vAmount2:= IF(@vAmount1, - 0, - ABS(vAmount) - ), - vCompanyFk - ), - ( vNewBookEntry, - vDated, - vCompensationAccount, - vOriginalAccount, - vConcept, - @vAmount2, - @vAmount1, - vCompanyFk); - - IF vIsClientCompensation THEN - IF vIsOriginalAClient THEN - SET vAmount = -vAmount; - END IF; - INSERT INTO receipt(invoiceFk, amountPaid, payed, bankFk, companyFk, clientFk, isConciliate) - VALUES (vConcept, vAmount, vDated, vBankFk, vCompanyFk, vClientFk, TRUE); - ELSE - IF NOT vIsOriginalAClient THEN - SET vAmount = -vAmount; - END IF; - SELECT id INTO vSupplierFk FROM supplier WHERE `account` LIKE vCompensationAccount COLLATE utf8_general_ci; - SELECT id INTO vPayMethodCompensation FROM payMethod WHERE `code` = 'compensation'; - - INSERT INTO payment (received, dueDated, supplierFk, amount, bankFk, payMethodFk, concept, companyFk, isConciliated) - VALUES(vDated, vDated, vSupplierFk, vAmount, vBankFk, vPayMethodCompensation, vConcept, vCompanyFk, TRUE); - 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 `ledger_next` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_next`(OUT vNewBookEntry INT) -BEGIN - - UPDATE vn.ledgerConfig SET lastBookEntry = LAST_INSERT_ID(lastBookEntry + 1); - SET vNewBookEntry = 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 `logAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 vEntity Nombre que hace referencia a la tabla. - * @param descripcion Descripción de la acción realizada por el usuario - */ - - CALL logAddWithUser(vOriginFk, account.userGetId(), vActionCode, vEntity, vDescription); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `logAddWithUser` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `logAddWithUser`(vOriginFk INT, vUserId 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 vEntity Nombre que hace referencia a la tabla. - * @param descripcion Descripción de la acción realizada por el usuario - */ - DECLARE vTableName VARCHAR(255) DEFAULT CONCAT(IFNULL(vEntity, ''), 'Log'); - - SET @sqlQuery = CONCAT( - 'INSERT INTO vn.', vTableName, ' SET originFk = ?, userFk = ?, action = ?, description = ?' - ); - SET @originFk = vOriginFk; - SET @userFk = vUserId; - SET @action = vActionCode; - SET @description = vDescription; - - PREPARE stmt FROM @sqlQuery; - EXECUTE stmt USING @originFk, @userFk, @action, @description; - 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 `logShow` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `logShow`(vOriginFk INT, vEntity VARCHAR(45)) -BEGIN -/** - * Muestra las acciones realizadas por el usuario - * - * @param vOriginFk Id del registro de origen - * @param vEntity Nombre que hace referencia a la tabla. - */ - DECLARE vTableName VARCHAR(45); - - 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', - ' INNER JOIN account.user u ON u.id = ot.userFk', - ' WHERE ot.originFk = ', vOriginFk, ' ORDER BY ot.creationDate DESC' - ); - - PREPARE stmt FROM @qryLog; - EXECUTE 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 `lungSize_generator` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `lungSize_generator`(vDate DATE) -BEGIN - -SET @buildingOrder := 0; -SET @route := 0; -set @cajas := 0; - - UPDATE tmp.sorter - SET buildingOrder = @buildingOrder := IF(@route = @route := routeFk, @buildingOrder, 0) + 1 - where date(created) = vDate - order by routeFk, created, weight DESC; - - update tmp.sorter - SET palletOrder = buildingOrder mod 14, lungGrow = buildingOrder mod 14 - WHERE date(created) = vDate; - - UPDATE tmp.sorter - JOIN ( - SELECT routeFk, max(id) maxid - FROM tmp.sorter - where date(created) = vDate - GROUP BY routeFk) sub ON sub.maxid = id - SET lungGrow = 1 - palletOrder ; - - UPDATE tmp.sorter - SET lungGrow = IF(palletOrder = 0, -13, lungGrow); - - DELETE FROM tmp.lungSize WHERE dia = vDate; - - INSERT INTO tmp.lungSize(dia, hora,size) - select vDate,hora, @cajas := @cajas + cajas as size - from - ( - select IF(lungGrow BETWEEN -12 AND -1, ETD,time_format(created,"%H:%i")) as hora, sum(if(lungGrow <= 0, lungGrow, 1)) as cajas, @cajas := 0 - from tmp.sorter - where date(created) = vDate - group by hora - ) sub; - - SELECT * FROM tmp.lungSize - WHERE dia = 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 `machineWorker_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT) -BEGIN - -/** - * Inserta registro si el vWorkerFk no ha registrado nada en las últimas 12 horas - * @param vPlate número de matrícula - * @param vWorkerFk id del worker - * -*/ - UPDATE vn.machineWorker mw - JOIN vn.machine m ON m.id = mw.machineFk - SET mw.outTimed = NOW() - WHERE (mw.workerFk = vWorkerFk OR m.plate = vPlate) - AND ISNULL(mw.outTimed); - - INSERT INTO machineWorker (machineFk, workerFk) - SELECT m.id, vWorkerFk - FROM machine m - WHERE m.plate= vPlate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `machineWorker_getHistorical` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT) -BEGIN -/** - * Obtiene historial de la matrícula vPlate que el trabajador vWorkerFk escanea, - * si es jefe de producción muestra el historial completo. - * - * @param vPlate número de matrícula - * @param vWorkerFk id del trabajador - * -*/ - DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vWorkerFk); - - SELECT mw.inTimed,account.user_getNameFromId(mw.workerFk) as workerName, mw.outTimed - FROM machineWorker mw - JOIN machine m ON m.plate = vPlate - WHERE mw.machineFk = m.id - AND mw.workerFk = IF(account.user_hasRole(vWorkerName, 'coolerAssist'), mw.workerFk, vWorkerFk) - ORDER BY mw.inTimed 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 `machineWorker_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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT) -BEGIN - -/** - * Actualiza el registro correspondiente si el vWorkerFk se ha registrado en las últimas horas (campo maxHours de machineWorkerConfig) con vPlate, - * - * @param vPlate número de matrícula - * @param vWorkerFk id del trabajador - * -*/ - - DECLARE vMachineFk INT(10); - DECLARE vMaxHours INT(10); - - SELECT m.id INTO vMachineFk - FROM machine m - WHERE m.plate = vPlate; - - SELECT maxHours INTO vMaxHours - FROM machineWorkerConfig; - - IF (SELECT COUNT(*) - FROM machineWorker m - WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, NOW()) AND ISNULL(m.outTimed)) THEN - - UPDATE machineWorker m - SET m.outTimed = CURRENT_TIMESTAMP() - WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, NOW()) - AND ISNULL(m.outTimed) - AND m.machineFk = vMachineFk; - - 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 `machine_getWorkerPlate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `machine_getWorkerPlate`(vWorkerFk INT) -BEGIN -/** - * Selecciona la matrícula del vehículo del workerfk - * - * @param vWorkerFk el id del trabajador - * - * - **/ - - SELECT m.plate - FROM machine m - JOIN machineWorker mw ON mw.machineFk = m.id - WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) - AND ISNULL(mw.outTimed) - AND mw.workerFk = vWorkerFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `mail_insert` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `mail_insert`( - vReceiver VARCHAR(255), - vReplyTo VARCHAR(50), - vSubject VARCHAR(100), - vBody TEXT) -BEGIN -/** - * Inserta en la tabla vn.mail - * - * @param vReceiver Receptor del correo - * @param vReplyTo A quién contestar el correo - * @param vSubject Título del correo - * @param vBody Cuerpo del correo - */ - - DECLARE vIsRepeated BOOLEAN; - - SELECT COUNT(*) INTO vIsRepeated - FROM vn.mail - WHERE creationDate >= CURDATE() - AND `receiver` = vReceiver - AND `replyTo` = vReplyTo - AND `subject` = vSubject - AND !sent; - - IF NOT vIsRepeated THEN - - INSERT INTO vn.mail SET - `receiver` = vReceiver, - `replyTo` = vReplyTo, - `subject` = vSubject, - `body` = vBody; - - 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 `makeNewItem` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `makeNewItem`() -BEGIN - - DECLARE newItemFk INT; - - SELECT getNewItemId() INTO newItemFk; - - INSERT INTO item(id,name,typeFk,originFk) - SELECT newItemFk, 'Nuevo artículo', 78,39; - - SELECT newItemFk; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `makePCSGraf` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `makePCSGraf`(vDated DATE) -BEGIN - - - DECLARE vHour INT DEFAULT 0; - DECLARE vMinute INT DEFAULT 0; - DECLARE vBoxes INT; - - - DROP TEMPORARY TABLE IF EXISTS vn.pcsDay; - CREATE TEMPORARY TABLE vn.pcsDay - SELECT 0 as hh, 0 as mm, 0 as boxes; - - -- Creamos una tabla soporte para acumular las cajas a lo largo del dia - WHILE vHour < 24 DO - - WHILE vMinute < 59 DO - - SET vMinute = vMinute + 1; - - INSERT INTO vn.pcsDay(hh,mm) VALUES(vHour, vMinute); - - END WHILE; - - SET vMinute = -1; - SET vHour = vHour + 1; - - END WHILE; - - -- Acumulamos - UPDATE vn.pcsDay pd - LEFT JOIN (SELECT * FROM vn.pcs_graf WHERE dia = vDated) pg USING(hh,mm) - SET pd.boxes = pd.boxes + pg.box; - - SELECT * FROM vn.pcsDay; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `manaSpellersRequery` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `manaSpellersRequery`(vWorkerFk INTEGER) -BEGIN -/** - * Recalcula el mana consumido por un trabajador - * - * @param vWorkerFk Id Trabajador - */ - DECLARE vWorkerIsExcluded BOOLEAN; - DECLARE vFromDated DATE; - DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,CURDATE()); - DECLARE vMana INT; - DECLARE vAutoMana INT; - DECLARE vManaBank INT; - DECLARE vManaGreugeType INT; - - SELECT COUNT(*) INTO vWorkerIsExcluded - FROM workerManaExcluded - WHERE workerFk = vWorkerFk; - - IF NOT vWorkerIsExcluded THEN - SELECT id INTO vMana - FROM `component` WHERE code = 'mana'; - - SELECT id INTO vAutoMana - FROM `component` WHERE code = 'autoMana'; - - SELECT id INTO vManaBank - FROM `bank` WHERE code = 'mana'; - - SELECT id INTO vManaGreugeType - FROM `greugeType` WHERE code = 'mana'; - - SELECT max(dated) INTO vFromDated - FROM clientManaCache; - - REPLACE workerMana (workerFk, amount) - SELECT vWorkerFk, sum(mana) FROM - ( - SELECT s.quantity * sc.value as mana - FROM ticket t - JOIN address a ON a.id = t.addressFk - JOIN client c ON c.id = a.clientFk - JOIN sale s ON s.ticketFk = t.id - JOIN saleComponent sc ON sc.saleFk = s.id - WHERE c.salesPersonFk = vWorkerFk AND sc.componentFk IN (vMana, vAutoMana) - AND t.shipped > vFromDated AND t.shipped < vToDated - UNION ALL - SELECT - r.amountPaid - FROM receipt r - JOIN client c ON c.id = r.clientFk - WHERE c.salesPersonFk = vWorkerFk AND bankFk = vManaBank - AND payed > vFromDated - UNION ALL - SELECT g.amount - FROM greuge g - JOIN client c ON c.id = g.clientFk - WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = vManaGreugeType - AND g.shipped > vFromDated and g.shipped < CURDATE() - UNION ALL - SELECT cc.mana - FROM clientManaCache cc - JOIN client c ON c.id = cc.clientFk - WHERE c.salesPersonFk = vWorkerFk AND cc.dated = vFromDated - ) sub; - 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 `mergeTicketUnattended` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `mergeTicketUnattended`(IN vMainTicket INT(11), IN hasSameAgency BOOLEAN) -BEGIN - - DECLARE isBilled BOOLEAN; - DECLARE arrayTickets VARCHAR(255); - - SELECT Factura IS NOT NULL INTO isBilled FROM vn2008.Tickets WHERE Id_Ticket = vMainTicket; - - IF NOT isBilled THEN - - SELECT GROUP_CONCAT(distinct T.Id_Ticket) INTO arrayTickets - FROM vn2008.Tickets T LEFT JOIN vn.ticketState ts ON T.Id_Ticket = ts.ticket - JOIN vn2008.Tickets ticketOriginal ON ticketOriginal.Id_Ticket = vMainTicket - AND T.empresa_id = ticketOriginal.empresa_id - AND T.Id_Consigna = ticketOriginal.Id_Consigna - AND DATE(T.Fecha) = DATE(ticketOriginal.Fecha) - AND T.warehouse_id = ticketOriginal.warehouse_id - AND IF(hasSameAgency <> 0,T.Id_Agencia = ticketOriginal.Id_Agencia,TRUE) - LEFT JOIN vn.ticketState tsOriginal ON ticketOriginal.Id_Ticket = tsOriginal.ticket - WHERE ts.alertLevel < 3 - AND T.Factura IS NULL - AND T.Anotadoencaja = FALSE - AND T.Id_Ticket <> vMainTicket - AND ts.alertLevel = tsOriginal.alertLevel; - - CALL mergeTicketWithArray(vMainTicket,arrayTickets); - - 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 `mergeTicketWithArray` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `mergeTicketWithArray`(IN vMainTicket INT(11), IN arrayTickets VARCHAR(50)) -BEGIN - - DECLARE isBilled BOOLEAN; - DECLARE messageLog VARCHAR(50); - DECLARE company INT; - DECLARE messageForSplit VARCHAR(255); - DECLARE vMainSplit INT; - DECLARE worker INT(3); - - SELECT Factura IS NOT NULL INTO isBilled FROM vn2008.Tickets WHERE Id_Ticket = vMainTicket; - - IF NOT isBilled THEN - - SELECT Id_Trabajador INTO worker from vn2008.Trabajadores where user_id = account.userGetId(); - - DROP TEMPORARY TABLE IF EXISTS vn2008.Tickets_to_fusion; - - -- 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 - WHERE Id_Ticket IN (%s);',arrayTickets)); - - INSERT INTO vn2008.ticket_observation (Id_Ticket,observation_type_id,text) - SELECT vMainTicket,observation_type_id,CONCAT(' Ticket ', Id_Ticket, ':' , tco.text, '. ') - FROM vn2008.Tickets_to_fusion tf - INNER JOIN vn2008.ticket_observation tco USING(Id_Ticket) - ON DUPLICATE KEY UPDATE `text` = CONCAT(ticket_observation.`text`,CONCAT(' Ticket ', VALUES(Id_Ticket), ':' , VALUES(`text`), '. ')); - - UPDATE vn2008.Movimientos M - JOIN vn2008.Tickets_to_fusion USING(Id_Ticket) - SET M.Id_Ticket = vMainTicket; - - 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; - - UPDATE vn2008.Tickets - JOIN vn2008.Tickets_to_fusion USING(Id_Ticket) - SET Fecha = TIMESTAMPADD(YEAR,-1 * (YEAR(Fecha)-2000), Fecha), Id_Ruta = NULL; - - UPDATE vn.ticketLog tl - JOIN vn2008.Tickets_to_fusion t ON t.Id_Ticket = tl.originFk - SET tl.originFk = vMainTicket; - - UPDATE vn2008.Tickets - SET Localizacion = CONCAT(Tickets.Localizacion,' ',IFNULL((SELECT GROUP_CONCAT(Localizacion SEPARATOR ' ') FROM vn2008.Tickets_to_fusion),'')) - WHERE Id_Ticket = vMainTicket; - - UPDATE vn2008.Splits s - RIGHT JOIN vn2008.Tickets_to_fusion t USING(Id_Ticket) - SET s.Id_Ticket = vMainTicket; - - UPDATE vn2008.Ordenes o - RIGHT JOIN vn2008.Tickets_to_fusion t ON t.Id_Ticket = o.ticketFk - SET o.ticketFk = vMainTicket; - - IF (SELECT COUNT(*) FROM vn2008.Splits WHERE Id_Ticket=vMainTicket) > 1 THEN - - SELECT Id_Split INTO vMainSplit FROM vn2008.Splits WHERE Id_Ticket = vMainTicket LIMIT 1; - - SELECT group_concat(Notas,',') INTO messageForSplit FROM vn2008.Splits WHERE Id_Ticket = vMainTicket; - UPDATE vn2008.Splits SET Notas = messageForSplit WHERE Id_Split=vMainSplit; - UPDATE vn2008.Split_lines sl JOIN vn2008.Splits s USING (Id_Split) SET sl.Id_Split=vMainSplit WHERE Id_Ticket=vMainTicket; - DELETE FROM vn2008.Splits WHERE Id_Ticket=vMainTicket AND Id_Split<>vMainSplit; - END IF; - - SELECT GROUP_CONCAT(Id_Ticket SEPARATOR ',') into messageLog FROM vn2008.Tickets_to_fusion; - CALL vn2008.Ditacio(vMainTicket,'Fusion','T',worker,messageLog,NULL); - - DELETE ts FROM vn2008.Tickets_state ts JOIN vn2008.Tickets_to_fusion t USING(Id_Ticket); - - DROP TEMPORARY TABLE vn2008.Tickets_to_fusion; - 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 `mysqlConnectionsSorter_kill` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlConnectionsSorter_kill`() -BEGIN - -/** - * Elimina conexiones del usuario sorter con tiempo >= 30seg. Asociado al evento con el mismo nombre - */ - - DECLARE vDone INT DEFAULT 0; - DECLARE vProcesId INT; - - DECLARE vCursor CURSOR FOR - SELECT p.id - FROM information_schema.processlist p - WHERE USER = 'sorter' - AND TIME >= 30; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - OPEN vCursor; - - l: LOOP - - FETCH vCursor INTO vProcesId; - - IF vDone THEN - LEAVE l; - END IF; - - KILL vProcesId; - - END LOOP; - - CLOSE vCursor; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `mysqlPreparedCount_check` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlPreparedCount_check`() -BEGIN - DECLARE vPreparedCount INTEGER; - - SELECT VARIABLE_VALUE INTO vPreparedCount - FROM INFORMATION_SCHEMA.GLOBAL_STATUS - WHERE VARIABLE_NAME LIKE '%prepared_stmt_count%'; - - IF(vPreparedCount >= 40000) THEN - CALL `vn`.`mail_insert`('cau@verdnatura.es', - NULL, - 'Problemas BBDD prepared_stmt_count', - CONCAT('Existen problemas con el servicio de Logiflora, prepared_stmt_count con valor: ', - vPreparedCount, - ', está próximo a exceder su límite. \r\n Hay que reiniciar el servicio LF.VMP.Service del servidor a3.') - ); - 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 `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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nestAdd__`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vParentFk` INT, IN `vChild` VARCHAR(100)) -BEGIN - DECLARE vSql TEXT; - DECLARE vTableClone VARCHAR(45); - - SET vTableClone = CONCAT(vTable, 'Clone'); - - CALL util.exec(CONCAT('DROP TEMPORARY TABLE IF EXISTS tmp.', vTableClone)); - CALL util.exec(CONCAT( - 'CREATE TEMPORARY TABLE tmp.', vTableClone, - ' ENGINE = MEMORY' - ' SELECT * FROM ', vScheme, '.', vTable - )); - - -- 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, 'tmp', vTableClone, 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, 'tmp', vTableClone, 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; - - CALL util.exec(CONCAT('DROP TEMPORARY TABLE tmp.', vTableClone)); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nestLeave__`(vScheme VARCHAR(45), vTable VARCHAR(45), vParentFk INT) -BEGIN - DROP TEMPORARY TABLE IF EXISTS tmp.tree; - - CALL util.exec(CONCAT( - 'CREATE TEMPORARY TABLE tmp.tree ', - 'SELECT - node.id, - node.name, - node.lft, - node.rgt, - node.depth, - node.sons - FROM ', - vScheme, '.', vTable, ' AS node, ', - vScheme, '.', vTable, ' AS parent ', - 'WHERE - node.lft BETWEEN parent.lft AND parent.rgt - AND node.depth = parent.depth + 1 - AND parent.id = ', vParentFk, ' ' - 'GROUP BY node.id - ORDER BY node.lft')); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nestTree__`( - vSourceSchema VARCHAR(45), - vSourceTable VARCHAR(45), - vDestinationSchema VARCHAR(45), - vDestinationTable VARCHAR(45)) -BEGIN - DECLARE vTableClone VARCHAR(45); - - SET vTableClone = CONCAT(vSourceTable, 'Clone'); - - CALL util.exec(CONCAT('DROP TEMPORARY TABLE IF EXISTS tmp.', vTableClone)); - CALL util.exec(CONCAT( - 'CREATE TEMPORARY TABLE tmp.', vTableClone, - ' ENGINE = MEMORY', - ' SELECT * FROM ', vSourceSchema, '.', vSourceTable - )); - - CALL util.exec(CONCAT( - 'TRUNCATE TABLE ', vDestinationSchema, '.', vDestinationTable)); - CALL util.exec(CONCAT( - 'INSERT INTO ', vDestinationSchema, '.', vDestinationTable, - '(id, name, lft, rgt, depth, sons)', - 'SELECT - node.id, - node.name, - node.lft, - node.rgt, - COUNT(parent.id) - 1 depth, - CAST((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons - FROM ', - vSourceSchema, '.', vSourceTable, ' AS node,', - 'tmp.', vTableClone, ' AS parent ', - 'WHERE node.lft - BETWEEN parent.lft AND parent.rgt - GROUP BY node.id - ORDER BY node.lft')); - - CALL util.exec(CONCAT('DROP TEMPORARY TABLE tmp.', vTableClone)); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `nextShelvingCodeMake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `nextShelvingCodeMake`() -BEGIN - - DECLARE newShelving VARCHAR(3); - DECLARE vCode VARCHAR(3); - - SELECT MAX(code) INTO vCode - FROM vn.shelving - WHERE isPrinted = FALSE; - - SET @a1 := ASCII(MID(vCode,1,1)); - SET @a2 := ASCII(MID(vCode,2,1)); - SET @a3 := ASCII(MID(vCode,3,1)) + 1; - - IF @a3 > 90 THEN - - SET @a3 = 65; - SET @a2 = @a2 + 1; - - IF @a2 > 90 THEN - - SET @a2 = 65; - SET @a1 = @a1 + 1; - - IF @a1 > 90 THEN - - SET @a1 = 65; - - END IF; - - END IF; - - END IF; - - SET newShelving = CHAR(@a1,@a2,@a3 USING utf8); - - INSERT INTO vn.shelving(code) VALUES(newShelving); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `observationAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `observationAdd`(vOriginFk INT, vTableCode VARCHAR(45), vDescription TEXT) -BEGIN -/** - * Guarda las observaciones realizadas por el usuario - * - * @param vOriginFk Id del registro de origen - * @param vTypeCode Código que referencia a la tabla. - * @param descripcion Texto de la observacion - */ - DECLARE vTableName VARCHAR(45); - - SET vTableName = CONCAT(vTableCode,'Observation'); - - IF ISNULL(vTableName) THEN - CALL util.throw('CODE_NOT_FOUND'); - END IF; - - SET @qryLog := CONCAT( - 'INSERT INTO ', vTableName, ' (originFk, userFk, description)', - ' VALUES (', vOriginFk, ', ', account.userGetId(), ', "', vDescription, '")' - ); - - PREPARE stmt FROM @qryLog; - 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 `orderCreate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `orderCreate`( - vLanded DATE, - vAgencyMode INT, - vAddress INT, - vSourceApp VARCHAR(10), - OUT vOrderId INT) -BEGIN - - DECLARE vDeliveryMethod INT; - DECLARE vClient INT; - - SELECT deliveryMethodFk INTO vDeliveryMethod - FROM vn.agencyMode - WHERE id = vAgencyMode; - - SELECT clientFk INTO vClient - FROM vn.address - WHERE id = vAddress; - - INSERT INTO hedera.order(date_send,customer_id,delivery_method_id,agency_id,address_id,source_app) - VALUES( vLanded,vClient ,vDeliveryMethod,vAgencyMode ,vAddress ,vSourceApp); - - SET vOrderId = 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 `orderDelete` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `orderDelete`(IN vId INT) -BEGIN - - DELETE FROM hedera.`order` where id = vId; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `orderListCreate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListCreate`( - vLanded DATE, - vAgencyMode INT, - vAddress INT, - vSourceApp VARCHAR(10)) -BEGIN - - DECLARE vOrderId INT; - CALL vn.orderCreate(vLanded,vAgencyMode,vAddress,vSourceApp,vOrderId); - SELECT vOrderId; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `orderListVolume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListVolume`(IN vOrderId INT) -BEGIN - - SELECT - o.id, - o.itemFk, - i.description, - o.amount, - round(ic.cm3delivery * o.amount / 1000000,3) as volume - FROM hedera.orderRow o - JOIN item i ON i.id = o.itemFk - JOIN itemCost ic ON ic.itemFk = o.itemFk AND ic.warehouseFk = o.warehouseFk - WHERE o.orderFk = vOrderId; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 vComponentCost INT DEFAULT 28; - DECLARE vGraceDate DATE; - DECLARE vDateEnd DATE; - - SET vGraceDays = IF(vIsAllInvoiceable ,0, 30); - SET vGraceDate = TIMESTAMPADD(DAY, - vGraceDays, vDate); - - /* Clientes especiales: - 3240 MADEFLOR - 992 JAVIER FELIU - 4 TONI VENDRELL - */ - - IF vClient IN (992, 3240, 4) THEN - - SET vGraceDays = 365; - - END IF; - /* Fin clientes especiales */ - - SET vDateEnd = DATE_ADD(vDate, INTERVAL 1 DAY); - - 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 packaging p ON p.id = tp.packagingFk - JOIN ticket t ON t.id = tp.ticketFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - 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 COUNT(*) - INTO vIsInvoiceable - FROM tmp.packageToInvoicePositives; - - IF vIsInvoiceable THEN - - CALL ticket_add(vClient, - vDateEnd, - vWarehouse, - vCompany, - NULL, - NULL, - NULL, - vDateEnd, - account.userGetId(), - TRUE, - 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 `packingListPrinted` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `packingListPrinted`(ticketFk INT) -BEGIN - - UPDATE vn2008.Movimientos_mark mm - JOIN vn2008.Movimientos m ON m.Id_Movimiento = mm.Id_Movimiento - SET mm.valor = 2 -- Impreso - WHERE mm.valor = 1 -- Listo para imprimir - AND mm.stateFk = 9 -- Encajando - AND m.Id_Ticket = ticketFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `packingListSwitch` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `packingListSwitch`(saleFk INT) -BEGIN - - DECLARE valueFk INT; - DECLARE encajando INT DEFAULT 9; - - SELECT valor INTO valueFk - FROM vn2008.Movimientos_mark - WHERE Id_Movimiento = saleFk - AND stateFk = encajando; - - SET valueFk = (IFNULL(valueFk,0) + 1) MOD 3; - - REPLACE vn2008.Movimientos_mark(Id_Movimiento, valor, Id_Trabajador, stateFk) - VALUES(saleFk,valueFk,account.myUser_getId(),encajando); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `parking_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN) -BEGIN - - DECLARE vColumn INT; - DECLARE vRow INT; - DECLARE vLetters VARCHAR(26) DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - DECLARE vMaxId INT; - DECLARE vCode VARCHAR(8); - - SET vColumn = vFromColumn; - SET vRow = vFromRow; - SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - - SELECT MAX(id) INTO vMaxId - FROM vn.parking; - - WHILE vColumn <= vToColumn DO - - WHILE vRow <= vToRow DO - - INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`, pickingOrder) - VALUES (vColumn, vRow, vSectorFk, vCode, vColumn * 100 + vRow ) - ON DUPLICATE KEY UPDATE `code` = vCode; - - SET vRow = vRow + 1; - SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - - END WHILE; - - SET vRow = vFromRow; - SET vColumn = vColumn + 1; - - SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - - END WHILE; - - SELECT * FROM vn.parking WHERE `column` BETWEEN vFromColumn AND vToColumn; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `parking_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_add__`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN) -BEGIN - - DECLARE vColumn INT; - DECLARE vRow INT; - DECLARE vLetters VARCHAR(26) DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - DECLARE vMaxId INT; - DECLARE vCode VARCHAR(8); - - SET vColumn = vFromColumn; - SET vRow = vFromRow; - SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - - SELECT MAX(id) INTO vMaxId - FROM vn.parking; - - WHILE vColumn <= vToColumn DO - - WHILE vRow <= vToRow DO - - INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`, pickingOrder) - VALUES (vColumn, vRow, vSectorFk, vCode, vColumn * 100 + vRow ) - ON DUPLICATE KEY UPDATE `code` = vCode; - - SET vRow = vRow + 1; - SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - - END WHILE; - - SET vRow = vFromRow; - SET vColumn = vColumn + 1; - - SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); - - END WHILE; - - SELECT * FROM vn.parking WHERE `column` BETWEEN vFromColumn AND vToColumn; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `parking_algemesi` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_algemesi`(vFromRow INT, vToRow INT, vSectorFk INT, vLetter VARCHAR(1), vPickingOrder INT, vTrolleysByLine INT) -BEGIN - - DECLARE vRow INT; - DECLARE vCode VARCHAR(8); - DECLARE i INT; - - IF vToRow < vFromRow THEN - - SET vRow = vFromRow; - - WHILE vRow >= vToRow DO - - SET i = 1; - - WHILE i <= vTrolleysByLine DO - - SET vCode = CONCAT(vLetter,'-', LPAD(vRow,2,'0'),'-', i); - - INSERT IGNORE INTO vn.parking( sectorFk, `code`, pickingOrder) - VALUES (vSectorFk, vCode, vPickingOrder + (i * 10)) - ON DUPLICATE KEY UPDATE `code` = vCode; - - SET i = i + 1; - - END WHILE; - - SET vRow = vRow - 1; - - END WHILE; - - ELSE - - SET vRow = vFromRow; - - WHILE vRow <= vToRow DO - - SET i = 1; - - WHILE i <= vTrolleysByLine DO - - SET vCode = CONCAT(vLetter,'-', LPAD(vRow,2,'0'),'-', i); - - INSERT IGNORE INTO vn.parking( sectorFk, `code`, pickingOrder) - VALUES (vSectorFk, vCode, vPickingOrder + (i * 10) ) - ON DUPLICATE KEY UPDATE `code` = vCode; - - SET i = i + 1; - - END WHILE; - - SET vRow = vRow + 1; - - END WHILE; - - - 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 `parking_new` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_new`(vStart INT, vEnd INT, vSectorFk INT) -BEGIN - - DECLARE vRow INT; - DECLARE vColumn INT; - DECLARE vLetters VARCHAR(200); - DECLARE vLettersLength INT; - - SET vColumn = vStart; - SET vRow = 1; - SET vLetters = 'ABCDEF'; - SET vLettersLength = LENGTH(vLetters); - - WHILE vColumn <= vEnd DO - - REPLACE vn.parking(`column`, `row`, `code`, sectorFk) - VALUES(vColumn, vRow, CONCAT(vColumn,MID(vLetters,vRow,1)), vSectorFk); - - SET vRow = vRow + 1; - - IF vRow > vLettersLength THEN - - SET vRow = 1; - SET vColumn = vColumn + 1; - - END IF; - - 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 `parking_new__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_new__`(vStart INT, vEnd INT, vSectorFk INT) -BEGIN - - DECLARE vRow INT; - DECLARE vColumn INT; - DECLARE vLetters VARCHAR(200); - DECLARE vLettersLength INT; - - SET vColumn = vStart; - SET vRow = 1; - SET vLetters = 'ABCDEF'; - SET vLettersLength = LENGTH(vLetters); - - WHILE vColumn <= vEnd DO - - REPLACE vn.parking(`column`, `row`, `code`, sectorFk) - VALUES(vColumn, vRow, CONCAT(vColumn,MID(vLetters,vRow,1)), vSectorFk); - - SET vRow = vRow + 1; - - IF vRow > vLettersLength THEN - - SET vRow = 1; - SET vColumn = vColumn + 1; - - END IF; - - 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 `parking_setOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_setOrder`(vWarehouseFk INT) -BEGIN - - /* - * Ordena el orden de preparacion de los parking de acuerdo con la tabla vn.corridor - */ - - UPDATE vn.parking p - JOIN ( - SELECT code, - @orden := @orden + 10 AS po - FROM ( - SELECT c.prepOrder, - p.code, - @orden := 0, - IF(c.isAscendent, 1,-1) * CAST(SUBSTRING(p.code,3,2) AS DECIMAL(2,0)) subCorridor , - CAST(IF(LENGTH(p.code) > 5, SUBSTRING(p.code,6,2), 0) AS DECIMAL(2,0)) ubication - FROM vn.parking p - JOIN vn.sector s ON s.id = p.sectorFk - JOIN vn.corridor c ON c.code = LEFT(p.code,1) COLLATE utf8_general_ci - WHERE s.warehouseFk = vWarehouseFk) sub - ORDER BY sub.prepOrder, subCorridor, ubication) sub2 ON sub2.code = p.code - SET p.pickingOrder = sub2.po; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `payRoll__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `payRoll__`(IN vFromDated DATE, IN vToDated DATE, IN vFromPaid DATE, IN vToPaid DATE, IN vPartTime BOOL) -BEGIN - - SET @userFk := 0; - - SELECT CONCAT(w.lastName,', ',w.firstname) AS Trabajador, - CAST(Sum((wj.total + wj.permission + wj.lunch)* wj.priceOrdinaryHour + wj.hollyday * wj.priceHollydayHour - + wj.nocturn * wj.priceNocturnHour - + wj.extra * wj.priceExtraHour) AS DECIMAL(10,2)) AS salario, - CAST(Sum(wj.permission) AS DECIMAL(10,2)) AS permission, - CAST(Sum(wj.total) AS DECIMAL(10,2)) AS total, - CAST(Sum(wj.nocturn) AS DECIMAL(10,2)) AS nocturn, - CAST(Sum(wj.hollyday) AS DECIMAL(10,2)) AS hollyday, - CAST(Sum(wj.lunch) AS DECIMAL(10,2)) AS lunch, - CAST(Sum(wj.extra) AS DECIMAL(10,2)) AS extra, - CAST(Sum(wj.contractJourney) AS DECIMAL(10,2)) AS contractJourney, - d.name AS departamento, - CAST(Sum((wj.contractJourney + wj.permission) * wj.priceOrdinaryHour) AS DECIMAL(10,2)) AS teorico, - CAST(Sum((wj.lunch + wj.permission + wj.total) * wj.priceordinaryhour) AS DECIMAL(10,2)) AS practico, - CAST(Sum(wj.nocturn * wj.pricenocturnhour) AS DECIMAL(10,2)) AS nocturno, - CAST(Sum(wj.hollyday * wj.priceHollydayHour) AS DECIMAL(10,2)) AS festivos, - CAST(Sum(wj.extra * wj.priceextrahour) AS DECIMAL(10,2)) AS extras, - MAX(wj.businessFk) as businessFk, - IF(sub.workerFk IS NULL, FALSE, TRUE) isLastBusiness, - Min(b.date_start) AS fromDated, - Max(b.date_end) AS toDated, - blp.importepactado, - bl.porhoras, - IF(wj.userFk != @userFk, CAST(IFNULL(a.Anticipos,0) AS DECIMAL(10,2)), 0) AS Anticipos, - IF(wj.userFk != @userFk, CAST(IFNULL(se.SaldoEuros,0) AS DECIMAL(10,2)), 0) AS SaldoEuros, - @userFk := wj.userFk as userFk - FROM worker w - JOIN workerJourney wj ON w.id = wj.userFk - JOIN postgresql.business b ON b.business_id = wj.businessFk - JOIN postgresql.business_labour bl ON bl.business_id = b.business_id - JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id - JOIN department d ON bl.department_id = d.id - LEFT JOIN (SELECT pe.id_trabajador, SUM(debe) Anticipos - FROM postgresql.income_employee ie - JOIN postgresql.person pe ON ie.person_id = pe.person_id - WHERE odbc_date BETWEEN vFromPaid AND vToPaid - AND id_incomeType = 14 -- Salario - GROUP BY pe.id_trabajador - ) a ON a.id_trabajador = w.id - LEFT JOIN (SELECT pe.id_trabajador, SUM(debe) - SUM(haber) as SaldoEuros - FROM postgresql.income_employee ie - JOIN postgresql.person pe ON ie.person_id = pe.person_id - GROUP BY pe.id_trabajador - ) se ON se.id_trabajador = w.id - LEFT JOIN (SELECT MAX(IFNULL(ended, DATE_ADD(vToDated, INTERVAL 1 DAY )))dated,wl.workerFk - FROM vn.workerLabour wl - GROUP BY wl.workerFk - HAVING dated<=vToDated - ) sub ON sub.workerFk = w.id - WHERE wj.dated BETWEEN vFromDated AND vToDated - AND IF(vPartTime, cl.hours_week <= 40, cl.hours_week = 40) - GROUP BY w.id - ORDER BY w.lastName, w.firstname; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `placement_test` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `placement_test`(vParamFk INT(11)) -BEGIN - - DECLARE vCalcFk INT; - DECLARE vWarehouseFk INT; - DECLARE vWarehouseAliasFk INT; - DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - ENGINE = MEMORY - SELECT 0000000 as ticketFk, - 0000000 as saleFk, - 0000000 as itemFk, - FALSE as isStowaway, - 0 as quantity; - - INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) - SELECT s.ticketFk, s.id, s.itemFk, FALSE - FROM vn.ticketCollection tc - JOIN vn.collection c ON c.id = tc.collectionFk - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - JOIN vn.item i ON i.id = s.itemFk - WHERE tc.collectionFk = vParamFk - AND (i.itemPackingTypeFk = c.itemPackingTypeFk OR ISNULL(c.itemPackingTypeFk)) - UNION ALL - SELECT s.ticketFk, s.id, s.itemFk, FALSE - FROM vn.sale s - WHERE s.ticketFk = vParamFk; - - - /* UNION ALL - SELECT sw.shipFk, s.id, s.itemFk, TRUE - FROM vn.sale s - JOIN vn.stowaway sw ON sw.id = s.ticketFk - JOIN vn.ticketCollection tc ON tc.ticketFk = sw.shipFk - WHERE tc.collectionFk = vParamFk; - - INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) - SELECT s.ticketFk, s.id, s.itemFk, FALSE - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - WHERE s.ticketFk = vParamFk - AND t.shipped > '2020-01-01' - UNION ALL - SELECT sw.shipFk, s.id, s.itemFk, TRUE - FROM vn.sale s - JOIN vn.stowaway sw ON sw.id = s.ticketFk - WHERE sw.shipFk = vParamFk; - - DELETE FROM tmp.sale - WHERE saleFk = 0; - */ - SELECT t.warehouseFk, w.aliasFk - INTO vWarehouseFk, vWarehouseAliasFk - FROM vn.ticket t - JOIN tmp.sale ts ON ts.ticketFk = t.id - JOIN vn.warehouse w ON w.id = t.warehouseFk - LIMIT 1; - - CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); - - UPDATE tmp.sale ts - JOIN ( SELECT itemFk, sum(visible) as visible - FROM vn.itemShelvingStock iss - JOIN vn.warehouse w ON w.id = iss.warehouseFk - WHERE w.aliasFk = vWarehouseAliasFk - GROUP BY iss.itemFk ) iss ON iss.itemFk = ts.itemFk - SET ts.quantity = iss.visible; - - DROP TEMPORARY TABLE IF EXISTS tmp.sale2; - CREATE TEMPORARY TABLE tmp.sale2 - ENGINE = MEMORY - SELECT * FROM tmp.sale; - - - DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; - CREATE TEMPORARY TABLE tmp.`grouping` - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT b.itemFk, - CASE b.groupingMode - WHEN 0 THEN 1 - WHEN 2 THEN b.packing - ELSE b.`grouping` - END AS `grouping` - FROM buy b - JOIN cache.last_buy lb ON lb.buy_id = b.id - WHERE lb.warehouse_id = vWarehouseFk - ; - - DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; - CREATE TEMPORARY TABLE tmp.grouping2 - ENGINE = MEMORY - SELECT * FROM tmp.`grouping`; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList; - CREATE TEMPORARY TABLE tmp.salePlacementList - ENGINE = MEMORY - - SELECT ts.saleFk, - ts.itemFk, - CONCAT( - IF( iss.id, - CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), - ''), - p.`code`) COLLATE utf8_general_ci as placement , - sh.code COLLATE utf8_general_ci as shelving, - ish.created, - ish.visible, - IF(ts.isStowaway, - 100000, IF(ish.visible > 0 OR iss.id, 1, 100000)) * p.pickingOrder as `order`, - IFNULL(IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`),1) as `grouping`, - IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW()))) as priority, - 0 as saleOrder, - sc.isPreviousPrepared, - iss.id as itemShelvingSaleFk, - ts.ticketFk - ,iss.id - , st.saleFk as salePreviousPrepared - , iss.userFk - FROM tmp.sale ts - LEFT JOIN (SELECT DISTINCT saleFk - FROM vn.saleTracking st - JOIN vn.state s ON s.id = st.stateFk - WHERE st.isChecked - AND s.semaphore = 1) st ON st.saleFk = ts.saleFk - JOIN vn.itemShelving ish ON ish.itemFk = ts.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - JOIN vn.warehouse w ON w.id = sc.warehouseFk - LEFT JOIN tmp.`grouping` g ON g.itemFk = ts.itemFk - LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = ts.saleFk AND iss.itemShelvingFk = ish.id - LEFT JOIN vn.worker wk ON wk.id = iss.userFk - WHERE w.aliasFk = vWarehouseAliasFk - HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL - ; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_2; - CREATE TEMPORARY TABLE tmp.salePlacementList_2 - ENGINE MEMORY - SELECT saleFk, priority as olderPriority - FROM (SELECT saleFk, priority - FROM tmp.salePlacementList - ORDER BY IF(isPreviousPrepared,2,1), IF(visible > 0 OR itemShelvingSaleFk,1,2), priority - ) sub - GROUP BY saleFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_3; - CREATE TEMPORARY TABLE tmp.salePlacementList_3 - ENGINE MEMORY - SELECT s1.saleFk, `order`as saleOrder - FROM tmp.salePlacementList s1 - JOIN tmp.salePlacementList_2 s2 ON s2.saleFk = s1.saleFk AND s2.olderPriority = s1.priority; - - UPDATE tmp.salePlacementList s1 - JOIN tmp.salePlacementList_3 s3 ON s3.saleFk = s1.saleFk - SET s1.saleOrder = s3.saleOrder; - /* - -- Anula el orden de antigüedad y ordena por ubicación */ - UPDATE tmp.salePlacementList - SET saleOrder = `order`; - - SELECT * - FROM tmp.salePlacementList - ORDER BY visible <> 0 DESC,saleOrder, IF(isPreviousPrepared,2,1), IF(itemShelvingSaleFk,1,2),priority; - - DROP TEMPORARY TABLE - tmp.sale, - tmp.sale2, - tmp.`grouping`, - tmp.grouping2, - tmp.salePlacementList_2, - tmp.salePlacementList_3; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `prepareClientList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareClientList`() -BEGIN - - /* - * Require la tabla tmp.ticket(id,clientFk) - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.client; - CREATE TEMPORARY TABLE tmp.client - (PRIMARY KEY (id)) - ENGINE = MEMORY - SELECT DISTINCT clientFk id - FROM 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 `prepareTicketList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket; - CREATE TEMPORARY TABLE tmp.productionTicket - (PRIMARY KEY (ticketFk)) - ENGINE = MEMORY - SELECT t.id ticketFk, t.clientFk - FROM vn.ticket t - LEFT JOIN vn.ticketState ts ON ts.ticket = t.id - JOIN vn.client c ON c.id = t.clientFk - WHERE c.typeFk IN ('normal','handMaking','internalUse') - AND ( - t.shipped BETWEEN CURDATE() AND vEndingDate - OR ( - ts.alertLevel < 3 - AND t.shipped >= vStartingDate - AND t.shipped < 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 `previousPreparationSticker_get__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `previousPreparationSticker_get__`(vTicketFk INT) -BEGIN - - SELECT t.id ticketFk, - p.code as location, - t.observations, - IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour, - IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute , - i.itemPackingTypeFk , - count(*) items - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - -- JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk AND iss.sectorFk = 38 - JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.state ss ON ss.id = st.stateFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.shelving sh ON sh.code = t.id - LEFT JOIN vn.parking p ON p.id = sh.parkingFk - WHERE t.id = vTicketFk - AND ss.code = 'PREVIOUS_PREPARATION' - AND st.isChecked = FALSE - GROUP BY i.itemPackingTypeFk ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `previousSticker_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `previousSticker_get`(vSaleGroupFk INT) -BEGIN -/** - * Devuelve los campos a imprimir en una etiqueta de preparación previa. - * Actualiza el valor de vn.saleGroup.parkingFk en el caso de que exista un saleGroup del mismo ticket - * con parking, del mismo sector, para que todos se pongan juntos - * - * @param vSaleGroupFk Identificador de vn.saleGroup - */ - DECLARE vTicketFk INT; - DECLARE vParkingFk INT; - DECLARE vSectorFk INT; - - SELECT s.ticketFk - INTO vTicketFk - FROM vn.saleGroupDetail sgd - JOIN vn.sale s ON s.id = sgd.saleFk - WHERE sgd.saleGroupFk = vSaleGroupFk - LIMIT 1; - - SELECT sg.parkingFk, sc.sectorFk - INTO vParkingFk, vSectorFk - FROM vn.saleGroup sg - JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id - JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk - JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = sg.id - JOIN vn.sale s ON s.id = sgd.saleFk - WHERE s.ticketFk = vTicketFk - AND sg.parkingFk IS NOT NULL - LIMIT 1; - - UPDATE vn.saleGroup sg - SET sg.parkingFk = vParkingFk - WHERE sg.id = vSaleGroupFk - AND sg.sectorFk = vSectorFk; - - SELECT sgd.saleGroupFk, - t.id ticketFk, - p.code as location, - t.observations, - IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour, - IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute , - IFNULL(MAX(i.itemPackingTypeFk),'H') itemPackingTypeFk , - count(*) items - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk - JOIN vn.ticket t ON t.id = s.ticketFk - LEFT JOIN vn.parking p ON p.id = sg.parkingFk - LEFT JOIN vn.`zone` z ON z.id = t.zoneFk - WHERE sgd.saleGroupFk = vSaleGroupFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `printTrolleyLabel`(vTicket INT, vPrinter INT, vReport INT) -BEGIN -/** - * Inserta en la cola de impresion una nueva etiqueta de carro, para el sacador - * - * @param vTicket Numero del ticket - * @param vPrinter Numero de impresora - * @param vReport Numero del informe - **/ - DECLARE vlabelCount INT DEFAULT 0; - DECLARE PRIORITY INT DEFAULT 3; - DECLARE vWorker INT; - DECLARE vShipmentHour VARCHAR(10); - - SELECT getTicketTrolleyLabelCount(vTicket) INTO vLabelCount; - SELECT account.myUser_getId() INTO vWorker; - SELECT CONCAT(getShipmentHour(vTicket),':00') INTO vShipmentHour; - - INSERT INTO printingQueue(printer - , priority - , report - , `text` - , worker - , text2 - , text3) - VALUES (vPrinter - , PRIORITY - , vReport - , vTicket - , vWorker - , vLabelCount - , vShipmentHour); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `prod` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `prod`(vWarehouseFk INT, vScopeDays INT) -proc: BEGIN - - DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); - - DECLARE vIsTodayRelative BOOLEAN; - - SELECT isTodayRelative INTO vIsTodayRelative - FROM vn.worker - WHERE userFk = vn.getUser(); - - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT * FROM tmp.productionTicket; - - CALL vn.prepareClientList(); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems; - CREATE TEMPORARY TABLE tmp.ticketGetProblems - (INDEX (ticketFk)) ENGINE = MEMORY - SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped - FROM tmp.productionTicket tt - JOIN vn.ticket t ON t.id = tt.ticketFk; - - CALL vn.ticketGetProblems(vIsTodayRelative); - - DROP TEMPORARY TABLE IF EXISTS tmp.productionBuffer; - CREATE TEMPORARY TABLE tmp.productionBuffer - (PRIMARY KEY(ticketFk)) - ENGINE = MEMORY - SELECT tt.ticketFk - , tt.clientFk - , t.warehouseFk - , t.nickname - , t.packages - , IF(HOUR(t.shipped), HOUR(t.shipped), IFNULL(HOUR(zc.hour),HOUR(z.hour))) as HH - , IFNULL(HOUR(zc.hour),HOUR(z.hour)) as Departure - , IF(MINUTE(t.shipped), MINUTE(t.shipped), IFNULL(MINUTE(zc.hour), MINUTE(z.hour))) as mm - , t.routeFk - , IF(am.deliveryMethodFk = 2,z.`id`,0) as zona - , t.nickname addressNickname - , a.postalCode - , a.city - , p.name province - , CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency - , am.id agencyModeFk - , 0 AS `lines` - , CAST( 0 AS DECIMAL(5,2)) AS m3 - , CAST( 0 AS DECIMAL(5,2)) AS preparationRate - , "" as problem - , IFNULL(tls.state,2) AS state - , w.code workerCode - , DATE(t.shipped) shipped - , wk.code AS salesPersonCode - , p.id provinceFk - , tls.productionOrder - , ifnull(tls.alertLevel,0) alertLevel - , t.isBoxed as palletized - , rg.deviceId ubicacion - , tlu.lastUpdated - -- , tls.updated lastUpdated - , ifnull(st.graphCategory,0) graphCategory - , pk.code as parking - , 0 AS H - , 0 AS V - , 0 AS F - , 0 AS P - , st.isOk - , ag.isOwn - FROM tmp.productionTicket tt - JOIN vn.ticket t on tt.ticketFk = t.id - LEFT JOIN vn.ticketStateToday tst ON tst.ticket = t.id - LEFT JOIN vn.state st ON st.id = tst.state - LEFT JOIN vn.client c ON c.id = t.clientFk - LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk - JOIN vn.address a on a.id = t.addressFk - LEFT JOIN vn.province p on p.id = a.provinceFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.agency ag ON ag.id = am.agencyFk - LEFT JOIN vn.ticketState tls on tls.ticket = tt.ticketFk - LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk - LEFT JOIN vn.worker w on w.id = tls.worker - LEFT JOIN vn.routeGate rg ON rg.routeFk = t.routeFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND date(t.shipped) = zc.dated - LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id - LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk - WHERE t.warehouseFk = vWarehouseFk - AND am.deliveryMethodFk IN (1,2,3); - - ALTER TABLE tmp.productionBuffer - CHANGE COLUMN `problem` `problem` VARCHAR(255), - ADD COLUMN `collectionH` INT, - ADD COLUMN `collectionV` INT, - ADD COLUMN `collectionF` INT, - ADD COLUMN `collectionP` INT; - - -- Líneas y volumen por ticket - UPDATE tmp.productionBuffer pb - JOIN ( - SELECT tt.ticketFk, - COUNT(*) as `lines`, - sum(sv.volume) as m3, - IFNULL(sum(IF(sv.isPicked,sv.volume,0)) / sum(sv.volume),0) as rate - FROM tmp.productionTicket tt - JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk - GROUP BY tt.ticketFk - ) m on m.ticketFk = pb.ticketFk - SET pb.`lines` = m.`lines`, - pb.m3 = m.m3, - pb.preparationRate = m.rate; - - DELETE FROM tmp.productionBuffer - WHERE `lines`= 0; - - -- Lineas por linea de encajado - UPDATE tmp.productionBuffer pb - JOIN ( SELECT ticketFk, - sum(sub.H) H, - sum(sub.V) V, - sum(sub.F) F, - sum(sub.P) P - FROM ( - SELECT t.ticketFk, - sum(i.itemPackingTypeFk = 'H') H, - sum(i.itemPackingTypeFk = 'V') V, - sum(i.itemPackingTypeFk = 'F') F, - sum(i.itemPackingTypeFk = 'P') P - FROM tmp.productionTicket t - JOIN vn.sale s ON s.ticketFk = t.ticketFk - JOIN vn.item i ON i.id = s.itemFk - GROUP BY t.ticketFk, i.itemPackingTypeFk) sub - GROUP BY ticketFk - ) sub2 ON sub2.ticketFk = pb.ticketFk - SET pb.H = sub2.H, - pb.V = sub2.V, - pb.F = sub2.F, - pb.P = sub2.P; - - -- Colecciones segun tipo de encajado - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionH = c.id - WHERE c.itemPackingTypeFk = 'H' OR ISNULL(c.itemPackingTypeFk); - - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionV = c.id - WHERE c.itemPackingTypeFk = 'V' OR ISNULL(c.itemPackingTypeFk); - - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionF = c.id - WHERE c.itemPackingTypeFk = 'F' OR ISNULL(c.itemPackingTypeFk); - - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionP = c.id - WHERE c.itemPackingTypeFk = 'P' OR ISNULL(c.itemPackingTypeFk); - - -- Cajas - ALTER TABLE tmp.productionBuffer - ADD Cajas DOUBLE DEFAULT NULL; - /* - -- Problemas por ticket - UPDATE tmp.productionBuffer pb - JOIN tmp.ticketProblems tp ON tp.ticketFk = pb.ticketFk - SET pb.problem = CAST(CONCAT( IFNULL(tp.itemShortage,''), - IFNULL(tp.itemDelay,''), - IF(tp.isFreezed,' CONGELADO',''), - IF(tp.risk,' RIESGO',''), - IF(tp.hasTicketRequest, ' COD 100',''), - IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), - IF(tp.componentLack,' COMPONENTES', '') - ) as char(255)); - */ - -- Refresca la caché para el cierre dinámico de agencias - -- CALL cache.departure_timing(vWarehouseFk); -/* - -- Tickets de recogida - REPLACE tmp.productionBuffer( - shipped - , ticketFk - , agency - , clientFk - , addressNickname - , state - , workerCode - , alertLevel - , warehouseFk - ) - SELECT DATE(t.shipped) - , t.id - , am.name - , t.clientFk - , a.nickname - , s.id as state - , w.code - , ifnull(tls.alertLevel,0) alert_level - , vWarehouseFk - FROM vn.ticket t - JOIN vn.address a on a.id = t.addressFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = am.id - LEFT JOIN vn.ticketState tls on tls.ticket = t.id - LEFT JOIN vn.state s ON s.id = tls.state - LEFT JOIN vn.worker w on w.id = tls.worker - WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) - AND wp.warehouse_id = vWarehouseFk; -*/ - DROP TEMPORARY TABLE tmp.productionTicket; - DROP TEMPORARY TABLE tmp.ticket; - 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 `productionControl` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `productionControl`(vWarehouseFk INT, vScopeDays INT) -proc: BEGIN - - /** - * Devuelve un listado de tickets con parámetros relativos a la producción de los días en rango - * - * @param vWarehouseFk Identificador de vn.warehouse - * @param vScopeDays Número de días desde hoy en adelante que entran en el cálculo. - * - * @return Table tmp.productionBuffer - */ - - DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); - - DECLARE vIsTodayRelative BOOLEAN; - - SELECT isTodayRelative INTO vIsTodayRelative - FROM vn.worker - WHERE userFk = vn.getUser(); - - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT * FROM tmp.productionTicket; - - CALL vn.prepareClientList(); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems; - CREATE TEMPORARY TABLE tmp.sale_getProblems - (INDEX (ticketFk)) ENGINE = MEMORY - SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped - FROM tmp.productionTicket tt - JOIN vn.ticket t ON t.id = tt.ticketFk; - - CALL vn.ticket_getProblems(vIsTodayRelative); - - DROP TEMPORARY TABLE IF EXISTS tmp.productionBuffer; - CREATE TEMPORARY TABLE tmp.productionBuffer - (PRIMARY KEY(ticketFk)) - ENGINE = MEMORY - SELECT tt.ticketFk - , tt.clientFk - , t.warehouseFk - , t.nickname - , t.packages - , IF(HOUR(t.shipped), HOUR(t.shipped), IFNULL(HOUR(zc.hour),HOUR(z.hour))) as HH - , IFNULL(HOUR(zc.hour),HOUR(z.hour)) as Departure - , IF(MINUTE(t.shipped), MINUTE(t.shipped), IFNULL(MINUTE(zc.hour), MINUTE(z.hour))) as mm - , t.routeFk - , IF(am.deliveryMethodFk = 2,z.`id`,0) as zona - , t.nickname addressNickname - , a.postalCode - , a.city - , p.name province - , CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency - , am.id agencyModeFk - , 0 AS `lines` - , CAST( 0 AS DECIMAL(5,2)) AS m3 - , CAST( 0 AS DECIMAL(5,2)) AS preparationRate - , "" as problem - , IFNULL(tls.state,2) AS state - , w.code workerCode - , DATE(t.shipped) shipped - , wk.code AS salesPersonCode - , p.id provinceFk - , tls.productionOrder - , ifnull(tls.alertLevel,0) alertLevel - , t.isBoxed as palletized - , IF(rm.isPickingAllowed ,rm.bufferFk, NULL) ubicacion - , tlu.lastUpdated - , ifnull(st.graphCategory,0) graphCategory - , pk.code as parking - , 0 AS H - , 0 AS V - , 0 AS N - , st.isOk - , ag.isOwn - , rm.bufferFk - FROM tmp.productionTicket tt - JOIN vn.ticket t on tt.ticketFk = t.id - LEFT JOIN vn.ticketStateToday tst ON tst.ticket = t.id - LEFT JOIN vn.state st ON st.id = tst.state - LEFT JOIN vn.client c ON c.id = t.clientFk - LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk - JOIN vn.address a on a.id = t.addressFk - LEFT JOIN vn.province p on p.id = a.provinceFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.agency ag ON ag.id = am.agencyFk - LEFT JOIN vn.ticketState tls on tls.ticket = tt.ticketFk - LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk - LEFT JOIN vn.worker w on w.id = tls.worker - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND date(t.shipped) = zc.dated - LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id - LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk - WHERE t.warehouseFk = vWarehouseFk - AND am.deliveryMethodFk IN (1,2,3); - - -- Problemas por ticket - ALTER TABLE tmp.productionBuffer - CHANGE COLUMN `problem` `problem` VARCHAR(255), - ADD COLUMN `collectionH` INT, - ADD COLUMN `collectionV` INT, - ADD COLUMN `collectionN` INT; - - UPDATE tmp.productionBuffer pb - JOIN tmp.ticket_problems tp ON tp.ticketFk = pb.ticketFk - SET pb.problem = TRIM(CAST(CONCAT( IFNULL(tp.itemShortage,''), - IFNULL(tp.itemDelay,''), - IFNULL(tp.itemLost,''), - IF(tp.isFreezed,' CONGELADO',''), - IF(tp.hasHighRisk,' RIESGO',''), - IF(tp.hasTicketRequest, ' COD 100',''), - IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), - IF(tp.hasComponentLack,' COMPONENTES', ''), - IF(HOUR(NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') - ) as char(255))); - - -- Clientes Nuevos o Recuperados - UPDATE tmp.productionBuffer pb - LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk - JOIN vn.productionConfig pc - SET pb.problem = TRIM(CAST(CONCAT('NUEVO ', pb.problem) AS CHAR(255))) - WHERE (ISNULL(cnb.clientFk) OR cnb.isRookie) - AND pc.rookieDays; - - -- Líneas y volumen por ticket - UPDATE tmp.productionBuffer pb - JOIN ( - SELECT tt.ticketFk, - COUNT(*) as `lines`, - sum(sv.volume) as m3, - IFNULL(sum(IF(sv.isPicked,sv.volume,0)) / sum(sv.volume),0) as rate - FROM tmp.productionTicket tt - JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk - GROUP BY tt.ticketFk - ) m on m.ticketFk = pb.ticketFk - SET pb.`lines` = m.`lines`, - pb.m3 = m.m3, - pb.preparationRate = m.rate; - - DELETE FROM tmp.productionBuffer - WHERE `lines`= 0; - - -- Lineas por linea de encajado - UPDATE tmp.productionBuffer pb - JOIN ( SELECT ticketFk, - sum(sub.H) H, - sum(sub.V) V, - sum(sub.N) N - FROM ( - SELECT t.ticketFk, - sum(i.itemPackingTypeFk = 'H') H, - sum(i.itemPackingTypeFk = 'V') V, - sum(ISNULL(i.itemPackingTypeFk)) N - FROM tmp.productionTicket t - JOIN vn.sale s ON s.ticketFk = t.ticketFk - JOIN vn.item i ON i.id = s.itemFk - GROUP BY t.ticketFk, i.itemPackingTypeFk) sub - GROUP BY ticketFk - ) sub2 ON sub2.ticketFk = pb.ticketFk - SET pb.H = sub2.H, - pb.V = sub2.V, - pb.N = sub2.N; - - -- Colecciones segun tipo de encajado - - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - SET pb.collectionH = IF(pb.H,tc.collectionFk,NULL), - pb.collectionV = IF(pb.V,tc.collectionFk,NULL), - pb.collectionN = IF(pb.N,tc.collectionFk,NULL); - - -- Previa pendiente - ALTER TABLE tmp.productionBuffer - ADD previousWithoutParking BOOL DEFAULT FALSE; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketWithPrevia; - CREATE TEMPORARY TABLE tmp.ticketWithPrevia - (ticketFk INT PRIMARY KEY, - salesCount INT DEFAULT 0, - salesInParkingCount INT DEFAULT 0) - ENGINE = MEMORY; - - -- Insertamos todos los tickets que tienen productos parkineados en sectores de previa, segun el sector - INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount) - SELECT pb.ticketFk, COUNT(DISTINCT s.id) - FROM tmp.productionBuffer pb - JOIN vn.sale s ON s.ticketFk = pb.ticketFk - JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk - JOIN vn.sector sc ON sc.id = iss.sectorFk - JOIN vn.item i ON i.id = iss.itemFk - WHERE iss.isPreviousPrepared - AND (ISNULL(sc.itemPackingTypeFk) - OR ISNULL(i.itemPackingTypeFk) - OR sc.itemPackingTypeFk = i.itemPackingTypeFk ) - GROUP BY pb.ticketFk; - - -- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado - UPDATE tmp.ticketWithPrevia twp - JOIN ( SELECT pb.ticketFk, count(DISTINCT s.id) salesInParkingCount - FROM tmp.productionBuffer pb - JOIN vn.sale s ON s.ticketFk = pb.ticketFk - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk - WHERE NOT ISNULL(sg.parkingFk) - GROUP BY pb.ticketFk ) sub ON twp.ticketFk = sub.ticketFk - SET twp.salesInParkingCount = sub.salesInParkingCount; - - -- Marcamos como pendientes aquellos que no coinciden las cantidades - UPDATE tmp.productionBuffer pb - JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk - SET pb.previousWithoutParking = TRUE - WHERE twp.salesCount > twp.salesInParkingCount; - -/* - -- Refresca la caché para el cierre dinámico de agencias - CALL cache.departure_timing(vWarehouseFk); - - -- Tickets de recogida - REPLACE tmp.productionBuffer( - shipped - , ticketFk - , agency - , clientFk - , addressNickname - , state - , workerCode - , alertLevel - , warehouseFk - ) - SELECT DATE(t.shipped) - , t.id - , am.name - , t.clientFk - , a.nickname - , s.id as state - , w.code - , ifnull(tls.alertLevel,0) alert_level - , vWarehouseFk - FROM vn.ticket t - JOIN vn.address a on a.id = t.addressFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = am.id - LEFT JOIN vn.ticketState tls on tls.ticket = t.id - LEFT JOIN vn.state s ON s.id = tls.state - LEFT JOIN vn.worker w on w.id = tls.worker - WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) - AND wp.warehouse_id = vWarehouseFk; -*/ - - DROP TEMPORARY TABLE tmp.productionTicket; - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.risk; - DROP TEMPORARY TABLE tmp.ticket_problems; - DROP TEMPORARY TABLE tmp.ticketWithPrevia; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `productionControl__` */; -/*!50003 SET @saved_cs_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 = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `productionControl__`(vWarehouseFk INT, vScopeDays INT) -proc: BEGIN - - /** - * Devuelve un listado de tickets con parámetros relativos a la producción de los días en rango - * - * @param vWarehouseFk Identificador de vn.warehouse - * @param vScopeDays Número de días desde hoy en adelante que entran en el cálculo. - * - * @return Table tmp.productionBuffer - */ - - DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); - - DECLARE vIsTodayRelative BOOLEAN; - - SELECT isTodayRelative INTO vIsTodayRelative - FROM vn.worker - WHERE userFk = vn.getUser(); - - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT * FROM tmp.productionTicket; - - CALL vn.prepareClientList(); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems; - CREATE TEMPORARY TABLE tmp.sale_getProblems - (INDEX (ticketFk)) ENGINE = MEMORY - SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped - FROM tmp.productionTicket tt - JOIN vn.ticket t ON t.id = tt.ticketFk; - - CALL vn.ticket_getProblems(vIsTodayRelative); - - DROP TEMPORARY TABLE IF EXISTS tmp.productionBuffer; - CREATE TEMPORARY TABLE tmp.productionBuffer - (PRIMARY KEY(ticketFk)) - ENGINE = MEMORY - SELECT tt.ticketFk - , tt.clientFk - , t.warehouseFk - , t.nickname - , t.packages - , IF(HOUR(t.shipped), HOUR(t.shipped), IFNULL(HOUR(zc.hour),HOUR(z.hour))) as HH - , IFNULL(HOUR(zc.hour),HOUR(z.hour)) as Departure - , IF(MINUTE(t.shipped), MINUTE(t.shipped), IFNULL(MINUTE(zc.hour), MINUTE(z.hour))) as mm - , t.routeFk - , IF(am.deliveryMethodFk = 2,z.`id`,0) as zona - , t.nickname addressNickname - , a.postalCode - , a.city - , p.name province - , CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency - , am.id agencyModeFk - , 0 AS `lines` - , CAST( 0 AS DECIMAL(5,2)) AS m3 - , CAST( 0 AS DECIMAL(5,2)) AS preparationRate - , "" as problem - , IFNULL(tls.state,2) AS state - , w.code workerCode - , DATE(t.shipped) shipped - , wk.code AS salesPersonCode - , p.id provinceFk - , tls.productionOrder - , ifnull(tls.alertLevel,0) alertLevel - , t.isBoxed as palletized - , IF(rm.isPickingAllowed ,rm.bufferFk, NULL) ubicacion - , tlu.lastUpdated - , ifnull(st.graphCategory,0) graphCategory - , pk.code as parking - , 0 AS H - , 0 AS V - , 0 AS N - , st.isOk - , ag.isOwn - FROM tmp.productionTicket tt - JOIN vn.ticket t on tt.ticketFk = t.id - LEFT JOIN vn.ticketStateToday tst ON tst.ticket = t.id - LEFT JOIN vn.state st ON st.id = tst.state - LEFT JOIN vn.client c ON c.id = t.clientFk - LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk - JOIN vn.address a on a.id = t.addressFk - LEFT JOIN vn.province p on p.id = a.provinceFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.agency ag ON ag.id = am.agencyFk - LEFT JOIN vn.ticketState tls on tls.ticket = tt.ticketFk - LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk - LEFT JOIN vn.worker w on w.id = tls.worker - LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND date(t.shipped) = zc.dated - LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id - LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk - WHERE t.warehouseFk = vWarehouseFk - AND am.deliveryMethodFk IN (1,2,3); - - -- Problemas por ticket - ALTER TABLE tmp.productionBuffer - CHANGE COLUMN `problem` `problem` VARCHAR(255), - ADD COLUMN `collectionH` INT, - ADD COLUMN `collectionV` INT; - - UPDATE tmp.productionBuffer pb - JOIN tmp.ticket_problems tp ON tp.ticketFk = pb.ticketFk - SET pb.problem = TRIM(CAST(CONCAT( IFNULL(tp.itemShortage,''), - IFNULL(tp.itemDelay,''), - IF(tp.isFreezed,' CONGELADO',''), - IF(tp.hasHighRisk,' RIESGO',''), - IF(tp.hasTicketRequest, ' COD 100',''), - IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), - IF(tp.hasComponentLack,' COMPONENTES', ''), - IF(HOUR(NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') - ) as char(255))); - - -- Clientes Nuevos o Recuperados - UPDATE tmp.productionBuffer pb - LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk - SET pb.problem = TRIM(CAST(CONCAT('NUEVO ', pb.problem) AS CHAR(255))) - WHERE ISNULL(cnb.clientFk) OR cnb.isRookie ; - - -- Líneas y volumen por ticket - UPDATE tmp.productionBuffer pb - JOIN ( - SELECT tt.ticketFk, - COUNT(*) as `lines`, - sum(sv.volume) as m3, - IFNULL(sum(IF(sv.isPicked,sv.volume,0)) / sum(sv.volume),0) as rate - FROM tmp.productionTicket tt - JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk - GROUP BY tt.ticketFk - ) m on m.ticketFk = pb.ticketFk - SET pb.`lines` = m.`lines`, - pb.m3 = m.m3, - pb.preparationRate = m.rate; - - DELETE FROM tmp.productionBuffer - WHERE `lines`= 0; - - -- Lineas por linea de encajado - UPDATE tmp.productionBuffer pb - JOIN ( SELECT ticketFk, - sum(sub.H) H, - sum(sub.V) V, - sum(sub.N) N - FROM ( - SELECT t.ticketFk, - sum(i.itemPackingTypeFk = 'H') H, - sum(i.itemPackingTypeFk = 'V') V, - sum(ISNULL(i.itemPackingTypeFk)) N - FROM tmp.productionTicket t - JOIN vn.sale s ON s.ticketFk = t.ticketFk - JOIN vn.item i ON i.id = s.itemFk - GROUP BY t.ticketFk, i.itemPackingTypeFk) sub - GROUP BY ticketFk - ) sub2 ON sub2.ticketFk = pb.ticketFk - SET pb.H = sub2.H, - pb.V = sub2.V, - pb.N = sub2.N; - - -- Colecciones segun tipo de encajado - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionH = c.id - WHERE (c.itemPackingTypeFk = 'H' OR ISNULL(c.itemPackingTypeFk)) - AND pb.H; - - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionV = c.id - WHERE (c.itemPackingTypeFk = 'V' OR ISNULL(c.itemPackingTypeFk)) - AND pb.V; - - -- Previa pendiente - ALTER TABLE tmp.productionBuffer - ADD previousWithoutParking BOOL DEFAULT FALSE; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketWithPrevia; - CREATE TEMPORARY TABLE tmp.ticketWithPrevia - (ticketFk INT PRIMARY KEY, - salesCount INT DEFAULT 0, - salesInParkingCount INT DEFAULT 0) - ENGINE = MEMORY; - - -- Insertamos todos los tickets que tienen productos parkineados en sectores de previa, segun el sector - INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount) - SELECT pb.ticketFk, COUNT(DISTINCT s.id) - FROM tmp.productionBuffer pb - JOIN vn.sale s ON s.ticketFk = pb.ticketFk - JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk - JOIN vn.sector sc ON sc.id = iss.sectorFk - JOIN vn.item i ON i.id = iss.itemFk - WHERE iss.isPreviousPrepared - AND (ISNULL(sc.itemPackingTypeFk) - OR ISNULL(i.itemPackingTypeFk) - OR sc.itemPackingTypeFk = i.itemPackingTypeFk ) - GROUP BY pb.ticketFk; - - -- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado - UPDATE tmp.ticketWithPrevia twp - JOIN ( SELECT pb.ticketFk, count(DISTINCT s.id) salesInParkingCount - FROM tmp.productionBuffer pb - JOIN vn.sale s ON s.ticketFk = pb.ticketFk - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk - WHERE NOT ISNULL(sg.parkingFk) - GROUP BY pb.ticketFk ) sub ON twp.ticketFk = sub.ticketFk - SET twp.salesInParkingCount = sub.salesInParkingCount; - - -- Marcamos como pendientes aquellos que no coinciden las cantidades - UPDATE tmp.productionBuffer pb - JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk - SET pb.previousWithoutParking = TRUE - WHERE twp.salesCount > twp.salesInParkingCount; - -/* - -- Refresca la caché para el cierre dinámico de agencias - CALL cache.departure_timing(vWarehouseFk); - - -- Tickets de recogida - REPLACE tmp.productionBuffer( - shipped - , ticketFk - , agency - , clientFk - , addressNickname - , state - , workerCode - , alertLevel - , warehouseFk - ) - SELECT DATE(t.shipped) - , t.id - , am.name - , t.clientFk - , a.nickname - , s.id as state - , w.code - , ifnull(tls.alertLevel,0) alert_level - , vWarehouseFk - FROM vn.ticket t - JOIN vn.address a on a.id = t.addressFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = am.id - LEFT JOIN vn.ticketState tls on tls.ticket = t.id - LEFT JOIN vn.state s ON s.id = tls.state - LEFT JOIN vn.worker w on w.id = tls.worker - WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) - AND wp.warehouse_id = vWarehouseFk; -*/ - DROP TEMPORARY TABLE tmp.productionTicket; - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.risk; - DROP TEMPORARY TABLE tmp.ticket_problems; - DROP TEMPORARY TABLE tmp.ticketWithPrevia; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `productionSectorList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `productionSectorList`(vSectorFk INT) -BEGIN - - /** - * Devuelve el listado de vn.sale que se puede preparar en previa para ese sector - * - * @param vSectorFk Identificador de vn.sector - */ - - DECLARE vWarehouseFk INT; - - SELECT warehouseFk INTO vWarehouseFk - FROM vn.sector - WHERE id = vSectorFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.whiteTicket; - CREATE TEMPORARY TABLE tmp.whiteTicket - (ticketFk INT PRIMARY KEY) - SELECT s.ticketFk , count(*) AS saleNum, sum(ISNULL(i.itemPackingTypeFk)) iptNull - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticket t ON t.id = s.ticketFk - WHERE t.shipped BETWEEN CURDATE() AND TIMESTAMPADD(HOUR, 23, CURDATE()) - GROUP BY s.ticketFk - HAVING saleNum = iptNull; - - DROP TEMPORARY TABLE IF EXISTS tmp.sectorTypeTicket; - CREATE TEMPORARY TABLE tmp.sectorTypeTicket - (ticketFk INT PRIMARY KEY) - SELECT s.ticketFk , sum(i.itemPackingTypeFk <=> sc.itemPackingTypeFk) iptSector - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.sector sc ON sc.id = vSectorFk - WHERE t.shipped BETWEEN CURDATE() AND TIMESTAMPADD(HOUR, 23, CURDATE()) - GROUP BY s.ticketFk - HAVING iptSector; - - CALL vn.productionControl(vWarehouseFk, 0); - - SELECT 0,999999,0 INTO @sameTicket, @ticket, @litrosTicket; - - SELECT @litrosTicket := IF(sub.ticketFk = @ticket, @litrosTicket + Litros, Litros) as LitrosTicket, - @sameTicket := IF(sub.ticketFk = @ticket, @sameTicket, IF(@sameTicket, 0 , 1)) as sameTicket, - sub.*, - @ticket := ticketFk AS lastTicket - FROM - ( - SELECT * FROM - ( - SELECT isa.saleFk, - isa.Modificado, - isa.ticketFk, - isa.isPicked, - isa.itemFk, - isa.quantity, - isa.concept, - i.itemPackingTypeFk, - isa.`size`, - isa.Estado, - isa.sectorProdPriority, - isa.available, - isa.sectorFk, - isa.matricula, - isa.parking, - isa.itemShelving, - isa.Agency, - isa.shipped, - isa.`grouping`, - isa.packing, - isa.`hour`, - isa.isPreviousPreparable, - isa.physicalVolume, - isa.warehouseFk , - sum(isa.available) as totalAvailable, - IF (HOUR(isa.shipped),HOUR(isa.shipped), HOUR(isa.`hour`)) Hora, - IF (MINUTE(isa.shipped),MINUTE(isa.shipped), MINUTE(isa.`hour`)) Minuto, - i.subName, - CAST(isa.physicalVolume * 1000 AS DECIMAL(10,0)) as Litros - FROM vn.itemShelvingAvailable isa - JOIN vn.item i ON i.id = isa.itemFk - JOIN vn.sector s ON s.id = isa.sectorFk AND s.warehouseFk = isa.warehouseFk - JOIN vn.ticket t ON t.id = isa.ticketFk - LEFT JOIN tmp.whiteTicket wt ON wt.ticketFk = isa.ticketFk - LEFT JOIN tmp.sectorTypeTicket stt ON stt.ticketFk = isa.ticketFk - JOIN vn.client c ON c.id = t.clientFk - JOIN tmp.productionBuffer pb ON pb.ticketFk = t.id - JOIN vn.packagingConfig pc - WHERE IF(s.isPreviousPreparedByPacking, - i.`size` > pc.previousPreparationMinimumSize - AND isa.packing > 1 - AND (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ), - TRUE) - AND isa.sectorFk = vSectorFk - AND isa.quantity > 0 - AND pb.problem = "" - AND (i.itemPackingTypeFk <=> s.itemPackingTypeFk - OR ISNULL(s.itemPackingTypeFk) - OR wt.ticketFk - OR (stt.ticketFk AND ISNULL(i.itemPackingTypeFk))) - GROUP BY saleFk - HAVING isa.quantity <= totalAvailable - ) sub2 - ORDER BY Hora, Minuto, ticketFk - ) sub - ; - - DROP TEMPORARY TABLE tmp.whiteTicket; - DROP TEMPORARY TABLE tmp.sectorTypeTicket; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `rangeDateInfo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rangeDateInfo`(vStarted DATE, vEnded DATE) -BEGIN -/** - * Crea una tabla temporal con las fechas - * desde una fecha inicial a una final - * @param vStarted fecha inicial - * @param vEnded fecha final - */ - DECLARE vDated DATE DEFAULT vStarted; - - DROP TEMPORARY TABLE IF EXISTS tmp.rangeDate; - CREATE TEMPORARY TABLE tmp.rangeDate( - `dated` DATE, - `period` INT, - `month` INT, - `year` INT, - `day` INT, - `week` INT, - `yearMonth` INT - ) - ENGINE = MEMORY; - - WHILE vDated <= vEnded DO - INSERT INTO tmp.rangeDate - SET `dated` = vDated, - `period` = YEAR(vDated) * 100 + WEEK(vDated, 1), - `month` = MONTH(vDated), - `year` = YEAR(vDated), - `day` = DAY(vDated), - `week` = WEEK(vDated, 1), - `yearMonth` = YEAR(vDated) * 100 + MONTH(vDated); - - SET vDated = DATE_ADD(vDated, INTERVAL 1 DAY); - 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 `rankingTeamByQuarter` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rankingTeamByQuarter`(vYear INT, vQuarter INT) -BEGIN - - DECLARE vMinimumSalesByQuarter INT; - - SELECT minimumSalesByQuarter INTO vMinimumSalesByQuarter - FROM commissionConfig; - - DROP TEMPORARY TABLE IF EXISTS tmp.rankingTeam; - CREATE TEMPORARY TABLE tmp.rankingTeam - (PRIMARY KEY(departmentFk)) ENGINE = MEMORY - SELECT - (sub1.importe - sub2.importe) / IF ((sub1.importe - sub2.importe) > 0,sub3.countPeople,1) AS diferencia, - CONCAT(sub1.name, - '(', - sub1.peopleMinSale, - '/', - sub3.countPeople, - ')') AS teamPeople, - sub1.departmentFk AS departmentFk - FROM - (((SELECT - SUM(sub.importe) AS importe, - sub.name AS name, - sub.año AS año, - sub.departmentFk AS departmentFk, - COUNT(*) peopleMinSale - FROM - (SELECT - SUM(v.portfolioWeight) AS importe, - d.`name`, - v.año, - wd.departmentFk - FROM (((bs.vendedores v - JOIN `account`.`user` u ON (u.id = v.Id_Trabajador)) - JOIN vn.workerDepartment wd ON (wd.workerFk = u.id)) - JOIN vn.department d ON (d.id = wd.departmentFk)) - WHERE v.año = vYear - AND d.name LIKE 'EQUIPO%' - AND CEIL(v.mes / 3) = vQuarter - GROUP BY v.Id_Trabajador - HAVING importe >= vMinimumSalesByQuarter) sub - GROUP BY sub.departmentFk) sub1 - JOIN (SELECT - SUM(v.portfolioWeight) AS importe, - d.name, - wd.departmentFk - FROM (((bs.vendedores v - JOIN account.user u ON (u.id = v.Id_Trabajador)) - JOIN vn.workerDepartment wd ON (wd.workerFk = u.id)) - JOIN vn.department d ON (d.id = wd.departmentFk)) - WHERE v.año = vYear - 1 - AND d.name LIKE 'EQUIPO%' - AND CEIL(v.mes / 3) = vQuarter - GROUP BY wd.departmentFk - ORDER BY SUM(v.importe) DESC) sub2 ON (sub1.name = sub2.name)) - JOIN (SELECT COUNT(0) AS countPeople, - wd.departmentFk AS departmentFk - FROM - (vn.salesPersonSince sps - JOIN vn.workerDepartment wd ON (sps.workerFk = wd.workerFk)) - WHERE - CONCAT(YEAR(sps.started), QUARTER(sps.started)) <= CONCAT(vYear - 1, vQuarter) - GROUP BY wd.departmentFk) sub3 ON (sub3.departmentFk = sub1.departmentFk)) - ORDER BY (sub1.importe - sub2.importe) / sub3.countPeople 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 `rate_getPrices` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices`(vDated DATE, vWarehouseFk INT) -BEGIN -/** - * Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén - * - * @param vDated fecha para la cual calcula la tarifa - * @param vWarehouseFk warehouse para el cual calcula la tafia - * @return tmp.rate(rate0, rate1, rate2, rate3) - */ - DROP TEMPORARY TABLE IF EXISTS tRate; - CREATE TEMPORARY TABLE tRate - SELECT rate0, rate1, rate2, rate3 - FROM vn.rate - WHERE dated <= vDated - AND warehouseFk = vWarehouseFk - ORDER BY dated DESC; - - DROP TEMPORARY TABLE IF EXISTS tmp.rate; - CREATE TEMPORARY TABLE tmp.rate - ENGINE = MEMORY - SELECT * FROM - ( - SELECT * FROM tRate - UNION ALL - SELECT rate0, rate1, rate2, rate3 FROM rateConfig - ) sub2 - LIMIT 1; - DROP TEMPORARY TABLE tRate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `rate_getPrices2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices2`(vLanded DATE, vWarehouseFk INT) -BEGIN - - -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén - DROP TEMPORARY TABLE IF EXISTS tRate; - CREATE TEMPORARY TABLE tRate - SELECT rate0, rate1, rate2, rate3 - FROM vn.rate - WHERE dated <= vLanded - AND warehouseFk = vWarehouseFk - ORDER BY dated DESC; - - DROP TEMPORARY TABLE IF EXISTS tmp.rate; - CREATE TEMPORARY TABLE tmp.rate - ENGINE = MEMORY - SELECT * FROM - ( - SELECT * FROM tRate - UNION ALL - SELECT rate0, rate1, rate2, rate3 FROM rateConfig - ) sub2 - LIMIT 1; - DROP TEMPORARY TABLE tRate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `rate_getPrices__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices__`(vLanded DATE, vWarehouseFk INT) -BEGIN - - -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén - - DROP TEMPORARY TABLE IF EXISTS tmp.rate; - CREATE TEMPORARY TABLE tmp.rate - ENGINE = MEMORY - SELECT * FROM - ( - SELECT * FROM - ( - SELECT DISTINCT rate0, rate1, rate2, rate3 - FROM vn.rate - WHERE dated <= vLanded - AND warehouseFk = vWarehouseFk - ORDER BY dated DESC - - ) sub - UNION ALL - SELECT rate0, rate1, rate2, rate3 - FROM rateConfig - ) sub2 - 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 `recipe_Cook` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `recipe_Cook`(vItemFk INT, vBunchesQuantity INT, vDate DATE) -BEGIN - - DECLARE vCalc INT; - DECLARE vWarehouseFk INT DEFAULT 1; -- Silla FV - - SET @element := ''; - SET @counter := 0; - - CALL cache.available_refresh(vCalc, FALSE, vWarehouseFk, vDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.recipeCook; - - CREATE TEMPORARY TABLE tmp.recipeCook - SELECT *, - @counter := IF(@element = element COLLATE utf8_general_ci , @counter + 1, 1) as counter, - @element := element COLLATE utf8_general_ci - FROM - ( - SELECT i.id itemFk, - CONCAT(i.longName, ' (ref: ',i.id,')') longName, - i.size, - i.inkFk, - a.available, - r.element, - vBunchesQuantity * r.quantity as quantity, - r.itemFk as bunchItemFk, - IFNULL((i.inkFk = r.inkFk ) ,0) - + IFNULL((i.size = r.size) ,0) - + IFNULL((i.name LIKE CONCAT('%',r.name,'%')) ,0) - + IFNULL((i.longName LIKE CONCAT('%',r.longName,'%')),0) - + IFNULL((i.typeFk = r.typeFk),0) as matches, - i.typeFk, - rl.previousSelected - FROM vn.recipe r - JOIN vn.item i ON (IFNULL(i.name LIKE CONCAT('%',r.name,'%'), 0) - OR IFNULL(i.longName LIKE CONCAT('%',r.longName,'%'),0)) - OR i.typeFk <=> r.typeFk - JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalc - LEFT JOIN (SELECT recipe_ItemFk, element as log_element, selected_ItemFk, count(*) as previousSelected - FROM vn.recipe_log - GROUP BY recipe_ItemFk, element, selected_ItemFk) rl ON rl.recipe_ItemFk = r.itemFk - AND rl.log_element = r.element - AND rl.selected_ItemFk = i.id - WHERE r.itemFk = vItemFk - AND a.available > vBunchesQuantity * r.quantity - UNION ALL - SELECT 100 itemFk, - CONCAT('? ',r.element,' ',IFNULL(r.size,''),' ',IFNULL(r.inkFk,'')) as longName, - NULL, - NULL, - 0, - r.element, - vBunchesQuantity * r.quantity as quantity, - r.itemFk as bunchItemFk, - -1 as matches, - r.typeFk, - NULL - FROM vn.recipe r - WHERE r.itemFk = vItemFk - GROUP BY r.element - ) sub - - ORDER BY element, matches DESC, previousSelected DESC; - - SELECT * - FROM tmp.recipeCook - WHERE counter < 6 - OR itemFk = 100 - ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `recipe_Plaster` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `recipe_Plaster`(vItemFk INT, vTicketFk INT, vQuantity INT) -BEGIN - - DECLARE vLastCost DECIMAL(10,2); - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vEntryFk INT; - DECLARE vTravelFk INT; - - CALL cache.last_buy_refresh(FALSE); - - SELECT warehouseFk, shipped - INTO vWarehouseFk, vShipped - FROM vn.ticket - WHERE id = vTicketFk; - - UPDATE vn.ticket t - JOIN vn.item i ON i.id = vItemFk - SET t.nickname = CONCAT(vQuantity,' ',i.longName) - WHERE t.id = vTicketFk; - - SELECT b.buyingValue INTO vLastCost - FROM vn.buy b - JOIN cache.last_buy lb ON lb.buy_id = b.id - WHERE lb.item_id = vItemFk - ORDER BY (lb.warehouse_id = vWarehouseFk) DESC - LIMIT 1; - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) - SELECT vTicketFk, 98, - vQuantity, i.longName, vLastCost - FROM vn.item i - WHERE i.id = vItemFk; - /* - SELECT tr.id INTO vTravelFk - FROM vn.travel tr - JOIN vn.warehouse w ON w.id = tr.warehouseOutFk - WHERE tr.warehouseInFk = vWarehouseFk - AND tr.landed = vShipped - AND w.name = 'Confeccion'; - - IF IFNULL(vTravelFk,0) = 0 THEN - - INSERT INTO vn.travel(shipped, landed, warehouseInFk, warehouseOutFk, agencyFk) - SELECT vShipped, vShipped, vWarehouseFk, w.id, am.id - FROM vn.warehouse w - JOIN vn.agencyMode am - WHERE w.name = 'Confeccion' - AND am.name = 'DIRECTO PROVEEDOR'; - - SET vTravelFk = LAST_INSERT_ID(); - - END IF; - - SELECT e.id INTO vEntryFk - FROM vn.entry e - JOIN vn.supplier s ON s.id = supplierFk - WHERE e.travelFk = vTravelFk - AND s.name = 'Confeccion Natural' - AND e.isRaid = FALSE; - - IF IFNULL(vEntryFk,0) = 0 THEN - - INSERT INTO vn.entry(supplierFk, evaNotes, travelFk, companyFk) - SELECT s.id, t.nickname, vTravelFk, c.id - FROM vn.supplier s - JOIN vn.ticket t ON t.id = vTicketFk - JOIN vn.company c ON c.code = 'VNL' - WHERE s.name = 'Confeccion Natural'; - - SET vEntryFk = LAST_INSERT_ID(); - - END IF; - - INSERT INTO vn.buy(entryFk, itemFk, quantity, buyingValue, packageFk, packing, grouping) - SELECT vEntryFk, b.itemFk, vQuantity, b.buyingValue, b.packageFk, b.packing, b.grouping - FROM cache.last_buy lb - JOIN vn.buy b ON b.id = lb.buy_id - WHERE lb.item_id = vItemFk - ORDER BY (lb.warehouse_id = vWarehouseFk) DESC - 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 `refund` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `refund`(IN vOriginTicket INT, OUT vNewTicket INT) -BEGIN - - DECLARE vDone BIT DEFAULT 0; - DECLARE vCustomer MEDIUMINT; - DECLARE vWarehouse TINYINT; - DECLARE vCompany MEDIUMINT; - DECLARE vAddress MEDIUMINT; - DECLARE vRefundAgencyMode INT; - DECLARE vItemFk INT; - DECLARE vQuantity DECIMAL (10,2); - DECLARE vConcept VARCHAR(50); - DECLARE vPrice DECIMAL (10,2); - DECLARE vDiscount TINYINT; - DECLARE vSaleNew INT; - DECLARE vSaleMain INT; - DECLARE vZoneFk INT; - - DECLARE vRsMainTicket CURSOR FOR - SELECT id, itemFk, - quantity, concept, price, discount - FROM vn.sale - WHERE ticketFk = vOriginTicket; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; - - SELECT id INTO vRefundAgencyMode - FROM agencyMode WHERE `name` = 'ABONO'; - - SELECT clientFk, warehouseFk, companyFk, addressFk - INTO vCustomer, vWarehouse, vCompany, vAddress - FROM ticket - WHERE id = vOriginTicket; - - SELECT id INTO vZoneFk - FROM zone WHERE agencyModeFk = vRefundAgencyMode - LIMIT 1; - - INSERT INTO vn2008.Tickets ( - Id_Cliente, - Fecha, - Id_Consigna, - Id_Agencia, - Alias, - warehouse_id, - empresa_id, - landing, - zoneFk - ) - SELECT - vCustomer, - CURDATE(), - vAddress, - vRefundAgencyMode, - a.nickname, - vWarehouse, - vCompany, - CURDATE(), - vZoneFk - FROM address a - WHERE a.id = vAddress; - - SET vNewTicket = LAST_INSERT_ID(); - - SET vDone := 0; - OPEN vRsMainTicket ; - FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; - - WHILE NOT vDone DO - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount) - VALUES( vNewTicket, vItemFk, vQuantity, vConcept, vPrice, vDiscount ); - - SET vSaleNew = LAST_INSERT_ID(); - - INSERT INTO vn.saleComponent(saleFk,componentFk,`value`) - SELECT vSaleNew,componentFk,`value` - FROM vn.saleComponent - WHERE saleFk = vSaleMain; - - FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; - - END WHILE; - CLOSE vRsMainTicket; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `replaceMovimientosMark` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `replaceMovimientosMark`( - idMovimiento INT, - detalle INT, - originalQuantity INT, - idTrabajador INT, - stateFk INT, - originFk INT, - userFk INT, - actionString VARCHAR(50), - description VARCHAR(100)) -BEGIN - - /* DEPRECATED - * - * usar vn.saleTracking_Replace - * - */ - - REPLACE INTO vn2008.Movimientos_mark(Id_Movimiento, valor, original_quantity, Id_Trabajador, stateFk) - VALUES(idMovimiento,detalle,originalQuantity,idTrabajador,stateFk); - /*INSERT INTO vn.ticketLog (originFk, userFk, action , description) - VALUES(originFk, userFk, actionString, description);*/ - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `reportLabelCollection_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `reportLabelCollection_get`(vParam INT) -BEGIN -/** - * Obtiene los datos de etiquetas a partir de de un ticket o colección. - * - * @param vParam Ticket/Colección del que sacar los datos - */ - DECLARE vIsTicket BOOL; - - SELECT IF(id, TRUE, FALSE) INTO vIsTicket - FROM ticket - WHERE created > (CURRENT_DATE() - INTERVAL 1 MONTH) - AND id = vParam; - - SELECT c.itemPackingTypeFk, - CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color, - CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV, - tc.ticketFk, - LEFT(IF(t.routeFk IS NULL, am.name, zo.name ), 12) agencyDescription, - am.name, - t.clientFk, - CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), 'm³') m3 , - CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) size, - w.code workerCode, - tt.labelCount, - IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) agencyHour, - t.shipped, - COUNT(*) lineCount, - t.nickName - FROM ticket t - JOIN ticketCollection tc ON tc.ticketFk = t.id - JOIN collection c ON c.id = tc.collectionFk - JOIN collectionColors cc ON cc.shelve = tc.`level` - AND cc.wagon = tc.wagon - AND cc.trainFk = c.trainFk - JOIN sale s ON s.ticketFk = t.id - LEFT JOIN saleVolume sv ON sv.saleFk = s.id - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN itemCategory ic ON ic.id = it.categoryFk - JOIN worker w ON w.id = c.workerFk - JOIN agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN ticketTrolley tt ON tt.ticket = t.id - LEFT JOIN `zone` zo ON t.zoneFk = zo.id - WHERE IF(vIsTicket, tc.ticketFk = vParam, tc.collectionFk = vParam) - GROUP BY t.id - ORDER BY cc.`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 */ ; -/*!50003 DROP PROCEDURE IF EXISTS `riskAllClients` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `riskAllClients`(maxRiskDate DATE) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.client_list; - CREATE TEMPORARY TABLE tmp.client_list - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT id Id_Cliente, null grade FROM vn.client; - - CALL vn2008.risk_vs_client_list(maxRiskDate); - - SELECT - c.RazonSocial, - c.Id_Cliente, - c.Credito, - CAST(r.risk as DECIMAL (10,2)) risk, - CAST(c.Credito - r.risk as DECIMAL (10,2)) Diferencia, - c.Id_Pais - FROM - vn2008.Clientes c - JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente - JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente - GROUP BY c.Id_cliente; - - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - DROP TEMPORARY TABLE IF EXISTS tmp.client_list; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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; - */ - IF ISNULL(vDevice) THEN - - DELETE FROM routeGate - WHERE routeFk = vRouteFk; - - ELSE - - REPLACE routeGate(routeFk, deviceId) - VALUES(vRouteFk, vDevice); - - END IF; - /* - UPDATE vn.route r - JOIN vn.beach b ON b.name = vDevice - SET r.beachFk = b.id - WHERE r.id = vRouteFk; - */ -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 vn.agencyMode a ON a.id = 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 < 2 - WHERE t.Fecha BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND t.warehouse_id IN (1,44) - 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), - rg.ready = IF(rg.freeTickets, FALSE, rg.ready); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `routeGate_assignDevice` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `routeGate_assignDevice`(vDevice VARCHAR(30), vRouteFk INT) -BEGIN -/** - * Asigna el dispositivo la ruta - * - * @param vDevice Dispositivo a remplazar - * @param vRouteFk Ruta a la cual asignarlo - */ - IF ISNULL(vDevice) THEN - - DELETE FROM routeGate - WHERE routeFk = vRouteFk; - - ELSE - - REPLACE routeGate(routeFk, deviceId) - VALUES(vRouteFk, vDevice); - - 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 `routeGuessPriority` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `routeGuessPriority`(IN vRuta INT) -BEGIN -/* Usa los valores del ultimo año para adivinar el orden de los tickets en la ruta - * vRuta id ruta -*/ - -UPDATE ticket mt - JOIN ( - SELECT tt.addressFk, ROUND(IFNULL(AVG(t.priority),0),0) AS priority - FROM ticket t - JOIN ticket tt ON tt.addressFk = t.addressFk - WHERE t.shipped > TIMESTAMPADD(YEAR,-1,CURDATE()) - AND tt.routeFk = vRuta - GROUP BY addressFk - ) sub ON sub.addressFk = mt.addressFk - SET mt.priority = sub.priority - WHERE mt.routeFk = vRuta; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `routeInfo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `routeInfo`(vRouteFk INT) -BEGIN - - DECLARE vPackages INT; - DECLARE vM3 INT; - DECLARE vKg INT; - DECLARE vMatricula varchar(50); - - SELECT sum(packages) as bultos - INTO vPackages - FROM vn.ticket t - WHERE routeFk = vRouteFk; - - SELECT SUM(sv.physicalVolume), SUM(sv.physicalWeight) - INTO vM3, vKg - FROM vn.saleVolume sv - WHERE sv.routeFk = vRouteFk; - - SELECT v.numberPlate as matricula - INTO vMatricula - FROM vn.route r - JOIN vn.vehicle v ON r.vehicleFk = v.id - WHERE r.id = vRouteFk; - - SELECT vRouteFk as Ruta, - vPackages as Bultos, - vM3 as m3, - vKg as Kg, - vMatricula as Matricula; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `routeMonitor_calculate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `routeMonitor_calculate`(vDate DATE) -BEGIN - - DECLARE vDateEND DATETIME; - - SET vDateEND = util.dayend(vDate); - SET vDate = TIMESTAMPADD(DAY,-1,vDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.routesMonitor; - - CREATE TEMPORARY TABLE tmp.routesMonitor - (INDEX (routeFk)) - ENGINE = MEMORY - SELECT DISTINCT(t.routeFk) routeFk - FROM vn.ticket t - WHERE t.shipped BETWEEN vDate AND vDateEND - AND t.routeFk IS NOT NULL; - - INSERT IGNORE INTO routesMonitor(routeFk) - SELECT routeFk - FROM tmp.routesMonitor; - - UPDATE routesMonitor rm - JOIN route r ON r.id = rm.routeFk - JOIN agencyMode a ON a.id = r.agencyModeFk - SET rm.`name` = a.name, - rm.ticketFree = 0, - rm.ticketProduction = 0, - rm.ticketPacked = 0, - rm.dated = r.created; - - UPDATE routesMonitor rm - JOIN(SELECT t.routeFk, COUNT(*) AS ticketFree - FROM vn.ticket t - JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk - JOIN ticketLastState ts ON t.id = ts.ticketFk - JOIN ticketTracking tt ON tt.id = ts.ticketTrackingFk - JOIN state s ON s.id = tt.stateFk AND s.alertLevel = 0 - GROUP BY t.routeFk - ) sub ON sub.routeFk = rm.routeFk - SET rm.ticketFree = sub.ticketFree; - - UPDATE routesMonitor rm - JOIN(SELECT t.routeFk, COUNT(*) AS ticketPacked - FROM vn.ticket t - JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk - JOIN ticketLastState ts ON t.id = ts.ticketFk - JOIN ticketTracking tt ON tt.id = ts.ticketTrackingFk - JOIN state s ON s.id = tt.stateFk AND s.alertLevel = 2 - GROUP BY t.routeFk - ) sub ON sub.routeFk = rm.routeFk - SET rm.ticketPacked = sub.ticketPacked; - - UPDATE routesMonitor rm - JOIN(SELECT t.routeFk, COUNT(*) AS ticketProduction - FROM vn.ticket t - JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk - JOIN ticketLastState ts ON t.id = ts.ticketFk - JOIN ticketTracking tt ON tt.id = ts.ticketTrackingFk - JOIN state s ON s.id = tt.stateFk AND s.alertLevel = 3 - GROUP BY t.routeFk - ) sub ON sub.routeFk = rm.routeFk - SET rm.ticketProduction = sub.ticketProduction; - - UPDATE routesMonitor rm - JOIN( SELECT t.routeFk, COUNT(*) AS packages - FROM vn.ticket t - JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk - JOIN expedition e ON e.ticketFk = t.id - GROUP BY t.routeFk - ) sub ON sub.routeFk = rm.routeFk - SET rm.packages = sub.packages; - - UPDATE routesMonitor rm - JOIN( SELECT t.routeFk, SUM(sv.volume) AS m3 - FROM vn.ticket t - JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk - JOIN vn.saleVolume sv ON sv.ticketFk = t.id - GROUP BY t.routeFk - ) sub ON sub.routeFk = rm.routeFk - SET rm.m3 = sub.m3; - - UPDATE routesMonitor rm - JOIN( SELECT t.routeFk , sum(IFNULL(pk.volume, pk.width * pk.height * pk.`depth` )) / 1000000 m3boxes - FROM vn.ticket t - JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk - JOIN vn.expedition e ON e.ticketFk = t.id - JOIN vn.packaging pk ON pk.id = e.packagingFk - GROUP BY t.routeFk - ) sub ON sub.routeFk = rm.routeFk - SET rm.m3boxes = sub.m3boxes; - - UPDATE routesMonitor rm - JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk - SET rm.etd = et.ETD; - - DROP TEMPORARY TABLE tmp.routesMonitor; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `routeSetOk` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `routeSetOk`( - vRouteFk INT) -BEGIN - - UPDATE vn.route r - SET r.isOk = 1 - WHERE r.id = vRouteFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `routeUpdateM3` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `routeUpdateM3`(vRoute INT) -BEGIN -/** - * @deprecated Use vn.route_updateM3() - */ - call route_updateM3(vRoute); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `route_doRecalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `route_doRecalc`() -proc: BEGIN -/** - * Recalculates modified route. - */ - - DECLARE vDone BOOL; - DECLARE vRouteFk INT; - - DECLARE cCur CURSOR FOR - SELECT routeFk FROM routeRecalc; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('vn.route_doRecalc'); - ROLLBACK; - RESIGNAL; - END; - - IF !GET_LOCK('vn.route_doRecalc', 0) THEN - LEAVE proc; - END IF; - - OPEN cCur; - - myLoop: LOOP - SET vDone = FALSE; - FETCH cCur INTO vRouteFk; - - IF vDone THEN - LEAVE myLoop; - END IF; - - START TRANSACTION; - CALL route_updateM3(vRouteFk); - COMMIT; - - DELETE FROM routeRecalc WHERE routeFk = vRouteFk; - END LOOP; - - CLOSE cCur; - DO RELEASE_LOCK('vn.route_doRecalc'); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `route_getTickets` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `route_getTickets`(vRouteFk INT) -BEGIN -/** - * Pasado un RouteFk devuelve la información - * de sus tickets. - * - * @param vRouteFk - * - * @select Información de los tickets - */ - - SELECT - t.id AS Id, - t.clientFk AS Client, - a.id AS Address, - a.nickname AS ClientName, - t.packages AS Packages, - a.street AS AddressName, - a.postalCode AS PostalCode, - a.city AS City, - sub2.itemPackingTypeFk AS PackingType, - c.phone AS ClientPhone, - c.mobile AS ClientMobile, - a.phone AS AddressPhone, - a.mobile AS AddressMobile, - tl.longitude AS Longitude, - tl.latitude AS Latitude, - wm.mediaValue AS SalePersonPhone, - tob.Note AS Note, - t.isSigned AS Signed, - st.id AS Polizon - FROM ticket t - JOIN client c ON t.clientFk = c.id - JOIN address a ON t.addressFk = a.id - LEFT JOIN ticketLocation tl ON tl.ticketFk = t.id - LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk - LEFT JOIN - (SELECT tob.description AS Note, t.id - FROM ticketObservation tob - JOIN ticket t ON tob.ticketFk = t.id - JOIN observationType ot ON ot.id = tob.observationTypeFk - WHERE t.routeFk = vRouteFk - AND ot.code = 'delivery' - )tob ON tob.id = t.id - LEFT JOIN stowaway st ON st.shipFk = t.id - LEFT JOIN - (SELECT sub.ticketFk, - CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeFk - FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - WHERE t.routeFk = vRouteFk - GROUP BY t.id,i.itemPackingTypeFk)sub - GROUP BY sub.ticketFk - ) sub2 ON sub2.ticketFk = t.id - WHERE t.routeFk = vRouteFk - GROUP BY t.id - ORDER BY t.priority; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `route_updateM3` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `route_updateM3`(vRoute INT) -BEGIN - - UPDATE vn.route r - LEFT JOIN ( - SELECT routeFk, SUM(volume) AS m3 - FROM saleVolume - WHERE routeFk = vRoute - ) v ON v.routeFk = r.id - SET r.m3 = IFNULL(v.m3,0) - WHERE r.id =vRoute; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `rutasAnalyze` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `rutasAnalyze`(vYear INT, vMonth INT) -BEGIN - -/* Analiza los costes de las rutas de reparto y lo almacena en la tabla Rutas_Master -* -* PAK 15/4/2019 -*/ - - DELETE FROM bi.rutasBoard - WHERE year = vYear AND month = vMonth; - - -- Rellenamos la tabla con los datos de las rutas VOLUMETRICAS, especialmente con los bultos "virtuales" - INSERT INTO bi.rutasBoard(year, - month, - warehouse_id, - Id_Ruta, - Id_Agencia, - km, - Dia, - Fecha, - Bultos, - Matricula, - Tipo, - Terceros) - SELECT YEAR(r.created), - MONTH(r.created), - GREATEST(1,a.warehouseFk), - r.id, - r.agencyModeFk, - r.kmEnd - r.kmStart, - DAYNAME(r.created), - r.created, - SUM(sv.volume / ebv.m3), - v.numberPlate, - IF(ISNULL(`r`.`cost`), 'P', 'A'), - r.cost - FROM vn.route r - JOIN vn.ticket t ON t.routeFk = r.id - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN vn.agency a ON a.id = am.agencyFk - LEFT JOIN vn.vehicle v ON v.id = r.vehicleFk - JOIN vn.saleVolume sv ON sv.ticketFk = t.id - JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = 71 - WHERE YEAR(r.created) = vYear AND MONTH(r.created) = vMonth - AND z.isVolumetric - GROUP BY r.id; - - -- Rellenamos la tabla con los datos de las rutas NO VOLUMETRICAS, especialmente con los bultos "virtuales" - INSERT INTO bi.rutasBoard(year, - month, - warehouse_id, - Id_Ruta, - Id_Agencia, - km, - Dia, - Fecha, - Bultos, - Matricula, - Tipo, - Terceros) - SELECT YEAR(r.created), - MONTH(r.created), - GREATEST(1,a.warehouseFk), - r.id, - r.agencyModeFk, - r.kmEnd - r.kmStart, - DAYNAME(r.created), - r.created, - SUM(t.packages), - v.numberPlate, - IF(ISNULL(`r`.`cost`), 'P', 'A'), - r.cost - FROM vn.route r - JOIN vn.ticket t ON t.routeFk = r.id - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk - LEFT JOIN vn.agency a ON a.id = am.agencyFk - LEFT JOIN vn.vehicle v ON v.id = r.vehicleFk - WHERE YEAR(r.created) = vYear AND MONTH(r.created) = vMonth - AND z.isVolumetric = FALSE - GROUP BY r.id - ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos); - - -- Coste REAL de cada bulto "virtual", de acuerdo con el valor apuntado a mano en la ruta - UPDATE bi.rutasBoard r - INNER JOIN vn2008.Rutas_Master rm ON rm.año = r.year AND rm.mes = r.month AND rm.warehouse_id = r.warehouse_id - SET r.coste_bulto = IF(r.Tipo ='A', r.Terceros, r.km * rm.coste_km ) / r.Bultos - WHERE r.Bultos > 0 - AND rm.año = vYear - AND rm.mes = vMonth; - - -- Coste PRACTICO de cada bulto, de acuerdo con los componentes de tipo AGENCIA en cada linea de venta - UPDATE bi.rutasBoard r - JOIN ( - SELECT t.routeFk, sum(s.quantity * sc.value) practicoTotal - FROM vn.route r - JOIN vn.time tm ON tm.dated = r.created - JOIN vn.ticket t ON t.routeFk = r.id - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.saleComponent sc ON sc.saleFk = s.id - JOIN vn.`component` c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk - WHERE ct.type = 'agencia' - AND tm.year = vYear - AND tm.month = vMonth - GROUP BY r.id - ) sub ON sub.routeFk = r.Id_Ruta - SET r.practico = sub.practicoTotal / r.Bultos; - - -- Coste TEORICO de una caja "virtual" para cada ruta, teniendo en cuenta que hay carros, pallets, etc - UPDATE bi.rutasBoard r - JOIN ( - SELECT t.routeFk, - SUM(t.zonePrice/ ebv.ratio)/ count(*) AS BultoTeoricoMedio - FROM vn.ticket t - JOIN vn.route r ON r.id = t.routeFk - JOIN vn.time tm ON tm.dated = r.created - JOIN vn.expedition e ON e.ticketFk = t.id - JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.isBox - JOIN vn.address ad ON ad.id = t.addressFk - JOIN vn.client c ON c.id = ad.clientFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - WHERE tm.year = vYear - AND tm.month = vMonth - AND z.isVolumetric = FALSE - GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk - SET r.teorico = sub.BultoTeoricoMedio; - - -- Coste VOLUMETRICO TEORICO de una caja "virtual" para cada ruta - UPDATE bi.rutasBoard r - JOIN ( - SELECT t.routeFk, - SUM(freight) AS BultoTeoricoMedio - FROM vn.ticket t - JOIN vn.route r ON r.id = t.routeFk - JOIN vn.time tm ON tm.dated = r.created - JOIN vn.saleVolume sf ON sf.ticketFk = t.id - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.zone z ON z.id = t.zoneFk - WHERE tm.year = vYear - AND tm.month = vMonth - AND z.isVolumetric != FALSE - GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk - SET r.teorico = sub.BultoTeoricoMedio / r.Bultos; - - -- La diferencia entre el teorico y el practico se deberia de cobrar en greuges, cada noche - UPDATE bi.rutasBoard r - JOIN ( - SELECT t.routeFk, - Sum(g.amount) AS greuge - FROM vn.ticket t - JOIN vn.route r ON r.id = t.routeFk - JOIN vn.time tm ON tm.dated = r.created - JOIN vn.greuge g ON g.ticketFk = t.id - JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk - WHERE tm.year = vYear - AND tm.month = vMonth - AND gt.name = 'Diferencia portes' - GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk - SET r.greuge = sub.greuge / r.Bultos; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleBuy_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleBuy_Add`(vSaleFk INT, vBuyFk INT) -BEGIN - - /* Añade un registro a la tabla saleBuy en el caso de que sea posible mantener la trazabilidad - * - * @param vSaleFk clave primaria de vn.sale - * @param vBuyFk clave primaria de vn.buy - */ - /*IF (SELECT COUNT(*) - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE s.id = vSaleFk - AND ic.code = 'fruit') THEN */ - - IF (SELECT COUNT(*) FROM vn.buy WHERE id = vBuyFk AND itemOriginalFk) THEN - - INSERT INTO vn.saleBuy (saleFk, buyFk) - VALUES(vSaleFk, vBuyFk); - - 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 `saleGroup_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_add`(vSectorFk INT) -BEGIN -/** - * Añade un nuevo registro a la tabla y devuelve su id. - * - * @param vSectorFk Identificador de vn.sector - */ - INSERT INTO vn.saleGroup(userFk, sectorFk) - VALUES (account.myUser_getId(), vSectorFk); - - SELECT 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 `saleItemShelvingDelete__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleItemShelvingDelete__`(vSaleFk INT) -BEGIN - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - SET ish.visible = sis.quantity + ish.visible, - ish.available = sis.quantity + ish.visible - WHERE sis.saleFk = vSaleFk; - - DELETE FROM vn.saleItemShelving - WHERE saleFk = vSaleFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleItemShelvingIsPicked__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleItemShelvingIsPicked__`(vTicketFk INT, vIsPicked BOOL) -BEGIN - - DECLARE vStateFk INT; - - SELECT id INTO vStateFk - FROM state - WHERE code = 'PREVIOUS_PREPARATION'; - - UPDATE vn.sale s - JOIN vn.saleItemShelving sis ON sis.saleFk = s.id - SET s.isPicked = vIsPicked - WHERE s.ticketFk = vTicketFk; - - REPLACE vn2008.Movimientos_mark(Id_Movimiento, Valor, original_quantity, Id_Trabajador, stateFk) - SELECT s.id, s.isPicked, s.quantity, account.myUser_getId(), vStateFk - FROM sale s - JOIN vn.saleItemShelving sis ON sis.saleFk = s.id - WHERE s.ticketFk = vTicketFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleItemShelvingMake__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleItemShelvingMake__`(IN `vTicketFk` INT, IN `vSectorFk` INT) -BEGIN - - SET @rest:= CAST(0 AS DECIMAL(10,0)); - SET @saleFk := CAST(0 AS DECIMAL(10,0)); - SET @reserved := CAST(0 AS DECIMAL(10,0)); - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN sale s ON s.id = sis.saleFk - SET ish.visible = sis.quantity + ish.visible, - ish.available = sis.quantity + ish.visible - WHERE s.ticketFk = vTicketFk; - - DELETE sis.* - FROM saleItemShelving sis - JOIN sale s ON s.id = sis.saleFk - WHERE s.ticketFk = vTicketFk; - - INSERT INTO saleItemShelving( saleFk, - itemShelvingFk, - quantity, - ubication) - SELECT saleFk, - itemShelvingFk, - CAST(Reserved as DECIMAL(10,0)) as Reserved, - ubication - FROM - (SELECT saleFk, - itemShelvingFk, - ubication, - @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, - @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, - @rest := @rest - @reserved, - @saleFk := saleFk - FROM - ( SELECT s.id as saleFk, - ish.created, - ish.id as itemShelvingFk, - ish.available, - s.quantity, - ish.packing, - CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk - JOIN vn.parking p ON p.sectorFk = sc.id - JOIN vn.shelving sh ON sh.parkingFk = p.id - JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk - WHERE t.id = vTicketFk - AND sc.id = vSectorFk - AND s.quantity MOD ish.packing = 0 - AND s.quantity >= ish.packing - ORDER BY s.id, - sh.priority DESC, - ish.packing DESC, - ish.created - ) sub - ) sub2 - WHERE Reserved > 0; - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN vn.sale s ON s.id = sis.saleFk - SET ish.available = ish.visible - sis.quantity, - ish.visible = ish.visible - sis.quantity - WHERE s.ticketFk = vTicketFk - AND s.isPicked = FALSE; - - CALL vn.saleItemShelvingIsPicked(vTicketFk, 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 `saleMistake_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleMistake_Add`(vSaleFk INT, vUserFk INT, vTypeFk INT) -BEGIN - - INSERT INTO vn.saleMistake(saleFk, userFk, typeFk) - VALUES(vSaleFk, vUserFk, vTypeFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleMove` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleMove`(IN vSaleFk BIGINT, IN vQuantity BIGINT) -BEGIN - - DECLARE vShipped DATE; - DECLARE vWarehouseFk INT; - DECLARE vAddressFk INT; - DECLARE vAgencyModeFk INT; - DECLARE vNewTicket BIGINT; - DECLARE vNewSale BIGINT; - DECLARE vLanded DATE; - DECLARE vShippedDayEnd DATETIME; - DECLARE vTicketOriginalFk INT; - DECLARE hasAlreadyItem BOOLEAN; - DECLARE vItemFk INT; - DECLARE vClientTypeFk VARCHAR(20); - - SELECT t.shipped, t.warehouseFk, t.addressFk, agencyModeFk, landed, t.id, s.itemfk, c.typeFk - INTO vShipped, vWarehouseFk, vAddressFk, vAgencyModeFk, vLanded, vTicketOriginalFk, vItemFk, vClientTypeFk - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN `client` c ON t.clientFk = c.id - WHERE s.id = vSaleFk; - - SET vShippedDayEnd = util.dayEnd(vShipped); - - IF vClientTypeFk <> 'handMaking' THEN - SELECT t.id INTO vNewTicket - FROM ticket t - JOIN ticketState ts ON ts.ticketFk = t.id - WHERE t.addressFk = vAddressFk - AND t.warehouseFk = vWarehouseFk - AND t.agencyModeFk = vAgencyModeFk - AND t.landed <=> vLanded - AND t.shipped BETWEEN vShipped AND vShippedDayEnd - AND t.refFk IS NULL - AND t.id <> vTicketOriginalFk - AND IFNULL(ts.alertLevel,0) = 0 - LIMIT 1; - END IF; - - IF vNewTicket IS NULL THEN - CALL vn.ticket_Clone(vTicketOriginalFk, vNewTicket); - END IF; - - INSERT INTO ticketTracking(ticketFk, workerFk, stateFk) - SELECT vNewTicket, account.myUser_getId(), s.id - FROM state s - WHERE s.code = 'FIXING'; - - SELECT COUNT(id) INTO hasAlreadyItem - FROM sale s - WHERE s.ticketFk = vNewTicket AND s.itemFk = vItemFk; - - IF hasAlreadyItem = FALSE THEN - - INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vNewTicket, itemFk, concept, vQuantity, price, discount - FROM sale s - WHERE s.id = vSaleFk; - - SELECT LAST_INSERT_ID() INTO vNewSale; - - INSERT INTO saleComponent(saleFk, componentFk, `value`) - SELECT vNewSale, componentFk, `value` - FROM saleComponent - WHERE saleFk = vSaleFk; - - ELSE - - UPDATE sale - SET quantity = quantity + vQuantity - WHERE ticketFk = vNewTicket AND itemFk = vItemFk; - - 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 `saleParking_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleParking_add__`(vSaleFk INT, vParkingCode VARCHAR(10)) -BEGIN - - /* - * Inserta registro en saleParking - * - * vSaleFk Identificador de vn.sale - * vParkingCode Code de vn.parking - */ - - INSERT INTO vn.saleParking(saleFk, parkingFk, userFk) - SELECT vSaleFk, p.id, account.myUser_getId() - FROM vn.parking p - WHERE p.code = vParkingCode 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 `salePreparingList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `salePreparingList`(IN ticketFk BIGINT) -BEGIN - -CALL cache.last_buy_refresh(FALSE); - - SELECT t.clientFk, - t.shipped, - a.nickname, - s.ticketFk, - s.itemFk, - s.quantity, - s.concept, - s.reserved, - s.id saleFk, - i.size, - i.inkFk, - i.stems, - i.image, - i.subName, - b.`grouping`, - ip.code as placement, - lpad(ifnull(cooler_path_detail_id, ip.code),5,'0') as path, - IF(stPrevious.saleFk,TRUE,FALSE) as isPreviousSelected, - stPrevious.isChecked as isPrevious, - stPrepared.isChecked as isPrepared, - stControled.isChecked as isControled, - ib.code as barcode - - FROM vn.ticket t - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = t.warehouseFk - LEFT JOIN vn2008.cooler_path_detail cpd on left(ip.code,3) = cpd.pasillo - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 - LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 14 - LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 8 - LEFT JOIN vn.itemBarcode ib ON ib.itemFk = i.id - - WHERE t.id = ticketFk - GROUP BY s.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 `salesMerge` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `salesMerge`(vTicketFk INT) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.salesToPreserve; - - CREATE TEMPORARY TABLE tmp.salesToPreserve - SELECT id, itemFk, sum(quantity) as newQuantity - FROM vn.sale s - WHERE s.ticketFk = vTicketFk - AND s.itemFk NOT IN (95,98,100) - GROUP by itemFk, price, discount; - - UPDATE vn.sale s - JOIN tmp.salesToPreserve stp ON stp.id = s.id - SET quantity = newQuantity - WHERE s.ticketFk = vTicketFk; - - DELETE s.* - FROM vn.sale s - LEFT JOIN tmp.salesToPreserve stp ON stp.id = s.id - WHERE s.ticketFk = vTicketFk - AND stp.id IS NULL - AND s.itemFk NOT IN (95,98,100); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `salesMerge_byCollection` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `salesMerge_byCollection`(vCollectionFk INT) -BEGIN - - DECLARE vDone BOOL; - -- Fetch variables - DECLARE vTicketFk INT; - - DECLARE cCur CURSOR FOR - SELECT ticketFk - FROM vn.ticketCollection - WHERE collectionFk = vCollectionFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - OPEN cCur; - - myLoop: LOOP - - SET vDone = FALSE; - - FETCH cCur INTO vTicketFk; - - IF vDone THEN - LEAVE myLoop; - END IF; - - CALL vn.salesMerge(vTicketFk); - - END LOOP; - - CLOSE cCur; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleSplit`(vSaleFk INT, vQuantity INT) -BEGIN - - - DECLARE vNewSaleFk INT; - - INSERT INTO vn.sale(itemFk, - concept, - price, - discount, - quantity, - ticketFk, - isPriceFixed) - SELECT s.itemFk, - i.longName, - s.price, - s.discount, - vQuantity, - s.ticketFk, - s.isPriceFixed - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - WHERE s.id = vSaleFk; - - UPDATE vn.sale s - JOIN vn.item i ON i.id = s.itemFk - SET s.quantity = s.quantity - vQuantity, s.concept = i.longName - WHERE s.id = vSaleFk; - - SELECT LAST_INSERT_ID() INTO vNewSaleFk; - - INSERT INTO vn.saleComponent( saleFk, - componentFk, - value) - SELECT vNewSaleFk, - componentFk, - value - FROM vn.saleComponent - WHERE saleFk = vSaleFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleTracking_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`@`localhost` PROCEDURE `saleTracking_add`(vSaleGroupFk INT) -BEGIN - - /* Inserta en vn.saleTracking las lineas de una previa - * - * @param vSaleGroupFk Identificador de vn.saleGroup - */ - - REPLACE vn.saleTracking(saleFk, - isChecked, - workerFk, - actionFk, - stateFk) - SELECT sgd.saleFk , - TRUE, - account.myUser_getId(), - a.accion_id, - s.id - FROM vn.saleGroupDetail sgd - JOIN vncontrol.accion a ON a.accion = 'SACAR' - JOIN vn.state s ON s.code = 'ON_PREPARATION' - WHERE sgd.saleGroupFk = vSaleGroupFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleTracking_addPreparedSaleGroup` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `saleTracking_addPreparedSaleGroup`(vSaleGroupFk INT) -BEGIN - - /** - * Inserta lineas de vn.saleTracking para un saleGroup (previa) que escanea un sacador - * - * @param vSaleGroupFk Identificador de vn.saleGroup - */ - - REPLACE vn.saleTracking(saleFk, isChecked, workerFk, actionFk, stateFk) - SELECT sgd.saleFk, TRUE, account.myUser_getId(), a.accion_id id, s.id - FROM vn.saleGroupDetail sgd - JOIN vncontrol.accion a ON a.accion = 'SACAR' - JOIN vn.state s ON s.code = 'PREPARED' - WHERE sgd.saleGroupFk = vSaleGroupFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleTracking_addPrevOK` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `saleTracking_addPrevOK`(vSectorCollectionFk INT) -BEGIN - - /** - * Inserta los registros de la colección de sector con el estado PREVIA OK - * - * @param vSectorCollectionFk Identificador de vn.sectorCollection - */ - - REPLACE vn.saleTracking(saleFk, - isChecked, - workerFk, - actionFk, - stateFk) - SELECT sgd.saleFk, - TRUE, - sc.userFk, - a.accion_id, - s.id - FROM vn.sectorCollection sc - JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id - JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk - JOIN vn.state s ON s.code = 'OK PREVIOUS' - JOIN vncontrol.accion a ON a.accion = 'PRESACAR' - WHERE sc.id = vSectorCollectionFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleTracking_del` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_del`(vSaleFk INT, vState VARCHAR(50)) -BEGIN - - DELETE FROM itemShelvingSale - WHERE saleFk = vSaleFk; - - DELETE st.* - FROM vn.saleTracking st - JOIN vn.state s ON s.id = st.stateFk - WHERE st.saleFk = vSaleFk - AND s.code = vState 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 `saleTracking_new` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_new`( vSaleFK INT, - vIsChecked BOOLEAN, - vOriginalQuantity INT, - vWorkerFk INT, - vAction VARCHAR(50), - vState VARCHAR(50)) -BEGIN - - REPLACE vn.saleTracking(saleFk, - isChecked, - originalQuantity, - workerFk, - actionFk, - stateFk) - SELECT vSaleFk, - vIsChecked, - vOriginalQuantity, - IFNULL(vWorkerFk, vn.getUser()), - a.accion_id, - s.id - FROM vncontrol.accion a - JOIN vn.state s - WHERE s.code = vState COLLATE utf8_unicode_ci - AND a.accion = vAction 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 `saleTracking_Replace` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_Replace`(vSaleFk INT, vIsChecked INT, vOriginalQuantity INT, vStateFk INT) -BEGIN - REPLACE vn.saleTracking(saleFk, isChecked, originalQuantity, stateFk) - VALUES(vSaleFk, vIsChecked, vOriginalQuantity, vStateFk); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saleTracking_updateIsChecked` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `saleTracking_updateIsChecked`(vSaleFk INT, vIsChecked BOOL) -BEGIN - - /** - * Actualiza el estado del campo vn.saleTracking.isChecked y elimina las lineas de vn.itemShelving - * si procede, en el caso de las preparaciones previas, por usuario - * - * @param vSaleFk Identificador de vn.sale - * @param vIsChecked Estado del registro - */ - - UPDATE vn.saleTracking st - JOIN vn.state s ON s.id = st.stateFk AND s.code = 'PREVIOUS_PREPARATION' - SET st.isChecked = vIsChecked - WHERE st.saleFk = vSaleFk - AND st.workerFk = account.myUser_getId(); - - IF vIsChecked = FALSE THEN - - DELETE FROM vn.itemShelvingSale - WHERE saleFk = vSaleFk; - - 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 `sale_calculateComponent` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_calculateComponent`(vSale INT, vOption INT) -proc: BEGIN -/** - * Crea tabla temporal para vn.sale_recalcComponent() para recalcular los componentes - * - * @param vSale Id de la venta - * @param vOption indica en que componente pone el descuadre, NULL en casos habituales - */ - DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales; - CREATE TEMPORARY TABLE tmp.recalculateSales - SELECT s.id - FROM sale s - WHERE s.id = vSale; - - CALL vn.sale_recalcComponent(vOption); - - DROP TEMPORARY TABLE tmp.recalculateSales; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_calculateComponent__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_calculateComponent__`(vSale INT, vOption INT) -proc: BEGIN -/** - * Actualiza los componentes - * - * @param vSale Delivery date - * @param vOption indica en que componente pone el descuadre, NULL en casos habituales - * @return tmp.ticketLot(warehouseFk, available, itemFk, buyFk) - * @return tmp.sale(saleFk, warehouseFk) - */ - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAgencyModeFk INT; - DECLARE vAddressFk INT; - DECLARE vTicket BIGINT; - DECLARE vItem BIGINT; - DECLARE vLanded DATE; - DECLARE vTicketFree BOOLEAN DEFAULT TRUE; - DECLARE vZoneFk INTEGER; - - SELECT NOT (t.refFk IS NOT NULL OR ts.alertLevel > 0) OR s.price = 0, s.ticketFk, s.itemFk , t.zoneFk - INTO vTicketFree, vTicket, vItem, vZoneFk - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id - WHERE s.id = vSale - LIMIT 1; - - SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.agencyModeFk, t.landed - INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded - FROM agencyMode a - JOIN ticket t ON t.agencyModeFk = a.id - WHERE t.id = vTicket; - - IF IFNULL(vZoneFk,0) = 0 THEN - CALL util.throw('ticket dont have zone'); - END IF; - - CALL buyUltimate (vWarehouseFk, vShipped); - - DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk - FROM tmp.buyUltimate - WHERE itemFk = vItem; - - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT vSale saleFk,vWarehouseFk warehouseFk; - - IF vOption IS NULL THEN - SET vOption = IF(vTicketFree,1,6); - END IF; - - CALL ticketComponentUpdateSale(vOption); - - INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) - VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); - - DROP TEMPORARY TABLE tmp.buyUltimate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_calculateComponent__2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_calculateComponent__2`() -proc: BEGIN -/** - * Actualiza los componentes - * - * @param vSale Delivery date - * @param vOption indica en que componente pone el descuadre, NULL en casos habituales - */ - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAgencyModeFk INT; - DECLARE vAddressFk INT; - DECLARE vTicketFk BIGINT; - DECLARE vItemFk BIGINT; - DECLARE vLanded DATE; - DECLARE vIsEditable BOOLEAN; - DECLARE vZoneFk INTEGER; - - DECLARE vSaleFk INTEGER; - DECLARE v_done BOOL DEFAULT FALSE; - - DECLARE vCur CURSOR FOR - select id from tmp.ticketRose; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE; - - OPEN vCur; - - l: LOOP - SET v_done = FALSE; - FETCH vCur INTO vSaleFk; - - IF v_done THEN - LEAVE l; - END IF; - - SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0), - s.ticketFk, - s.itemFk , - t.zoneFk, - t.warehouseFk, - t.shipped, - t.addressFk, - t.agencyModeFk, - t.landed - INTO vIsEditable, - vTicketFk, - vItemFk, - vZoneFk, - vWarehouseFk, - vShipped, - vAddressFk, - vAgencyModeFk, - vLanded - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - LEFT JOIN ticketState ts ON ts.ticketFk = t.id - WHERE s.id = vSaleFk; - - - CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); - - IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) > 0 THEN - - IF vLanded IS NULL OR vZoneFk IS NULL THEN - - UPDATE ticket t - SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) - WHERE t.id = vTicketFk AND t.landed IS NULL; - - IF vZoneFk IS NULL THEN - SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; - UPDATE ticket t - SET t.zoneFk = vZoneFk - WHERE t.id = vTicketFk AND t.zoneFk IS NULL; - END IF; - DROP TEMPORARY TABLE tmp.zoneGetLanded; - - END IF; - - -- rellena la tabla buyUltimate con la ultima compra - CALL buyUltimate (vWarehouseFk, vShipped); - - DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk - FROM tmp.buyUltimate - WHERE itemFk = vItemFk; - - CALL catalog_componentPrepare(); - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT vSaleFk saleFk,vWarehouseFk warehouseFk; - /* - IF vOption IS NULL THEN - SET vOption = IF(vIsEditable, 1, 6); - END IF; - */ - - CALL ticketComponentUpdateSale(1); - CALL catalog_componentPurge(); - - DROP TEMPORARY TABLE tmp.buyUltimate; - DROP TEMPORARY TABLE tmp.sale; - - ELSE - INSERT INTO tmp.ticketFail (id) values (vSaleFk); - END IF; - - END LOOP; - CLOSE vCur; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_checkNoComponents` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_checkNoComponents`(vCreatedFrom DATETIME, vCreatedTo DATETIME) -BEGIN -/** - * Comprueba que las ventas creadas entre un rango de fechas tienen componentes - * - * @param vCreatedFrom inicio del rango - * @param vCreatedTo fin del rango - */ - DECLARE v_done BOOL DEFAULT FALSE; - DECLARE vSaleFk INTEGER; - DECLARE vTicketFk INTEGER; - DECLARE vConcept VARCHAR(50); - DECLARE vCur CURSOR FOR - SELECT s.id - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - JOIN item i ON i.id = s.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - LEFT JOIN tmp.coste c ON c.id = s.id - WHERE s.created >= vCreatedFrom AND s.created <= vCreatedTo - AND c.id IS NULL - AND t.agencyModeFk IS NOT NULL - AND t.isDeleted IS FALSE - AND t.warehouseFk = 60 - AND ic.merchandise != FALSE - GROUP BY s.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.coste; - - DROP TEMPORARY TABLE IF EXISTS tmp.coste; - CREATE TEMPORARY TABLE tmp.coste - (PRIMARY KEY (id)) ENGINE = MEMORY - SELECT s.id - FROM sale s - JOIN item i ON i.id = s.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - JOIN saleComponent sc ON sc.saleFk = s.id - JOIN component c ON c.id = sc.componentFk - JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 6 - WHERE s.created >= vCreatedFrom - AND ic.merchandise != FALSE; - - OPEN vCur; - - l: LOOP - SET v_done = FALSE; - FETCH vCur INTO vSaleFk; - - IF v_done THEN - LEAVE l; - END IF; - - SELECT ticketFk, concept - INTO vTicketFk, vConcept - FROM sale - WHERE id = vSaleFk; - - CALL util.debugAdd(vTicketFk, vConcept); - CALL sale_calculateComponent(vSaleFk, 1); - END LOOP; - - CLOSE vCur; - DROP TEMPORARY TABLE tmp.coste; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_fruitWithoutLot__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_fruitWithoutLot__`() -BEGIN -/** -* -* Manda correo a el usuario encargado de fruta y verdura -* de las lineas de tickets a las que no ha sido asignada -* un lote. -* -*/ - SET SESSION group_concat_max_len = 102400; - - INSERT INTO mail (receiver,replyTo,subject,body) - SELECT CONCAT(sub.name, '@verdnatura.es') receiver, - 'noreply@verdnatura.es' replyTo, - CONCAT( - 'El ', - CONCAT (CAST((SUM(sub.fail)/COUNT(*))*100 AS DECIMAL(10,2)), ' %'), - CONCAT(' de los artículos han sido vendidos sin lote con fecha: ', DATE_SUB(CURDATE(), INTERVAL 3 DAY )) - ) subject, - GROUP_CONCAT(sub.ticket SEPARATOR '

') body - FROM (SELECT IF (sb.saleFk IS NULL,1, 0) fail, - u.name, - IF (sb.saleFk IS NULL,CONCAT('Artículo ',i.id,', ',i.name,':
     - https://salix.verdnatura.es/#!/ticket/',t.id,'/sale'), NULL) ticket - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - LEFT JOIN saleBuy sb ON sb.saleFk = s.id - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN account.user u ON u.id = it.workerFk - JOIN itemCategory ic ON ic.id = it.categoryFk - WHERE t.shipped = DATE_SUB(CURDATE(), INTERVAL 1 DAY) - AND ic.code='fruit')sub; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_getForSijsner__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getForSijsner__`(vDated DATE) -BEGIN - - /** - * Devuelve el listado de ventas que tiene que etiquetar Sijsner para la fecha dada - * - * @param vDated Fecha de preparación de los tickets - */ - - SELECT b.printedStickers OR s.isPicked isPrinted, - t.shipped , - t.nickname , - s.ticketFk , - s.itemFk , - FLOOR(s.quantity / e.pac) stickers, - CONCAT(FLOOR(s.quantity / e.pac) , ' x ', e.pac ) amount, - s.concept, - e.kop, - e.sub, - sp.company_name supplier, - b.id buyFk - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.item i ON i.id = s.itemFk - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN edi.ekt e ON e.id = b.ektFk - LEFT JOIN edi.supplier sp ON sp.supplier_id = e.pro - WHERE t.shipped BETWEEN vDated AND TIMESTAMPADD(HOUR,23,vDated) - AND c.code != 'ES' - AND w.code IN ('FLM','VNH') - AND s.quantity ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_getFromTicketOrCollection` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getFromTicketOrCollection`(vParam INT) -BEGIN -/** - * Visualizar lineas de la tabla sale a través del parámetro vParam que puede - * ser ticket o collection. - * - * @param vParam Identificador de ticket o collection - */ - DECLARE vItemPackingTypeFk VARCHAR(1); - DECLARE vIsCollection BOOL; - - SELECT COUNT(*) INTO vIsCollection - FROM collection c - WHERE c.id = vParam; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; - - IF vIsCollection THEN - CREATE TEMPORARY TABLE tmp.ticket - (INDEX (id)) - ENGINE = MEMORY - SELECT tc.ticketFk id - FROM ticketCollection tc - JOIN ticket t ON t.id = tc.ticketFk - WHERE tc.collectionFk = vParam; - - CREATE TEMPORARY TABLE tmp.ticket2 - (INDEX (id)) - ENGINE = MEMORY - SELECT tc.ticketFk id - FROM ticketCollection tc - JOIN ticket t ON t.id = tc.ticketFk - WHERE tc.collectionFk = vParam; - ELSE - CREATE TEMPORARY TABLE tmp.ticket - (INDEX (id)) - ENGINE = MEMORY - SELECT vParam id; - - CREATE TEMPORARY TABLE tmp.ticket2 - (INDEX (id)) - ENGINE = MEMORY - SELECT vParam id; - END IF; - - SELECT s.ticketFk, - sgd.saleGroupFk, - s.id as saleFk, - s.itemFk, - s.quantity, - i.longName, - i.size, - s.reserved, - MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) as isPreviousPrepared, - MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) as isPrepared, - MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) as isControlled, - MAX(IF(st.semaphore <=> 4, TRUE, FALSE)) as isPreControlled, - ic.color, - ip.productor, - s.discount, - s.price, - i.stems, - i.category, - o.code origin, - tt.clientFk, - s.originalQuantity, - TRIM(CONCAT(LPAD(s.concept,30,' '), ' ', - RPAD(IFNULL(i.size,''),5,' '))) line1, - '' cel1, - TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) line2, - IF(s.quantity MOD IFNULL(b.packing,s.quantity + 1), - CONCAT(CAST(s.quantity/IFNULL(b.`grouping`,1) AS DECIMAL(10,0)),' x ',IFNULL(b.`grouping`,1)), - CONCAT(CAST(s.quantity / IFNULL(b.packing,1) AS DECIMAL(10,0)),' pack de ',IFNULL(b.packing,1))) cel2, - TRIM(CONCAT(ic.color)) line3, - p.code cel3, - s.isAdded, - sub2.originalQuantity as startQuantity, -- eliminar cuando tengamos la nueva apk - IFNULL(c.workerFk,getUser()) as workerFk, - IFNULL(SUM(iss.quantity),0) as pickedQuantity, - i.packingShelve, - MIN(iss.created) picked - FROM tmp.ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN ticket tt ON tt.id = t.id - LEFT JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = tt.warehouseFk - LEFT JOIN buy b ON b.id = lb.buy_id - JOIN item i ON i.id = s.itemFk - LEFT JOIN ticketCollection tc ON tc.ticketFk = t.id - LEFT JOIN collection c ON c.id = tc.collectionFk - LEFT JOIN (SELECT sub.saleFk, sub.isChecked, sub.stateFk, sub.originalQuantity - FROM (SELECT DISTINCT st.id, st.saleFk, st.isChecked, st.stateFk, st.originalQuantity - FROM tmp.ticket2 t - JOIN sale s ON s.ticketFk = t.id - JOIN saleTracking st ON st.saleFk = s.id - ORDER BY st.id DESC) sub - GROUP BY sub.saleFk, sub.stateFK) sub2 ON sub2.saleFk = s.id AND sub2.isChecked = 1 - LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id - LEFT JOIN state st ON st.id = sub2.stateFk - LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk - LEFT JOIN itemProductor ip ON ip.itemFk = s.itemFk - LEFT JOIN origin o ON o.id = i.originFk - LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id - LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk - LEFT JOIN parking p ON p.id = sg.parkingFk - GROUP BY s.id; - - DROP TEMPORARY TABLE - tmp.ticket, - tmp.ticket2; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_getProblems` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblems`(IN vIsTodayRelative tinyint(1)) -BEGIN -/** - * Calcula los problemas de cada venta para un conjunto de tickets. - * - * @param vIsTodayRelative Indica si se calcula el disponible como si todo saliera hoy - * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular - * @return tmp.sale_problems - */ - DECLARE vWarehouseFk INT; - DECLARE vDate DATE; - DECLARE vAvailableCache INT; - DECLARE vVisibleCache INT; - DECLARE vDone INT DEFAULT 0; - DECLARE vComponentCount INT; - - DECLARE vCursor CURSOR FOR - SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)) - FROM tmp.sale_getProblems tt - WHERE DATE(tt.shipped) BETWEEN CURDATE() - AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; - - DELETE tt.* - FROM tmp.sale_getProblems tt - JOIN vn.ticketObservation tto ON tto.ticketFk = tt.ticketFk - JOIN vn.observationType ot ON ot.id = tto.observationTypeFk - WHERE ot.code = 'administrative' - AND tto.description = 'Miriam'; - - DROP TEMPORARY TABLE IF EXISTS tmp.sale_problems; - CREATE TEMPORARY TABLE tmp.sale_problems ( - ticketFk INT(11), - saleFk INT(11), - isFreezed INTEGER(1) DEFAULT 0, - risk DECIMAL(10,2) DEFAULT 0, - hasHighRisk TINYINT(1) DEFAULT 0, - hasTicketRequest INTEGER(1) DEFAULT 0, - isAvailable INTEGER(1) DEFAULT 1, - itemShortage VARCHAR(255), - isTaxDataChecked INTEGER(1) DEFAULT 1, - itemDelay VARCHAR(255), - itemLost VARCHAR(255), - hasComponentLack INTEGER(1), - isTooLittle BOOL DEFAULT FALSE, - PRIMARY KEY (ticketFk, saleFk) - ) ENGINE = MEMORY; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; - CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (ticketFk)) - ENGINE = MEMORY - SELECT tp.ticketFk, tp.clientFk - FROM tmp.sale_getProblems tp; - - SELECT COUNT(*) INTO vComponentCount - FROM vn.component c - WHERE c.isRequired; - - -- Too Little - INSERT INTO tmp.sale_problems(ticketFk, isTooLittle) - SELECT tp.ticketFk, TRUE - FROM tmp.sale_getProblems tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN (SELECT t.addressFk, SUM(sv.litros) litros, t.totalWithoutVat - FROM tmp.ticket_list tl - JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = CURDATE() - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),CURDATE())) - AND dm.code IN('AGENCY','DELIVERY','PICKUP') - AND t.shipped BETWEEN CURDATE() AND util.midnight() - GROUP BY t.addressFk) sub ON sub.addressFk = t.addressFk - JOIN vn.volumeConfig vc - WHERE sub.litros < vc.minTicketVolume - AND sub.totalWithoutVat < vc.minTicketValue; - - -- Faltan componentes - INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk) - SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id)), s.id - FROM tmp.ticket_list tl - JOIN vn.sale s ON s.ticketFk = tl.ticketFk - LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id - LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE dm.code IN('AGENCY','DELIVERY','PICKUP') - GROUP BY tl.ticketFk, s.id; - - -- Cliente congelado - INSERT INTO tmp.sale_problems(ticketFk, isFreezed) - SELECT DISTINCT tl.ticketFk, TRUE - FROM tmp.ticket_list tl - JOIN vn.client c ON c.id = tl.clientFk - WHERE c.isFreezed - ON DUPLICATE KEY UPDATE isFreezed = c.isFreezed; - - -- Cr�dito excedido - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - (PRIMARY KEY (clientFk)) - ENGINE = MEMORY - SELECT DISTINCT clientFk - FROM tmp.ticket_list; - - CALL clientGetDebt(CURDATE()); - - INSERT INTO tmp.sale_problems(ticketFk, risk, hasHighRisk) - SELECT DISTINCT tl.ticketFk, r.risk, ((r.risk - cc.riskTolerance) > c.credit + 10) - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.agencyMode a ON t.agencyModeFk = a.id - JOIN tmp.risk r ON r.clientFk = t.clientFk - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.clientConfig cc - WHERE r.risk > c.credit + 10 - AND a.isRiskFree = FALSE - ON DUPLICATE KEY UPDATE - risk = r.risk, hasHighRisk = ((r.risk - cc.riskTolerance) > c.credit + 10); - - -- Antiguo COD 100, son peticiones de compra sin terminar - INSERT INTO tmp.sale_problems(ticketFk, hasTicketRequest) - SELECT DISTINCT tl.ticketFk, TRUE - FROM tmp.ticket_list tl - JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk - WHERE tr.isOK IS NULL - ON DUPLICATE KEY UPDATE hasTicketRequest = TRUE; - - -- Disponible, Faltas, Inventario y Retrasos - OPEN vCursor; - - WHILE NOT vDone DO - - FETCH vCursor INTO vWarehouseFk, vDate; - - -- Disponible: no va a haber suficiente producto para preparar todos los pedidos - CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, vDate); - - INSERT INTO tmp.sale_problems(ticketFk, isAvailable, saleFk) - SELECT tl.ticketFk, FALSE, s.id - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - WHERE date(t.shipped) = vDate - AND ic.merchandise = TRUE - AND IFNULL(av.available, 0) < 0 - AND s.isPicked = FALSE - AND NOT i.generic - AND vWarehouseFk = t.warehouseFk - GROUP BY tl.ticketFk - ON DUPLICATE KEY UPDATE isAvailable = FALSE, saleFk = VALUES(saleFk); - - -- Faltas: visible, disponible y ubicado son menores que la cantidad vendida - CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); - - INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk) - SELECT ticketFk, problem, saleFk - FROM ( - SELECT tl.ticketFk, - LEFT(CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')),250) problem, - s.id AS saleFk - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache - LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - WHERE IFNULL(v.visible,0) < s.quantity - AND IFNULL(av.available ,0) < s.quantity - AND IFNULL(issw.visible, 0) < s.quantity - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND ic.merchandise = TRUE - AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) - AND NOT i.generic - AND CURDATE() = vDate - AND t.warehouseFk = vWarehouseFk - GROUP BY tl.ticketFk) sub - ON DUPLICATE KEY UPDATE itemShortage = sub.problem, saleFk = sub.saleFk; - - -- Inventario: Visible suficiente, pero ubicado menor a la cantidad vendida - INSERT INTO tmp.sale_problems(ticketFk, itemLost, saleFk) - SELECT ticketFk, problem, saleFk - FROM ( - SELECT tl.ticketFk, LEFT(GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' '),250) problem, s.id AS saleFk - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - WHERE IFNULL(v.visible,0) >= s.quantity - AND IFNULL(issw.visible, 0) < s.quantity - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND ic.merchandise = TRUE - AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) - AND NOT i.generic - AND CURDATE() = vDate - AND t.warehouseFk = vWarehouseFk - GROUP BY tl.ticketFk) sub - ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; - - -- Retraso: Disponible suficiente, pero no visible ni ubicado - INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk) - SELECT ticketFk, problem, saleFk - FROM ( - SELECT tl.ticketFk, LEFT(GROUP_CONCAT('R: ',i.id, ' ', i.longName, ' '),250) problem, s.id AS saleFk - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache - LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - WHERE IFNULL(v.visible,0) < s.quantity - AND IFNULL(av.available ,0) >= s.quantity - AND IFNULL(issw.visible, 0) < s.quantity - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND ic.merchandise = TRUE - AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) - AND NOT i.generic - AND CURDATE() = vDate - AND t.warehouseFk = vWarehouseFk - GROUP BY tl.ticketFk) sub - ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; - END WHILE; - - CLOSE vCursor; - - INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked) - SELECT DISTINCT tl.ticketFk, FALSE - FROM tmp.ticket_list tl - JOIN vn.client c ON c.id = tl.clientFk - WHERE c.isTaxDataChecked = FALSE - ON DUPLICATE KEY UPDATE isTaxDataChecked = FALSE; - - DROP TEMPORARY TABLE - tmp.clientGetDebt, - tmp.ticket_list; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_getProblemsByTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1)) -BEGIN -/** - * Calcula los problemas de cada venta - * para un conjunto de tickets. - * - * @return Problems result - */ - DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems; - CREATE TEMPORARY TABLE tmp.sale_getProblems - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped - FROM ticket t - WHERE t.id = vTicketFk; - - CALL sale_getProblems(vIsTodayRelative); - - SELECT * FROM tmp.sale_problems; - - DROP TEMPORARY TABLE - tmp.sale_getProblems, - tmp.sale_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 `sale_getProblems__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblems__`(IN vIsTodayRelative tinyint(1)) -BEGIN -/** - * Calcula los problemas de cada venta - * para un conjunto de tickets. - * - * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular - * @return tmp.sale_problems - */ - DECLARE vWarehouse INT; - DECLARE vDate DATE; - DECLARE vAvailableCache INT; - DECLARE vDone INT DEFAULT 0; - DECLARE vComponentCount INT; - - DECLARE vCursor CURSOR FOR - SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)) - FROM tmp.sale_getProblems tt - WHERE DATE(tt.shipped) BETWEEN CURDATE() - AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.sale_problems; - CREATE TEMPORARY TABLE tmp.sale_problems ( - ticketFk INT(11), - saleFk INT(11), - isFreezed INTEGER(1) DEFAULT 0, - risk DECIMAL(10,2) DEFAULT 0, - hasHighRisk TINYINT(1) DEFAULT 0, - hasTicketRequest INTEGER(1) DEFAULT 0, - isAvailable INTEGER(1) DEFAULT 1, - itemShortage VARCHAR(250), - isTaxDataChecked INTEGER(1) DEFAULT 1, - itemDelay VARCHAR(250), - hasComponentLack INTEGER(1), - isTooLittle BOOL DEFAULT FALSE, - PRIMARY KEY (ticketFk, saleFk) - ) ENGINE = MEMORY; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; - CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (ticketFk)) - ENGINE = MEMORY - SELECT tp.ticketFk, c.id clientFk - FROM tmp.sale_getProblems tp - JOIN vn.client c ON c.id = tp.clientFk; - - SELECT COUNT(*) INTO vComponentCount - FROM vn.component c - WHERE c.isRequired; - - INSERT INTO tmp.sale_problems(ticketFk, isTooLittle) - SELECT sub.ticketFk, TRUE - FROM (SELECT tl.ticketFk, SUM(sv.litros) litros - FROM tmp.ticket_list tl - JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = CURDATE() - WHERE NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),CURDATE())) - GROUP BY tl.ticketFk) sub - JOIN vn.volumeConfig vc - WHERE sub.litros < vc.minTicketVolume; - - INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk) - SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id)), s.id - FROM tmp.ticket_list tl - JOIN vn.sale s ON s.ticketFk = tl.ticketFk - LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id - LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE dm.code IN('AGENCY','DELIVERY','PICKUP') - GROUP BY tl.ticketFk, s.id; - - INSERT INTO tmp.sale_problems(ticketFk, isFreezed) - SELECT DISTINCT tl.ticketFk, TRUE - FROM tmp.ticket_list tl - JOIN vn.client c ON c.id = tl.clientFk - WHERE c.isFreezed - ON DUPLICATE KEY UPDATE - isFreezed = c.isFreezed; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - (PRIMARY KEY (clientFk)) - ENGINE = MEMORY - SELECT DISTINCT clientFk - FROM tmp.ticket_list; - - CALL clientGetDebt(CURDATE()); - - INSERT INTO tmp.sale_problems(ticketFk, risk, hasHighRisk) - SELECT DISTINCT tl.ticketFk, r.risk, ((r.risk - cc.riskTolerance) > c.credit + 10) - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.agencyMode a ON t.agencyModeFk = a.id - JOIN tmp.risk r ON r.clientFk = t.clientFk - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.clientConfig cc - WHERE r.risk > c.credit + 10 - AND a.isRiskFree = FALSE - ON DUPLICATE KEY UPDATE - risk = r.risk, hasHighRisk = ((r.risk - cc.riskTolerance) > c.credit + 10); - - INSERT INTO tmp.sale_problems(ticketFk, hasTicketRequest) - SELECT DISTINCT tl.ticketFk, TRUE - FROM tmp.ticket_list tl - JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk - WHERE tr.isOK IS NULL - ON DUPLICATE KEY UPDATE - hasTicketRequest = TRUE; - - OPEN vCursor; - - WHILE NOT vDone - DO - FETCH vCursor INTO vWarehouse, vDate; - - CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate); - - INSERT INTO tmp.sale_problems(ticketFk, isAvailable, saleFk) - SELECT tl.ticketFk, FALSE, s.id - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - LEFT JOIN cache.available av ON av.item_id = i.id - AND av.calc_id = vAvailableCache - WHERE date(t.shipped) = vDate - AND it.categoryFk != 6 - AND IFNULL(av.available, 0) < 0 - AND s.isPicked = FALSE - AND NOT i.generic - AND vWarehouse = t.warehouseFk - GROUP BY tl.ticketFk - ON DUPLICATE KEY UPDATE - isAvailable = FALSE, saleFk = VALUES(saleFk); - - INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk) - SELECT ticketFk, problem, saleFk - FROM ( - SELECT tl.ticketFk, CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')) problem, s.id AS saleFk - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - WHERE IFNULL(av.available, 0) < 0 - AND s.quantity > IFNULL(issw.visible, 0) - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND it.categoryFk != 6 - AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) - AND NOT i.generic - AND CURDATE() = vDate - AND t.warehouseFk = vWarehouse - GROUP BY tl.ticketFk LIMIT 1) sub - ON DUPLICATE KEY UPDATE - itemShortage = sub.problem, saleFk = sub.saleFk; - - INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk) - SELECT ticketFk, problem, saleFk - FROM ( - SELECT tl.ticketFk, GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' ') problem, s.id AS saleFk - FROM tmp.ticket_list tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - WHERE s.quantity > IFNULL(issw.visible, 0) - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND it.categoryFk != 6 - AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) - AND NOT i.generic - AND CURDATE() = vDate - AND t.warehouseFk = vWarehouse - GROUP BY tl.ticketFk LIMIT 1) sub - ON DUPLICATE KEY UPDATE - itemDelay = sub.problem, saleFk = sub.saleFk; - END WHILE; - - CLOSE vCursor; - - INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked) - SELECT DISTINCT tl.ticketFk, FALSE - FROM tmp.ticket_list tl - JOIN vn.client c ON c.id = tl.clientFk - WHERE c.isTaxDataChecked = FALSE - ON DUPLICATE KEY UPDATE - isTaxDataChecked = FALSE; - - DROP TEMPORARY TABLE - tmp.clientGetDebt, - tmp.ticket_list; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_PriceFix` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `sale_PriceFix`(vTicketFk INT) -BEGIN - - DELETE sc.* - FROM vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk - WHERE s.ticketFk = vTicketFk - AND ct.`type` = 'otros'; - - UPDATE vn.sale s - JOIN ( - SELECT sc.saleFk, sum(sc.value ) price - FROM vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk - WHERE s.ticketFk = vTicketFk - GROUP BY sc.saleFk) sub ON sub.saleFk = s.id - SET s.price = sub.price; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_recalcComponent` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_recalcComponent`(vOption INT) -proc: BEGIN -/** - * Actualiza los componentes - * - * @table tmp.recalculateSales - */ - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAgencyModeFk INT; - DECLARE vAddressFk INT; - DECLARE vTicketFk BIGINT; - DECLARE vItemFk BIGINT; - DECLARE vLanded DATE; - DECLARE vIsEditable BOOLEAN; - DECLARE vZoneFk INTEGER; - - DECLARE vSale INTEGER; - DECLARE vDone BOOL DEFAULT FALSE; - - DECLARE vCur CURSOR FOR - SELECT id from tmp.recalculateSales; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - OPEN vCur; - - l: LOOP - SET vDone = FALSE; - FETCH vCur INTO vSale; - - IF vDone THEN - LEAVE l; - END IF; - - SELECT t.refFk IS NULL, - s.ticketFk, - s.itemFk , - t.zoneFk, - t.warehouseFk, - t.shipped, - t.addressFk, - t.agencyModeFk, - t.landed - INTO vIsEditable, - vTicketFk, - vItemFk, - vZoneFk, - vWarehouseFk, - vShipped, - vAddressFk, - vAgencyModeFk, - vLanded - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - LEFT JOIN ticketState ts ON ts.ticketFk = t.id - WHERE s.id = vSale; - - CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); - - IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN - CALL util.throw('There is no zone for these parameters'); - END IF; - - IF vLanded IS NULL OR vZoneFk IS NULL THEN - - UPDATE ticket t - SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) - WHERE t.id = vTicketFk AND t.landed IS NULL; - - IF vZoneFk IS NULL THEN - SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; - UPDATE ticket t - SET t.zoneFk = vZoneFk - WHERE t.id = vTicketFk AND t.zoneFk IS NULL; - END IF; - - END IF; - - DROP TEMPORARY TABLE tmp.zoneGetLanded; - - -- rellena la tabla buyUltimate con la ultima compra - CALL buyUltimate (vWarehouseFk, vShipped); - - DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk - FROM tmp.buyUltimate - WHERE itemFk = vItemFk; - - CALL catalog_componentPrepare(); - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT vSale saleFk,vWarehouseFk warehouseFk; - - IF vOption IS NULL THEN - SET vOption = IF(vIsEditable, 1, 6); - END IF; - - CALL ticketComponentUpdateSale(vOption); - CALL catalog_componentPurge(); - - DROP TEMPORARY TABLE tmp.buyUltimate; - DROP TEMPORARY TABLE tmp.sale; - - END LOOP; - CLOSE vCur; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_setQuantity` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_setQuantity`(vSaleFk INT, vQuantity INT) -BEGIN -/* - * Actualiza la cantidad de la línea de venta - * - * @vSaleFk id de la línea de venta - * @vQuantity cantidad a modificar - * - */ - - DECLARE vDescription VARCHAR(100); - DECLARE vOrigin INT; - - SELECT CONCAT("Cambio cantidad ",concept," de ", quantity," a ", vQuantity) INTO vDescription - FROM sale - WHERE id = vSaleFk; - - SELECT ticketFk INTO vOrigin FROM sale WHERE id = vSaleFk; - - CALL logAdd(vOrigin, 'update', 'ticket', vDescription); - - UPDATE sale - SET originalQuantity = quantity, - quantity = vQuantity - WHERE id = vSaleFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sale_updateOriginalQuantity` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_updateOriginalQuantity`(vSale INT, vQuantity INT) -proc: BEGIN - -UPDATE vn.sale SET originalQuantity = vQuantity -WHERE id = vSale; - -SELECT * FROM vn.sale WHERE id = vSale; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `saveLoadWorker` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `saveLoadWorker`(routeFk INT, workerFk INT) -BEGIN - - -REPLACE INTO vn.routeLoadWorker(routeFk, workerFk) -VALUES(routeFk,workerFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `scanTreeCreate__`() -BEGIN - CALL nestTree( - 'vn2008', - 'scan', - 'vn2008', - 'scanTree' - ); - - 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 expedition e ON e.id = sl.`code` - JOIN 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 */ ; -/*!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 `sectorCollectionSaleGroup_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollectionSaleGroup_add`(vSaleGroupFk INT, vSectorCollectionFk INT) -BEGIN - - /** - * Inserta un nuevo registro en vn.sectorCollectionSaleGroup - * Actualiza el usuario en vn.saleGroup y reemplaza los registros de vn.saleTracking - * - * @param vSaleGroupFk Identificador de vn.saleGroup - * @param vSectorCollectionFk Identificador de vn.sectorCollection - */ - - REPLACE vn.sectorCollectionSaleGroup(sectorCollectionFk, saleGroupFk) - VALUES(vSectorCollectionFk, vSaleGroupFk); - - UPDATE vn.saleGroup sg - JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id - JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk - SET sg.userFk = sc.userFk - WHERE sg.id = vSaleGroupFk; - - - INSERT IGNORE vn.saleTracking(saleFk, - isChecked, - workerFk, - actionFk, - stateFk) - SELECT sgd.saleFk , - FALSE, - sc.userFk, - a.accion_id, - s.id - FROM vn.saleGroupDetail sgd - JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk - JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk - JOIN vncontrol.accion a ON a.accion = 'SACAR' - JOIN vn.state s ON s.code = 'PREVIOUS_PREPARATION' - WHERE sgd.saleGroupFk = vSaleGroupFk; - - UPDATE vn.saleTracking st - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = st.saleFk - SET st.isChecked = TRUE - WHERE sgd.saleGroupFk = vSaleGroupFk AND st.workerFk = 20; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sectorCollection_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_get`(vSectorFk INT) -BEGIN - - /** - * Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas - * - * @param vSectorFk Identificador de vn.sector - */ - - SELECT DISTINCT sc.id collectionFk, sc.created - FROM vn.sectorCollection sc - JOIN vn.state s ON s.code = 'PREVIOUS_PREPARATION' - LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id - LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk - LEFT JOIN vn.saleTracking st ON st.saleFk = sgd.saleFk AND st.stateFk = s.id AND st.workerFk = sc.userFk - LEFT JOIN vn.sale sl ON sl.id = st.saleFk - WHERE sc.userFk = account.myUser_getId() - AND (ISNULL(scsg.sectorCollectionFk) - OR - (NOT st.isChecked AND sl.quantity > 0)) - AND sc.created > 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 `sectorCollection_getSale` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `sectorCollection_getSale`(vSelf INT) -BEGIN - - /** - * Devuelve las lineas de venta correspondientes a esa coleccion de sector - * - * @param vSelf Identificador de vn.sectorCollection - */ - - SELECT s.ticketFk, - s.itemFk, - i.longName, - IFNULL(i.itemPackingTypeFk,' ') itemPackingTypeFk, - IFNULL(i.subName ,' ') subName, - s.quantity, - w.code workerCode, - sgd.saleFk, - IFNULL(iss.quantity,0) pickedQuantity, - c.salesPersonFk - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk - JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.state stt ON stt.id = st.stateFk AND stt.code = 'PREVIOUS_PREPARATION' - JOIN vn.worker w ON w.id = st.workerFk - JOIN vn.ticket t ON t.id= s.ticketFk - JOIN vn.client c ON c.id=t.clientFk - LEFT JOIN vn.itemShelvingSaleSum iss ON iss.saleFk = s.id - WHERE scsg.sectorCollectionFk = vSelf; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `sectorCollection_new` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_new`(vSectorFk INT) -BEGIN - -/** - * Inserta una nueva colección, si el usuario no tiene ninguna vacia. - * Esto se hace para evitar que por error se generen colecciones sin sentido. - * - * @param vSectorFk Identificador de vn.sector - */ - DECLARE hasEmptyCollections BOOL; - DECLARE vUserFk INT; - - SET vUserFk = account.myUser_getId(); - - SELECT (COUNT(sc.id) > 0) INTO hasEmptyCollections - FROM vn.sectorCollection sc - LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id - WHERE ISNULL(scsg.id) - AND sc.userFk = vUserFk - AND sc.sectorFk = vSectorFk - AND sc.created >= CURDATE(); - - IF NOT hasEmptyCollections THEN - INSERT INTO vn.sectorCollection(userFk, sectorFk) - VALUES(vUserFk, vSectorFk); - 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 `sectorProductivity_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_general_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorProductivity_add`() -BEGIN - - DECLARE vDatedFrom DATETIME; - DECLARE vDatedTo DATETIME; - - SELECT DATE_SUB(CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; - DROP TEMPORARY TABLE IF EXISTS tmp.errorsByChecker; - DROP TEMPORARY TABLE IF EXISTS tmp.previousErrors; - - CALL timeControl_calculateAll(vDatedFrom, vDatedTo); - - CREATE TEMPORARY TABLE tmp.errorsByChecker - ENGINE = MEMORY - SELECT sub1.workerFk, COUNT(sub1.id) errorsByChecker - FROM ( - SELECT st.workerFk, t.id - FROM saleMistake sm - JOIN saleTracking st ON sm.saleFk = st.saleFk - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - JOIN sale s ON s.id = sm.saleFk - JOIN ticket t on t.id = s.ticketFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.sector se ON se.id = i.sectorFk - WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND a.accion = 'PRESACAR' AND se.code IN ('ALGEMESI ARTIFI','COMPLEMENTOS') - GROUP BY s.ticketFk - ) sub1 - GROUP BY sub1.workerFk; - - CREATE TEMPORARY TABLE tmp.previousErrors -- Errores de previa, derivadores de los revisadores (por reclamación) - ENGINE = MEMORY - SELECT tt.workerFk, COUNT(c.ticketFk) errorsByClaim - FROM claimDevelopment cd - JOIN claim c ON cd.claimFk = c.id - JOIN ticket t ON c.ticketFk = t.id - JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id - JOIN ticketTracking tt ON tt.ticketFk = t.id - JOIN state s ON s.id = tt.stateFk - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = 'Revisadores' AND s.code = 'OK PREVIOUS' - GROUP BY workerFk; - - INSERT INTO sectorProductivity(workerFk, firstName, lastName, sector, ticketCount, saleCount, error, volume, hourWorked, dated) - SELECT w.id workerFk, - w.firstName, - w.lastName, - se.description sector, - COUNT(DISTINCT t.id) ticketCount, - COUNT(st.saleFk) saleCount, - IFNULL(ec2.errorsByChecker,0) + IFNULL(pe.errorsByClaim, 0) errors, - wp.volume, - IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) AS hourWorked, - DATE(vDatedFrom) dated - FROM vn.saleTracking st - LEFT JOIN vn.worker w ON w.id = st.workerFk - LEFT JOIN vn.sale s ON s.id = st.saleFk - LEFT JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.sector se ON se.id = i.sectorFk - LEFT JOIN vn.ticket t ON s.ticketFk = t.id - LEFT JOIN vncontrol.accion a ON a.accion_id = st.actionFk - LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = w.id - LEFT JOIN bs.workerProductivity wp ON wp.workerFk = w.id AND a.accion = 'PRESACAR' - LEFT JOIN tmp.errorsByChecker ec2 ON ec2.workerFk = w.id - LEFT JOIN tmp.previousErrors pe ON pe.workerFk = w.id - WHERE DATE(st.created) = vDatedFrom - AND se.code IN ('ALGEMESI ARTIFI','COMPLEMENTOS') - AND wp.dated = vDatedFrom - GROUP BY w.id; - - DROP TEMPORARY TABLE tmp.timeControlCalculate; - DROP TEMPORARY TABLE tmp.errorsByChecker; - DROP TEMPORARY TABLE tmp.previousErrors; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sector_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sector_get`() -BEGIN - -/** - * Obtiene los sectores -*/ - - SELECT s.id,s.description,s.warehouseFk - FROM vn.sector s; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sector_getWarehouse` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sector_getWarehouse`(vSectorFk INT) -BEGIN - - SELECT s.warehouseFk - FROM vn.sector s - WHERE s.id = vSectorFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `setPlacementReserve` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `setPlacementReserve`(vItemFk INT, vPlacement VARCHAR(10), vWarehouseFk INT ) -BEGIN - - DECLARE vReserve VARCHAR(10); - DECLARE vReserveOLD VARCHAR(10); - DECLARE vPlacementOLD VARCHAR(10); - - SELECT code, reserve INTO vPlacementOLD, vReserveOLD - FROM itemPlacement - WHERE itemFk = vItemFk - AND warehouseFk = vWarehouseFk; - - IF ASCII(vPlacement) > 57 THEN - - SET vReserve = vPlacement; - SET vPlacement = vPlacementOLD; - - ELSE - - SET vReserve = vReserveOLD; - - END IF; - - REPLACE itemPlacement(itemFk, warehouseFk, code,reserve) - VALUES(vItemFk, vWarehouseFk, vPlacement, vReserve); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `shelvingChange` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8)) -BEGIN - - UPDATE vn.itemShelving - SET shelvingFk = vShelvingD COLLATE utf8_unicode_ci - WHERE shelvingFk = vShelvingO 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 `shelvingFuture__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingFuture__`(vSectorFk INT) -BEGIN - - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vItemFk INT; - DECLARE vItemShelvingRest INT; - DECLARE vItemShelvingFk INT; - DECLARE vItemShelvingCreated DATE; - DECLARE vSaleRest INT; - DECLARE vSaleDated DATE; - DECLARE vWarehouseFk INT; - - DECLARE rsItem CURSOR FOR - SELECT DISTINCT itemFk - FROM vn.itemShelvingStock - WHERE sectorFk = vSectorFk - AND visible > 0; - - DECLARE rsItemShelving CURSOR FOR - SELECT ish.id, - ish.visible, - date(ish.created) - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - WHERE ish.itemFk = vItemFk - AND ish.visible > 0 - AND p.sectorFk = vSectorFk - ORDER BY date(ish.created), ish.visible; - - DECLARE rsSale CURSOR FOR - SELECT - floor(sum(io.amount)) as sold, - date(io.dat) as dated - FROM vn2008.item_out io - LEFT JOIN tmp.ticketFree tf ON tf.ticketFk = io.ticketFk - WHERE (dat BETWEEN util.tomorrow() AND '2019-10-31' - OR - (dat BETWEEN CURDATE() AND util.dayEnd(CURDATE()) AND tf.ticketFk IS NOT NULL)) - AND item_id = vItemFk - AND io.warehouse_id = vWarehouseFk - GROUP BY dated; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - SELECT warehouseFk INTO vWarehouseFk - FROM vn.sector - WHERE id = vSectorFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketFree; - CREATE TEMPORARY TABLE tmp.ticketFree - SELECT ticket as ticketFk - FROM vn.ticketStateToday tst - JOIN vn.state s ON s.id = tst.state - WHERE s.isPicked = FALSE; - - DROP TEMPORARY TABLE IF EXISTS tmp.result; - CREATE TEMPORARY TABLE tmp.result - SELECT ish.id as itemShelvingFk, - date(ish.created) as created, - ish.visible, - 0 as reserve, - CAST('2019-10-31' AS DATE) as picked, - ish.shelvingFk, - 0 as Litros, - p.code as parkingCode - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - WHERE ish.visible > 0 - AND p.sectorFk = vSectorFk - ORDER BY date(ish.created), ish.visible; - - UPDATE tmp.result r - JOIN (SELECT ish.id, floor(sum(ish.visible * r.cm3) / 1000) as Litros - FROM vn.itemShelving ish - JOIN bi.rotacion r ON r.Id_Article = ish.itemFk AND r.warehouse_id = vWarehouseFk - GROUP BY ish.id) sub ON r.itemShelvingFk = sub.id - SET r.Litros = sub.Litros; - - ALTER TABLE tmp.result - ADD PRIMARY KEY (itemShelvingFk); - - OPEN rsItem; - - FETCH rsItem INTO vItemFk; - - -- TRUNCATE tmp.log; - - WHILE NOT vDone DO - - OPEN rsItemShelving; - OPEN rsSale; - - FETCH rsSale INTO vSaleRest, vSaleDated; - FETCH rsItemShelving INTO vItemShelvingFk, vItemShelvingRest, vItemShelvingCreated; - /* - INSERT INTO tmp.log(vItemFk, vItemShelvingRest, vSaleRest, vSalePicked,ifSide) - VALUES (vItemFk, vItemShelvingRest, vSaleRest, vSaleDated, '0'); - */ - bucle: LOOP - - IF vDone THEN - - LEAVE bucle; - - END IF; - - IF vSaleRest >= vItemShelvingRest THEN - /* - INSERT INTO tmp.log(vItemFk, vItemShelvingRest, vSaleRest, vSalePicked,ifSide) - VALUES (vItemFk, vItemShelvingRest, vSaleRest, vSaleDated, '1'); - */ - SET vSaleRest = vSaleRest - vItemShelvingRest; - - UPDATE tmp.result - SET reserve = reserve + vItemShelvingRest, - picked = LEAST(picked, vSaleDated) - WHERE itemShelvingFk = vItemShelvingFk; - - FETCH rsItemShelving INTO vItemShelvingFk, vItemShelvingRest, vItemShelvingCreated; - - IF vSaleRest = 0 THEN - - FETCH rsSale INTO vSaleRest, vSaleDated; - - END IF; - - ELSE - /* - INSERT INTO tmp.log(vItemFk, vItemShelvingRest, vSaleRest, vSalePicked,ifSide) - VALUES (vItemFk, vItemShelvingRest, vSaleRest, vSaleDated, '2'); - */ - SET vItemShelvingRest = vItemShelvingRest - vSaleRest; - - UPDATE tmp.result - SET reserve = reserve + vSaleRest, - picked = LEAST(picked, vSaleDated) - WHERE itemShelvingFk = vItemShelvingFk; - - FETCH rsSale INTO vSaleRest, vSaleDated; - - END IF; - - END LOOP; - - CLOSE rsItemShelving; - CLOSE rsSale; - /* - INSERT INTO tmp.log(vItemFk, vItemShelvingRest, vSaleRest, vSalePicked,ifSide) - VALUES (vItemFk, vItemShelvingRest, vSaleRest, vSaleDated, '4'); - */ - SET vDone = FALSE; - - FETCH rsItem INTO vItemFk; - - END WHILE; - - CLOSE rsItem; - - SELECT * FROM tmp.result - ORDER BY created, visible; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `shelvingLog_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingLog_get`(shelvingFk VARCHAR(10)) -BEGIN - - /* Lista el log de un carro - * - * @param shelvingFk matrícula del carro - * - */ - - SELECT originFk, name, creationDate, description - FROM shelvingLog sl - JOIN user u ON u.id = sl.userFk - WHERE sl.originFk = shelvingFk COLLATE utf8_general_ci - ORDER BY creationDate 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 `shelvingPark` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingPark`(IN `vParam` VARCHAR(8), IN `vParkingCode` VARCHAR(8)) -proc: BEGIN - -/* - * Aparca una colección, un ticket, un saleGroup o un shelving en un parking - * - * @param vParam id del ticket, colección, saleGroup o shelving - * @param vParkingCode código del parking - * - */ - - DECLARE vParkingFk INT; - DECLARE vColumn VARCHAR(3); - DECLARE vRow VARCHAR(2); - DECLARE vReturn VARCHAR(50); - DECLARE vIsSaleGroup BOOL; - DECLARE vIsTicket BOOL; - DECLARE vIsCollection BOOL; - DECLARE vCollection INT DEFAULT NULL; - DECLARE vDone INT DEFAULT FALSE; - DECLARE vTicketFk INT; - DECLARE vCursor CURSOR FOR - SELECT IFNULL(tc2.ticketFk, t.id) - FROM ticket t - LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id - LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk - WHERE t.id = vParam; - - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SET vParkingCode = replace(vParkingCode,' ','') ; - - SELECT id INTO vParkingFk - FROM vn.parking - WHERE code = vParkingCode COLLATE utf8_unicode_ci; - - IF vParkingFk IS NULL THEN - - LEAVE proc; - - END IF; - - -- Se comprueba si es una preparación previa - SELECT COUNT(*) INTO vIsSaleGroup - FROM vn.saleGroup sg - WHERE sg.id = vParam; - - IF vIsSaleGroup THEN - - UPDATE vn.saleGroup sg - SET sg.parkingFk = vParkingFk - WHERE sg.id = vParam - AND sg.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); - - CALL vn.ticket_setNextState(vn.ticket_get(vParam)); - - LEAVE proc; - - END IF; - - -- Se comprueba si es un ticket - SELECT COUNT(*) INTO vIsTicket - FROM vn.ticket t - WHERE t.id = vParam - AND t.shipped >= TIMESTAMPADD(WEEK,-1,CURDATE()); - - IF vIsTicket THEN - - INSERT INTO vn.ticketParking(ticketFk, parkingFk) - SELECT IFNULL(tc2.ticketFk, t.id), vParkingFk - FROM ticket t - LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id - LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk - WHERE t.id = vParam - ON DUPLICATE KEY UPDATE parkingFk = vParkingFk; - - OPEN vCursor; - l: LOOP - - FETCH vCursor INTO vTicketFk; - - IF vDone THEN - LEAVE l; - END IF; - - CALL vn.ticket_setNextState(vTicketFk); - - END LOOP; - - CLOSE vCursor; - - LEAVE proc; - - END IF; - - -- Se comprueba si es una coleccion de tickets - SELECT COUNT(*) INTO vIsCollection - FROM vn.collection c - WHERE c.id = vParam - AND c.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); - - IF vIsCollection THEN - - REPLACE vn.ticketParking(ticketFk,parkingFk) - SELECT tc.ticketFk, vParkingFk - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vParam; - - LEAVE proc; - - END IF; - - -- Por descarte, se considera una matrícula - INSERT INTO vn.shelvingLog (originFk, userFk, action , description) - SELECT vParam, account.userGetId(), 'update', CONCAT("Cambio parking ",vParam," de ", p.code," a ", vParkingCode) - FROM parking p - JOIN shelving s ON s.parkingFk = p.id - WHERE s.code = vParam COLLATE utf8_unicode_ci; - - UPDATE vn.shelving - SET parkingFk = vParkingFk, parked = NOW(), isPrinted = TRUE - WHERE `code` = vParam 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 `shelvingParking_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT) -BEGIN - - -SELECT s.itemFk, - s.concept, - CAST(SUM(s.quantity) AS DECIMAL(10,0)) as sinServir, - CAST(IFNULL(ist.visible,0) AS DECIMAL(10,0)) as aparcado - FROM vn.sale s - LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id - JOIN vn.ticket t ON t.id = s.ticketFk - LEFT JOIN vn.itemShelvingStock ist ON ist.itemFk = s.itemFk AND ist.warehouseFk = vWarehouseFk - JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk AND ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci - WHERE t.shipped BETWEEN CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), CURDATE())) - AND iss.saleFk IS NULL - AND t.warehouseFk = vWarehouseFk - GROUP BY s.itemFk - HAVING sinServir > aparcado; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `shelvingPark__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingPark__`(IN `vParam` VARCHAR(8), IN `vParkingCode` VARCHAR(8)) -proc: BEGIN - - /* Aparca una colección, un ticket, un saleGroup o un shelving en un parking - * - * @param vParam - * - */ - DECLARE vParkingFk INT; - DECLARE vColumn VARCHAR(3); - DECLARE vRow VARCHAR(2); - DECLARE vReturn VARCHAR(50); - DECLARE vIsSaleGroup BOOL; - DECLARE vIsTicket BOOL; - DECLARE vIsCollection BOOL; - - SET vParkingCode = replace(vParkingCode,' ','') ; - - SELECT id INTO vParkingFk - FROM vn.parking - WHERE code = vParkingCode COLLATE utf8_unicode_ci; - - IF vParkingFk IS NULL THEN - - LEAVE proc; - - END IF; - - -- Se comprueba si es una preparación previa - SELECT COUNT(*) INTO vIsSaleGroup - FROM vn.saleGroup sg - WHERE sg.id = vParam; - - IF vIsSaleGroup THEN - - UPDATE vn.saleGroup sg - SET sg.parkingFk = vParkingFk - WHERE sg.id = vParam - AND sg.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); - - CALL vn.ticket_setPreviousState(vn.ticket_get(vParam)); - - LEAVE proc; - - END IF; - - -- Se comprueba si es un ticket - SELECT COUNT(*) INTO vIsTicket - FROM vn.ticket t - WHERE t.id = vParam - AND t.shipped >= TIMESTAMPADD(WEEK,-1,CURDATE()); - - IF vIsTicket THEN - - REPLACE vn.ticketParking(ticketFk,parkingFk) - VALUES (vParam, vParkingFk); - - CALL vn.ticket_setPreviousState(vParam); - - LEAVE proc; - - END IF; - - -- Se comprueba si es una coleccion de tickets - SELECT COUNT(*) INTO vIsCollection - FROM vn.collection c - WHERE c.id = vParam - AND c.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); - - IF vIsCollection THEN - - REPLACE vn.ticketParking(ticketFk,parkingFk) - SELECT tc.ticketFk, vParkingFk - FROM vn.ticketCollection tc - WHERE tc.collectionFk = vParam; - - LEAVE proc; - - END IF; - - -- Por descarte, se considera una matrícula - INSERT INTO vn.shelvingLog (originFk, userFk, action , description) - SELECT vParam, getUser(), 'update', CONCAT("Cambio parking ",vParam," de ", p.code," a ", vParkingCode) - FROM parking p - JOIN shelving s ON s.parkingFk = p.id - WHERE s.code = vParam COLLATE utf8_unicode_ci; - - UPDATE vn.shelving - SET parkingFk = vParkingFk, parked = NOW(), isPrinted = 1 - WHERE `code` = vParam COLLATE utf8_unicode_ci; - - SELECT (COUNT(*) > 0) AS IsUpdated - FROM vn.shelving - WHERE parkingFk = vParkingFk - AND `code` = vParam 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 `shelvingPriority_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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingPriority_update`(priority INT,vShelvingFk VARCHAR(10)) -BEGIN - - UPDATE vn.shelving SET priority = priority WHERE code=vShelvingFk 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 `shelving_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`@`localhost` PROCEDURE `shelving_clean`() -BEGIN - - DELETE FROM vn.shelving - WHERE length(code) > 3 - AND parked < TIMESTAMPADD(WEEK,-1,CURDATE()); - - DELETE FROM vn.itemShelving - WHERE visible <= 0 - AND created < TIMESTAMPADD(MONTH,-1,CURDATE()); - - DELETE ish.* - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - WHERE sh.parkingFk IS NULL - AND ish.created < TIMESTAMPADD(WEEK,-1,CURDATE()); - - UPDATE vn.shelving sh - LEFT JOIN vn.itemShelving its ON its.shelvingFk = sh.`code` - SET isPrinted = 0, - parkingFk = NULL - WHERE its.id IS NULL - AND sh.isRecyclable - AND ( sh.parked IS NULL - OR - sh.parked < TIMESTAMPADD(MONTH,-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 */ ; -/*!50003 DROP PROCEDURE IF EXISTS `shelving_getSpam` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_getSpam`(vDated DATE, vWarehouseFk INT) -BEGIN - - /** - * Devuelve las matrículas con productos que no son necesarios para la venta hasta la fecha señalada - * - * @param vDated Fecha hasta la que se puede pasar sin esos productos. - * @param vWarehouse Identificador único de vn.warehouse - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.stock; - - CALL cache.stock_refresh(FALSE); - - CREATE TEMPORARY TABLE tmp.stock - SELECT i.id itemFk, - v.amount - IFNULL(fue.reserva,0) as visible, - fue.reserva, - sale.venta, - IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, - IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) - IFNULL(fue.reserva,0) as saldo - FROM vn.item i - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN ( - SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS reserva - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - WHERE s.code = 'FUENTES_PICASSE' - OR sh.isSpam - GROUP BY ish.itemFk - ) fue ON fue.itemFk = i.id - LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id - ) sale ON sale.item_id = i.id - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - AND isVirtualStock = FALSE - GROUP BY item_id - ) buy ON buy.item_id = i.id - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id - ) mov ON mov.item_id = i.id - WHERE v.amount; - - SELECT ish.shelvingFk matricula, - i.longName articulo, - ish.visible, - count(*) lineas, - sum(ish.visible <= s.saldo) spam, - p.code parking, - s.description sector , - w.name AS almacen, - sh.isSpam - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - JOIN vn.warehouse w ON w.id = s.warehouseFk - LEFT JOIN tmp.stock s ON s.itemFk = ish.itemFk - WHERE (w.name = 'Algemesi' - OR (w.name = 'NuncaJamas' AND ish.created < curdate())) - AND ish.visible - GROUP BY ish.shelvingFk - HAVING lineas = spam OR isSpam; - - DROP TEMPORARY TABLE tmp.stock; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `silla_algemesi__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `silla_algemesi__`(vDate DATE, vItemFk INT, vQuantity INT) -BEGIN - -DECLARE done INT DEFAULT FALSE; -DECLARE vWarehouseFk INT DEFAULT 60; -DECLARE vTicketFk INT; -DECLARE vSaleFk INT; -DECLARE vClonTicket INT DEFAULT 0; -DECLARE i INT DEFAULT 0; - -DECLARE cur1 CURSOR FOR - select distinct s.ticketFk, s.id - from vn.sale s - join vn.ticket t ON t.id = s.ticketFk - left join vn.ticketStateToday tss ON tss.ticket = t.id - join vn.itemShelving ish ON ish.itemFk = s.itemFk - join vn.shelving sh ON sh.code = ish.shelvingFk - join vn.parking p ON p.id = sh.parkingFk - where t.shipped between vDate and util.dayend(vDate) - and p.sectorFk = 37 - and left(t.nickname,1) != '-' - and t.warehouseFk = 1 - and s.quantity mod ish.packing = 0 - and vItemFk IN (0,s.itemFk) - and IFNULL(tss.alertLevel,0) = 0 - and s.quantity >= ish.packing - and s.quantity >= vQuantity - and s.itemFk NOT IN (1, 130, 60002, 1778, 3899); - - -DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - -OPEN cur1; - -FETCH cur1 INTO vTicketFk, vSaleFk; - - WHILE done = 0 DO - - SELECT t.id INTO vClonTicket - FROM vn.ticket t - JOIN (SELECT t.addressFk, t.shipped - FROM vn.ticket t - LEFT JOIN vn.ticketStateToday tss ON tss.ticket = t.id - WHERE id = vTicketFk - and IFNULL(tss.alertLevel,0) = 0 ) sub USING(addressFk, shipped) - WHERE t.warehouseFk = vWarehouseFk - LIMIT 1; - - -- SELECT vTicketFk, vClonTicket; - - IF vClonTicket = 0 THEN - - INSERT INTO ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk - ) - SELECT - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - vWarehouseFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk - - FROM ticket - WHERE id = vTicketFk; - - SET vClonTicket = LAST_INSERT_ID(); - - -- SELECT 'lstID', vClonTicket; - - INSERT IGNORE INTO ticketObservation(ticketFk, observationTypeFk, description) - SELECT vClonTicket, ao.observationTypeFk, ao.description - FROM addressObservation ao - JOIN ticket t ON t.addressFk = ao.addressFk - WHERE t.id = vTicketFk; - - INSERT IGNORE INTO ticketLog - SET originFk = vClonTicket, userFk = account.myUser_getId(), `action` = 'insert', - description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk); - - END IF; - - UPDATE vn.sale - SET ticketFk = vClonTicket - WHERE id = vSaleFk; - -- SELECT vTicketFk, vClonTicket; - - SET vClonTicket = 0; - - SET done = 0; - FETCH cur1 INTO vTicketFk, vSaleFk; - - SET i = i + 1; - - END WHILE; - - CLOSE cur1; - - SELECT i; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `sleep_X_min` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `sleep_X_min`() -BEGIN - # Ernesto. 4.8.2020 - # Para su uso en las tareas ejecutadas a las 2AM (visibles con: SELECT * FROM bs.nightTask order by started asc;) - # Simplemente esperar unos minutos para que en las graficas de rendimiento de Percona PMM y escritura a disco de vCenter se puedan ver los efectos de cada tarea. - do SLEEP(300); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `solunionRiskRequest` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `solunionRiskRequest`() -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.client_list; - CREATE TEMPORARY TABLE tmp.client_list - (PRIMARY KEY (Id_Cliente)) - ENGINE = MEMORY - SELECT * FROM (SELECT cc.client Id_Cliente, ci.grade FROM vn.creditClassification cc - JOIN vn.creditInsurance ci ON cc.id = ci.creditClassification - WHERE dateEnd IS NULL - ORDER BY ci.creationDate DESC) t1 GROUP BY Id_Cliente; - - CALL vn2008.risk_vs_client_list(CURDATE()); - - SELECT - c.Id_Cliente, c.Cliente, c.Credito credito_vn, c.creditInsurance solunion, cast(r.risk as DECIMAL(10,0)) riesgo_vivo, - cast(c.creditInsurance - r.risk as decimal(10,0)) margen_vivo, - f.Consumo consumo_anual, c.Vencimiento, ci.grade - FROM - vn2008.Clientes c - JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente - JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente - JOIN bi.facturacion_media_anual f ON c.Id_Cliente = f.Id_Cliente - GROUP BY Id_cliente; - - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - DROP TEMPORARY TABLE IF EXISTS tmp.client_list; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `stockBuyedByWorker` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `stockBuyedByWorker`(vDate DATE, vWorker INT) -BEGIN - - DECLARE vVolume DECIMAL(10,2); - DECLARE vWarehouse INT DEFAULT 7; - CALL stockTraslation(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 ) * vn.buy_getVolume(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 tmp.buyUltimate bu ON bu.itemFk = a.Id_Article AND bu.warehouseFk = vWarehouse - JOIN vn2008.Compres c ON c.Id_compra = bu.buyFk - WHERE r.display <> 0 AND tr.user_id = vWorker; - - DROP TEMPORARY TABLE - tmp.buyUltimate, - 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 `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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 ) * vn.buy_getVolume(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 `stockBuyed_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyed_add`(vDated DATE) -BEGIN -/** - * Inserta el volumen de compra por comprador en vn.stockBuyed de acuerdo con la fecha - * - * @param vDated Fecha de compra - */ - CALL vn.stockTraslation(vDated); - - DELETE - FROM vn.stockBuyed - WHERE `date` = vDated; - - INSERT INTO vn.stockBuyed(`user`, buyed, `date`, description) - SELECT it.workerFk, - SUM(( ti.amount / b.packing ) * vn.buy_getVolume(b.id)) / vc.palletM3 / 1000000 buyed, - vDated, - u.name - FROM tmp_item ti - JOIN vn.item i ON i.id = ti.item_id - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.warehouse wh ON wh.code = 'VNH' - JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = wh.id - JOIN vn.buy b ON b.id = bu.buyFk - JOIN vn.volumeConfig vc - JOIN account.`user` u ON u.id = it.workerFk - WHERE ic.display != 0 - GROUP BY it.workerFk; - - INSERT INTO stockBuyed(buyed, `date`, description) - SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000), vDated, IF(c.country = 'España',p.name,c.country) destiny - FROM vn.itemTicketOut ito - JOIN vn.ticket t ON t.id = ito.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.warehouse wh ON wh.id = t.warehouseFk - JOIN vn.itemCost ic ON ic.itemFk = ito.itemFk AND ic.warehouseFk = t.warehouseFk - JOIN vn.volumeConfig vc - WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated) - AND wh.code = 'VNH' - GROUP BY destiny; - - DROP TEMPORARY TABLE - tmp.buyUltimate, - 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` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `stockTraslation`(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 - (UNIQUE INDEX i USING HASH (item_id)) - ENGINE = MEMORY - SELECT item_id, SUM(amount) amount - FROM vn2008.item_entry_in - WHERE dat = vDate - AND vDate >= CURDATE() - AND warehouse_id = vWarehouse - AND isVirtualStock is FALSE - GROUP BY item_id - HAVING amount != 0; - - 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 buyUltimate(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 `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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 `stowawayBoarding__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `stowawayBoarding__`(IN vShipFk INT, IN vStowawayFk INT) -BEGIN - - REPLACE stowaway(shipFk, id) - VALUES (vShipFk, vStowawayFk); - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vShipFk, myWorker_getId() - FROM state - WHERE code = 'BOARDING'; - - -- FIXME No crear ticket 98 - INSERT INTO sale(ticketFk, itemFk, quantity, concept) - VALUES(vShipFk, 98,1, CONCAT('POLIZÓN! ',vStowawayFk)); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `stowawayControl__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `stowawayControl__`(vDated DATE) -BEGIN - - SELECT t.id ticketFV, - tst.code as stateFV, - sw.id ticketPCA, - w.code, - w.firstName, - w.lastName, - s.itemFk, - s.concept, - MAX(IF(s.isPicked,'OK',st.code)) situacion - FROM vn.ticket t - LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id - JOIN vn.stowaway sw ON sw.shipFk = t.id - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id - LEFT JOIN vn.collection c ON c.id = tc.collectionFk - LEFT JOIN vn.worker w ON w.id = c.workerFk - JOIN vn.sale s ON s.ticketFk = sw.id - LEFT JOIN vn.saleTracking str ON str.saleFk = s.id AND str.isChecked = 1 - LEFT JOIN vn.state st ON st.id = str.stateFk AND st.code = 'PREPARED' - WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) - GROUP BY s.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 `stowaway_launchShip__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `stowaway_launchShip__`(vStowawayFk INT) -BEGIN - - DECLARE myShipFk INT; - - SELECT shipFk INTO myShipFk - FROM vn.stowaway - WHERE id = vStowawayFk; - - IF myShipFk THEN - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, myShipFk, account.myUser_getId() - FROM state - WHERE code = 'OK STOWAWAY'; - - 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 `stowaway_unboarding__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `stowaway_unboarding__`(vShipFk INT, vStowawayFk INT) -BEGIN - DECLARE vWorker VARCHAR(255); - - DELETE FROM stowaway - WHERE shipFk = vShipFk AND id = vStowawayFk; - - DELETE tt FROM ticketTracking tt - JOIN state s ON s.id = tt.stateFk - WHERE code = 'BOARDING' AND ticketFk = vShipFk; - - DELETE FROM sale - WHERE ticketFk = vShipFk - AND itemFk = 98 - AND concept = CONCAT('POLIZÓN! ',vStowawayFk); - - SELECT u.`name` INTO vWorker - FROM account.user u JOIN worker w ON w.userFk = u.id - WHERE w.id = client_getSalesPersonByTicket(vStowawayFk); - - SELECT messageSend(vWorker,CONCAT('El ticket: ', vStowawayFk, ' ha dejado de ser un polizón')) INTO @a; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `subordinateGetList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `subordinateGetList`(vBossFk INT) -BEGIN - - -- deprecated usar vn.worker_GetHierarch - DECLARE vBossId INT; - DECLARE vDone BOOL; - DECLARE workerCur CURSOR FOR - SELECT workerFk - FROM tmp.subordinate - WHERE NOT isChecked; - - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DECLARE EXIT HANDLER FOR 1062 BEGIN - CALL util.throw('INFINITE_LOOP'); - END; - - DROP TEMPORARY TABLE IF EXISTS tmp.subordinate; - - CREATE TEMPORARY TABLE tmp.subordinate - (PRIMARY KEY (workerFk)) - ENGINE = MEMORY - SELECT vBossFk AS workerFk, 0 AS isChecked; - - WHILE (SELECT COUNT(*) FROM tmp.subordinate WHERE NOT isChecked) > 0 DO - OPEN workerCur; - workerLoop: LOOP - SET vDone = FALSE; - - FETCH workerCur INTO vBossId; - - IF vDone THEN - LEAVE workerLoop; - END IF; - - INSERT INTO tmp.subordinate - SELECT id, 0 - FROM worker - WHERE bossFk = vBossId; - - UPDATE tmp.subordinate - SET isChecked = 1 - WHERE workerFk = vBossId; - END LOOP; - - CLOSE workerCur; - 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 `supplierExpenses` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierExpenses`(vEnded DATE) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS openingBalance; - - CREATE TEMPORARY TABLE openingBalance( - dueDated DATE - , supplierFk INT NOT NULL - , companyFk INT NOT NULL - , eurAmount DOUBLE NOT NULL - , foreignAmount DOUBLE NOT NULL - , PRIMARY KEY(supplierFk, companyFk)) - ENGINE = MEMORY; - - -- Calcula el balance inicial y final de cada proveedor - INSERT INTO openingBalance - SELECT MAX(dueDated), - supplierFk, - companyFk, - sum(amount) eurAmount, - sum(divisa) foreignAmount - FROM ( - SELECT p.dueDated, - p.supplierFk, - p.companyFk, - p.amount, - p.divisa - FROM payment p - JOIN currency c ON c.id = p.currencyFk - JOIN company co ON co.id = p.companyFk - WHERE p.dueDated > '2014-12-31' - AND p.dueDated <= vEnded - AND co.`code` = 'VNL' - AND c.`code` <> 'EUR' - UNION ALL - - SELECT iidd.dueDated, - ii.supplierFk, - ii.companyFk, - - iidd.amount, - - iidd.foreignValue - FROM invoiceIn ii - JOIN invoiceInDueDay iidd ON ii.id = iidd.invoiceInFk - JOIN currency c ON c.id = ii.currencyFk - JOIN company co ON co.id = ii.companyFk - WHERE iidd.dueDated > '2014-12-31' - AND iidd.dueDated <= vEnded - AND ii.isBooked AND co.`code` = 'VNL' - AND c.`code` <> 'EUR' - UNION ALL - - SELECT se.dueDated, - se.supplierFk, - se.companyFk, - - se.amount, - 0 - FROM supplierExpense se - JOIN currency c ON c.id = se.currencyFk - JOIN company co ON co.id = se.companyFk - WHERE se.dueDated > '2014-12-31' - AND se.dueDated <= vEnded - AND co.`code` = 'VNL' AND c.`code` <> 'EUR' - ) sub - GROUP BY companyFk, supplierFk; - - SELECT ob.dueDated - , ob.supplierFk - , ob.companyFk - , ob.eurAmount - , s.`name` - FROM openingBalance ob - LEFT JOIN supplier s ON s.id = ob.supplierFk - WHERE ob.eurAmount <> 0 AND ob.foreignAmount = 0; - - DROP TEMPORARY TABLE openingBalance; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `supplierPackaging_ReportSource` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierPackaging_ReportSource`(vFromDated DATE, vSupplierFk INT) -BEGIN - -/** - * Selecciona los embalajes de un proveedor a partir de una fecha - * - * @param vFromDated Fecha de la que partir - * @param vSupplierFk Id del proveedor - */ - - DECLARE vCounter INT DEFAULT 0; - DECLARE vMaxRow INT DEFAULT 0; - DECLARE vItemFk INT DEFAULT 0; - SET @vRowNumber = 0; - SET @vBalance = 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackagingList; - CREATE TEMPORARY TABLE tmp.supplierPackagingList - SELECT itemFk, - @vRowNumber:= @vRowNumber + 1 `row` - FROM ( - SELECT * - FROM ( - SELECT supplierFk, - itemFk, - longName, - supplier, - entryFk, - landed, - `out`, - `in`, - warehouse, - buyingValue - FROM supplierPackaging - WHERE supplierFk = vSupplierFk - AND landed >= vFromDated - - UNION ALL - - SELECT vSupplierFk, - itemFk, - longName, - supplier, - 'previous', - vFromDated, - SUM(`out`), - SUM(`in`), - NULL, - buyingValue - FROM supplierPackaging - WHERE supplierFk = vSupplierFk - AND landed < vFromDated - GROUP BY itemFk) i - GROUP BY itemFk - ORDER BY landed) i2; - - SELECT MAX(`row`) - INTO vMaxRow - FROM tmp.supplierPackagingList; - - DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackaging; - CREATE TEMPORARY TABLE tmp.supplierPackaging( - supplierFk INT, - itemFk INT, - longName VARCHAR(50), - supplier VARCHAR(50), - entryFk VARCHAR(50), - landed DATE, - `in` VARCHAR(50), - `out` VARCHAR(50), - warehouse INT, - buyingValue INT, - balance INT); - - l1: LOOP - - IF vCounter = vMaxRow THEN - LEAVE l1; - ELSE - SET vCounter = vCounter + 1; - SET @vBalance = 0; - END IF; - - SELECT itemFk - INTO vItemFk - FROM tmp.supplierPackagingList - WHERE `row` = vCounter; - - INSERT INTO tmp.supplierPackaging - SELECT supplierFk, - itemFk, - longName, - supplier, - entryFk, - landed, - `in`, - `out`, - warehouse, - buyingValue, - @vBalance:= (`in` - `out` + @vBalance) - FROM ( - SELECT supplierFk, - itemFk, - longName, - supplier, - entryFk, - landed, - `out`, - `in`, - warehouse, - buyingValue - FROM supplierPackaging - WHERE supplierFk = vSupplierFk - AND landed >= vFromDated - AND itemFk = vItemFk - - UNION ALL - - SELECT vSupplierFk, - itemFk, - longName, - supplier, - 'previous', - vFromDated, - SUM(`out`), - SUM(`in`), - NULL, - buyingValue - FROM supplierPackaging - WHERE supplierFk = vSupplierFk - AND landed < vFromDated - AND itemFk = vItemFk - GROUP BY itemFk - ) sub - WHERE `out` OR `in` - ORDER BY itemFk, landed; - - END LOOP l1; - - SELECT * FROM tmp.supplierPackaging; - - DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackagingList; - DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackaging; - SET @vRowNumber = 0; - SET @vBalance = 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 `supplier_checkBalance` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL) -BEGIN - - DECLARE vDateFrom DATE; - SET vDateTo = TIMESTAMP(vDateTo,'23:59:59'); - SELECT util.firstDayOfYear(vDateTo) INTO vDateFrom; - - SELECT c.code, s.id , s.account, mysql, sage, mysql - sage difference, sub1.companyFk, s.name - FROM supplier s - JOIN ( SELECT companyFk, supplierFk, ROUND(SUM(mysql),2) mysql, ROUND(SUM(sage),2) sage - FROM ( SELECT companyFk, supplierFk, -SUM(iid.amount) as mysql, 0 sage - FROM invoiceInDueDay iid - JOIN invoiceIn ii ON ii.id = iid.invoiceInFk - WHERE IFNULL(ii.bookEntried, ii.issued) BETWEEN vDateFrom AND vDateTo - AND ii.isBooked - GROUP BY ii.id - UNION ALL - SELECT p.companyFk, p.supplierFk, p.amount, 0 - FROM payment p - JOIN payMethod pm ON pm.id = p.payMethodFk - WHERE p.received BETWEEN vDateFrom AND vDateTo - AND IF(vIsConciliated, p.isConciliated, TRUE) = TRUE - AND NOT pm.code <=>'previousBalance' - UNION ALL - SELECT se.companyFk, se.supplierFk, - se.amount, 0 - FROM supplierExpense se - WHERE se.dated BETWEEN vDateFrom AND vDateTo - AND IF(vIsConciliated, se.isConciliated, TRUE) = TRUE - UNION ALL - SELECT xd.empresa_id, s.id, 0, ROUND(NZ(Eurodebe)-NZ(Eurohaber),2) - FROM bi.XDiario_ALL xd - JOIN supplier s ON s.account = xd.SUBCTA - WHERE xd.Fecha BETWEEN vDateFrom AND vDateTo - ) sub - GROUP BY companyFk, supplierFk - ) sub1 ON sub1.supplierFk = s.id - JOIN company c ON c.id = sub1.companyFk - HAVING ABS(difference) > 0.05 - ORDER BY s.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 `supplier_disablePayMethodChecked` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `supplier_disablePayMethodChecked`() -BEGIN - -/* - * Deshabilita la comprobación de los datos bancarios de todos aquellos proveedores que tengan - * un número que no sea 0 en el campo graceMonthsDisableChecked de la tabla vn.payMethod - * y que no hayan recibido un pago desde el mes indicado - */ - - UPDATE vn.supplier s - JOIN ( SELECT p.supplierFk - FROM vn.payment p - LEFT JOIN vn.supplier s ON s.id = p.supplierFk - LEFT JOIN vn.payMethod pm ON pm.id = s.payMethodFk - WHERE p.created < (CURDATE() - INTERVAL pm.graceMonthsDisableChecked MONTH) - AND pm.graceMonthsDisableChecked - AND s.isPayMethodChecked - GROUP BY p.supplierFk) sdpmc ON sdpmc.supplierFk = s.id - SET s.isPayMethodChecked = FALSE; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `test` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `test`() -BEGIN -select 'procedimiento ejecutado con éxito'; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketBoxesView` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBoxesView`(IN vTicketFk INT) -BEGIN - - SELECT s.id, - s.itemFk, - s.concept, - floor(s.quantity / b.packing) as Cajas, - b.packing, - s.isPicked, - i.size - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - JOIN cache.last_buy lb on lb.warehouse_id = t.warehouseFk AND lb.item_id = s.itemFk - JOIN buy b on b.id = lb.buy_id - JOIN packaging p on p.id = b.packageFk - WHERE s.quantity >= b.packing - AND t.id = vTicketFk - AND p.isBox - GROUP BY s.itemFk; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketBuiltTime` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBuiltTime`(vDate DATE) -BEGIN - - DECLARE vDateStart DATETIME DEFAULT DATE(vDate); - DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketBuiltTime; - - CREATE TEMPORARY TABLE tmp.ticketBuiltTime - ENGINE = MEMORY - SELECT t.id as ticketFk ,t.shipped, IFNULL(builtTime, vDateEnd) as builtTime - FROM - vn.ticket t - LEFT JOIN - ( - SELECT ticketFk, builtTime - FROM - ( - SELECT - Id_Ticket as ticketFk, - odbc_date as builtTime - FROM - vncontrol.inter - WHERE odbc_date BETWEEN vDateStart AND vDateEnd - ORDER BY Id_Ticket, odbc_date DESC - ) sub - GROUP BY ticketFk - ) sub2 ON sub2.ticketFk = t.id - WHERE t.shipped BETWEEN vDate AND util.dayEnd(vDate) - AND t.clientFk NOT IN (50,400,200) - AND t.companyFk = 442 - - ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCalculateClon` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT) -BEGIN -/* - * Recalcula los componentes un ticket clonado, - * las lineas a precio cero fuerza para que tengan precio, el resto lo respeta - * @param vTicketNew nuevo ticket clonado - * @param vTicketOld icket original, a partir del qual se clonara el nuevo -*/ - DECLARE vShipped DATE; - DECLARE vClient INT; - DECLARE vWarehouse SMALLINT; - DECLARE vAgencyMode INT; - DECLARE vAddress INT; - DECLARE vLanded DATE; - DECLARE vAgency INT; - DECLARE vZoneFk INT; - - REPLACE INTO orderTicket(orderFk,ticketFk) - SELECT orderFk, vTicketNew - FROM orderTicket - WHERE ticketFk = vTicketOld; - - SELECT t.clientFk, t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk, t.zoneFk - INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk - FROM agencyMode a - JOIN ticket t ON t.agencyModeFk = a.id - WHERE t.id = vTicketNew; - - IF vLanded IS NULL THEN - CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse, TRUE); - UPDATE ticket t - JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk - SET t.landed = zgl.landed, - t.zoneFk = zgl.zoneFk - WHERE t.id = vTicketNew; - - SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; - DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; - END IF; - - -- rellena la tabla tmp.buyUltimate con la ultima compra - CALL buyUltimate(vWarehouse, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk; - - CALL catalog_componentPrepare(); - CALL catalog_componentCalculate(vZoneFk, vAddress, vShipped, vWarehouse); - - -- Bionizamos lineas con Preu = 0 - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT s.id saleFk, vWarehouse warehouseFk - FROM sale s - JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0; - - CALL ticketComponentUpdateSale(1); - - -- Bionizamos lineas con Preu > 0 - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT s.id saleFk, vWarehouse warehouseFk - FROM sale s - JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew - AND s.price > 0; - - CALL ticketComponentUpdateSale(6); - - -- Log - CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket'); - - -- Limpieza - CALL catalog_componentPurge(); - DROP TEMPORARY TABLE IF EXISTS - tmp.buyUltimate, - tmp.sale, - tmp.zoneGetLanded; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCalculateClon__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateClon__`(IN vTicketNew INT, vTicketOld INT) -BEGIN - /* - * @vTicketNew id del nuevo ticket clonado - * @vTicketOld id ticket original, a partir del qual se clonara el nuevo - * Este procedimiento "rebioniza" una linea, eliminando los componentes existentes e insertandolos de nuevo - */ - DECLARE vShipped DATE; - DECLARE vClient INT; - DECLARE vWarehouse SMALLINT; - DECLARE vAgencyMode INT; - DECLARE vAddress INT; - DECLARE vLanded DATE; - DECLARE vAgency INT; - DECLARE vZoneFk INT; - - REPLACE INTO orderTicket(orderFk,ticketFk) - SELECT orderFk, vTicketNew - FROM orderTicket - WHERE ticketFk = vTicketOld; - - SELECT t.clientFk, t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk, t.zoneFk - INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk - FROM vn.agencyMode a - JOIN vn.ticket t ON t.agencyModeFk = a.id - WHERE t.id = vTicketNew; - - IF vLanded IS NULL THEN - CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse); - UPDATE ticket t - JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk - SET t.landed = zgl.landed, - t.zone = zgl.zoneFk - WHERE t.id = vTicketNew; - - SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; - DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; - END IF; - - -- rellena la tabla tmp.buyUltimate con la ultima compra - CALL buyUltimate(vWarehouse, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk; - - CALL catalog_componentCalculate(vZoneFk, vAddress, vAgencyMode); - - -- Bionizamos lineas con Preu = 0 - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT s.id saleFk, vWarehouse warehouseFk - FROM sale s - JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0; - - CALL ticketComponentUpdateSale(1); - - -- Bionizamos lineas con Preu > 0 - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT s.id saleFk, vWarehouse warehouseFk - FROM sale s - JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew - AND s.price > 0; - - CALL ticketComponentUpdateSale(6); - - -- Log - CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket'); - - -- Limpieza - DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCalculateFromType` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateFromType`( vLanded DATE, - vAddressFk INT, - vAgencyModeFk INT, - vTypeFk INT) -BEGIN - DROP TEMPORARY TABLE IF EXISTS tmp.item; - CREATE TEMPORARY TABLE tmp.item - (INDEX (itemFk)) - ENGINE = MEMORY - SELECT id itemFk FROM vn.item - WHERE typeFk = vTypeFk; - - CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); - DROP TEMPORARY TABLE tmp.item; - DROP TEMPORARY TABLE tmp.ticketLot; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCalculatePurge` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculatePurge`() -BEGIN - DROP TEMPORARY TABLE - tmp.ticketCalculateItem, - tmp.ticketComponentPrice, - tmp.ticketComponent, - tmp.ticketLot, - tmp.zoneGetShipped; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCalculateSaleForcePrice2__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateSaleForcePrice2__`(IN vSale BIGINT) -proc: BEGIN - - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAddressFk INT; - DECLARE vTicket BIGINT; - DECLARE vItem BIGINT; - DECLARE vZoneFk INT; - - SELECT ticketFk, itemFk - INTO vTicket, vItem - FROM sale - WHERE id = vSale; - - SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.zoneFk - INTO vWarehouseFk, vShipped, vAddressFk, vZoneFk - FROM agencyMode a - JOIN ticket t ON t.agencyModeFk = a.id - WHERE t.id = vTicket; - - IF vZoneFk IS NULL THEN - CALL util.throw('ticket without zone'); - END IF; - - CALL buyUltimate (vWarehouseFk, vShipped); - - DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk - FROM tmp.buyUltimate - WHERE itemFk = vItem; - - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT vSale saleFk,vWarehouseFk warehouseFk; - - CALL ticketComponentUpdateSale(1); - - INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) - VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); - - DROP TEMPORARY TABLE tmp.buyUltimate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCalculateSaleForcePrice__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateSaleForcePrice__`(IN vSale BIGINT) -proc: BEGIN - - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAddressFk INT; - DECLARE vTicket BIGINT; - DECLARE vItem BIGINT; - DECLARE vZoneFk INT; - - SELECT ticketFk, itemFk - INTO vTicket, vItem - FROM sale - WHERE id = vSale; - - SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.zoneFk - INTO vWarehouseFk, vShipped, vAddressFk, vZoneFk - FROM agencyMode a - JOIN ticket t ON t.agencyModeFk = a.id - WHERE t.id = vTicket; - - IF vZoneFk IS NULL THEN - CALL util.throw('ticket without zone'); - END IF; - - CALL buyUltimate (vWarehouseFk, vShipped); - - DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk - FROM tmp.buyUltimate - WHERE itemFk = vItem; - - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT vSale saleFk,vWarehouseFk warehouseFk; - - CALL ticketComponentUpdateSale(1); - - INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) - VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); - - DROP TEMPORARY TABLE tmp.buyUltimate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCalculateSale__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateSale__`(IN vSale BIGINT) -proc: BEGIN --- OBSOLETO USAR: sale_calculateComponent(vSale, NULL) - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAgencyModeFk INT; - DECLARE vAddressFk INT; - DECLARE vTicket BIGINT; - DECLARE vItem BIGINT; - DECLARE vLanded DATE; - DECLARE vTicketFree BOOLEAN DEFAULT TRUE; - DECLARE vZoneFk INTEGER; - - SELECT NOT (t.refFk IS NOT NULL OR ts.alertLevel > 0) OR s.price = 0, s.ticketFk, s.itemFk , t.zoneFk - INTO vTicketFree, vTicket, vItem, vZoneFk - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id - WHERE s.id = vSale - LIMIT 1; - - SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.agencyModeFk, t.landed - INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded - FROM agencyMode a - JOIN ticket t ON t.agencyModeFk = a.id - WHERE t.id = vTicket; - - IF IFNULL(vZoneFk,0) = 0 THEN - CALL util.throw('ticket dont have zone'); - END IF; - - CALL buyUltimate (vWarehouseFk, vShipped); - - DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk - FROM tmp.buyUltimate - WHERE itemFk = vItem; - - CALL vn.catalog_componentCalculate; - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT vSale saleFk,vWarehouseFk warehouseFk; - - CALL ticketComponentUpdateSale(IF(vTicketFree,1,6)); - - INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) - VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); - - CALL catalog_componentPurge(); - DROP TEMPORARY TABLE tmp.buyUltimate; - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCalculate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculate__`( - vLanded DATE, - vAddressFk INT, - vAgencyModeFk INT) -proc: BEGIN --- OBSOLETO utilizar catalog_calculate - CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketClon` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE) -BEGIN - - DECLARE done INT DEFAULT FALSE; - DECLARE vNewTicketFk INT; - DECLARE vOldSaleFk INT; - DECLARE vNewSaleFk INT; - - DECLARE cur1 CURSOR FOR - SELECT id - FROM vn.sale - WHERE ticketFk = vTicketFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SET vNewShipped = IFNULL(vNewShipped, CURDATE()); - - CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - - UPDATE vn.ticket - SET landed = TIMESTAMPADD(DAY, DATEDIFF(vNewShipped, shipped), landed), - shipped = vNewShipped - WHERE id = vNewTicketFk; - - OPEN cur1; - - read_loop: LOOP - - FETCH cur1 INTO vOldSaleFk; - - IF done THEN - LEAVE read_loop; - END IF; - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed) - SELECT vNewTicketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed - FROM vn.sale - WHERE id = vOldSaleFk; - - SELECT max(id) INTO vNewSaleFk - FROM vn.sale - WHERE ticketFk = vNewTicketFk; - - INSERT INTO vn.saleComponent(saleFk, componentFk, value, isGreuge) - SELECT vNewSaleFk, componentFk, value, isGreuge - FROM vn.saleComponent - WHERE saleFk = vOldSaleFk; - - END LOOP; - - CLOSE cur1; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketClon_OneYear` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon_OneYear`(vTicketFk INT) -BEGIN - - DECLARE vShipped DATE; - DECLARE vMaxDated DATE; - - SELECT shipped, TIMESTAMPADD(YEAR,1,shipped) - INTO vShipped, vMaxDated - FROM vn.ticket - WHERE id = vTicketFk; - - WHILE vShipped <= vMaxDated DO - - SET vShipped = TIMESTAMPADD(WEEK, 1, vShipped); - - CALL vn.ticketClon(vTicketFk, vShipped); - - 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 `ticketClosureAgencyListAdd__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClosureAgencyListAdd__`(vAgencyModeFk INT) -BEGIN -/** - * Prepara un listado de agencias sobre los que se realizará el cierre. - * Es necesario llamar al procedimiento por cada agencia. - * - * @param vAgencyModeFk Id almacén - */ - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.ticketClosureAgencyList ( - `agencyModeFk` INT, - PRIMARY KEY(agencyModeFk)) ENGINE = MEMORY; - - INSERT INTO tmp.ticketClosureAgencyList(agencyModeFk) VALUES(vAgencyModeFk); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketClosureAgencyList__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClosureAgencyList__`(vWarehouseFk INT, vDateTo DATE) -BEGIN -/** - * Inserta los tickets de todos los almacenes en la tabla temporal - * para ser cerrados. - * - * @param vWarehouseFk Id del almacén - * @param vDate Fecha del cierre - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; - - CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( - SELECT - t.id AS ticketFk - FROM expedition e - INNER JOIN ticket t ON t.id = e.ticketFk - INNER JOIN tmp.ticketClosureAgencyList al ON al.agencyModeFk = t.agencyModeFk - LEFT JOIN ticketState ts ON ts.ticketFk = t.id - WHERE - ts.alertLevel = 2 - AND t.warehouseFk = vWarehouseFk - AND DATE(t.shipped) BETWEEN DATE_ADD(vDateTo, INTERVAL -2 DAY) AND vDateTo - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - DROP TEMPORARY TABLE tmp.ticketClosureAgencyList; - - CALL ticketClosure(); - - DROP TEMPORARY TABLE tmp.ticketClosure; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketClosureRoute__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClosureRoute__`( vRouteFk INT) -BEGIN -/** - * Inserta los tickets de la ruta en la tabla temporal - * para ser cerrados. - * - * @param vWarehouseFk Almacén a cerrar - * @param vRouteFk Ruta a cerrar - * @param vDate Fecha del cierre - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; - - CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( - SELECT - t.id AS ticketFk - FROM expedition e - INNER JOIN ticket t ON t.id = e.ticketFk - LEFT JOIN ticketState ts ON ts.ticketFk = t.id - WHERE - ts.alertLevel = 2 - AND t.routeFk = vRouteFk - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - CALL ticketClosure(); - - DROP TEMPORARY TABLE tmp.ticketClosure; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketClosureTicket__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClosureTicket__`(vTicketFk INT) -BEGIN - -/** - * @deprecated Use ticket_closeByTicket() - * Inserta el ticket en la tabla temporal - * para ser cerrado. - * - * @param vTicketFk Id del ticket - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; - - CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( - SELECT - t.id AS ticketFk - FROM expedition e - INNER JOIN ticket t ON t.id = e.ticketFk - LEFT JOIN ticketState ts ON ts.ticketFk = t.id - WHERE - ts.alertLevel = 2 - AND t.id = vTicketFk - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - CALL ticketClosure(); - - DROP TEMPORARY TABLE tmp.ticketClosure; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCollection_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_get`(vTicketFk INT) -BEGIN - - SELECT tc.collectionFk - FROM vn.ticketCollection tc - WHERE ticketFk = vTicketFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketCollection_setUsedShelves` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_setUsedShelves`(vTicketFk INT, vUsedShelves INT) -BEGIN - - /* - * Inserta número de baldas que ocupa un ticket - * - * @param vTicketFk Identificador de ticket - * @param vUsedShelves Número de baldas - */ - - UPDATE ticketCollection tc - SET tc.usedShelves = vUsedShelves - WHERE tc.ticketFk = vTicketFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketComponentUpdate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentUpdate`( - vTicketFk INT, - vClientFk INT, - vAgencyModeFk INT, - vAddressFk INT, - vWarehouseFk TINYINT, - vCompanyFk SMALLINT, - vShipped DATETIME, - vLanded DATE, - vIsDeleted BOOLEAN, - vHasToBeUnrouted BOOLEAN, - vOption INT) -BEGIN - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN - - UPDATE ticket t - JOIN address a ON a.id = vAddressFk - SET t.nickname = a.nickname - WHERE t.id = vTicketFk; - - END IF; - - UPDATE ticket t - SET - t.clientFk = vClientFk, - t.agencyModeFk = vAgencyModeFk, - t.addressFk = vAddressFk, - t.warehouseFk = vWarehouseFk, - t.companyFk = vCompanyFk, - t.landed = vLanded, - t.shipped = vShipped, - t.isDeleted = vIsDeleted - WHERE - t.id = vTicketFk; - - IF vHasToBeUnrouted THEN - UPDATE ticket t SET t.routeFk = NULL - WHERE t.id = vTicketFk; - END IF; - - IF vOption <> 8 THEN - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) - ENGINE = MEMORY - SELECT id AS saleFk, vWarehouseFk warehouseFk - FROM sale s WHERE s.ticketFk = vTicketFk; - - CALL ticketComponentUpdateSale (vOption); - - DROP TEMPORARY TABLE tmp.sale; - 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 `ticketComponentUpdateSale` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentUpdateSale`(vOption INT) -BEGIN -/** - * A partir de la tabla tmp.sale, crea los Movimientos_componentes - * y modifica el campo Preu de la tabla Movimientos - * - * @param i_option integer tipo de actualizacion - * @param table tmp.sale tabla memory con el campo saleFk, warehouseFk - **/ - DECLARE vComponentFk INT; - DECLARE vRenewComponents BOOLEAN; - DECLARE vKeepPrices BOOLEAN; - - CASE vOption - WHEN 1 THEN - SET vRenewComponents = TRUE; - SET vKeepPrices = FALSE; - WHEN 2 THEN - SELECT id INTO vComponentFk FROM component WHERE `code` = 'debtCollection'; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 3 THEN - SELECT id INTO vComponentFk FROM component WHERE `code` = 'mana'; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 4 THEN - SELECT id INTO vComponentFk FROM component WHERE `code` = 'buyerDiscount'; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - /* WHEN 5 THEN - SET vComponentFk = 35; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE;*/ - WHEN 6 THEN - SELECT id INTO vComponentFk FROM component WHERE `code` = 'imbalance'; - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - WHEN 7 THEN - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk NOT IN (28, 29) - GROUP BY s.id; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk NOT IN (28, 29) - GROUP BY s.id; - - SET vRenewComponents = FALSE; - SET vKeepPrices = FALSE; - WHEN 8 THEN - DELETE sc.* - FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3) - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id; - - SET vRenewComponents = FALSE; - SET vKeepPrices = FALSE; - WHEN 9 THEN - SET vRenewComponents = TRUE; - SET vKeepPrices = TRUE; - END CASE; - - IF vRenewComponents THEN - DELETE sc.* - FROM tmp.sale tmps - JOIN saleComponent sc ON sc.saleFk = tmps.saleFk - JOIN `component` c ON c.id = sc.componentFk - WHERE c.isRenewable; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, tc.componentFk, tc.cost - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk = tc.componentFk - LEFT JOIN `component` c ON c.id = tc.componentFk - WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE); - - -- Añadir componente venta por paquete - DROP TEMPORARY TABLE IF EXISTS tmp.sale2; - CREATE TEMPORARY TABLE tmp.sale2 - (PRIMARY KEY (saleFk)) - ENGINE = MEMORY - SELECT * FROM tmp.sale; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent2; - CREATE TEMPORARY TABLE tmp.ticketComponent2 - SELECT * FROM tmp.ticketComponent; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT t.id, t.componentFk, t.cost - FROM ( - SELECT s.id, tc.componentFk, tc.cost, MOD(s.quantity, b.packing) as resto - FROM vn.sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND tmps.warehouseFk = lb.warehouse_id - JOIN vn.buy b ON b.id = buy_id - JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk - JOIN `component` c ON c.id = tc.componentFk AND c.code = 'salePerPackage' - LEFT JOIN ( - SELECT s.id - FROM vn.sale s - JOIN tmp.sale2 tmps ON tmps.saleFk = s.id - JOIN tmp.ticketComponent2 tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk - JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk - JOIN `component` c ON c.id = sc.componentFk AND c.code = 'lastUnitsDiscount' - ) tp ON tp.id = s.id - WHERE tp.id IS NULL - HAVING resto <> 0) t; - - DROP TEMPORARY TABLE IF EXISTS - tmp.sale2, - tmp.ticketComponent2; - END IF; - - IF vKeepPrices THEN - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - WHERE sc.saleFk <> vComponentFk - GROUP BY s.id - HAVING dif <> 0; - ELSE - UPDATE sale s - JOIN item i on i.id = s.itemFk - JOIN itemType it on it.id = i.typeFk - JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - GROUP BY sc.saleFk) sc ON sc.saleFk = s.id - SET s.price = sumValue / ((100 - s.discount) / 100) - WHERE it.code != 'PRT' ; - - REPLACE INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - WHERE sc.componentFk != 21 - GROUP BY s.id - HAVING ROUND(saleValue, 4) <> 0; - END IF; - - UPDATE sale s - JOIN ( - SELECT SUM(sc.value) sumValue, sc.saleFk - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - JOIN `component` c ON c.id = sc.componentFk - JOIN componentType ct on ct.id = c.typeFk AND ct.isBase - GROUP BY sc.saleFk) sc ON sc.saleFk = s.id - SET s.priceFixed = sumValue, s.isPriceFixed = 1; - - DELETE sc.* - FROM saleComponent sc - JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk - JOIN sale s on s.id = sc.saleFk - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - WHERE it.code = 'PRT'; - - INSERT INTO saleComponent(saleFk, componentFk, value) - SELECT s.id, 15, s.price - FROM sale s - JOIN tmp.sale tmps ON tmps.saleFk = s.id - JOIN item i ON i.id = s.itemFK - JOIN itemType it ON it.id = i.typeFk - WHERE it.code = 'PRT' AND s.price > 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 `ticketCreate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCreate`( - vClientId INT - ,vShipped DATE - ,vWarehouseId INT - ,vCompanyFk INT - ,vAddressFk INT - ,vAgencyType INT - ,vRouteFk INT - ,vlanded DATE - ,OUT vNewTicket INT) -BEGIN - CALL `ticketCreateWithUser`(vClientId, vShipped, vWarehouseId, vCompanyFk, vAddressFk, vAgencyType, vRouteFk, vlanded, account.userGetId(), 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 `ticketCreateWithUser` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCreateWithUser`( - vClientId INT - ,vShipped DATE - ,vWarehouseFk INT - ,vCompanyFk INT - ,vAddressFk INT - ,vAgencyModeFk INT - ,vRouteFk INT - ,vlanded DATE - ,vUserId INT - ,OUT vNewTicket INT) -BEGIN - CALL ticket_add( - vClientId, - vShipped, - vWarehouseFk, - vCompanyFk, - vAddressFk, - vAgencyModeFk, - vRouteFk, - vlanded, - vUserId, - TRUE, - 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 `ticketDown_PrintableSelection` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketDown_PrintableSelection`(vSectorFk INT) -BEGIN - - UPDATE vn.ticketDown td - JOIN - (SELECT DISTINCT t.id - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id - JOIN vn.itemShelving ish ON ish.id = iss.itemShelvingFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - WHERE p.sectorFk = vSectorFk - ) sub ON sub.id = td.ticketFk - JOIN vn.ticketDown_SelectionType tdst ON tdst.description = 'FREE' - JOIN vn.ticketDown_SelectionType tdst2 ON tdst2.description = 'SELECTED' - SET td.selected = tdst2.id - WHERE td.selected = tdst.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 `ticketFilter__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketFilter__`() -BEGIN -/** - * Obtiene un listado de tickets - * junto con el precio total y los problemas - * - * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular - * @return Listado de tickets - */ - CALL ticketGetTotal(); - CALL ticketGetProblems(FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketFilter; - CREATE TEMPORARY TABLE tmp.ticketFilter ENGINE = MEMORY - SELECT t.*, tt.total, tp.problem - FROM tmp.ticket t - JOIN tmp.ticketTotal tt ON tt.ticketFk = t.ticketFk - LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = t.ticketFk; - - DROP TEMPORARY TABLE - tmp.ticket, - tmp.ticketTotal, - tmp.ticketProblems; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketGetProblems__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetProblems__`(IN vIsTodayRelative TINYINT(1)) -BEGIN -/** - * @deprecated Use ticket_getProblems() instead - * - * Hay que revisar los dos procesos y unificarlos. No son equivalentes. PAK 04/06/21 - * - */ - DECLARE vWarehouse INT; - DECLARE vDate DATE; - DECLARE vAvailableCache INT; - DECLARE vDone INT DEFAULT 0; - DECLARE vComponentCount INT; - DECLARE vHasUbications BOOL; - - DECLARE vCursor CURSOR FOR - SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)), w.hasUbications - FROM tmp.ticketGetProblems tt - JOIN vn.warehouse w ON w.id = tt.warehouseFk - WHERE DATE(tt.shipped) BETWEEN CURDATE() - AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketProblems; - CREATE TEMPORARY TABLE tmp.ticketProblems ( - ticketFk INT(11) PRIMARY KEY, - isFreezed INTEGER(1) DEFAULT 0, - risk DECIMAL(10,2) DEFAULT 0, - hasTicketRequest INTEGER(1) DEFAULT 0, - isAvailable INTEGER(1) DEFAULT 1, - itemShortage VARCHAR(250), - isTaxDataChecked INTEGER(1) DEFAULT 1, - itemDelay VARCHAR(250), - componentLack INTEGER(1) - ) ENGINE = MEMORY; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketList; - CREATE TEMPORARY TABLE tmp.ticketList - (PRIMARY KEY (ticketFk)) - ENGINE = MEMORY - SELECT tp.ticketFk, c.id clientFk - FROM tmp.ticketGetProblems tp - JOIN vn.client c ON c.id = tp.clientFk; - - SELECT COUNT(*) INTO vComponentCount - FROM vn.component c - WHERE c.isRequired; - - INSERT INTO tmp.ticketProblems(ticketFk, componentLack) - SELECT tl.ticketFk, - (COUNT(DISTINCT s.id) * (vComponentCount - (dm.code = 'PICKUP')) > COUNT(c.id)) - FROM tmp.ticketList tl - JOIN vn.sale s ON s.ticketFk = tl.ticketFk - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk - LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id - LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired - GROUP BY tl.ticketFk; - - INSERT INTO tmp.ticketProblems(ticketFk, isFreezed) - SELECT DISTINCT tl.ticketFk, 1 - FROM tmp.ticketList tl - JOIN vn.client c ON c.id = tl.clientFk - WHERE c.isFreezed - ON DUPLICATE KEY UPDATE - isFreezed = c.isFreezed; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - (PRIMARY KEY (clientFk)) - ENGINE = MEMORY - SELECT DISTINCT clientFk - FROM tmp.ticketList; - - CALL clientGetDebt(CURDATE()); - - INSERT INTO tmp.ticketProblems(ticketFk, risk) - SELECT DISTINCT tl.ticketFk, r.risk - FROM tmp.ticketList tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.agencyMode a ON t.agencyModeFk = a.id - JOIN tmp.risk r ON r.clientFk = t.clientFk - JOIN vn.client c ON c.id = t.clientFk - JOIN vn.clientConfig cc - WHERE r.risk - cc.riskTolerance > c.credit + 10 - AND a.isRiskFree = FALSE - ON DUPLICATE KEY UPDATE - risk = r.risk; - - INSERT INTO tmp.ticketProblems(ticketFk, hasTicketRequest) - SELECT DISTINCT tl.ticketFk, 1 - FROM tmp.ticketList tl - JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk - WHERE tr.isOK IS NULL AND tr.saleFk IS NOT NULL - ON DUPLICATE KEY UPDATE - hasTicketRequest = 1; - - OPEN vCursor; - - WHILE NOT vDone - DO - FETCH vCursor INTO vWarehouse, vDate, vHasUbications; - - CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate); - - INSERT INTO tmp.ticketProblems(ticketFk, isAvailable) - SELECT tl.ticketFk, 0 - FROM tmp.ticketList tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - LEFT JOIN cache.available av ON av.item_id = i.id - AND av.calc_id = vAvailableCache - WHERE date(t.shipped) = vDate - AND it.categoryFk != 6 - AND IFNULL(av.available, 0) < 0 - AND s.isPicked = FALSE - AND NOT i.generic - AND vWarehouse = t.warehouseFk - GROUP BY tl.ticketFk - ON DUPLICATE KEY UPDATE - isAvailable = 0; - - IF vHasUbications THEN - - INSERT INTO tmp.ticketProblems(ticketFk, itemShortage) - SELECT ticketFk, problem - FROM ( - SELECT tl.ticketFk, CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')) problem - FROM tmp.ticketList tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - WHERE IFNULL(av.available, 0) < 0 - AND s.quantity > IFNULL(issw.visible, 0) - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND it.categoryFk != 6 - AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) - AND NOT i.generic - AND CURDATE() = vDate - AND t.warehouseFk = vWarehouse - GROUP BY tl.ticketFk) sub - ON DUPLICATE KEY UPDATE - itemShortage = sub.problem; - - INSERT INTO tmp.ticketProblems(ticketFk, itemDelay) - SELECT ticketFk, problem - FROM ( - SELECT tl.ticketFk, GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' ') problem - FROM tmp.ticketList tl - JOIN vn.ticket t ON t.id = tl.ticketFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - WHERE s.quantity > IFNULL(issw.visible, 0) - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND it.categoryFk != 6 - AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) - AND NOT i.generic - AND CURDATE() = vDate - AND t.warehouseFk = vWarehouse - GROUP BY tl.ticketFk) sub - ON DUPLICATE KEY UPDATE - itemDelay = sub.problem; - - END IF; - - END WHILE; - - CLOSE vCursor; - - INSERT INTO tmp.ticketProblems(ticketFk, isTaxDataChecked) - SELECT DISTINCT tl.ticketFk, FALSE - FROM tmp.ticketList tl - JOIN vn.client c ON c.id = tl.clientFk - WHERE c.isTaxDataChecked= FALSE - ON DUPLICATE KEY UPDATE - isTaxDataChecked = FALSE; - - DROP TEMPORARY TABLE - tmp.clientGetDebt, - tmp.ticketList; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketGetTaxAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTaxAdd`(vTicketFk INT) -BEGIN -/** - * Añade un ticket a la tabla tmp.ticket para calcular - * el IVA y el recargo de equivalencia y devuelve el resultado. - */ - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - ENGINE = MEMORY - SELECT vTicketFk ticketFk; - - CALL vn.ticket_getTax(NULL); - - SELECT - tt.ticketFk, - CAST(tt.taxableBase AS DECIMAL(10, 2)) AS taxableBase, - CAST(tt.rate * tt.taxableBase / 100 AS DECIMAL(10, 2)) AS tax, - pgc.*, - CAST(IF(pe.equFk IS NULL, taxableBase, 0) AS DECIMAL(10, 2)) AS Base, - pgc.rate / 100 as vatPercent - FROM tmp.ticketTax tt - JOIN vn.pgc ON pgc.code = tt.pgcFk - LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code; - - 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 `ticketGetTax_new` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTax_new`() - 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 - * @return tmp.ticketTax Impuesto desglosado para cada ticket - * @return tmp.ticketAmount - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - CREATE TEMPORARY TABLE tmp.addressCompany - (INDEX (addressFk, companyFk)) - ENGINE = MEMORY - SELECT DISTINCT t.addressFk, t.companyFk - FROM tmp.ticket tmpTicket - JOIN ticket t ON t.id = tmpTicket.ticketFk; - - CALL addressTaxArea (); - - 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 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 tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = 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 = ata.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.addressCompany; - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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 - * @return tmp.ticketAmount - * @return tmp.ticketTax Impuesto desglosado para cada ticket. - - */ - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - CREATE TEMPORARY TABLE tmp.addressCompany - (INDEX (addressFk, companyFk)) - ENGINE = MEMORY - SELECT DISTINCT t.addressFk, t.companyFk - FROM tmp.ticket tmpTicket - JOIN ticket t ON t.id = tmpTicket.ticketFk; - - CALL addressTaxArea (); - - - /** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente - * No se debería cambiar el sistema por problemas con los decimales - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; - CREATE TEMPORARY TABLE tmp.ticketTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT tmpTicket.ticketFk, - bp.pgcFk, - SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, - pgc.rate, - tc.code - FROM tmp.ticket tmpTicket - 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 tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = 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 = ata.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,pgc.rate - HAVING taxableBase != 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; - CREATE TEMPORARY TABLE tmp.ticketServiceTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT tt.ticketFk, - SUM(ts.quantity * ts.price) AS taxableBase, - pgc.rate, - tc.code - FROM tmp.ticketTax tt - JOIN ticketService ts ON ts.ticketFk = tt.ticketFk - JOIN ticket t ON t.id = tt.ticketFk - JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN bookingPlanner bp - ON bp.countryFk = su.countryFk - AND bp.taxAreaFk = ata.areaFk - AND bp.taxClassFk = ts.taxClassFk - JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate - JOIN taxClass tc ON tc.id = bp.taxClassFk - GROUP BY tt.ticketFk, tt.code,tt.rate - HAVING taxableBase != 0; - - UPDATE tmp.ticketTax tt - JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate - SET tt.taxableBase = tt.taxableBase + ts.taxableBase; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; - CREATE TEMPORARY TABLE tmp.ticketAmount - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code - FROM tmp.ticketTax - GROUP BY ticketFk, code; - - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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__2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTax__2`() - READS SQL DATA -BEGIN - CALL ticket_getTax(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 `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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTotal`() -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 ticket_getTax(NULL); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTotal; - CREATE TEMPORARY TABLE tmp.ticketTotal - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT t.ticketFk, - IFNULL(SUM(ta.taxableBase + ta.tax), 0.0) AS total, - SUM(ta.taxableBase) totalWithoutVat - FROM tmp.ticket t - LEFT JOIN tmp.ticketAmount ta ON t.ticketFk = ta.ticketFk - GROUP BY ticketFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; - DROP TEMPORARY TABLE IF EXISTS 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 `ticketGetVisibleAvailable` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetVisibleAvailable`( - vTicket INT) -BEGIN - DECLARE vVisibleCalc INT; - DECLARE vAvailableCalc INT; - DECLARE vShipped DATE; - DECLARE vWarehouse TINYINT; - DECLARE vAlertLevel INT; - - SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel - FROM ticket t - LEFT JOIN ticketState ts ON ts.ticketFk = vTicket - WHERE t.id = vTicket; - - IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN - IF vShipped >= CURDATE() THEN - CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); - END IF; - IF vShipped = CURDATE() THEN - CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse); - END IF; - END IF; - - SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available, it.image, it.subName - FROM sale s - LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc - LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc - LEFT JOIN item it ON it.id = s.itemFk - WHERE s.ticketFk = vTicket - ORDER BY s.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 `ticketManaToPromo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketManaToPromo`(vTicketFk INT) -BEGIN - - DECLARE vManaComponent INT; - - DECLARE vPromoComponent INT; - - SELECT id INTO vManaComponent - FROM vn.component c - WHERE c.code = 'mana'; - - SELECT id INTO vPromoComponent - FROM vn.component c - WHERE c.code = 'floramondoPromo'; - - UPDATE vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk - SET componentFk = vPromoComponent - WHERE componentFk = vManaComponent - AND s.ticketFk = vTicketFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketMissed_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_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketMissed_List`(vTicketFk INT) -BEGIN - - DECLARE vParkingFk INT; - DECLARE vParked DATETIME; - DECLARE vLevel INT; - DECLARE vCollectionFk INT; - - SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) - INTO vLevel, vCollectionFk - FROM vn.ticketCollection - WHERE ticketFk = vTicketFk - LIMIT 1; - - SELECT created, parkingFk - INTO vParked, vParkingFk - FROM vn.ticketParking - WHERE ticketFk = vTicketFk; - - SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia - FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.zone z ON z.id = t.zoneFk - JOIN vn.agencyMode am ON am.id = z.agencyModeFk - JOIN vn.state s ON s.id = tst.state - WHERE (s.alertLevel < 2 - AND tp.parkingFk = vParkingFk - AND sc.isPackagingArea - AND ( - ( - ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) - OR - ( tc.collectionFk = vCollectionFk AND LEFT(tc.level,1) < LEFT(vLevel,1) ) - ) - )) -- Etiquetas que no se han escaneado y ya estamos con una posterior - OR - (s.alertLevel > 1 - AND tp.parkingFk = vParkingFk - AND sc.isPackagingArea - AND tp.created < vParked - AND t.packages <=> 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 `ticketNotInvoicedByClient` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketNotInvoicedByClient`(vClientFk INT) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - - CREATE TEMPORARY TABLE tmp.ticket - SELECT id ticketFk - FROM ticket - WHERE refFk IS NULL - AND clientFk = vClientFk - AND shipped > '2001-01-01'; - - CALL vn.ticketGetTotal; - - SELECT c.id, - c.name as Cliente, - t.shipped as Fecha, - t.id as Id_Ticket, - CAST(tt.total AS DECIMAL(10,2)) as Importe - FROM tmp.ticketTotal tt - JOIN ticket t ON t.id = tt.ticketFk - JOIN client c ON c.id = t.ClientFk; - - 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 `ticketObservation_addNewBorn` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `ticketObservation_addNewBorn`(vTicketFk INT) -BEGIN - - /** - * Inserta observaciones para los tickets con clientes nuevos o recuperados - * - * @param vTicketFk Identificador de vn.ticket - */ - - DECLARE vDescription VARCHAR(20) DEFAULT '¡Cliente NUEVO! '; - - INSERT INTO vn.ticketObservation(ticketFk, observationTypeFk, description) - SELECT vTicketFk, ot.id, vDescription - FROM vn.observationType ot - WHERE ot.hasNewBornMessage - ON DUPLICATE KEY UPDATE description = CONCAT(vDescription, ticketObservation.description); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketPackagingRecovery__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketPackagingRecovery__`() -BEGIN - - /* Recupera los embalajes que han caido en el cliente 31 */ - - DECLARE done BOOL DEFAULT FALSE; - DECLARE vClientFk INT; - DECLARE vTicketFk INT; - DECLARE vTicketNewFk INT; - DECLARE vWarehouseFk INT; - DECLARE vShipped DATE; - DECLARE vCompanyFk INT; - - DECLARE rs CURSOR FOR - SELECT DISTINCT tp.ticketFk, a.clientFk, t.warehouseFk, t.shipped, t.companyFk - FROM ticket t - JOIN ticketPackaging tp ON t.id = tp.ticketFk - JOIN address a ON a.id = t.addressFk - WHERE t.clientFk = 31 - AND t.shipped > '2001-01-01'; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - FETCH rs INTO vTicketFk, vClientFk, vWarehouseFk, vShipped, vCompanyFk; - - WHILE NOT done DO - - CALL vn.ticket_add(vClientFk, - vShipped, - vWarehouseFk, - vCompanyFk, - NULL, - NULL, - NULL, - vShipped, - account.userGetId(), - TRUE, - vTicketNewFk); - - UPDATE vn.ticketPackaging set ticketFk = vTicketNewFk WHERE ticketFk = vTicketFk; - - CALL vn.ticketStateUpdate(vTicketNewFk, 'DELIVERED'); - - INSERT INTO vn.sale(ticketFk, itemFk, concept) VALUES(vTicketNewFk,90,CONCAT('Embalajes ',vTicketFk)); - - FETCH rs INTO vTicketFk, vClientFk, vWarehouseFk, vShipped, vCompanyFk; - - END WHILE; - - CLOSE rs; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketParking_findSkipped` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1)) -BEGIN - -/** - * Averigua los tickets que se han saltado por un error en el proceso encajado - * @param vTicketFk Ticket - * @param vItemPackingTypeFk Modo de encajado - * @return un select con los tickets afectados - */ - - DECLARE vParkingFk INT; - DECLARE vParked DATETIME; - DECLARE vLevel INT; - DECLARE vWagon INT; - DECLARE vCollectionFk INT; - - SELECT IFNULL(`level`,0), IFNULL(`wagon`,0),IFNULL(collectionFk,0) - INTO vLevel, vWagon, vCollectionFk - FROM vn.ticketCollection tc - JOIN vn.collection c ON c.id = tc.collectionFk AND c.itemPackingTypeFk = vItemPackingTypeFk - WHERE ticketFk = vTicketFk - ORDER BY c.id DESC - LIMIT 1; - - SELECT created, parkingFk - INTO vParked, vParkingFk - FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - WHERE ticketFk = vTicketFk - AND s.itemPackingTypeFk = vItemPackingTypeFk - AND s.isPackagingArea ; - - SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' ', tc.wagon, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia - FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.zone z ON z.id = t.zoneFk - JOIN vn.agencyMode am ON am.id = z.agencyModeFk - JOIN vn.state s ON s.id = tst.state - WHERE (s.alertLevel < 2 - AND tp.parkingFk = vParkingFk - AND sc.isPackagingArea - AND ( - ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) - OR - ( tc.collectionFk = vCollectionFk - AND (LEFT(tc.wagon,1) < LEFT(vWagon,1) - OR (LEFT(tc.wagon,1) = LEFT(vWagon,1) AND LEFT(tc.level,1) < LEFT(vLevel,1))) - ) - ) - ) -- Etiquetas que no se han escaneado y ya estamos con una posterior - OR - (s.alertLevel > 1 - AND tp.parkingFk = vParkingFk - AND sc.isPackagingArea - AND tp.created < vParked - AND t.packages <=> 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 `ticketRequest_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketRequest_Add`(vDescription VARCHAR(255), vQuantity INT, vPrice DOUBLE, vTicketFk INT, vBuyerCode VARCHAR(3)) -BEGIN - - INSERT INTO vn.ticketRequest(description, - quantity, - price, - ticketFk, - buyerCode, - requesterFk) - VALUES(vDescription, - vQuantity, - vPrice, - vTicketFk, - vBuyerCode, - vn.getUser()); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketSplitCounter` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketSplitCounter`(vTicketFk INT) -BEGIN - -SELECT CONCAT(OK,'/',Total, IF(OK = Total ,' LS','')) - FROM - ( - SELECT sum(if(l.Id_Movimiento != 0,1,0)) as OK, COUNT(*) as Total - FROM vn.sale s - LEFT JOIN movement_label l ON l.Id_Movimiento = s.id - WHERE ticketFk = vTicketFk - ) sub; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketStatePrevious__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStatePrevious__`(vTicketFk INT) -BEGIN - - DECLARE vControlFk INT; - DECLARE vLastWorkerFk INT; - DECLARE vStateId INT; - - SELECT MAX(inter_id) INTO vControlFk - FROM vncontrol.inter - WHERE Id_Ticket = vTicketFk; - - IF (SELECT s.code - FROM vn.state s - JOIN vncontrol.inter i ON i.state_id = s.id - WHERE i.inter_id = vControlFk) - = 'PREVIOUS_PREPARATION' THEN - - SELECT inter_id, Id_Trabajador - INTO vControlFk,vLastWorkerFk - FROM vncontrol.inter i - JOIN vn.state s ON i.state_id = s.id - WHERE Id_Ticket = vTicketFk - AND inter_id < vControlFk - AND s.code != 'PREVIOUS_PREPARATION' - ORDER BY inter_id DESC - LIMIT 1; - /* - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador, Id_Supervisor) - SELECT state_id, Id_Ticket, vLastWorkerFk, vn.getWorker() - FROM vncontrol.inter - WHERE inter_id = vControlFk; - */ - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador, Id_Supervisor) - SELECT s.nextStateFk, i.Id_Ticket, vLastWorkerFk, account.myUser_getId() - FROM vncontrol.inter i - JOIN vn.state s ON i.state_id = s.id - WHERE inter_id = vControlFk; - - SELECT state_id INTO vStateId - FROM vncontrol.inter - WHERE inter_id = vControlFk; - - END IF; - - /*DELETE FROM vn2008.Movimientos_mark - WHERE Id_Movimiento IN (SELECT Id_Movimiento FROM vn2008.Movimientos WHERE Id_Ticket = vTicketFk) - AND valor <> 1 - AND stateFk = 26; */ - - SELECT TRUE AS IsUpdated; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketStateToday_setOnchecking__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setOnchecking__`(vParamFk INT) -BEGIN - /* - * @deprecated:utilizar ticketStateToday_setState - */ - - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM vn.state s - JOIN vn.ticketStateToday tst ON tst.state = s.id - WHERE tst.ticket = vParamFk - LIMIT 1; - - IF vAlertLevel < 2 THEN - - CALL vn.ticketStateUpdate(vParamFk, 'ON_CHECKING'); - - 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 `ticketStateToday_setOnPreviousChecking__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setOnPreviousChecking__`(vParamFk INT) -BEGIN - - /* - * @deprecated:utilizar ticketStateToday_setState - */ - - - /* - * Cambia el estado del ticket al estado de "control previa" - * - * @param vParamFk ticket a cambiar el estado - * - */ - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM state s - JOIN ticketStateToday tst ON tst.state = s.id - WHERE tst.ticket = vParamFk - LIMIT 1; - - IF vAlertLevel < 2 THEN - - CALL ticketStateUpdate(vParamFk, 'PREVIOUS_CONTROL'); - - 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 `ticketStateToday_setState` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45)) -BEGIN - - /* Modifica el estado de un ticket de hoy - * - * @param vTicketFk el id del ticket - * @param vStateCode estado a modificar del ticket - * - */ - - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM state s - JOIN ticketStateToday tst ON tst.state = s.id - WHERE tst.ticket = vTicketFk - LIMIT 1; - - IF vAlertLevel < 2 THEN - - CALL vn.ticket_setState(vTicketFk, vStateCode); - - 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 `ticketStateUpdate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateUpdate`(vTicketFk INT, vStateCode VARCHAR(45)) -BEGIN - - /* - * @deprecated:utilizar ticket_setState - */ - - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM vn.state s - JOIN vn.ticketState ts ON ts.stateFk = s.id - WHERE ts.ticketFk = vTicketFk; - - IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vTicketFk, account.myUser_getId() - FROM vn.state - WHERE `code` = vStateCode collate utf8_unicode_ci; - - 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 `ticketToInvoiceByAddress` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByAddress`( - vStarted DATE, - vEnded DATETIME, - vAddress INT, - vCompany INT - ) -BEGIN - - SET vEnded = util.dayEnd(vEnded); - - DROP TEMPORARY TABLE IF EXISTS vn.ticketToInvoice; - - CREATE TEMPORARY TABLE vn.ticketToInvoice - SELECT id - FROM vn.ticket - WHERE addressFk = vAddress - AND companyFk = vCompany - AND shipped BETWEEN vStarted AND vEnded - AND refFk 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 `ticketToInvoiceByDate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByDate`( - vStarted DATE, - vEnded DATETIME, - vClient INT, - vCompany INT - ) -BEGIN - - SET vEnded = util.dayEnd(vEnded); - - DROP TEMPORARY TABLE IF EXISTS vn.ticketToInvoice; - - CREATE TEMPORARY TABLE vn.ticketToInvoice - SELECT id - FROM vn.ticket - WHERE clientFk = vClient - AND companyFk = vCompany - AND shipped BETWEEN vStarted AND vEnded - AND refFk 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 `ticketToInvoiceByRef` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByRef`(IN vInvoiceRef VARCHAR(15)) -BEGIN - -/* Para tickets ya facturados, vuelve a repetir el proceso de facturación. -* -* @param vInvoiceRef Factura -*/ - - DECLARE vInvoice INT; - DECLARE vCountry INT; - DECLARE vTaxArea VARCHAR(15); - DECLARE vSpainCountryCode INT DEFAULT 1; - - SELECT id - INTO vInvoice - FROM vn.invoiceOut - WHERE ref = vInvoiceRef; - - SELECT s.countryFk - INTO vCountry - FROM vn.supplier s - JOIN vn.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 vn.invoiceOutSerial i - JOIN vn.invoiceOut io ON io.serial = i.code - JOIN vn.client c ON c.id = io.clientFk - WHERE io.id = vInvoice; - - DROP TEMPORARY TABLE IF EXISTS vn.ticketToInvoice; - - CREATE TEMPORARY TABLE vn.ticketToInvoice - SELECT id - FROM vn.ticket - WHERE refFk = vInvoiceRef; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketToPrePrepare` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToPrePrepare`(IN vSaleGroupFk INT, IN vSectorFk INT) -BEGIN - -/* Devuelve las lineas de vn.sale para preparación previa según el saleGroup - * - * - * @param vSaleGroupFk Identificador de vn.saleGroup -*/ - DECLARE vIsResetCode BOOLEAN; - - SELECT (vSaleGroupFk = 2000000) INTO vIsResetCode; - - IF vIsResetCode THEN - - UPDATE vn.saleTracking st - JOIN vn.state s ON s.code = 'OK PREVIOUS' - JOIN vn.state s2 ON s2.id = st.stateFk - SET st.stateFk = s.id - WHERE workerFk = vn.getUser() - AND s2.code = 'PREVIOUS_PREPARATION'; - - ELSE - - UPDATE vn.saleTracking st - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = st.saleFk - SET workerFk = vn.getUser() - WHERE sgd.saleGroupFk = vSaleGroupFk; - - UPDATE vn.saleGroup sg - SET sg.userFk = vn.getUser() - WHERE sg.id = vSaleGroupFk; - - SELECT s.ticketFk, - s.itemFk, - i.longName, - IFNULL(i.itemPackingTypeFk,' ') itemPackingTypeFk, - IFNULL(i.subName ,' ') subName, - s.quantity originalQuantity , - s.quantity, - w.code workerCode, - sgd.saleFk, - IFNULL(iss.quantity,0) pickedQuantity, - vSectorFk, - c.salesPersonFk - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.state stt ON stt.id = st.stateFk - JOIN vn.worker w ON w.id = st.workerFk - LEFT JOIN vn.itemShelvingSaleSum iss ON iss.saleFk = s.id - JOIN vn.ticket t ON t.id= s.ticketFk - JOIN vn.client c ON c.id=t.clientFk - WHERE st.workerFk = account.myUser_getId() - AND stt.code = 'PREVIOUS_PREPARATION'; - - 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 `ticketToPrePrepare__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToPrePrepare__`(IN vIdTicket INT, IN viewAll BOOL, IN vSectorFk INT) -BEGIN - -/* Tickets de preparacion previa (artificial) 21/03/2021 PAK -*/ - -/* Tickets de preparacion previa (artificial) 21/03/2021 PAK -*/ - - DECLARE vIsResetCode BOOLEAN; - -IF viewAll IS true THEN - - SELECT (vIdTicket = 2000000) INTO vIsResetCode; - - IF vIsResetCode THEN - - UPDATE vn.saleTracking st - JOIN vn.state s ON s.code = 'OK PREVIOUS' - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - JOIN vn.state s2 ON s2.id = st.stateFk - SET st.stateFk = s.id - WHERE workerFk = vn.getUser() - AND (a.accion = 'PRESACAR') - AND st.created > TIMESTAMPADD(HOUR, -10, NOW()); - - ELSE - - UPDATE vn.saleTracking st - JOIN vn.salesToPrePrepare stpp ON stpp.Id_Movimiento_mark = st.id - SET workerFk = vn.getUser() - WHERE stpp.Id_Ticket = vIdTicket - AND stpp.isChecked = FALSE; - - SELECT stpp.Id_Ticket, - stpp.Id_Movimiento, - stpp.Id_Movimiento_mark, - stpp.Id_Trabjador, - stpp.Id_Article, - i.itemPackingTypeFk packingType, - stpp.Concepte Concepte, - stpp.subName, - stpp.Cantidad, - stpp.original_quantity, - stpp.Hora, - stpp.Departure, - stpp.Minuto, - stpp.agency_id, - stpp.warehouse_id, - stpp.province_id, - stpp.picked, - stpp.trabajador, - ispss.created, - ispss.sectorFk - FROM vn.salesToPrePrepare stpp - JOIN vn.worker w ON w.code = stpp.trabajador - LEFT JOIN vn.itemShelvingPlacementSupplyStock ispss - ON ispss.itemShelvingFk = ( SELECT itemShelvingFk - FROM vn.itemShelvingPlacementSupplyStock - WHERE itemFk = stpp.Id_Article - AND sectorFk = vSectorFk - ORDER BY parking ASC - LIMIT 1) - LEFT JOIN vn.parking p ON p.id = ispss.parkingFk - LEFT JOIN vn.item i ON i.id = stpp.Id_Article - JOIN vn.state s ON s.id = stpp.stateFk - WHERE w.id = vn.getUser() - AND stpp.created > CURDATE() - AND s.code = 'PREVIOUS_PREPARATION' - ORDER BY p.pickingOrder, p.column ASC; - - 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 DROP PROCEDURE IF EXISTS `ticketTrackingAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketTrackingAdd`(vTicketFk INT, vState VARCHAR(25) CHARSET UTF8, vWorkerFk INT) -BEGIN -/** - * Inserta un registro de cambios en un ticket. - * @param vTicketFk Id del ticket - * @param vState Código del estado - * @param vWorkerFk Id del trabajador - */ - INSERT INTO ticketTracking (stateFk, ticketFk, workerFk) - SELECT s.id, vTicketFk, vWorkerFk FROM state s WHERE s.code = vState; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `ticketVolumeByDate_ventas_Artificial__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketVolumeByDate_ventas_Artificial__`(vDate DATE) -BEGIN - - DECLARE vDateStart DATETIME DEFAULT DATE(vDate); - DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketVolumeByDate_Artificial; - - CREATE TEMPORARY TABLE tmp.ticketVolumeByDate_Artificial - ENGINE = MEMORY - SELECT s.ticketFk, - CAST(SUM(r.cm3 * s.quantity) / 1000000 AS DECIMAL(10,2)) as m3 - FROM sale s - JOIN bs.ventas v ON v.Id_Movimiento = s.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.sector sc ON sc.id = i.sectorFk - JOIN vn.ticket t on t.id = s.ticketFk - JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk - WHERE sc.description = 'Artificial' - AND t.shipped BETWEEN vDateStart AND vDateEnd - GROUP BY s.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 `ticketVolumeByDate_ventas__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketVolumeByDate_ventas__`(vDate DATE) -BEGIN - - DECLARE vDateStart DATETIME DEFAULT DATE(vDate); - DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketVolumeByDate; - - CREATE TEMPORARY TABLE tmp.ticketVolumeByDate - ENGINE = MEMORY - SELECT s.ticketFk, - CAST(SUM(r.cm3 * s.quantity) / 1000000 AS DECIMAL(10,2)) as m3 - FROM sale s - JOIN bs.ventas v ON v.Id_Movimiento = s.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.ticket t on t.id = s.ticketFk - JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk - WHERE ic.merchandise - AND t.shipped BETWEEN vDateStart AND vDateEnd - AND it.name NOT IN ('Accesorios Funerarios','Composiciones planta','Composición bajo pedido','Coronas y centros') - GROUP BY s.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 `ticketVolumeByDate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketVolumeByDate__`(vDate DATE) -BEGIN - - DECLARE vDateStart DATETIME DEFAULT DATE(vDate); - DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketVolumeByDate; - - CREATE TEMPORARY TABLE tmp.ticketVolumeByDate - ENGINE = MEMORY - SELECT s.ticketFk, - CAST(SUM(ic.cm3delivery * s.quantity) / 1000000 AS DECIMAL(10,2)) as m3 - FROM sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory c ON c.id = it.categoryFk - JOIN vn.ticket t on t.id = s.ticketFk - JOIN vn.itemCost ic ON ic.itemFk = s.itemFk AND ic.warehouseFk = t.warehouseFk - WHERE c.merchandise - AND t.shipped BETWEEN vDateStart AND vDateEnd - GROUP BY s.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 `ticket_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_add`( - vClientId INT - ,vShipped DATE - ,vWarehouseFk INT - ,vCompanyFk INT - ,vAddressFk INT - ,vAgencyModeFk INT - ,vRouteFk INT - ,vlanded DATE - ,vUserId INT - ,vIsRequiredZone INT - ,OUT vNewTicket INT) -BEGIN - - DECLARE vZoneFk INT; - DECLARE vPrice DECIMAL(10,2); - DECLARE vBonus DECIMAL(10,2); - - IF vClientId IS NULL THEN - CALL util.throw ('CLIENT_NOT_ESPECIFIED'); - END IF; - - IF NOT vAddressFk OR vAddressFk IS NULL THEN - SELECT id INTO vAddressFk - FROM address - WHERE clientFk = vClientId AND isDefaultAddress; - END IF; - - IF vAgencyModeFk IS NOT NULL THEN - - CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE); - - SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus - FROM tmp.zoneGetShipped - WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; - - IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN - CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); - END IF; - END IF; - INSERT INTO ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - routeFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus - ) - SELECT - vClientId, - vShipped, - a.id, - vAgencyModeFk, - a.nickname, - vWarehouseFk, - IF(vRouteFk,vRouteFk,NULL), - vCompanyFk, - vlanded, - vZoneFk, - vPrice, - vBonus - FROM address a - JOIN agencyMode am ON am.id = a.agencyModeFk - WHERE a.id = vAddressFk; - - 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.id = vAddressFk; - - IF (SELECT COUNT(*) FROM bs.clientNewBorn cnb - WHERE cnb.clientFk = vClientId - AND NOT cnb.isRookie) = 0 THEN - - CALL vn.ticketObservation_addNewBorn(vNewTicket); - - END IF; - - INSERT INTO vn.ticketLog - SET originFk = vNewTicket, userFk = vUserId, `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vNewTicket); - - IF (SELECT ct.isCreatedAsServed FROM vn.clientType ct JOIN vn.client c ON c.typeFk = ct.code WHERE c.id = vClientId ) <> FALSE THEN - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vNewTicket, account.myUser_getId() - 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 `ticket_administrativeCopy` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_administrativeCopy`(vOriginalTicket INT, OUT vNewTicket INT) -BEGIN - - INSERT INTO vn.ticket(clientFk, addressFk, shipped, warehouseFk, companyFk, landed) - SELECT t.clientFk , t.addressFk , t.shipped ,w.id, t.companyFk , t.landed - FROM vn.ticket t - JOIN vn.warehouse w ON w.name = 'INVENTARIO' - WHERE t.id = vOriginalTicket; - - SELECT LAST_INSERT_ID() INTO vNewTicket; - - INSERT INTO vn.sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vNewTicket, s.itemFk , s.concept , s.quantity , s.price , s.discount - FROM vn.sale s - WHERE s.ticketFk = vOriginalTicket; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_canAdvance` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canAdvance`(vDated DATE, vWarehouseFk INT) -BEGIN -/** - * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. - * - * @param vDated Fecha de los tickets que se quieren adelantar. - * @param vWarehouseFk Almacén - */ - DECLARE vDateInventory DATE; - DECLARE vDateToAdvance DATE; - - SELECT inventoried INTO vDateInventory FROM vn.config; - - SET vDateToAdvance = TIMESTAMPADD(DAY,-1,vDated); - - DROP TEMPORARY TABLE IF EXISTS tmp.stock; - CREATE TEMPORARY TABLE tmp.stock - (itemFk INT PRIMARY KEY, - amount INT) - ENGINE = MEMORY; - - INSERT INTO tmp.stock(itemFk, amount) - SELECT itemFk, SUM(quantity) amount FROM - ( - SELECT itemFk, quantity - FROM vn.itemTicketOut - WHERE shipped >= vDateInventory - AND shipped < vDated - AND warehouseFk = vWarehouseFk - UNION ALL - SELECT itemFk, quantity - FROM vn.itemEntryIn - WHERE landed >= vDateInventory - AND landed < vDated - AND isVirtualStock = FALSE - AND warehouseInFk = vWarehouseFk - UNION ALL - SELECT itemFk, quantity - FROM vn.itemEntryOut - WHERE shipped >= vDateInventory - AND shipped < vDated - AND warehouseOutFk = vWarehouseFk - ) t - GROUP BY itemFk HAVING amount != 0; - - SELECT s.ticketFk ticketFuture, - sum((s.quantity <= IFNULL(st.amount,0))) hasStock, - count(DISTINCT s.id) saleCount, - st.name tfState, - GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) tfIpt, - t2.ticketFk, - t2.state, - t2.ipt - FROM vn.ticket t - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.state st ON st.id = ts.stateFk - LEFT JOIN (SELECT - t2.id ticketFk, - t2.addressFk, - st.name state, - GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt - FROM vn.ticket t2 - JOIN vn.sale s ON s.ticketFk = t2.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticketState ts ON ts.ticketFk = t2.id - JOIN vn.state st ON st.id = ts.stateFk - WHERE t2.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) - AND t2.warehouseFk = vWarehouseFk - GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk - WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) - AND t.warehouseFk = vWarehouseFk - GROUP BY t.id; - - DROP TEMPORARY TABLE tmp.stock; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_canMerge` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) -BEGIN -/** - * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro - * - * @param vDated Fecha en cuestión - * @param vScopeDays Dias en el futuro a sondear - * @param vLitersMax Volumen máximo de los tickets a catapultar - * @param vLinesMax Número máximo de lineas de los tickets a catapultar - * @param vWarehouseFk Identificador de vn.warehouse - */ - SELECT sv.ticketFk , - GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, - CAST(sum(litros) AS DECIMAL(10,0)) liters, - CAST(count(*) AS DECIMAL(10,0)) `lines`, - st.name state, - sub2.id ticketFuture, - sub2.shipped, - sub2.iptd tfIpt, - sub2.state tfState - FROM vn.saleVolume sv - JOIN vn.sale s ON s.id = sv.saleFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticket t ON t.id = sv.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.state st ON st.id = ts.stateFk - JOIN vn.alertLevel al ON al.id = ts.alertLevel - LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id - LEFT JOIN ( - SELECT * FROM ( - SELECT - t.addressFk , - t.id, - t.shipped, - st.name state, - GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd - FROM vn.ticket t - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.state st ON st.id = ts.stateFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) - AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) - AND t.warehouseFk = vWarehouseFk - GROUP BY t.id - ) sub - GROUP BY sub.addressFk - ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id - WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) - AND t.warehouseFk = vWarehouseFk - AND al.code = 'FREE' - AND tp.ticketFk IS NULL - GROUP BY sv.ticketFk - HAVING liters <= vLitersMax AND `lines` <= vLinesMax AND ticketFuture; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_canMerge__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge__`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) -BEGIN - - /* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro - * - * @param vDated Fecha en cuestión - * @param vScopeDays Dias en el futuro a sondear - * @param vLitersMax Volumen máximo de los tickets a catapultar - * @param vLinesMax Número máximo de lineas de los tickets a catapultar - * @param vWarehouseFk Identificador de vn.warehouse - */ - - SELECT sv.ticketFk , - CAST(sum(litros) AS DECIMAL(10,0)) liters, - CAST(count(*) AS DECIMAL(10,0)) `lines`, - sub2.id ticketFuture, - sub2.shipped - FROM vn.saleVolume sv - JOIN vn.ticket t ON t.id = sv.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.alertLevel al ON al.id = ts.alertLevel - LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id - LEFT JOIN tmp.routeDayMove ra ON ra.routeFk = t.routeFk - LEFT JOIN ( - SELECT * FROM ( - SELECT t.addressFk , t.id, t.shipped - FROM vn.ticket t - WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) - AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) - AND t.warehouseFk = vWarehouseFk - ) sub - GROUP BY sub.addressFk - ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id - WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) - AND t.warehouseFk = vWarehouseFk - AND al.code = 'FREE' - AND tp.ticketFk IS NULL - AND ra.routeFk IS NULL - GROUP BY sv.ticketFk - HAVING liters <= vLitersMax AND `lines` <= vLinesMax AND ticketFuture; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_changeClient` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_changeClient`(vNewClient INT, vUserFk INT) -BEGIN - -/** - * Dado un conjunto de tickets - * cambia el cliente al nuevo cliente dado - * - * params @vNewClient nuevo cliente - * params @vUserFk usuario que realiza el cambio - * - * table @tmp.ticket(ticketFk) conjunto de tickets - */ - - INSERT INTO ticketLog (originFk, userFk, `action`, changedModel, oldInstance, newInstance) - SELECT t.id, vUserFk, 'update', 'Ticket', CONCAT('{"clientFk":',t.clientFk,'}'), CONCAT('{"clientFk":',vNewClient,'}') - FROM ticket t - JOIN tmp.ticket tt - ON t.id = tt.ticketFk; - - UPDATE ticket t - JOIN tmp.ticket tt - ON t.id = tt.ticketFk - SET t.clientFk = vNewClient; - - UPDATE ticket t - JOIN tmp.ticket tt - ON t.id = tt.ticketFk - JOIN stowaway s - ON s.shipFk = tt.ticketFk - SET t.clientFk = vNewClient; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_checkFullyControlled` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_checkFullyControlled`(vWorkerFk INT, vTicketFk INT ) -BEGIN -/** - * Comprueba que no hay ningún ticket pendiente de revisar de alguna colección que haya revisado el trabajador - * @param vWorkerFk id del user - * @param vTicketFk número de ticket escaneada - * - */ - - SELECT t.id - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN ticketCollection tc ON tc.ticketFk = t.id - JOIN (SELECT tc.collectionFk - FROM ticketState ts - JOIN ticketCollection tc ON tc.ticketFk = ts.ticketFk - LEFT JOIN (SELECT tc.collectionFk - FROM ticketCollection tc - WHERE ticketFk = vTicketFk - AND tc.created >= CURDATE() - )sub ON sub.collectionFk = tc.collectionFk - WHERE ts.workerFk = vWorkerFk - AND sub.collectionFk IS NULL - AND tc.created >= CURDATE() - GROUP BY tc.collectionFk - )sub ON sub.collectionFk = tc.collectionFk - JOIN ticketState ts ON ts.ticketFk = t.id - WHERE ts.code IN ('ON_PREPARATION', 'PREPARED', 'PREVIOUS_PREPARATION', 'OK PREVIOUS') - AND t.shipped >= CURDATE() - AND s.quantity <>0 - 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 `ticket_checkNoComponents` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME) -BEGIN - -/** - * Comprueba que los tickets entre un rango de fechas tienen componentes - * - * @param vShippedFrom rango inicial de fecha - * @param vShippedTo rango final de fecha - */ - DECLARE v_done BOOL DEFAULT FALSE; - DECLARE vSaleFk INTEGER; - DECLARE vCur CURSOR FOR - SELECT s.id - FROM ticket t - JOIN client clt ON clt.id = t.clientFk - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - LEFT JOIN tmp.coste c ON c.id = s.id - WHERE t.shipped >= vShippedFrom AND t.shipped <= vShippedTo - AND c.id IS NULL - AND clt.isActive != 0 - AND ic.merchandise != 0 - GROUP BY s.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET v_done = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.coste; - - DROP TEMPORARY TABLE IF EXISTS tmp.coste; - CREATE TEMPORARY TABLE tmp.coste - (primary key (id)) ENGINE = MEMORY - SELECT s.id - FROM ticket t - JOIN client clt ON clt.id = t.clientFk - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - JOIN itemType tp ON tp.id = i.typeFk - JOIN itemCategory ic ON ic.id = tp.categoryFk - JOIN saleComponent sc ON sc.saleFk = s.id - JOIN component c ON c.id = sc.componentFk - JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1 - WHERE t.shipped >= vShippedFrom - AND ic.merchandise != 0; - - OPEN vCur; - - l: LOOP - SET v_done = FALSE; - FETCH vCur INTO vSaleFk; - - IF v_done THEN - LEAVE l; - END IF; - - CALL sale_calculateComponent(vSaleFk, 1); - END LOOP; - - CLOSE vCur; - DROP TEMPORARY TABLE tmp.coste; - END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_Clone` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_Clone`(vOriginalTicket INT, OUT vNewTicket INT) -BEGIN -/** - * Clona el contenido de un ticket en otro - * - * @param vOriginalTicket ticket Original - * @param vNewTicket ticket creado - */ - DECLARE vStateFk INT; - - INSERT INTO ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk, - priority, - hasPriority - ) - SELECT - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus, - routeFk, - priority, - hasPriority - FROM ticket - WHERE id = vOriginalTicket; - - SET vNewTicket = LAST_INSERT_ID(); - - INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) - SELECT vNewTicket, ao.observationTypeFk, ao.description - FROM addressObservation ao - JOIN ticket t ON t.addressFk = ao.addressFk - WHERE t.id = vNewTicket; - - INSERT INTO ticketLog - SET originFk = vNewTicket, userFk = account.myUser_getId(), `action` = 'insert', - description = CONCAT('Ha creado el ticket:', ' ', vNewTicket, ' clonando el ', vOriginalTicket); - - INSERT INTO ticketLog - SET originFk = vOriginalTicket, userFk = account.myUser_getId(), `action` = 'insert', - description = CONCAT('Ha creado el ticket:', ' ', vNewTicket, ' clonando el ', vOriginalTicket); - - INSERT INTO vncontrol.inter(Id_Ticket, state_id, Id_Trabajador, odbc_date) - SELECT vNewTicket, state_id, Id_Trabajador , odbc_date - FROM vncontrol.inter - WHERE Id_Ticket = vOriginalTicket - ORDER BY odbc_date; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_cloneWeekly` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT) -BEGIN - DECLARE vIsDone BOOL; - DECLARE vLanding DATE; - DECLARE vShipment DATE; - DECLARE vWarehouseFk INT; - DECLARE vTicketFk INT; - DECLARE vWeekDay INT; - DECLARE vClientFk INT; - DECLARE vCompanyFk INT; - DECLARE vAddressFk INT; - DECLARE vAgencyModeFk INT; - DECLARE vNewTicket INT; - DECLARE vYear INT; - - DECLARE rsTicket CURSOR FOR - SELECT tt.ticketFk, tt.weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tt.agencyModeFk - FROM vn.ticketWeekly tt - JOIN vn.ticket t ON tt.ticketFk = t.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; - - SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0); - - OPEN rsTicket; - myLoop: LOOP - BEGIN - DECLARE vSalesPersonEmail VARCHAR(150); - DECLARE vMailSent BOOL; - DECLARE vSubject VARCHAR(150); - DECLARE vMessage TEXT; - - SET vIsDone = FALSE; - FETCH rsTicket INTO vTicketFk, vWeekDay, vClientFk, vWarehouseFk, vCompanyFk, vAddressFk, vAgencyModeFk; - - IF vIsDone THEN - - LEAVE myLoop; - END IF; - SELECT dated INTO vShipment - FROM `time` - WHERE `year` = vYear AND `week` = vWeek - AND WEEKDAY(dated) = vWeekDay; - - -- busca si el ticket ya ha sido clonado - IF (SELECT COUNT(*) FROM vn.ticket tOrig - JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk - JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id - JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk - JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk - WHERE tOrig.id = vTicketFk AND tClon.isDeleted = FALSE AND DATE(tClon.shipped) = vShipment) > 0 - THEN - ITERATE myLoop; - END IF; - - IF vAgencyModeFk IS NULL THEN - SELECT agencyModeFk INTO vAgencyModeFk - FROM address - WHERE clientFk = vClientFk AND isDefaultAddress; - END IF; - - CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk,FALSE); - SET vLanding = NULL; - SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1; - - CALL ticket_add( - vClientFk, - vShipment, - vWarehouseFk, - vCompanyFk, - vAddressFk, - vAgencyModeFk, - NULL, - vLanding, - account.userGetId(), - FALSE, - vNewTicket); - - IF (vLanding IS NULL) THEN - - SELECT e.email INTO vSalesPersonEmail - FROM vn.client c - JOIN vn.worker sp ON sp.id = c.salesPersonFk - JOIN account.emailUser e ON e.userFk = sp.userFk - WHERE c.id = vClientFk; - - SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicketFk, - ' para el dia: ', vShipment); - SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicketFk, - ' para el dia: ', vShipment, - ' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket, - ' pero ha que revisar las fechas y la agencia'); - - SELECT COUNT(*) INTO vMailSent - FROM vn.mail - WHERE receiver = vSalesPersonEmail - AND subject = vSubject; - - IF NOT vMailSent THEN - CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage); - END IF; - CALL vn.ticketStateUpdate (vNewTicket, 'FIXING'); - END IF; - - INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed) - SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed - FROM vn.sale saleOrig - WHERE saleOrig.ticketFk = vTicketFk; - - INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk) - SELECT saleOriginal.id, saleClon.id - FROM vn.sale saleOriginal - JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity - WHERE saleOriginal.ticketFk = vTicketFk AND saleClon.ticketFk = vNewTicket; - - INSERT INTO ticketRequest (description,ordered,shipped,quantity,price,itemFk,clientFk,response, - total,buyed,requesterFk,attenderFk,ticketFk) - SELECT description,ordered,shipped,quantity,price,itemFk,clientFk,response, - total,buyed,requesterFk,attenderFk,vNewTicket - FROM ticketRequest - WHERE ticketFk =vTicketFk; - - INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) VALUES(vNewTicket,4,CONCAT('turno desde ticket: ',vTicketFk)) - ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); - - INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) VALUES(vNewTicket,1,'ATENCION: Contiene lineas de TURNO') - ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); - - CALL vn.ticketCalculateClon(vNewTicket, vTicketFk); - END; - END LOOP; - - CLOSE rsTicket; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_close` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_close`() -BEGIN -/** - * Realiza el cierre de todos los - * tickets de la tabla tmp.ticket_close. - * - * @table tmp.ticket_close(ticketFk) Identificadores de los tickets a cerrar - */ - DECLARE vDone BOOL; - DECLARE vClientFk INT; - DECLARE vCurTicketFk INT; - DECLARE vIsTaxDataChecked BOOL; - DECLARE vCompanyFk INT; - DECLARE vShipped DATE; - DECLARE vNewInvoiceId INT; - DECLARE vHasDailyInvoice BOOL; - DECLARE vWithPackage BOOL; - DECLARE vHasToInvoice BOOL; - - DECLARE cur CURSOR FOR - SELECT ticketFk FROM tmp.ticket_close; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN - RESIGNAL; - END; - - OPEN cur; - - proc: LOOP - SET vDone = FALSE; - - FETCH cur INTO vCurTicketFk; - - IF vDone THEN - LEAVE proc; - END IF; - - -- Fetch ticket data - SELECT - c.id, - c.isTaxDataChecked, - t.companyFk, - t.shipped, - co.hasDailyInvoice, - w.isManaged, - c.hasToInvoice - INTO vClientFk, - vIsTaxDataChecked, - vCompanyFk, - vShipped, - vHasDailyInvoice, - vWithPackage, - vHasToInvoice - FROM ticket t - JOIN `client` c ON c.id = t.clientFk - JOIN province p ON p.id = c.provinceFk - JOIN country co ON co.id = p.countryFk - JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.id = vCurTicketFk; - - INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) - (SELECT vCurTicketFk, p.id, COUNT(*) - FROM expedition e - JOIN packaging p ON p.itemFk = e.itemFk - WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable - AND vWithPackage - GROUP BY p.itemFk); - - -- No retornables o no catalogados - INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed) - (SELECT e.itemFk, vCurTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 - FROM expedition e - JOIN item i ON i.id = e.itemFk - LEFT JOIN packaging p ON p.itemFk = i.id - WHERE e.ticketFk = vCurTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 - AND getSpecialPrice(e.itemFk, vClientFk) > 0 - GROUP BY e.itemFk); - - IF(vHasDailyInvoice) AND vHasToInvoice THEN - - -- Facturacion rapida - CALL ticketTrackingAdd(vCurTicketFk, 'DELIVERED', NULL); - -- Facturar si está contabilizado - IF vIsTaxDataChecked THEN - CALL invoiceOut_newFromClient( - vClientFk, - (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), - vShipped, - vCompanyFk, - NULL, - NULL, - vNewInvoiceId); - END IF; - ELSE - CALL ticketTrackingAdd(vCurTicketFk, (SELECT vn.getAlert3State(vCurTicketFk)), NULL); - END IF; - END LOOP; - - CLOSE cur; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_closeAll__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_closeAll__`() -BEGIN -/** - * Realiza el cierre de todos los - * tickets de la tabla tmp.ticketClosure. - * - * @param vTicketFk Id del ticket - */ - DECLARE vDone BOOL; - DECLARE vClientFk INT; - DECLARE vCurTicketFk INT; - DECLARE vIsTaxDataChecked BOOL; - DECLARE vCompanyFk INT; - DECLARE vShipped DATE; - DECLARE vNewInvoiceId INT; - DECLARE vHasDailyInvoice BOOL; - DECLARE vWithPackage BOOL; - 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; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure2; - CREATE TEMPORARY TABLE tmp.ticketClosure2 - SELECT ticketFk FROM tmp.ticketClosure; - - INSERT INTO tmp.ticketClosure - SELECT id FROM stowaway s - JOIN tmp.ticketClosure2 tc ON s.shipFk = tc.ticketFk; - OPEN cur; - - proc: LOOP - SET vDone = FALSE; - - FETCH cur INTO vCurTicketFk; - - IF vDone THEN - LEAVE proc; - END IF; - - -- ticketClosure start - SELECT - c.id, - c.isTaxDataChecked, - t.companyFk, - t.shipped, - co.hasDailyInvoice, - w.isManaged, - c.hasToInvoice - INTO vClientFk, - vIsTaxDataChecked, - vCompanyFk, - vShipped, - vHasDailyInvoice, - vWithPackage, - vHasToInvoice - FROM ticket t - JOIN `client` c ON c.id = t.clientFk - JOIN province p ON p.id = c.provinceFk - JOIN country co ON co.id = p.countryFk - JOIN warehouse w ON w.id = t.warehouseFk - WHERE t.id = vCurTicketFk; - - INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) - (SELECT vCurTicketFk, p.id, COUNT(*) - FROM expedition e - JOIN packaging p ON p.itemFk = e.itemFk - WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable - AND vWithPackage - GROUP BY p.itemFk); - - -- No retornables o no catalogados - INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed) - (SELECT e.itemFk, vCurTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 - FROM expedition e - JOIN item i ON i.id = e.itemFk - LEFT JOIN packaging p ON p.itemFk = i.id - WHERE e.ticketFk = vCurTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 - AND getSpecialPrice(e.itemFk, vClientFk) > 0 - GROUP BY e.itemFk); - - CALL vn.zonePromo_Make(); - - IF(vHasDailyInvoice) AND vHasToInvoice THEN - - -- Facturacion rapida - CALL ticketTrackingAdd(vCurTicketFk, 'DELIVERED', NULL); - -- Facturar si está contabilizado - IF vIsTaxDataChecked THEN - CALL invoiceOut_newFromClient( - vClientFk, - (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), - vShipped, - vCompanyFk, - NULL, - NULL, - vNewInvoiceId); - END IF; - ELSE - CALL ticketTrackingAdd(vCurTicketFk, (SELECT vn.getAlert3State(vCurTicketFk)), NULL); - END IF; - END LOOP; - - CLOSE cur; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_closeByTicket` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_closeByTicket`(IN vTicketFk int) -BEGIN - -/** - * Inserta el ticket en la tabla temporal - * para ser cerrado. - * - * @param vTicketFk Id del ticket - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_close; - CREATE TEMPORARY TABLE tmp.ticket_close ENGINE = MEMORY ( - SELECT - t.id AS ticketFk - FROM expedition e - INNER JOIN ticket t ON t.id = e.ticketFk - LEFT JOIN ticketState ts ON ts.ticketFk = t.id - JOIN alertLevel al ON al.id = ts.alertLevel - WHERE - al.code = 'PACKED' - AND t.id = vTicketFk - AND t.refFk IS NULL - GROUP BY e.ticketFk); - - CALL ticket_close(); - - DROP TEMPORARY TABLE tmp.ticket_close; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_componentMakeUpdate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentMakeUpdate`(IN vTicketFk INT, IN vClientFk INT, - IN vNickname VARCHAR(50), IN vAgencyModeFk INT, - IN vAddressFk INT, IN vZoneFk INT, IN vWarehouseFk TINYINT, - IN vCompanyFk SMALLINT, IN vShipped DATETIME, - IN vLanded DATE, IN vIsDeleted TINYINT(1), - IN vHasToBeUnrouted TINYINT(1), IN vOption INT) -BEGIN - - /** - * Modifica en el ticket los campos que se le pasan por parámetro - * y cambia sus componentes - * - * @param vTicketFk Id del ticket a modificar - * @param vClientFk nuevo cliente - * @param vNickname nuevo alias - * @param vAgencyModeFk nueva agencia - * @param vAddressFk nuevo consignatario - * @param vZoneFk nueva zona - * @param vWarehouseFk nuevo almacen - * @param vCompanyFk nueva empresa - * @param vShipped nueva fecha del envio de mercancia - * @param vLanded nueva fecha de recepcion de mercancia - * @param vIsDeleted si se borra el ticket - * @param vHasToBeUnrouted si se le elimina la ruta al ticket - * @param vOption opcion para el case del proc ticketComponentUpdateSale - */ - - DECLARE vPrice DECIMAL(10,2); - DECLARE vBonus DECIMAL(10,2); - - CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk); - - IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN - - UPDATE ticket t - JOIN address a ON a.id = vAddressFk - SET t.nickname = a.nickname - WHERE t.id = vTicketFk; - - END IF; - - CALL zone_getShipped(vLanded, vAddressFk, vAgencyModeFk, TRUE); - - SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus - FROM tmp.zoneGetShipped - WHERE shipped BETWEEN DATE(vShipped) AND util.dayEnd(vShipped) AND warehouseFk = vWarehouseFk LIMIT 1; - - UPDATE ticket t - SET - t.clientFk = vClientFk, - t.nickname = vNickname, - t.agencyModeFk = vAgencyModeFk, - t.addressFk = vAddressFk, - t.zoneFk = vZoneFk, - t.zonePrice = vPrice, - t.zoneBonus = vBonus, - t.warehouseFk = vWarehouseFk, - t.companyFk = vCompanyFk, - t.landed = vLanded, - t.shipped = vShipped, - t.isDeleted = vIsDeleted - WHERE - t.id = vTicketFk; - - IF vHasToBeUnrouted THEN - UPDATE ticket t SET t.routeFk = NULL - WHERE t.id = vTicketFk; - END IF; - - IF vOption <> 8 THEN - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) - ENGINE = MEMORY - SELECT id AS saleFk, vWarehouseFk warehouseFk - FROM sale s WHERE s.ticketFk = vTicketFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent; - CREATE TEMPORARY TABLE tmp.ticketComponent - SELECT * FROM tmp.ticketComponentPreview; - - CALL ticketComponentUpdateSale (vOption); - - DROP TEMPORARY TABLE tmp.sale; - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent; - END IF; - - DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_componentPreview` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentPreview`( - vTicketFk INT, - vLanded DATE, - vAddressFk INT, - vZoneFk INT, - vWarehouseFk SMALLINT) -BEGIN -/** - * Calcula los componentes de los articulos de un ticket - * - * @param vTicketFk id del ticket - * @param vLanded nueva fecha de entrega - * @param vAddressFk nuevo consignatario - * @param vZoneFk nueva zona - * @param vWarehouseFk nuevo warehouse - * - * @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost) - */ - DECLARE vHasDataChanged BOOL DEFAULT FALSE; - DECLARE vHasAddressChanged BOOL; - DECLARE vHasZoneChanged BOOL DEFAULT FALSE; - DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE; - - DECLARE vShipped DATE; - DECLARE vAddressTypeRateFk INT DEFAULT NULL; - DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL; - - DECLARE vHasChangeAll BOOL DEFAULT FALSE; - - SELECT DATE(landed) <> vLanded, - addressFk <> vAddressFk, - zoneFk <> vZoneFk, - warehouseFk <> vWarehouseFk - INTO - vHasDataChanged, - vHasAddressChanged, - vHasZoneChanged, - vHasWarehouseChanged - FROM vn.ticket t - WHERE t.id = vTicketFk; - - IF vHasDataChanged OR vHasWarehouseChanged THEN - SET vHasChangeAll = TRUE; - END IF; - - IF vHasAddressChanged THEN - SET vAddressTypeRateFk = 5; - END IF; - - IF vHasZoneChanged THEN - SET vAgencyModeTypeRateFk = 6; - END IF; - - SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped - FROM zone - WHERE id = vZoneFk; - - CALL buyUltimate(vWarehouseFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY ( - SELECT - vWarehouseFk AS warehouseFk, - NULL AS available, - s.itemFk, - bu.buyFk, - vZoneFk zoneFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketFk - GROUP BY bu.warehouseFk, bu.itemFk); - - CALL catalog_componentPrepare(); - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value - FROM saleComponent sc - JOIN sale s ON s.id = sc.saleFk - JOIN ticket t ON t.id = s.ticketFk - JOIN `component` c ON c.id = sc.componentFk - WHERE s.ticketFk = vTicketFk - AND (c.isRenewable = FALSE - OR - (NOT vHasChangeAll - AND (NOT (c.typeFk <=> vAddressTypeRateFk - OR c.typeFk <=> vAgencyModeTypeRateFk)))); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPreview; - CREATE TEMPORARY TABLE tmp.ticketComponentPreview - SELECT * FROM tmp.ticketComponent; - - CALL catalog_componentPurge(); - DROP TEMPORARY TABLE tmp.buyUltimate; - - IF vShipped IS NULL THEN - CALL util.throw('NO_ZONE_AVAILABLE'); - 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_componentPreview__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentPreview__`( - vTicketFk INT, - vLanded DATE, - vAddressFk INT, - vZoneFk INT, - vWarehouseFk SMALLINT) -BEGIN -/** - * Calcula los componentes de los articulos de un ticket - * - * @param vTicketFk id del ticket - * @param vLanded nueva fecha de entrega - * @param vAddressFk nuevo consignatario - * @param vZoneFk nueva zona - * @param vWarehouseFk nuevo warehouse - * - * @return tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - */ - DECLARE vShipped DATE; - DECLARE vBuyOrderItem INT DEFAULT 100; - - DECLARE vHasDataChanged BOOL DEFAULT FALSE; - DECLARE vHasAddressChanged BOOL; - DECLARE vHasZoneChanged BOOL DEFAULT FALSE; - DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE; - - DECLARE vAddressTypeRateFk INT DEFAULT NULL; - DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL; - - DECLARE vHasChangeAll BOOL DEFAULT FALSE; - - SELECT DATE(landed) <> vLanded, - addressFk <> vAddressFk, - zoneFk <> vZoneFk, - warehouseFk <> vWarehouseFk - INTO - vHasDataChanged, - vHasAddressChanged, - vHasZoneChanged, - vHasWarehouseChanged - FROM vn.ticket t - WHERE t.id = vTicketFk; - - IF vHasDataChanged OR vHasWarehouseChanged THEN - SET vHasChangeAll = TRUE; - END IF; - - IF vHasAddressChanged THEN - SET vAddressTypeRateFk = 5; - END IF; - - IF vHasZoneChanged THEN - SET vAgencyModeTypeRateFk = 6; - END IF; - - SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped - FROM zone - WHERE id = vZoneFk; - - CALL buyUltimate(vWarehouseFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY ( - SELECT - vWarehouseFk AS warehouseFk, - NULL AS available, - s.itemFk, - bu.buyFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketFk - AND s.itemFk != vBuyOrderItem - GROUP BY bu.warehouseFk, bu.itemFk); - - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); - - REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) - SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value - FROM saleComponent sc - JOIN sale s ON s.id = sc.saleFk - JOIN ticket t ON t.id = s.ticketFk - JOIN `component` c ON c.id = sc.componentFk - WHERE s.ticketFk = vTicketFk - AND (c.isRenewable = FALSE - OR - (NOT vHasChangeAll - AND (NOT (c.typeFk <=> vAddressTypeRateFk - OR c.typeFk <=> vAgencyModeTypeRateFk)))); - - SET @shipped = vShipped; - - DROP TEMPORARY TABLE - tmp.buyUltimate, - tmp.ticketLot; - - IF vShipped IS NULL THEN - CALL util.throw('NO_ZONE_AVAILABLE'); - END IF; - - IF vShipped < CURDATE() THEN - CALL util.throw('ERROR_PAST_SHIPMENT'); - 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_componentUpdate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentUpdate__`( - vTicketFk INT, - vClientFk INT, - vAgencyModeFk INT, - vAddressFk INT, - vZoneFk INT, - vWarehouseFk TINYINT, - vCompanyFk SMALLINT, - vShipped DATETIME, - vLanded DATE, - vIsDeleted BOOLEAN, - vHasToBeUnrouted BOOLEAN, - vOption INT) -BEGIN - DECLARE vPrice DECIMAL(10,2); - DECLARE vBonus DECIMAL(10,2); - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN - - UPDATE ticket t - JOIN address a ON a.id = vAddressFk - SET t.nickname = a.nickname - WHERE t.id = vTicketFk; - - END IF; - - CALL vn.zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk); - - SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus - FROM tmp.zoneGetShipped - WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; - - UPDATE ticket t - SET - t.clientFk = vClientFk, - t.agencyModeFk = vAgencyModeFk, - t.addressFk = vAddressFk, - t.zoneFk = vZoneFk, - t.zonePrice = vPrice, - t.zoneBonus = vBonus, - t.warehouseFk = vWarehouseFk, - t.companyFk = vCompanyFk, - t.landed = vLanded, - t.shipped = vShipped, - t.isDeleted = vIsDeleted - WHERE - t.id = vTicketFk; - - IF vHasToBeUnrouted THEN - UPDATE ticket t SET t.routeFk = NULL - WHERE t.id = vTicketFk; - END IF; - - IF vOption <> 8 THEN - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) - ENGINE = MEMORY - SELECT id AS saleFk, vWarehouseFk warehouseFk - FROM sale s WHERE s.ticketFk = vTicketFk; - - CALL ticketComponentUpdateSale (vOption); - - DROP TEMPORARY TABLE tmp.sale; - 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 `ticket_DelayTruck` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT) -BEGIN - - DECLARE done INT DEFAULT FALSE; - DECLARE vTicketFk INT; - DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tmp.ticket; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - CALL vn.productionControl(vWarehouserFk,0) ; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT ticketFk - FROM tmp.productionBuffer - WHERE shipped = curdate() - AND problem LIKE '%I:%' - AND (HH <= vHour OR HH = vHour AND mm < vMinute) - AND alertLevel = 0; - - OPEN cur1; - - read_loop: LOOP - - FETCH cur1 INTO vTicketFk; - - IF done THEN - LEAVE read_loop; - END IF; - - CALL vn.ticket_DelayTruckSplit(vTicketFk); - - END LOOP; - - CLOSE cur1; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_DelayTruckSplit` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruckSplit`(vTicketFk INT) -BEGIN - - /* - * Splita las lineas de ticket que no estan ubicadas - * - */ - - DECLARE vNewTicketFk INT; - DECLARE vTotalLines INT; - DECLARE vLinesToSplit INT; - - DROP TEMPORARY TABLE IF EXISTS tmp.SalesToSplit; - - SELECT COUNT(*) INTO vTotalLines - FROM vn.sale - WHERE ticketFk = vTicketFk; - - CREATE TEMPORARY TABLE tmp.SalesToSplit - SELECT s.id saleFk - FROM vn.ticket t - JOIN vn.sale s ON t.id = s.ticketFk - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = s.itemFk AND issw.warehouseFk = t.warehouseFk - WHERE s.quantity > IFNULL(issw.visible, 0) - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND t.id = vTicketFk; - - SELECT COUNT(*) INTO vLinesToSplit - FROM tmp.SalesToSplit; - - IF vLinesToSplit = vTotalLines AND vLinesToSplit > 0 THEN - - SET vNewTicketFk = vTicketFk; - - ELSE - - CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - - UPDATE vn.sale s - JOIN tmp.SalesToSplit sts ON sts.saleFk = s.id - SET s.ticketFk = vNewTicketFk; - - END IF; - - CALL vn.ticketStateUpdate(vNewTicketFk, 'FIXING'); - - DROP TEMPORARY TABLE tmp.SalesToSplit; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_doRecalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_doRecalc`() -proc: BEGIN -/** - * Recalculates modified ticket. - */ - - DECLARE vDone BOOL; - DECLARE vTicketFk INT; - DECLARE vError INT; - - DECLARE cCur CURSOR FOR - SELECT ticketFk FROM ticketRecalc; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('vn.ticket_doRecalc'); - ROLLBACK; - GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; - SET vError = IFNULL(@errno, 0) ; - IF NOT(vError = 1105 OR vError = 1751) THEN - CALL `vn`.`mail_insert`('cau@verdnatura.es', - NULL, - 'Problema al recalcular el total de ticket', - CONCAT('Se ha detectado un problema en ticket_doRecalc al calcular el total del ticket : ', - vTicketFk,' el error es el: ', - CONCAT('ERROR ', IFNULL(@errno, 0), ': ', ifnull(@text, ''))) - ); - END IF; - RESIGNAL; - END; - - IF !GET_LOCK('vn.ticket_doRecalc', 0) THEN - LEAVE proc; - END IF; - - OPEN cCur; - - myLoop: LOOP - SET vDone = FALSE; - FETCH cCur INTO vTicketFk; - - IF vDone THEN - LEAVE myLoop; - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - ENGINE = MEMORY - SELECT vTicketFk ticketFk; - - CALL ticketGetTotal; - - START TRANSACTION; - UPDATE ticket t - JOIN tmp.ticketTotal tt ON tt.ticketFk = t.id - SET t.totalWithVat = tt.total, - t.totalWithoutVat = tt.totalWithoutVat; - DELETE FROM ticketRecalc WHERE ticketFk = vTicketFk; - COMMIT; - - DROP TEMPORARY TABLE - tmp.ticket, - tmp.ticketTotal; - END LOOP; - - CLOSE cCur; - DO RELEASE_LOCK('vn.ticket_doRecalc'); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_doRefund` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `ticket_doRefund`(IN vOriginTicket INT, OUT vNewTicket INT) -BEGIN - - DECLARE vDone BIT DEFAULT 0; - DECLARE vCustomer MEDIUMINT; - DECLARE vWarehouse TINYINT; - DECLARE vCompany MEDIUMINT; - DECLARE vAddress MEDIUMINT; - DECLARE vRefundAgencyMode INT; - DECLARE vItemFk INT; - DECLARE vQuantity DECIMAL (10,2); - DECLARE vConcept VARCHAR(50); - DECLARE vPrice DECIMAL (10,2); - DECLARE vDiscount TINYINT; - DECLARE vSaleNew INT; - DECLARE vSaleMain INT; - DECLARE vZoneFk INT; - - DECLARE vRsMainTicket CURSOR FOR - SELECT * - FROM tmp.sale; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; - - SELECT id INTO vRefundAgencyMode - FROM agencyMode WHERE `name` = 'ABONO'; - - SELECT clientFk, warehouseFk, companyFk, addressFk - INTO vCustomer, vWarehouse, vCompany, vAddress - FROM ticket - WHERE id = vOriginTicket; - - SELECT id INTO vZoneFk - FROM zone WHERE agencyModeFk = vRefundAgencyMode - LIMIT 1; - - INSERT INTO vn.ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - companyFk, - landed, - zoneFk - ) - SELECT - vCustomer, - CURDATE(), - vAddress, - vRefundAgencyMode, - a.nickname, - vWarehouse, - vCompany, - CURDATE(), - vZoneFk - FROM address a - WHERE a.id = vAddress; - - SET vNewTicket = LAST_INSERT_ID(); - - SET vDone := 0; - OPEN vRsMainTicket ; - FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; - - WHILE NOT vDone DO - - INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount) - VALUES( vNewTicket, vItemFk, vQuantity, vConcept, vPrice, vDiscount ); - - SET vSaleNew = LAST_INSERT_ID(); - - INSERT INTO vn.saleComponent(saleFk,componentFk,`value`) - SELECT vSaleNew,componentFk,`value` - FROM vn.saleComponent - WHERE saleFk = vSaleMain; - - FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; - - END WHILE; - CLOSE vRsMainTicket; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getFromFloramondo` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `ticket_getFromFloramondo`(vDateFrom DATE, vDateTo DATE) -BEGIN - -/** - * Genera una tabla con la lista de tickets de Floramondo para una fecha determinada - * @param vDated Fecha de preparación de los pedidos - * @return tmp.ticketFloramondo(ticketFk, clientName, agencyName, freight, expeditionCount, margin, trolleys, pallets) - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketFloramondo; - CREATE TEMPORARY TABLE tmp.ticketFloramondo - (ticketFk INT PRIMARY KEY, - clientName VARCHAR(50), - agencyName VARCHAR(50), - freight DECIMAL(10,2) DEFAULT 0, - expeditionCount INT, - margin DECIMAL(10,3) DEFAULT 0, - trolleys INT DEFAULT 0, - shipped DATE, - pallets INT DEFAULT 0) - ENGINE = MEMORY; - - INSERT INTO tmp.ticketFloramondo(ticketFk, clientName, agencyName, shipped) - SELECT t.id ticketFk, t.nickname , am.name, t.shipped - FROM vn.ticket t - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.warehouse w ON w.id = t.warehouseFk AND w.code IN ('VNH','FLM') - AND t.shipped BETWEEN vDateFrom AND TIMESTAMPADD(HOUR, 23, vDateTo); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - (ticketFk INT(11) PRIMARY KEY) - SELECT ticketFk - FROM tmp.ticketFloramondo; - - -- Freight - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(sc.value * s.quantity) freight, t.ticketFk - FROM vn.saleComponent sc - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk - JOIN vn.sale s ON s.id = sc.saleFk - JOIN tmp.ticket t ON t.ticketFk = s.ticketFk - WHERE ct.code = 'FREIGHT' - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.freight = sb.freight; - - -- Freight service - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(ts.price * ts.quantity) service, t.ticketFk - FROM vn.ticketService ts - JOIN tmp.ticket t ON t.ticketFk = ts.ticketFk - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.freight = tf.freight + sb.service; - - -- Expedition Count - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT COUNT(e.id) expeditionCount, t.ticketFk - FROM vn.expedition e - RIGHT JOIN tmp.ticket t ON t.ticketFk = e.ticketFk - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.expeditionCount = sb.expeditionCount; - - -- Margin - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(IF(ct.code = 'COST',sc.value, 0)) cost, - SUM(IF(ct.isMargin, sc.value, 0)) margin, - t.ticketFk - FROM vn.saleComponent sc - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk - JOIN vn.sale s ON s.id = sc.saleFk - JOIN tmp.ticket t ON t.ticketFk = s.ticketFk - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.margin = sb.margin / sb.cost; - - -- Trolleys - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(tp.quantity) trolleys, t.ticketFk - FROM vn.ticketPackaging tp - JOIN tmp.ticket t ON t.ticketFk = tp.ticketFk - JOIN vn.packaging p ON p.id = tp.packagingFk - WHERE p.isTrolley - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.trolleys = sb.trolleys; - - -- Pallets - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(tp.quantity) pallets, t.ticketFk - FROM vn.ticketPackaging tp - JOIN tmp.ticket t ON t.ticketFk = tp.ticketFk - JOIN vn.packaging p ON p.id = tp.packagingFk - WHERE p.isPallet - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.pallets = sb.pallets; - - SELECT * FROM tmp.ticketFloramondo; - - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticketFloramondo; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getMovable` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) -BEGIN -/** - * Cálcula el stock movible para los artículos de un ticket - * vDatedNew debe ser menor que vDatedOld, en los otros casos se - * asume que siempre es posible - * - * @param vTicketFk -> Ticket - * @param vDatedNew -> Nueva fecha - * @return Sales con Movible -*/ - DECLARE vDatedOld DATETIME; - SET vDatedNew = DATE_ADD(vDatedNew, INTERVAL 1 DAY); - - SELECT t.shipped INTO vDatedOld - FROM ticket t - WHERE t.id = vTicketFk; - - CALL itemStock(vWarehouseFk, vDatedNew, NULL); - CALL item_getMinacum(vWarehouseFk, vDatedNew, DATEDIFF(DATE_SUB(vDatedOld, INTERVAL 1 DAY), vDatedNew), NULL); - - SELECT s.id, - s.itemFk, - s.quantity, - s.concept, - s.price, - s.reserved, - s.discount, - i.image, - i.subName, - il.stock + IFNULL(im.amount, 0) AS movable - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk AND im.warehouseFk = vWarehouseFk - LEFT JOIN tmp.itemList il ON il.itemFk = s.itemFk - WHERE t.id = vTicketFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemList; - DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getProblems` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getProblems`(IN vIsTodayRelative tinyint(1)) -BEGIN -/** - * Calcula los problemas para un conjunto de tickets. - * Agrupados por ticket - * - * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular - * @return tmp.ticket_problems - */ - CALL sale_getProblems(vIsTodayRelative); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems; - CREATE TEMPORARY TABLE tmp.ticket_problems - (PRIMARY KEY (ticketFk)) - ENGINE = MEMORY - SELECT - ticketFk, - MAX(p.isFreezed) AS isFreezed, - MAX(p.risk) AS risk, - MAX(p.hasHighRisk) AS hasHighRisk, - MAX(p.hasTicketRequest) AS hasTicketRequest, - MIN(p.isAvailable) AS isAvailable, - MAX(p.itemShortage) AS itemShortage, - MIN(p.isTaxDataChecked) AS isTaxDataChecked, - MAX(p.hasComponentLack) AS hasComponentLack, - MAX(p.isTooLittle) AS isTooLittle, - MAX(p.itemDelay) AS itemDelay, - MAX(p.itemLost) AS itemLost, - 0 AS totalProblems - FROM tmp.sale_problems p - GROUP BY ticketFk; - - UPDATE tmp.ticket_problems tp - SET tp.totalProblems = - ( - (tp.isFreezed) + - IF(tp.risk, TRUE, FALSE) + - (tp.hasTicketRequest) + - (tp.isAvailable = 0) + - (tp.isTaxDataChecked = 0) + - (tp.hasComponentLack) + - (tp.itemDelay) + - (tp.isTooLittle) + - (tp.itemLost) + - (tp.itemShortage) - ); - - DROP TEMPORARY TABLE - tmp.sale_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 `ticket_getProblems__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getProblems__`(IN vIsTodayRelative tinyint(1)) -BEGIN -/** - * Calcula los problemas para un conjunto de tickets. - * Agrupados por ticket - * - * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular - * @return tmp.ticket_problems - */ - CALL sale_getProblems(vIsTodayRelative); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems; - CREATE TEMPORARY TABLE tmp.ticket_problems - (PRIMARY KEY (ticketFk)) - ENGINE = MEMORY - SELECT - ticketFk, - MAX(p.isFreezed) AS isFreezed, - MAX(p.risk) AS risk, - MAX(p.hasHighRisk) AS hasHighRisk, - MAX(p.hasTicketRequest) AS hasTicketRequest, - MIN(p.isAvailable) AS isAvailable, - MAX(p.itemShortage) AS itemShortage, - MIN(p.isTaxDataChecked) AS isTaxDataChecked, - MAX(p.hasComponentLack) AS hasComponentLack, - MAX(p.isTooLittle) AS isTooLittle, - 0 AS totalProblems - FROM tmp.sale_problems p - GROUP BY ticketFk; - - UPDATE tmp.ticket_problems tp - SET tp.totalProblems = ( - (tp.isFreezed) + - IF(tp.risk, TRUE, FALSE) + - (tp.hasTicketRequest) + - (tp.isAvailable = 0) + - (tp.isTaxDataChecked = 0) + - (tp.hasComponentLack) + - (tp.isTooLittle) - ); - - DROP TEMPORARY TABLE - tmp.sale_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 `ticket_getShip` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getShip`(vTicketFk INT) -BEGIN - SELECT s.shipFk FROM vn.stowaway s - WHERE s.id = vTicketFk; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getSplitList` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getSplitList`(vDated DATE, vHour TIME, vWarehouseFk INT) -BEGIN -/** - * Devuelve un listado con los tickets posibles para splitar HOY. - * - * @param vDated Fecha a estudiar - * @param vHour Hora a partir de la cual todavía se puede enviar, si la fecha es la de hoy - * @param vWarehouseFk Almacén - */ - DECLARE vAvailableCache INT; - DECLARE vVisibleCache INT; - - CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, CURDATE()); - CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); - CALL `vn`.`zoneClosure_recalc`(); - - DROP TEMPORARY TABLE IF EXISTS tmp.salesToSplit; - - CREATE TEMPORARY TABLE tmp.salesToSplit - (saleFk INT PRIMARY KEY, - ticketFk INT, - problem VARCHAR(1)) ENGINE = MEMORY; - - INSERT INTO tmp.salesToSplit(saleFk, ticketFk, problem) - SELECT s.id, s.ticketFk, 'F' - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache - LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - WHERE IFNULL(v.visible,0) < s.quantity - AND IFNULL(av.available ,0) < s.quantity - AND IFNULL(issw.visible, 0) < s.quantity - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND ic.merchandise = TRUE - AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND NOT i.generic - AND t.warehouseFk = vWarehouseFk; - - INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem) - SELECT s.id, s.ticketFk, 'I' - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - WHERE IFNULL(v.visible,0) >= s.quantity - AND IFNULL(issw.visible, 0) < s.quantity - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND ic.merchandise = TRUE - AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND NOT i.generic - AND t.warehouseFk = vWarehouseFk; - - INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem) - SELECT s.id, s.ticketFk, 'R' - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it on it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache - LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache - LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk - WHERE IFNULL(v.visible,0) < s.quantity - AND IFNULL(av.available ,0) >= s.quantity - AND IFNULL(issw.visible, 0) < s.quantity - AND s.quantity > 0 - AND s.isPicked = FALSE - AND s.reserved = FALSE - AND ic.merchandise = TRUE - AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) - AND NOT i.generic - AND t.warehouseFk = vWarehouseFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketsToSplit; - - CREATE TEMPORARY TABLE tmp.ticketsToSplit - (ticketFk INT PRIMARY KEY, - problems VARCHAR(100), - addressFk INT, - ipt VARCHAR(10), - etd TIME) ENGINE = MEMORY; - - INSERT INTO tmp.ticketsToSplit - SELECT - ss.ticketFk, - GROUP_CONCAT(DISTINCT ss.problem ORDER BY ss.problem) problems, - t.addressFk, - GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, - zc.`hour` etd - FROM tmp.salesToSplit ss - JOIN vn.ticket t ON t.id = ss.ticketFk - JOIN vn.sale s ON s.id = ss.saleFk - JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk - GROUP BY ss.ticketFk; - - SELECT - ts.*, - t.id ticketFuture, - st.name state, - zc.`hour` tfEtd, - GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) tfIpt, - st2.name tfState - FROM tmp.ticketsToSplit ts - LEFT JOIN vn.ticketState ts2 ON ts2.ticketFk = ts.ticketFk - LEFT JOIN vn.state st ON st.id = ts2.stateFk - LEFT JOIN vn.ticket t - ON t.id != ts.ticketFk - AND t.addressFk = ts.addressFk - AND t.shipped BETWEEN vDated AND util.dayend(vDated) - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = vDated - LEFT JOIN vn.sale s ON s.ticketFk = t.id - LEFT JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id - LEFT JOIN vn.state st2 ON st2.id = tst.stateFk - WHERE (t.id IS NULL - OR (vDated > CURDATE()) - OR (vDated = CURDATE() AND vHour >= zc.`hour`)) - AND ts.etd <= vHour - GROUP BY ts.ticketFk, t.id - ORDER BY ts.etd, ts.ticketFk; - - DROP TEMPORARY TABLE - tmp.ticketsToSplit; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getTax` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getTax`(IN vTaxArea VARCHAR(25)) -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 - * @return tmp.ticketAmount (ticketFk, taxableBase, tax, code) - * @return tmp.ticketTax (ticketFk, pgcFk, taxableBase, rate, code) Impuesto desglosado para cada ticket. - */ - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - CREATE TEMPORARY TABLE tmp.addressCompany - (INDEX (addressFk, companyFk)) - ENGINE = MEMORY - SELECT DISTINCT t.addressFk, t.companyFk - FROM tmp.ticket tmpTicket - JOIN ticket t ON t.id = tmpTicket.ticketFk; - - CALL addressTaxArea (); - - IF vTaxArea > '' THEN - UPDATE tmp.addressTaxArea - SET areaFk = vTaxArea; - END IF; - /* Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente - * No se debería cambiar el sistema por problemas con los decimales - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; - CREATE TEMPORARY TABLE tmp.ticketTax - (PRIMARY KEY (ticketFk, code, rate)) - ENGINE = MEMORY - SELECT * FROM ( - SELECT tmpTicket.ticketFk, - bp.pgcFk, - SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, - pgc.rate, - tc.code, - bp.priority - FROM tmp.ticket tmpTicket - 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 tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = 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 = ata.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, pgc.rate - HAVING taxableBase != 0) t3 - ORDER BY priority; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; - CREATE TEMPORARY TABLE tmp.ticketServiceTax - (PRIMARY KEY (ticketFk, code, rate)) - ENGINE = MEMORY - SELECT tt.ticketFk, - pgc.code pgcFk, - SUM(ts.quantity * ts.price) AS taxableBase, - pgc.rate, - tc.code - FROM tmp.ticket tt - JOIN ticketService ts ON ts.ticketFk = tt.ticketFk - JOIN ticket t ON t.id = tt.ticketFk - JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN bookingPlanner bp - ON bp.countryFk = su.countryFk - AND bp.taxAreaFk = ata.areaFk - AND bp.taxClassFk = ts.taxClassFk - JOIN pgc ON pgc.code = bp.pgcFk - JOIN taxClass tc ON tc.id = bp.taxClassFk - GROUP BY tt.ticketFk, pgc.code - HAVING taxableBase != 0; - - INSERT INTO tmp.ticketTax (ticketFk, pgcFk, taxableBase, rate, code) - SELECT ts.ticketFk, ts.pgcFk, ts.taxableBase, ts.rate, ts.code - FROM tmp.ticketServiceTax ts - ON DUPLICATE KEY UPDATE ticketTax.taxableBase = VALUES (taxableBase) + ticketTax.taxableBase ; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; - CREATE TEMPORARY TABLE tmp.ticketAmount - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT ticketFk, - taxableBase, - SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax, - code - FROM tmp.ticketTax - GROUP BY ticketFk, code; - - DROP TEMPORARY TABLE tmp.addressCompany; - DROP TEMPORARY TABLE tmp.addressTaxArea; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_getTax__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getTax__`(vTaxArea VARCHAR(25)) - 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 - * @return tmp.ticketAmount - * @return tmp.ticketTax Impuesto desglosado para cada ticket. - */ - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - CREATE TEMPORARY TABLE tmp.addressCompany - (INDEX (addressFk, companyFk)) - ENGINE = MEMORY - SELECT DISTINCT t.addressFk, t.companyFk - FROM tmp.ticket tmpTicket - JOIN ticket t ON t.id = tmpTicket.ticketFk; - - CALL addressTaxArea (); - - IF vTaxArea > '' THEN - UPDATE tmp.addressTaxArea - SET areaFk = vTaxArea; - END IF; - /** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente - * No se debería cambiar el sistema por problemas con los decimales - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; - CREATE TEMPORARY TABLE tmp.ticketTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT * FROM ( - SELECT tmpTicket.ticketFk, - bp.pgcFk, - SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, - pgc.rate, - tc.code, - bp.priority - FROM tmp.ticket tmpTicket - 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 tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = 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 = ata.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,pgc.rate - HAVING taxableBase != 0) t - ORDER BY priority; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; - CREATE TEMPORARY TABLE tmp.ticketServiceTax - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT tt.ticketFk, - SUM(ts.quantity * ts.price) AS taxableBase, - pgc.rate, - tc.code - FROM tmp.ticketTax tt - JOIN ticketService ts ON ts.ticketFk = tt.ticketFk - JOIN ticket t ON t.id = tt.ticketFk - JOIN supplier su ON su.id = t.companyFk - JOIN tmp.addressTaxArea ata - ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk - JOIN bookingPlanner bp - ON bp.countryFk = su.countryFk - AND bp.taxAreaFk = ata.areaFk - AND bp.taxClassFk = ts.taxClassFk - JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate - JOIN taxClass tc ON tc.id = bp.taxClassFk - GROUP BY tt.ticketFk, tt.code,tt.rate - HAVING taxableBase != 0; - - UPDATE tmp.ticketTax tt - JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate - SET tt.taxableBase = tt.taxableBase + ts.taxableBase; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; - CREATE TEMPORARY TABLE tmp.ticketAmount - (INDEX (ticketFk)) - ENGINE = MEMORY - SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code - FROM tmp.ticketTax - GROUP BY ticketFk, code; - - DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; - DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_insertZone` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_insertZone`() -BEGIN - DECLARE vDone INT DEFAULT 0; - DECLARE vFechedTicket INT; - DECLARE vLanded DATE; - DECLARE vAddressFk INT; - DECLARE vAgencyModeFk INT; - DECLARE vWarehouseFk INT; - DECLARE vCursor CURSOR FOR - SELECT id, landed, addressFk, agencyModeFk, warehouseFk - FROM vn.ticket WHERE shipped > '2020-01-01' AND zoneFk is null; - DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET vDone = 1; - - OPEN vCursor; - REPEAT - FETCH vCursor INTO vFechedTicket, vLanded, vAddressFk, vAgencyModeFk, vWarehouseFk; - CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE); - - UPDATE vn.ticket t - JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = vWarehouseFk - SET t.zoneFk = zgs.zoneFk - WHERE t.id = vFechedTicket; - - UNTIL vDone END REPEAT; - DROP TEMPORARY TABLE tmp.zoneGetShipped; - - CLOSE vCursor; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_merge` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_merge`(vSelf INT, vTicketTargetFk INT) -BEGIN - - /** - * Fusiona el primer ticket al segundo - * - * @param vSelf Número de ticket a fusionar - * @param vTicketTargetFk Ticket destino - * - */ - - UPDATE vn.sale s - SET s.ticketFk = vTicketTargetFk - WHERE s.ticketFk = vSelf; - - UPDATE vn.ticket t - SET t.shipped = TIMESTAMPADD(YEAR, - YEAR(NOW()) MOD 2000, t.shipped ) - WHERE t.id = vSelf; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ticket_priceDifference` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_priceDifference`( - vTicketFk INT, - vLanded DATE, - vAddressFk INT, - vZoneFk INT, - vWarehouseFk INT) -BEGIN -/** - * Devuelve las diferencias de precio de los movimientos de un ticket. - * - * @param vTicketFk Id del ticket - * @param vLanded Fecha de recepcion - * @param vAddressFk Id del consignatario - * @param vZoneFk Id de la zona - * @param vWarehouseFk Id del almacén - */ - CALL vn.ticket_componentPreview(vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk); - - SELECT s.itemFk, - i.name, - i.size, - i.category, - IFNULL(s.quantity, 0) AS quantity, - IFNULL(s.price, 0) AS price, - ROUND(SUM(tc.cost), 2) AS newPrice, - s.quantity * (s.price - ROUND(SUM(tc.cost), 2)) difference, - s.id AS saleFk - FROM sale s - JOIN item i ON i.id = s.itemFk - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN tmp.ticketComponentPreview tc ON tc.itemFk = s.itemFk - AND tc.warehouseFk = vWarehouseFk - LEFT JOIN saleComponent sc ON sc.saleFk = s.id - AND sc.componentFk = tc.componentFk - LEFT JOIN `component` c ON c.id = tc.componentFk - WHERE t.id = vTicketFk - AND IF(sc.componentFk IS NULL - AND c.classRate IS NOT NULL, FALSE, TRUE) - GROUP BY s.id ORDER BY s.id; - - DROP TEMPORARY TABLE tmp.ticketComponentPreview; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_recalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalc`(vTicketId INT) -BEGIN -/** - * Calcula y guarda el total con/sin IVA en un ticket. - * - * @param vTicketId Identificador del ticket - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - ENGINE = MEMORY - SELECT vTicketId ticketFk; - - CALL ticketGetTotal; - - UPDATE ticket t - JOIN tmp.ticketTotal tt ON tt.ticketFk = t.id - SET t.totalWithVat = tt.total, - t.totalWithoutVat = tt.totalWithoutVat; - - 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 `ticket_recalcComponents` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN) -proc: BEGIN - -/** - * Este procedimiento recalcula los componentes de un ticket, - * eliminando los componentes existentes e insertandolos de nuevo - * - * @param vTicketFk Id del ticket - * @param vIsTicketEditable si no se quiere forzar llamar con NULL - */ - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAgencyModeFk INT; - DECLARE vAddressFk INT; - DECLARE vLanded DATE; - DECLARE vZoneFk INTEGER; - - IF vIsTicketEditable IS NULL THEN - SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = '' - INTO vIsTicketEditable - FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket - WHERE id = vTicketFk; - END IF; - - SELECT t.warehouseFk, - t.shipped, - t.addressFk, - t.agencyModeFk, - t.landed, - t.zoneFk - INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk - FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket - WHERE t.id = vTicketFk; - - CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); - - IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN - CALL util.throw('There is no zone for these parameters'); - END IF; - - IF vLanded IS NULL OR vZoneFk IS NULL THEN - - UPDATE ticket t - SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) - WHERE t.id = vTicketFk AND t.landed IS NULL; - - IF vZoneFk IS NULL THEN - SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; - UPDATE ticket t - SET t.zoneFk = vZoneFk - WHERE t.id = vTicketFk AND t.zoneFk IS NULL; - END IF; - - END IF; - - DROP TEMPORARY TABLE tmp.zoneGetLanded; - - -- rellena la tabla buyUltimate con la ultima compra - CALL buyUltimate (vWarehouseFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, - s.itemFk, bu.buyFk, vZoneFk zoneFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketFk - GROUP BY s.itemFk; - - CALL catalog_componentPrepare(); - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT id saleFk, vWarehouseFk warehouseFk - FROM sale s - WHERE s.ticketFk = vTicketFk; - - -- si el ticket esta facturado, respeta los precios - CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6)); - - CALL catalog_componentPurge(); - DROP TEMPORARY TABLE - tmp.buyUltimate, - tmp.sale; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_recalcComponentsForcePrice__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponentsForcePrice__`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN ) -proc: BEGIN - -/** - * Este procedimiento trata de "rebionizar" un ticket, - * eliminando los componentes existentes e insertandolos de nuevo - * - * @param vTicketFk Id del ticket - * @return tmp.buyUltimate - */ - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAgencyModeFk INT; - DECLARE vAddressFk INT; - DECLARE vLanded DATE; - DECLARE vZoneFk INTEGER; - - IF vIsTicketEditable IS NULL THEN - SELECT (IFNULL(ts.alertLevel,0) >0 or IFNULL(t.refFk,"") != "") = FALSE, t.zoneFk - INTO vIsTicketEditable, vZoneFk - FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket - WHERE id = vTicketFk; - END IF; - SELECT warehouseFk, date(shipped), addressFk, agencyModeFk, landed - INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded - FROM ticket - WHERE id = vTicketFk; - - CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, TRUE); - - CALL vn.buyUltimate (vWarehouseFk, vShipped); -- rellena la tabla buyUltimate con la ultima compra - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, - s.itemFk, bu.buyFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketFk - GROUP BY s.itemFk; - - CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT id saleFk, vWarehouseFk warehouseFk - FROM sale s - WHERE s.ticketFk = vTicketFk; - - CALL vn.ticketComponentUpdateSale(IF(vIsTicketEditable,1,6)); -- si el ticket esta facturado, respeta los precios - - IF vLanded IS NULL THEN - - CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk); - - UPDATE vn2008.Tickets t - SET t.landing = (SELECT landed FROM tmp.zoneGetLanded) - WHERE Id_Ticket = vTicketFk; - - DROP TEMPORARY TABLE tmp.zoneGetLanded; - - END IF; - - DROP TEMPORARY TABLE tmp.buyUltimate; - DROP TEMPORARY TABLE tmp.ticketComponentPrice; - DROP TEMPORARY TABLE tmp.ticketComponent; - DROP TEMPORARY TABLE tmp.sale; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_recalcComponents__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponents__`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN) -proc: BEGIN - -/** - * Este procedimiento recalcula los componentes de un ticket, - * eliminando los componentes existentes e insertandolos de nuevo - * - * @param vTicketFk Id del ticket - * @param vIsTicketEditable si no se quiere forzar llamar con NULL - */ - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAgencyModeFk INT; - DECLARE vAddressFk INT; - DECLARE vLanded DATE; - DECLARE vZoneFk INTEGER; - - -- Santos 2021, borrar a partir del dia 31 PAK - IF (SELECT COUNT(*) - FROM tmp.routeDayMove ra - JOIN vn.ticket t ON t.routeFk = ra.routeFk - WHERE t.id = vTicketFk) THEN - - LEAVE proc; - - END IF; - - IF vIsTicketEditable IS NULL THEN - SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = '' - INTO vIsTicketEditable - FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket - WHERE id = vTicketFk; - END IF; - - SELECT t.warehouseFk, - t.shipped, - t.addressFk, - t.agencyModeFk, - t.landed, - t.zoneFk - INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk - FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket - WHERE t.id = vTicketFk; - - IF vLanded IS NULL OR vZoneFk IS NULL THEN - - CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); - - IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN - CALL util.throw('There is no zone for these parameters'); - END IF; - - UPDATE ticket t - SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) - WHERE t.id = vTicketFk AND t.landed IS NULL; - - IF vZoneFk IS NULL THEN - SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; - UPDATE ticket t - SET t.zoneFk = vZoneFk - WHERE t.id = vTicketFk AND t.zoneFk IS NULL; - END IF; - DROP TEMPORARY TABLE tmp.zoneGetLanded; - - END IF; - - -- rellena la tabla buyUltimate con la ultima compra - CALL buyUltimate (vWarehouseFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, - s.itemFk, bu.buyFk, vZoneFk zoneFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketFk - GROUP BY s.itemFk; - - CALL catalog_componentPrepare(); - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT id saleFk, vWarehouseFk warehouseFk - FROM sale s - WHERE s.ticketFk = vTicketFk; - - -- si el ticket esta facturado, respeta los precios - CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6)); - - CALL catalog_componentPurge(); - DROP TEMPORARY TABLE - tmp.buyUltimate, - tmp.sale; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_requestRecalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `ticket_requestRecalc`(vSelf INT) -proc: BEGIN -/** - * Adds a request to recalculate the ticket total. - * - * @param vSelf The ticket identifier - */ - IF vSelf IS NULL THEN - LEAVE proc; - END IF; - - INSERT IGNORE INTO ticketRecalc SET ticketFk = vSelf; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `ticket_setNextState` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setNextState`(vSelf INT) -BEGIN -/** - * Cambia el estado del ticket al siguiente estado según la tabla state - * - * @param vSelf id dle ticket - */ - DECLARE vStateFk INT; - DECLARE vNewStateFk INT; - - SELECT stateFk INTO vStateFk - FROM ticketState - WHERE ticketFk = vSelf; - - SELECT nextStateFk INTO vNewStateFk - FROM state - WHERE id = vStateFk; - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - VALUES (vNewStateFk, vSelf, account.myUser_getId()); - - SELECT TRUE AS IsUpdated; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_setPreviousState` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setPreviousState`(vTicketFk INT) -BEGIN - - DECLARE vControlFk INT; - - SELECT MAX(inter_id) INTO vControlFk - FROM vncontrol.inter - WHERE Id_Ticket = vTicketFk; - - IF (SELECT s.code - FROM vn.state s - JOIN vncontrol.inter i ON i.state_id = s.id - WHERE i.inter_id = vControlFk) - = 'PREVIOUS_PREPARATION' THEN - - SELECT inter_id - INTO vControlFk - FROM vncontrol.inter i - JOIN vn.state s ON i.state_id = s.id - WHERE Id_Ticket = vTicketFk - AND inter_id < vControlFk - AND s.code != 'PREVIOUS_PREPARATION' - ORDER BY inter_id DESC - LIMIT 1; - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT s.nextStateFk, i.Id_Ticket, account.myUser_getId() - FROM vncontrol.inter i - JOIN vn.state s ON i.state_id = s.id - WHERE inter_id = vControlFk; - - END IF; - - SELECT TRUE AS IsUpdated; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_setState` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`(vTicketFk INT, vStateCode VARCHAR(45)) -BEGIN - - /* Modifica el estado de un ticket - * - * @param vTicketFk el id del ticket - * @param vStateCode estado a modificar del ticket - * - */ - - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM vn.state s - JOIN vn.ticketState ts ON ts.stateFk = s.id - WHERE ts.ticketFk = vTicketFk; - - IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vTicketFk, account.myUser_getId() - FROM vn.state - WHERE `code` = vStateCode collate utf8_unicode_ci; - - 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_split` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE) -proc:BEGIN -/** - * Mueve las lineas con problemas a otro ticket existente o a uno nuevo. - * - * @param vTicketFk Identificador del ticket a splittar - * @param vTicketFutureFk Identificador del ticket al que se quieren mover las lineas - * @param vDate Fecha a la que se va a mover - * @table tmp.salesToSplit(saleFk, ticketFk, problem) - */ - DECLARE vHasFullProblem BOOL; - DECLARE vProblemLines INT; - DECLARE vTotalLines INT; - - SELECT COUNT(*) INTO vProblemLines - FROM tmp.salesToSplit - WHERE ticketFk = vTicketFk; - - SELECT count(*) INTO vTotalLines - FROM vn.sale s - WHERE s.ticketFk = vTicketFk; - - SET vHasFullProblem = (vTotalLines = vProblemLines); - - -- Ticket completo - IF vHasFullProblem THEN - - UPDATE vn.ticket - SET landed = vDated + 1, - shipped = vDated, - nickname = CONCAT('(',DAY(curdate()),') ', nickname ) - WHERE id = vTicketFk; - - SELECT CONCAT("Se ha cambiado el ticket ", vTicketFk, " al dia ", vDated); - LEAVE proc; - - END IF; - - -- Ticket a futuro existe - IF vTicketFutureFk THEN - - UPDATE vn.sale s - JOIN tmp.salesToSplit ss ON s.id = ss.saleFk - SET s.ticketFk = vTicketFutureFk, - s.concept = CONCAT('(s) ', s.concept) - WHERE ss.ticketFk = vTicketFk; - - SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, - " al ticket existente ", vTicketFutureFk,"(", vDated,")"); - LEAVE proc; - - END IF; - - -- Ticket nuevo - CALL vn.ticket_Clone(vTicketFk, vTicketFutureFk); - - UPDATE vn.ticket t - JOIN vn.productionConfig pc - SET t.landed = vDated + 1, - t.shipped = vDated, - t.agencyModeFk = pc.defautlAgencyMode, - t.zoneFk = pc.defaultZone - WHERE t.id = vTicketFutureFk; - - UPDATE vn.sale s - JOIN tmp.salesToSplit sts ON sts.saleFk = s.id - SET s.ticketFk = vTicketFutureFk, - s.concept = CONCAT('(s) ', s.concept) - WHERE sts.ticketFk = vTicketFk; - - CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING'); - - SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, - " al nuevo ticket ", vTicketFutureFk,"(", vDated,")"); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_splitItemPackingType` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitItemPackingType`(vTicketFk INT) -proc:BEGIN - - /* - * Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado - * - * @param vTicketFk Identificador de vn.ticket - * @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk) - */ - - - DECLARE vItemPackingTypeFk VARCHAR(1); - - DECLARE vNewTicketFk INT; - - DECLARE vPackingTypesToSplit INT; - - DECLARE vDone INT DEFAULT FALSE; - - DECLARE cur1 CURSOR FOR - SELECT itemPackingTypeFk - FROM tmp.saleGroup - WHERE itemPackingTypeFk IS NOT NULL; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (id)) - SELECT s.id, i.itemPackingTypeFk , sv.litros - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.saleVolume sv ON sv.saleFk = s.id - LEFT JOIN vn.saleTracking st ON st.saleFk = s.id - WHERE s.ticketFk = vTicketFk - AND ISNULL(st.id); - - DROP TEMPORARY TABLE IF EXISTS tmp.saleGroup; - CREATE TEMPORARY TABLE tmp.saleGroup - SELECT itemPackingTypeFk , sum(litros) AS totalLitros - FROM tmp.sale - GROUP BY itemPackingTypeFk; - - SELECT COUNT(*) INTO vPackingTypesToSplit - FROM tmp.saleGroup - WHERE itemPackingTypeFk IS NOT NULL; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketIPT; - CREATE TEMPORARY TABLE tmp.ticketIPT - (ticketFk INT, - itemPackingTypeFk VARCHAR(1)); - - CASE vPackingTypesToSplit - - WHEN 0 THEN - - INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) - VALUES(vTicketFk, 'H'); - - WHEN 1 THEN - - INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) - SELECT vTicketFk, itemPackingTypeFk - FROM tmp.saleGroup - WHERE itemPackingTypeFk IS NOT NULL; - ELSE - - OPEN cur1; - - FETCH cur1 INTO vItemPackingTypeFk; - - INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) - VALUES(vTicketFk, vItemPackingTypeFk); - - read_loop: LOOP - - FETCH cur1 INTO vItemPackingTypeFk; - - IF vDone THEN - LEAVE read_loop; - END IF; - - CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - - INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) - VALUES(vNewTicketFk, vItemPackingTypeFk); - - END LOOP; - - CLOSE cur1; - - UPDATE vn.sale s - JOIN tmp.sale ts ON ts.id = s.id - JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk - SET s.ticketFk = t.ticketFk; - - SELECT itemPackingTypeFk INTO vItemPackingTypeFk - FROM tmp.saleGroup sg - WHERE NOT ISNULL(sg.itemPackingTypeFk) - ORDER BY sg.totalLitros - LIMIT 1; - - UPDATE vn.sale s - JOIN tmp.sale ts ON ts.id = s.id - JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk - SET s.ticketFk = t.ticketFk - WHERE ISNULL(ts.itemPackingTypeFk); - - END CASE; - - DROP TEMPORARY TABLE tmp.sale; - DROP TEMPORARY TABLE tmp.saleGroup; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_splitPackingComplete` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitPackingComplete`(vTicketFk INT, vSectorFk INT) -BEGIN - - DECLARE vNeedToSplit BOOLEAN; - DECLARE vNewTicketFk INT; - - DROP TEMPORARY TABLE IF EXISTS tmpSale; - - CREATE TEMPORARY TABLE tmpSale - SELECT DISTINCT s.id - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk AND iss.sectorFk = vSectorFk - JOIN vn.packagingConfig pc - WHERE t.id = vTicketFk - AND ( s.quantity MOD IFNULL(iss.packing,1) != 0 - OR - IFNULL(iss.packing,1) = 1 - OR - i.`size` <= pc.previousPreparationMinimumSize - ); - - SELECT COUNT(*) - INTO vNeedToSplit - FROM tmpSale; - - IF vNeedToSplit THEN - - CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); - - UPDATE vn.sale s - JOIN vn.tmpSale ts ON ts.id = s.id - SET s.ticketFk = vNewTicketFk; - - END IF; - - DROP TEMPORARY TABLE tmpSale; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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_WeightDeclaration` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_WeightDeclaration`(vClientFk INT, vDated DATE) -BEGIN - - DECLARE vTheorycalWeight DECIMAL(10,2); - DECLARE vRealWeight DECIMAL(10,2); - DECLARE vRatio DOUBLE; - - SELECT IFNULL(sum(tob.description),0) INTO vRealWeight - FROM vn.ticketObservation tob - JOIN vn.observationType ot ON ot.id = tob.observationTypeFk - JOIN vn.ticket t ON t.id = tob.ticketFk - WHERE ot.description = 'Peso Aduana' - AND t.clientFk = vClientFk - AND t.shipped BETWEEN vDated AND util.dayend(vDated); - - SELECT sum(IF(sv.physicalWeight = 0, sv.weight, sv.physicalWeight)) INTO vTheorycalWeight - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.saleVolume sv ON sv.saleFk = s.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk - WHERE t.clientFk = vClientFk - AND t.shipped BETWEEN vDated AND util.dayend(vDated); - - SET vRatio = vRealWeight / vTheorycalWeight; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketWeight; - - CREATE TEMPORARY TABLE tmp.ticketWeight - ENGINE = MEMORY - SELECT i.intrastatFk, - ib.ediBotanic, - FLOOR(sum(s.quantity)) as quantity, - CAST(vRatio * SUM(IF(sv.physicalWeight = 0, sv.weight, sv.physicalWeight) ) AS DECIMAL(10,2)) physicalWeight, - o.code as countryCode, - vDated as Dated - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.saleVolume sv ON sv.saleFk = s.id - JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.itemBotanicalWithGenus ib ON ib.itemFk = i.id - LEFT JOIN vn.origin o ON o.id = i.originFk - WHERE t.clientFk = vClientFk - AND t.shipped BETWEEN vDated AND util.dayend(vDated) - GROUP BY ib.ediBotanic, o.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 */ ; -/*!50003 DROP PROCEDURE IF EXISTS `timeBusiness_calculate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * Horas que debe trabajar un empleado según contrato y día. - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - * @table tmp.user(userFk) - * @return tmp.timeBusinessCalculate - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate; - - CREATE TEMPORARY TABLE tmp.timeBusinessCalculate - SELECT dated, - businessFk, - userFk, - departmentFk, - hourStart, - hourEnd, - timeTable, - timeWorkSeconds, - SEC_TO_TIME(timeWorkSeconds) timeWorkSexagesimal, - timeWorkSeconds / 3600 timeWorkDecimal, - timeWorkSeconds timeBusinessSeconds, - SEC_TO_TIME(timeWorkSeconds) timeBusinessSexagesimal, - timeWorkSeconds / 3600 timeBusinessDecimal, - type, - permissionRate, - hoursWeek, - discountRate, - isAllowedToWork - FROM(SELECT t.dated, - b.business_id businessFk, - w.userFk, - bl.department_id departmentFk, - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart , - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd, - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5), " - ", LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) timeTable, - IF(j.start = NULL, 0, IFNULL(SUM(TIME_TO_SEC(j.end)) - SUM(TIME_TO_SEC(j.start)),0)) timeWorkSeconds, - cs.type, - cs.permissionRate, - cs.discountRate, - cl.hours_week hoursWeek, - cs.isAllowedToWork - FROM vn.time t - LEFT JOIN postgresql.business b ON t.dated BETWEEN b.date_start AND ifnull(b.date_end, vDatedTo ) - LEFT JOIN postgresql.profile AS pr ON b.client_id = pr.profile_id - LEFT JOIN postgresql.person AS p ON pr.person_id = p.person_id - LEFT JOIN vn.worker AS w ON p.id_trabajador = w.id - JOIN tmp.`user` u ON u.userFK = w.userFK - JOIN postgresql.business_labour AS bl ON b.business_id = bl.business_id - LEFT JOIN postgresql.business_labour_payroll AS bp ON bl.business_id = bp.business_id - LEFT JOIN postgresql.professional_category AS pc ON bl.professional_category_id = pc.professional_category_id - LEFT JOIN postgresql.workcenter AS wc ON bl.workcenter_id = wc.workcenter_id - LEFT JOIN postgresql.calendar_labour_type AS cl ON bl.calendar_labour_type_id = cl.calendar_labour_type_id - LEFT JOIN postgresql.journey AS j ON j.business_id = b.business_id and j.day_id=WEEKDAY(t.dated)+1 - LEFT JOIN postgresql.calendar_employee ce ON ce.business_id=b.business_id and ce.date = t.dated - LEFT JOIN postgresql.calendar_state cs ON cs.calendar_state_id = ce.calendar_state_id - WHERE t.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY w.userFk,dated - )sub; - - UPDATE tmp.timeBusinessCalculate t - LEFT JOIN postgresql.journey j ON j.business_id = t.businessFk - SET t.timeWorkSeconds = t.hoursWeek / 5 * 3600, - t.timeWorkSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), - t.timeWorkDecimal = t.hoursWeek / 5, - t.timeBusinessSeconds = t.hoursWeek / 5 * 3600, - t.timeBusinessSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), - t.timeBusinessDecimal = t.hoursWeek / 5 - WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND j.journey_id IS NULL ; - - UPDATE tmp.timeBusinessCalculate t - SET t.timeWorkSeconds = t.timeWorkSeconds - (t.timeWorkSeconds * permissionRate) , - t.timeWorkSexagesimal = SEC_TO_TIME ((t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)) * 3600), - t.timeWorkDecimal = t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate) - WHERE permissionRate <> 0; - - UPDATE tmp.timeBusinessCalculate t - JOIN vn.calendarHolidays ch ON ch.dated = t.dated - JOIN postgresql.business_labour bl ON bl.business_id = t.businessFk AND bl.workcenter_id = ch.workcenterFk - SET t.timeWorkSeconds = 0, - t.timeWorkSexagesimal = 0, - t.timeWorkDecimal = 0, - t.permissionrate = 1, - t.type = 'Festivo' - WHERE t.type 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 `timeBusiness_calculateAll` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` - SELECT userFk - FROM vn.worker w - JOIN vn.`user` u ON u.id = w.userFk - WHERE userFk IS NOT NULL; - - CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeBusiness_calculateByDepartment` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * @param vDepartmentFk - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE tmp.`user` - SELECT DISTINCT w.userFk - FROM postgresql.business AS b - LEFT JOIN postgresql.profile AS pr ON pr.profile_id = b.client_id - LEFT JOIN postgresql.person AS p ON p.person_id = pr.person_id - LEFT JOIN postgresql.business_labour AS bl ON b.business_id = bl.business_id - LEFT JOIN vn.worker AS w ON p.id_trabajador = w.id - LEFT JOIN vn.department AS d ON bl.department_id = d.id - WHERE ((b.date_start BETWEEN vDatedFrom AND vDatedTo OR b.date_end BETWEEN vDatedFrom AND vDatedTo) OR - (b.date_end IS NULL AND b.date_start <= vDatedTo) OR - (b.date_start <= vDatedFrom AND b.date_end >= vDatedTo) - ) AND bl.department_id = vDepartmentFk - ORDER BY b.date_end DESC; - - CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeBusiness_calculateByUser` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * @param vUserFk - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE tmp.`user` - SELECT id userFk - FROM user - WHERE id = vUserFk; - CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeBusiness_calculateByWorker` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * @param vWorkerFk - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE tmp.`user` - SELECT u.id userFk - FROM vn.user u - JOIN vn.worker w ON w.userFk = u.id - WHERE w.id = vWorkerFk; - - CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeBusiness_calculate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculate__`(vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * Horas que debe trabajar un empleado según contrato y día. - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - * @table tmp.user(userFk) - * @return tmp.timeBusinessCalculate - */ - - DROP TABLE IF EXISTS tmp.timeBusinessCalculate; - DROP TEMPORARY TABLE IF EXISTS tmp.businessFullTime; - - CALL rangeDateInfo(vDatedFrom, vDatedTo); - - CREATE TABLE tmp.timeBusinessCalculate - SELECT dated, - businessFk, - userFk, - departmentFk, - hourStart, - hourEnd, - timeTable, - timeWorkSeconds, - SEC_TO_TIME(timeWorkSeconds) timeWorkSexagesimal, - timeWorkSeconds / 3600 timeWorkDecimal, - timeWorkSeconds timeBusinessSeconds, - SEC_TO_TIME(timeWorkSeconds) timeBusinessSexagesimal, - timeWorkSeconds / 3600 timeBusinessDecimal, - type, - permissionRate, - hoursWeek, - discountRate - FROM(SELECT rd.dated, - b.business_id businessFk, - w.userFk, - bl.department_id departmentFk, - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart , - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd, - IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5), " - ", LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) timeTable, - IF(j.start = NULL, 0, IFNULL(SUM(TIME_TO_SEC(j.end)) - SUM(TIME_TO_SEC(j.start)),0)) timeWorkSeconds, - cs.type, - cs.permissionRate, - cs.discountRate, - cl.hours_week hoursWeek - FROM tmp.rangeDate rd - LEFT JOIN postgresql.business b ON rd.dated BETWEEN b.date_start AND ifnull(b.date_end, vDatedTo ) - LEFT JOIN postgresql.profile AS pr ON b.client_id = pr.profile_id - LEFT JOIN postgresql.person AS p ON pr.person_id = p.person_id - LEFT JOIN vn.worker AS w ON p.id_trabajador = w.id - JOIN tmp.`user` u ON u.userFK = w.userFK - JOIN postgresql.business_labour AS bl ON b.business_id = bl.business_id - LEFT JOIN postgresql.business_labour_payroll AS bp ON bl.business_id = bp.business_id - LEFT JOIN postgresql.professional_category AS pc ON bl.professional_category_id = pc.professional_category_id - LEFT JOIN postgresql.workcenter AS wc ON bl.workcenter_id = wc.workcenter_id - LEFT JOIN postgresql.calendar_labour_type AS cl ON bl.calendar_labour_type_id = cl.calendar_labour_type_id - LEFT JOIN postgresql.journey AS j ON j.business_id = b.business_id and j.day_id=WEEKDAY(rd.dated)+1 - LEFT JOIN postgresql.calendar_employee ce ON ce.business_id=b.business_id and ce.date = rd.dated - LEFT JOIN postgresql.calendar_state cs ON cs.calendar_state_id = ce.calendar_state_id - WHERE rd.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY w.userFk,dated - )sub; - - - UPDATE tmp.timeBusinessCalculate t - LEFT JOIN postgresql.journey j ON j.business_id = t.businessFk - SET t.timeWorkSeconds = t.hoursWeek / 5 * 3600, - t.timeWorkSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), - t.timeWorkDecimal = t.hoursWeek / 5, - t.timeBusinessSeconds = t.hoursWeek / 5 * 3600, - t.timeBusinessSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), - t.timeBusinessDecimal = t.hoursWeek / 5 - WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND j.journey_id IS NULL ; - - UPDATE tmp.timeBusinessCalculate t - SET t.timeWorkSeconds = t.timeWorkSeconds - (t.timeWorkSeconds * permissionRate) , - t.timeWorkSexagesimal = SEC_TO_TIME ((t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)) * 3600), - t.timeWorkDecimal = t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate) - WHERE permissionRate <> 0; - -UPDATE tmp.timeBusinessCalculate t - JOIN vn.calendarHolidays ch ON ch.dated = t.dated - JOIN postgresql.business_labour bl ON bl.business_id = t.businessFk AND bl.workcenter_id = ch.workcenterFk - SET t.timeWorkSeconds = 0, - t.timeWorkSexagesimal = 0, - t.timeWorkDecimal = 0, - t.permissionrate = 1, - t.type = 'Festivo' - WHERE t.type IS NULL; - -DROP TEMPORARY TABLE IF EXISTS tmp.rangeDate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeControl_calculate` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN -/* - * @param vDatedFrom - * @param vDatedTo - * Calculo de horas trabajadas por empleado y dia, sin tener encuenta los dias con fichadas incorrectas - * segun la tabla tmp.timeControlError - * @return tmp.timeControlCalculate (workerFk, dated, timeWorkSeconds, timeWorkSexagesimal, timeWorkDecimal, timed) - */ - DECLARE vHourToSeconds INTEGER; - DECLARE vDatedFromYesterday DATETIME; - DECLARE vDatedToTomorrow DATETIME; - DECLARE vTimeToBreakTime INT; - DECLARE vBreakTime INT; - - SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) - INTO vDatedFromYesterday, vDatedToTomorrow; - - SELECT timeToBreakTime, breakTime INTO vTimeToBreakTime, vBreakTime - FROM workerTimeControlConfig LIMIT 1; - - CALL timeControl_getError(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControl; - CREATE TEMPORARY TABLE tmp.workerTimeControl - (INDEX (userFk), INDEX (timed)) - ENGINE = MEMORY - SELECT DISTINCT(wtc.id), - wtc.userFk, - wtc.timed, - wtc.direction, - TRUE isReal - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id - WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow - AND tce.id IS NULL - ORDER BY wtc.userFk, wtc.timed ASC; - - SELECT MAX(id) INTO @vCont - FROM tmp.workerTimeControl; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; - CREATE TEMPORARY TABLE tmp.workerTimeControlAux ( - `id` int(11) , - `userFk` int(10) unsigned , - `timed` datetime, - `direction` enum('in', 'out','middle') - ) ENGINE=MEMORY; - - - SET @counter := 0; - SET @vIsOdd := FALSE; - - -- Cambio de dia en medio de un descanso - INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1 id, userFk, util.dayEnd(dated) timed, 'middle' direction - FROM(SELECT wtc.userFk, - DATE(@lastTimed) dated, - (@vIsOdd := NOT @vIsOdd) isOdd, - IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, - @lastTimed := wtc.timed - FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed - )sub - WHERE hasBreak; - - SET @counter := 0; - SET @vIsOdd := FALSE; - - INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1, userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'middle' - FROM(SELECT wtc.userFk, - DATE(@lastTimed) dated, - (@vIsOdd := NOT @vIsOdd) isOdd, - IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, - @lastTimed := wtc.timed - FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed - )sub - WHERE hasBreak; - - -- Cambio de dia - INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1 id, sub.userFk, util.dayEnd(sub.dated) timed, 'out' direction - FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id - WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow - AND tce.id IS NULL - GROUP BY wtc.userFk, DATE(wtc.timed) - ) sub - JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk - WHERE wtc.direction <> 'out'; - - INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1, sub.userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'in' - FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id - WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow - AND tce.id IS NULL - GROUP BY wtc.userFk, DATE(wtc.timed) - ) sub - JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk - WHERE wtc.direction <> 'out'; - - INSERT INTO tmp.workerTimeControl (id, userFk, timed, direction, isReal) - SELECT id, userFk, timed, direction, FALSE FROM tmp.workerTimeControlAux; - - SET vHourToSeconds = 3600; - SET @vIsOdd := TRUE; - SET @vDated := 0; - SET @vLastTimed := 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerBreakDays; - CREATE TEMPORARY TABLE tmp.workerBreakDays - (INDEX (userFk), INDEX (dated)) - ENGINE = MEMORY - SELECT sub.userFk, sub.dated - FROM (SELECT (@vIsOdd := NOT @vIsOdd), - IF(wtc.direction = 'in', @vIsOdd := TRUE, NULL), - IF(@vIsOdd, @vLastTimed := UNIX_TIMESTAMP(wtc.timed), NULL), - IF(@vIsOdd, 0, UNIX_TIMESTAMP(wtc.timed) - @vLastTimed) timeWork, - IF(direction='in', @vDated := DATE(wtc.timed), @vDated) dated, - wtc.userFk - FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed, wtc.id - )sub - GROUP BY sub.userFk, sub.dated - HAVING SUM(sub.timeWork) >= vTimeToBreakTime; - - SET @vIsOdd := TRUE; - SET @vDated := 0; - SET @vLastTimed := 0; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; - - CREATE TEMPORARY TABLE tmp.timeControlCalculate - (INDEX (userFk, dated)) - ENGINE = MEMORY - SELECT sub.userFk, - sub.dated, - IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork) timeWorkSeconds, - SEC_TO_TIME(IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork)) timeWorkSexagesimal, - (IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork)) / vHourToSeconds timeWorkDecimal, - CAST(GROUP_CONCAT(DATE_FORMAT(sub.realTimed, "%H:%i") ORDER BY sub.timed ASC SEPARATOR ' - ') AS CHAR(256)) timed - FROM (SELECT (@vIsOdd := NOT @vIsOdd), - IF(direction='in', @vIsOdd := TRUE, 0), - IF(@vIsOdd, @vLastTimed := UNIX_TIMESTAMP(timed), 0), - IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed) - @vLastTimed) timeWork, - timed, - userFk, - DATE(timed) dated, - IF(isReal, timed, NULL) realTimed - FROM tmp.workerTimeControl - WHERE timed BETWEEN vDatedFromYesterday AND vDatedTo - ORDER BY userFk, timed, id - )sub - LEFT JOIN tmp.workerBreakDays wb ON wb.userFk = sub.userFk AND wb.dated = sub.dated - WHERE sub.timed BETWEEN vDatedFrom AND vDatedTo - GROUP BY sub.userFk, sub.dated; - - DROP TEMPORARY TABLE tmp.workerBreakDays; - DROP TEMPORARY TABLE tmp.timeControlError; - DROP TEMPORARY TABLE tmp.workerTimeControlAux; - DROP TEMPORARY TABLE tmp.workerTimeControl; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeControl_calculateAll` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` - SELECT userFk - FROM vn.worker w - JOIN vn.`user` u ON u.id = w.userFk - WHERE userFk IS NOT NULL; - - CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeControl_calculateByDepartment` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * @param vDepartmentFk - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE tmp.`user` - SELECT DISTINCT w.userFk - FROM postgresql.business AS b - LEFT JOIN postgresql.profile AS pr ON pr.profile_id = b.client_id - LEFT JOIN postgresql.person AS p ON p.person_id = pr.person_id - LEFT JOIN postgresql.business_labour AS bl ON b.business_id = bl.business_id - LEFT JOIN vn.worker AS w ON p.id_trabajador = w.id - LEFT JOIN vn.department AS d ON bl.department_id = d.id - WHERE ((b.date_start BETWEEN vDatedFrom AND vDatedTo OR b.date_end BETWEEN vDatedFrom AND vDatedTo) OR - (b.date_end IS NULL AND b.date_start <= vDatedTo) OR - (b.date_start <= vDatedFrom AND b.date_end >= vDatedTo) - ) AND bl.department_id = vDepartmentFk - ORDER BY b.date_end DESC; - - CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeControl_calculateByUser` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * @param vUserFk - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE tmp.`user` - SELECT id userFk - FROM user - WHERE id = vUserFk; - CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeControl_calculateByWorker` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - -/** - * @param vWorkerFk - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - CREATE TEMPORARY TABLE tmp.`user` - SELECT u.id userFk - FROM vn.user u - JOIN vn.worker w ON w.userFk = u.id - WHERE w.id = vWorkerFk; - - CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); - - DROP TEMPORARY TABLE tmp.`user`; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeControl_calculate__` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `timeControl_calculate__`(vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - SET @vIsOdd := TRUE; - SET @vUser := NULL; - SET @vDated := NULL; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; - - CREATE TEMPORARY TABLE tmp.timeControlCalculate - SELECT - userFk, - dated, - IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds, - SEC_TO_TIME(@timeWork ) timeWorkSexagesimal, - @timeWork / 3600 timeWorkDecimal, - timed - FROM (SELECT SUM(timeWork) timeWork, - userFk, - dated, - GROUP_CONCAT(DATE_FORMAT(sub.timed,"%H:%i") ORDER BY sub.timed ASC SEPARATOR ' - ') timed - FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk), - IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE), - IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd), - IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed), - IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork, - IF(direction='in', @vDated := DATE(wtc.timed), @vDated) dated, - wtc.timed timed, - wtc.userFk, - direction - FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo - ORDER BY userFk, timed ASC - ) wtc - WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo - ) sub - GROUP BY userFk, dated - )sub2; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `timeControl_getError` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN -/* - * @param vDatedFrom - * @param vDatedTo - * @table tmp.`user`(userFk) - * Fichadas incorrectas de las cuales no se puede calcular horas trabajadas - * @return tmp.timeControlError (id) - */ - DECLARE vDayMaxTime INTEGER; - - SET @journeyCounter := 0; - SET @lastUserFk := NULL; - - SELECT dayMaxTime INTO vDayMaxTime - FROM workerTimeControlConfig LIMIT 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; - CREATE TEMPORARY TABLE tmp.timeControl - (INDEX(id), INDEX(journeyCounter)) - ENGINE = MEMORY - SELECT wtc.id, - wtc.direction, - wtc.timed, - IF(wtc.direction = 'in' OR @hasOut OR wtc.userFk <> @lastUserFk, @journeyCounter := @journeyCounter + 1, @journeyCounter) journeyCounter, - @lastUserFk := wtc.userFk workerFk, - IF(wtc.direction = 'out', @hasOut:= TRUE, @hasOut:= FALSE) - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - WHERE wtc.timed BETWEEN DATE_SUB(vDatedFrom, INTERVAL 1 DAY) AND DATE_ADD(vDatedTo, INTERVAL 1 DAY) - ORDER BY wtc.userFk, wtc.timed; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; - CREATE TEMPORARY TABLE tmp.timeControlAux - (INDEX(id), INDEX(journeyCounter)) - ENGINE = MEMORY - SELECT * FROM tmp.timeControl; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlError; - CREATE TEMPORARY TABLE tmp.timeControlError - (INDEX(id)) - ENGINE = MEMORY - SELECT id - FROM tmp.timeControlAux tca - JOIN (SELECT journeyCounter, - UNIX_TIMESTAMP(MAX(timed)) - UNIX_TIMESTAMP(MIN(timed)) timeWork, - SUM(direction = 'in') totalIn, - SUM(direction = 'out') totalOut, - timed - FROM tmp.timeControl - GROUP BY journeyCounter - HAVING COUNT(*) MOD 2 = 1 - OR totalIn <> 1 - OR totalOut <> 1 - OR timeWork >= vDayMaxTime - )sub ON sub.journeyCounter = tca.journeyCounter - WHERE sub.timed BETWEEN vDatedFrom AND vDatedTo; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `timeWorkerControl_check` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `timeWorkerControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) -proc: BEGIN -/** - * deprecated call workerTimeControl_check - */ -CALL vn.workerTimeControl_check(vUserFk,vDated,vTabletFk); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `tpvTransaction_checkStatus` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_checkStatus`() -BEGIN -/** - * - * Envia mail con los cobros web no - * trasladados a la ficha del cliente. - * - */ - INSERT INTO mail (receiver,replyTo,subject,body) - SELECT 'administracion@verdnatura.es', - 'noreply@verdnatura.es', - CONCAT('Cobro web no trasladado a la ficha del cliente ', t.clientFk), - CONCAT('Hay un importe de ', t.amount/100, '€ del cliente ', t.clientFk, ' con fecha ', t.created, - ', que no se ha trasladado a recibos. Si nos ha llegado el importe al banco confirme el pago en - - https://salix.verdnatura.es/#!/client/',t.clientFk,'/web-payment') - FROM hedera.tpvTransaction t - WHERE t.receiptFk IS NULL - AND t.status = 'ok' - AND t.created < DATE_ADD(NOW(),INTERVAL - 2 DAY) - GROUP BY t.clientFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `travelVolume` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume`(vTravelFk INT) -BEGIN - - SELECT w1.name AS ORI, - w2.name AS DES, - tr.shipped shipment, - tr.landed landing, - a.name Agencia, - s.name Proveedor, - e.id Id_Entrada, - e.REF Referencia, - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) AS CC, - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) AS espais - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.supplier s ON s.id = e.supplierFk - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.agencyMode a ON a.id = tr.agencyFk - JOIN vn.warehouse w1 ON w1.id = tr.warehouseInFk - JOIN vn.warehouse w2 ON w2.id = tr.warehouseOutFk - JOIN vn.volumeConfig vc - JOIN vn.item i ON i.id = b.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - WHERE tr.id = vTravelFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `travelVolume_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT) -BEGIN - - SELECT tr.landed Fecha, - a.name Agencia, - count(DISTINCT e.id) numEntradas, - FLOOR(sum(item_getVolume(b.itemFk, b.packageFk) * b.stickers / 1000000 )) AS m3 - FROM vn.travel tr - JOIN vn.agencyMode a ON a.id = tr.agencyFk - JOIN vn.entry e ON e.travelFk = tr.id - JOIN vn.buy b ON b.entryFk = e.id - WHERE tr.landed BETWEEN vFromDated AND vToDated - AND e.isRaid = FALSE - AND tr.warehouseInFk = vWarehouseFk - GROUP BY tr.landed , a.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 `travel_checkDates` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkDates`(vShipped DATE, vLanded DATE) -BEGIN -/** - * Checks the landing/shipment dates of travel, throws an error - * ir they are not correct. - * - * @param vShipped The shipment date - * @param vLanded The landing date - */ - - IF vLanded < vShipped THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Landing cannot be lesser than shipment'; - 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 `travel_clone` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `travel_clone`(vSelf INT, vDays INT, OUT vNewTravelFk INT) -BEGIN - - /** - * Clona un travel el número de dias indicado y devuelve su Id - * - * @param vSelf Identificador de vn.travel - * @param vDays Número de dias a futuro - * - * @return vNewTravelFk Nuevo número de travel - */ - - SELECT tr.id INTO vNewTravelFk - FROM vn.travel tr - JOIN vn.travel tr2 USING(shipped, warehouseInFk, warehouseOutFk, agencyFk, `ref`) - WHERE tr2.id = vSelf - AND tr.landed = TIMESTAMPADD(DAY, vDays, tr2.landed); - - IF ISNULL(vNewTravelFk) THEN - - START TRANSACTION; - - INSERT INTO vn.travel( shipped, - shipmentHour, - landed, - landingHour, - warehouseInFk, - warehouseOutFk, - agencyFk, - `ref`, - cargoSupplierFk) - SELECT shipped, - shipmentHour, - TIMESTAMPADD(DAY, vDays, landed), - landingHour, - warehouseInFk, - warehouseOutFk, - agencyFk, - `ref`, - cargoSupplierFk - FROM vn.travel - WHERE id = vSelf; - - SELECT LAST_INSERT_ID() INTO vNewTravelFk; - - COMMIT; - - END IF; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `travel_cloneWithEntries` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`( - IN vTravelFk INT, - IN vDateStart DATE, - IN vDateEnd DATE, - IN vWarehouseOutFk INT, - IN vWarehouseInFk INT, - IN vRef VARCHAR(255), - IN vAgencyModeFk INT, - OUT vNewTravelFk INT) -BEGIN -/** - * Clona un travel junto con sus entradas y compras - * - * @param vTravelFk travel plantilla a clonar - * @param vDateStart fecha del shipment del nuevo travel - * @param vDateEnd fecha del landing del nuevo travel - * @param vWarehouseOutFk fecha del salida del nuevo travel - * @param vWarehouseInFk warehouse de landing del nuevo travel - * @param vRef referencia del nuevo travel - * @param vAgencyModeFk del nuevo travel - * @param vNewTravelFk id del nuevo travel - */ - DECLARE vEntryNew INT; - DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE vAuxEntryFk INT; - DECLARE vRsEntry CURSOR FOR - SELECT e.id - FROM entry e - JOIN travel t - ON t.id = e.travelFk - WHERE e.travelFk = vTravelFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION/*, 1062 Duplicate key*/ - BEGIN - ROLLBACK; - - END; - - START TRANSACTION; - INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyFk, `ref`, isDelivered, isReceived, m3, kg) - SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3, kg - FROM travel - WHERE id = vTravelFk; - - SET vNewTravelFk = LAST_INSERT_ID(); - CALL logAdd(vNewTravelFk, 'insert', 'travel', CONCAT('clona travel ',vTravelFk)); - SET vDone = FALSE; - SET @isModeInventory = TRUE; - OPEN vRsEntry ; - FETCH vRsEntry INTO vAuxEntryFk; - - WHILE NOT vDone DO - INSERT INTO entry ( - supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - travelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk) - SELECT supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - vNewTravelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk - FROM entry - WHERE id = vAuxEntryFk; - - SET vEntryNew = LAST_INSERT_ID(); - - CALL logAdd(vEntryNew, 'insert', 'entry', CONCAT('clona entrada ',vAuxEntryFk)); - INSERT INTO buy ( - entryFk, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked, - weight) - SELECT vEntryNew, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked, - weight - FROM buy - WHERE entryFk = vAuxEntryFk; - - FETCH vRsEntry INTO vAuxEntryFk; - END WHILE; - SET @isModeInventory = FALSE; - CLOSE vRsEntry; - 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 `travel_cloneWithEntries__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries__`(IN vTravelFk INT, IN vDateStart DATE, IN vDateEnd DATE, - IN vRef VARCHAR(255), OUT vNewTravelFk INT) -BEGIN - DECLARE vEntryNew INT; - DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE vAuxEntryFk INT; - DECLARE vRsEntry CURSOR FOR - SELECT e.id - FROM entry e - JOIN travel t - ON t.id = e.travelFk - WHERE e.travelFk = vTravelFk; - - DECLARE vRsBuy CURSOR FOR - SELECT b.* - FROM buy b - JOIN entry e - ON b.entryFk = e.id - WHERE e.travelFk = vNewTravelFk and b.entryFk=vNewTravelFk - ORDER BY e.id; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg) - SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg - FROM travel - WHERE id = vTravelFk; - - SET vNewTravelFk = LAST_INSERT_ID(); - SET vDone = FALSE; - OPEN vRsEntry ; - FETCH vRsEntry INTO vAuxEntryFk; - - WHILE NOT vDone DO - INSERT INTO entry (supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - travelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk) - SELECT supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - vNewTravelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk - FROM entry - WHERE id = vAuxEntryFk; - - SET vEntryNew = LAST_INSERT_ID(); - - - INSERT INTO buy (entryFk, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked, - weight) - SELECT vEntryNew, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked, - weight - FROM buy - WHERE entryFk = vAuxEntryFk; - - - FETCH vRsEntry INTO vAuxEntryFk; - END WHILE; - CLOSE vRsEntry; - 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 `travel_doRecalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_doRecalc`() -BEGIN -/** - * Recounts the number of entries of changed travels. - */ - DECLARE vDone BOOL; - DECLARE vTravelFk INT; - DECLARE vTotalEntries INT; - - DECLARE cCur CURSOR FOR - SELECT travelFk FROM travelRecalc; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - OPEN cCur; - - myLoop: LOOP - SET vDone = FALSE; - FETCH cCur INTO vTravelFk; - - IF vDone THEN - LEAVE myLoop; - END IF; - - SELECT COUNT(*) INTO vTotalEntries - FROM entry - WHERE travelFk = vTravelFk; - - UPDATE travel - SET totalEntries = vTotalEntries - WHERE id = vTravelFk; - - DELETE FROM travelRecalc WHERE travelFk = vTravelFk; - END LOOP; - - CLOSE cCur; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `travel_moveRaids` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_moveRaids`() -BEGIN - -/* - * Desplaza al dia siguiente los travels que contengan redadas y avisa a los compradores - * - */ - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vWorkerName VARCHAR(50); - DECLARE vRaid TEXT; - DECLARE vWorker VARCHAR(50) DEFAULT ''; - DECLARE vMailBody TEXT DEFAULT ''; - - DECLARE vCur CURSOR FOR - SELECT GROUP_CONCAT( DISTINCT CONCAT('https://salix.verdnatura.es/#!/travel/', ttr.id, '/summary ') ORDER BY ttr.id SEPARATOR '\n\r'), - u.name - FROM tmp.travel ttr - JOIN entry e ON e.travelFk = ttr.id - JOIN buy b ON b.entryFk = e.id - JOIN item i ON i.id = b.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN account.user u ON u.id = it.workerFk - GROUP BY u.name; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - DROP TEMPORARY TABLE IF EXISTS tmp.travel; - CREATE TEMPORARY TABLE tmp.travel - SELECT tr.id,tr.landed - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - WHERE tr.landed = util.tomorrow() - AND e.isRaid - GROUP BY tr.id; - - START TRANSACTION; - - UPDATE travel tr - JOIN tmp.travel ttr ON ttr.id = tr.id - SET tr.landed = TIMESTAMPADD(DAY, 1, tr.landed); - - INSERT INTO travelLog (originFk, userFk , action, description) - SELECT ttr.id, account.userGetId(), 'update', CONCAT('Se ha cambiado la fecha del travel al dia ', util.tomorrow()) - FROM tmp.travel ttr; - - OPEN vCur; - - l: LOOP - SET vDone = FALSE; - FETCH vCur INTO vRaid, vWorkerName; - - IF vDone THEN - LEAVE l; - END IF; - - CALL `vn`.`mail_insert`(CONCAT(vWorkerName, '@verdnatura.es'), - 'noreply@verdnatura.es', - 'Cambio de fecha en Redadas', - CONCAT('Se ha movido las siguientes redadas: \n\r ', vRaid) - ); - - END LOOP; - CLOSE vCur; - COMMIT; - DROP TEMPORARY TABLE tmp.travel; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `travel_requestRecalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_requestRecalc`(vSelf INT) -proc: BEGIN -/** - * Adds a request to recount the number of entries for the travel. - * - * @param vSelf The travel reference - */ - IF vSelf IS NULL THEN - LEAVE proc; - END IF; - - INSERT IGNORE INTO travelRecalc SET travelFk = vSelf; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `travel_weeklyClone` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_weeklyClone`(vSinceWeek INT, vToWeek INT) -BEGIN -/** - * Clona los travels plantilla para las semanas pasadas por parámetros - * - * @param vSinceWeek Número de semanas en el futuro para empezar a clonar - * @param vToWeek Número de semenas en el futuro hasta donde clonar - */ - - DECLARE vCounter INT; - DECLARE vCurrentTravelFk INT; - DECLARE vShipped DATE; - DECLARE vLanded DATE; - DECLARE vWarehouseInFk INT; - DECLARE vWarehouseOutFk INT; - DECLARE vAgencyModeFk INT; - DECLARE vRef VARCHAR(255); - DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE vRsTravel CURSOR FOR - SELECT travelFk, - @a := TIMESTAMPADD(DAY,vCounter * 7 - WEEKDAY(CURDATE()) - 1 + weekDay,CURDATE()), - @a := TIMESTAMPADD(DAY,duration,@a), - warehouseOutFk, - warehouseInFk, - `ref`, - agencyModeFk - FROM travelClonedWeekly - WHERE travelFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SET vCounter = vSinceWeek; - vWeekLoop :LOOP - INSERT IGNORE INTO travel (shipped, landed, warehouseOutFk, warehouseInFk, agencyFk, ref, cargoSupplierFk, kg) - SELECT @a := TIMESTAMPADD(DAY, vCounter * 7 - WEEKDAY(CURDATE()) - 1 + weekDay,CURDATE()), - @a := TIMESTAMPADD(DAY, duration, @a), - warehouseOutFk, - warehouseInFk, - agencyModeFk, - ref, - supplierFk, - kg - FROM travelClonedWeekly - WHERE travelFk IS NULL; - OPEN vRsTravel; - FETCH vRsTravel INTO vCurrentTravelFk, vShipped, vLanded, vWarehouseOutFk, vWarehouseInFk, vRef, vAgencyModeFk; - SET vDone = FALSE; - WHILE NOT vDone DO - CALL travel_cloneWithEntries(vCurrentTravelFk, vShipped, vLanded, vWarehouseOutFk, vWarehouseInFk, vRef, vAgencyModeFk, @newTravel); - FETCH vRsTravel INTO vCurrentTravelFk, vShipped, vLanded, vWarehouseOutFk, vWarehouseInFk, vRef, vAgencyModeFk; - END WHILE; - CLOSE vRsTravel; - - IF vCounter = vToWeek THEN - LEAVE vWeekLoop; - END IF; - SET vCounter = vCounter + 1; - - END LOOP vWeekLoop; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `typeTagMake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `typeTagMake`(vTypeFk INT) -BEGIN -/* - * Plantilla para modificar reemplazar todos los tags - * por los valores que tienen los articulos - * - * @param vTypeFk tipo a modificar - * - */ - DELETE it.* - FROM itemTag it - JOIN item i ON i.id = it.itemFk - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, CONCAT(i.size,' cm'), 1 - FROM item i - JOIN tag t ON t.name = 'Longitud' COLLATE utf8_general_ci - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, i.category, 5 - FROM item i - JOIN tag t ON t.name = 'Categoria' COLLATE utf8_general_ci - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, ink.name, 2 - FROM item i - JOIN tag t ON t.name = 'Color' COLLATE utf8_general_ci - JOIN ink ON ink.id = i.inkFk - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, p.name, 3 - FROM item i - JOIN tag t ON t.name = 'Productor' COLLATE utf8_general_ci - JOIN producer p ON p.id = i.producerFk - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, o.name, 4 - FROM item i - JOIN tag t ON t.name = 'Origen' COLLATE utf8_general_ci - JOIN origin o ON o.id = i.originFk - WHERE i.typeFk = vTypeFk; - /* - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, i.stems, 6 - FROM item i - JOIN tag t ON t.name = 'Tallos' COLLATE utf8_general_ci - WHERE i.typeFk = vTypeFk; - */ --- CALL itemTagArrangedUpdate(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 `updatePedidosInternos` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `updatePedidosInternos`(vItemFk INT) -BEGIN - - UPDATE vn.item SET upToDown = 0 WHERE item.id = vItemFk; - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `visible_getMisfit` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `visible_getMisfit`(vSectorFk INT) -BEGIN - - /* Devuelve una tabla temporal con los descuadres entre el visible teórico y lo ubicado en la práctica - * - * @param vSectorFk Identificador de vn.sector - * - * @return tmp.stockMisfit(itemFk, visible, parked) - */ - - DECLARE vCalcVisibleFk INT; - DECLARE vWarehouseFk INT; - - SELECT warehouseFk INTO vWarehouseFk - FROM vn.sector s - WHERE s.id = vSectorFk; - - CALL cache.visible_refresh(vCalcVisibleFk, FALSE, vWarehouseFk); - - DROP TEMPORARY TABLE IF EXISTS tmp.stockMisfit; - - CREATE TEMPORARY TABLE tmp.stockMisfit( - itemFk INT PRIMARY KEY, - visible INT NOT NULL DEFAULT 0, - parked INT NOT NULL DEFAULT 0) - ENGINE = MEMORY; - - INSERT INTO tmp.stockMisfit(itemFk, parked) - SELECT iss.itemFk , sum(iss.visible ) - FROM vn.itemShelvingStock iss - JOIN vn.sector s ON s.id = iss.sectorFk - WHERE vSectorFk IN (s.id, s.sonFk) - GROUP BY iss.itemFk; - - INSERT INTO tmp.stockMisfit(itemFk, visible) - SELECT v.item_id , v.visible - FROM cache.visible v - WHERE v.calc_id = vCalcVisibleFk - ON DUPLICATE KEY UPDATE visible = v.visible; - - DELETE FROM tmp.stockMisfit - WHERE visible = parked; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `warehouseFitting` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting`(IN vWhOrigin INT , IN vWhDestiny INT) -BEGIN - DECLARE vCacheVisibleOriginFk INT; - DECLARE vCacheVisibleDestinyFk INT; - - CALL cache.visible_refresh(vCacheVisibleOriginFk, FALSE, vWhOrigin); - CALL cache.visible_refresh(vCacheVisibleDestinyFk, FALSE, vWhDestiny); - - SELECT i.id itemFk, - i.longName, - i.size, - i.subName, - vOrigin.visible AS Origen, - vDestiny.visible Destino - - FROM vn.item i - JOIN vn.itemType it ON it.id = i.typeFk - LEFT JOIN cache.visible vOrigin ON vOrigin.calc_id = vCacheVisibleOriginFk AND vOrigin.item_id = i.id - LEFT JOIN cache.visible vDestiny ON vDestiny.calc_id = vCacheVisibleDestinyFk AND vDestiny.item_id = i.id - WHERE (vOrigin.visible OR vDestiny.visible) - AND it.categoryFk < 6 - ORDER BY IF(vOrigin.visible,0,1), longName, size, subName; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `warehouseFitting_byTravel` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting_byTravel`(IN vTravelFk INT) -BEGIN - - DECLARE vWhOrigin INT; - DECLARE vWhDestiny INT; - - SELECT warehouseInFk, warehouseOutFk INTO vWhDestiny, vWhOrigin - FROM vn.travel - WHERE id = vTravelFk; - - CALL vn.warehouseFitting(vWhOrigin, vWhDestiny); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerCalculateBoss` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalculateBoss`(vWorker INT) -BEGIN -/** -* Actualiza la tabla workerBosses -* vWorker: id del trabajador -* -*/ - DECLARE vBoss INT; - DECLARE vWorkerCompare INT DEFAULT vWorker; - - l: LOOP - SELECT bossFk INTO vBoss - FROM vn.worker - WHERE id=vWorkerCompare; - - IF vBoss=0 OR vWorkerCompare=vBoss THEN - LEAVE l; - END IF; - - REPLACE INTO vn.workerBosses(workerFk,bossFk) - VALUES(vWorker,vBoss); - - SET vWorkerCompare = vBoss; - - 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 `workerCalendar_calculateBusiness` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateBusiness`(vYear INT, vBusinessFk INT) -BEGIN - -/** - * Calcula los días y horas de vacaciones en función de un contrato y año - * - * @param vYear - * @param vBusinessFk - * @return tmp.workerCalendarCalculateBusiness (days, hours, daysEnjoyed, hoursEnjoyed) - */ - - DECLARE vStarted DATE; - DECLARE vEnded DATE; - DECLARE vDaysHoliday DECIMAL(5,2); - DECLARE vHoursWeek DECIMAL(5,2); - DECLARE vDaysToSubtract DECIMAL(5,2); - DECLARE vDaysHolidayEnjoyed DECIMAL(5,2); - DECLARE vDifDays INT; - - SELECT IF(b.date_start < CONCAT(vYear,"-01-01"), CONCAT(vYear,"-01-01"),b.date_start), - IF(b.date_end IS NULL OR YEAR(b.date_end)>vYear , CONCAT(vYear,"-12-31"), b.date_end), - IF(wbt.hasHolidayEntitlement, w.days, 0), - c.hours_week - INTO vStarted, - vEnded, - vDaysHoliday, - vHoursWeek - FROM postgresql.business b - JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id - JOIN workerBusinessType wbt ON wbt.id = cod_contrato - JOIN postgresql.business_labour bl ON bl.business_id = b.business_id - JOIN workCenterHoliday w ON w.workcenterFk = bl.workcenter_id - LEFT JOIN postgresql.calendar_labour_type c ON c.calendar_labour_type_id=bl.calendar_labour_type_id - WHERE b.business_id = vBusinessFk - AND w.year = vYear; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateBusiness; - - IF vStarted < vEnded THEN - SET vDifDays = DAYOFYEAR(vEnded) - DAYOFYEAR(vStarted) + 1; - - SELECT IFNULL(SUM(holidayEntitlementRate), 0) , - SUM(-(discountRate - 1)) - INTO vDaysToSubtract, - vDaysHolidayEnjoyed - FROM workerCalendar w - JOIN absenceType a ON a.id = w.absenceTypeFk - WHERE w.businessFk = vBusinessFk - AND YEAR(dated) = vYear; - END IF; - - CREATE TEMPORARY TABLE tmp.workerCalendarCalculateBusiness - ENGINE = MEMORY - SELECT @days := IFNULL(ROUND((vDaysHoliday * (vDifDays - vDaysToSubtract) / IF(util.isLeapYear(vYear) , 366, 365)), 1), 0) days, - @days * (vHoursWeek / 5) hours, - @daysEnjoyed := IFNULL(ROUND(vDaysHolidayEnjoyed, 1), 0) daysEnjoyed, - @daysEnjoyed * (vHoursWeek / 5) hoursEnjoyed; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerCalendar_calculateBusiness__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateBusiness__`(vYear INT, vBusinessFk INT) -BEGIN - -/** - * Calcula los días y horas de vacaciones en función de un contrato y año - * - * @param vYear - * @param vBusinessFk - * @return tmp.workerCalendarCalculateBusiness (days, hours, daysEnjoyed, hoursEnjoyed) - */ - - DECLARE vStarted DATE; - DECLARE vEnded DATE; - DECLARE vDaysHoliday DECIMAL(5,2); - DECLARE vHoursWeek DECIMAL(5,2); - DECLARE vDaysToSubtract DECIMAL(5,2); - DECLARE vDaysHolidayEnjoyed DECIMAL(5,2); - DECLARE vDifDays INT; - - SELECT IF(b.date_start < CONCAT(vYear,"-01-01"), CONCAT(vYear,"-01-01"),b.date_start), - IF(b.date_end IS NULL OR YEAR(b.date_end)>vYear , CONCAT(vYear,"-12-31"), b.date_end), - IF(hasHolidayEntilement, w.days, 0), - c.hours_week - INTO vStarted, - vEnded, - vDaysHoliday, - vHoursWeek - FROM postgresql.business b - JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id - JOIN vn2008.payroll_contratos p ON p.CodContrato = cod_contrato - JOIN postgresql.business_labour bl ON bl.business_id = b.business_id - JOIN workCenterHoliday w ON w.workcenterFk = bl.workcenter_id - LEFT JOIN postgresql.calendar_labour_type c ON c.calendar_labour_type_id=bl.calendar_labour_type_id - WHERE b.business_id= vBusinessFk - AND w.year = vYear; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateBusiness; - - IF vStarted < vEnded THEN - SET vDifDays = DAYOFYEAR(vEnded) - DAYOFYEAR(vStarted) + 1; - - SELECT IFNULL(SUM(holidayEntitlementRate), 0) , - SUM(-(discountRate - 1)) - INTO vDaysToSubtract, - vDaysHolidayEnjoyed - FROM workerCalendar w - JOIN absenceType a ON a.id = w.absenceTypeFk - WHERE w.businessFk = vBusinessFk - AND YEAR(dated) = vYear; - END IF; - - CREATE TEMPORARY TABLE tmp.workerCalendarCalculateBusiness - ENGINE = MEMORY - SELECT @days := IFNULL(ROUND((vDaysHoliday * (vDifDays - vDaysToSubtract) / IF(util.isLeapYear(vYear) , 366, 365)), 1), 0) days, - @days * (vHoursWeek / 5) hours, - @daysEnjoyed := IFNULL(ROUND(vDaysHolidayEnjoyed, 1), 0) daysEnjoyed, - @daysEnjoyed * (vHoursWeek / 5) hoursEnjoyed; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerCalendar_calculateYear` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateYear`(vYear INT, vWorkerFk INT) -BEGIN - -/** - * Calcula los días y horas de vacaciones en función de un trabajador y año - * - * @param vYear - * @param vWorkerFk - * @return tmp.workerCalendarCalculateYear (days, hours, daysEnjoyed, hoursEnjoyed) - */ - - DECLARE vDone BOOL; - DECLARE vBusinessFk INT; - - DECLARE cur CURSOR FOR - SELECT b.business_id - FROM postgresql.business b - LEFT JOIN postgresql.profile AS pr ON pr.profile_id = b.client_id - LEFT JOIN postgresql.person AS p ON p.person_id = pr.person_id - WHERE vYear BETWEEN YEAR(b.date_start) AND IFNULL(YEAR(b.date_end), vYear ) - AND p.id_trabajador = vWorkerFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateYear; - - CREATE TEMPORARY TABLE tmp.workerCalendarCalculateYear - (days DEC(5,2), - hours DEC(5,2), - daysEnjoyed DEC(5,2), - hoursEnjoyed DEC(5,2)) - ENGINE = MEMORY; - INSERT INTO tmp.workerCalendarCalculateYear VALUES(0, 0, 0, 0); - - OPEN cur; - - l: LOOP - SET vDone = FALSE; - FETCH cur INTO vBusinessFk; - - IF vDone THEN - LEAVE l; - END IF; - - CALL workerCalendar_calculateBusiness(vYear, vBusinessFk); - UPDATE tmp.workerCalendarCalculateYear w - JOIN tmp.workerCalendarCalculateBusiness wc - SET w.days = w.days + wc.days, - w.hours = w.hours + wc.hours, - w.daysEnjoyed = w.daysEnjoyed + wc.daysEnjoyed, - w.hoursEnjoyed = w.hoursEnjoyed + wc.hoursEnjoyed; - - DROP TEMPORARY TABLE tmp.workerCalendarCalculateBusiness; - - END LOOP; - - CLOSE cur; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerCreate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCreate`( - vFirstname VARCHAR(50), - vSurnames VARCHAR(50), - vWorkerCode CHAR(3), - vBossFk INT, - vUserFk INT -) -BEGIN -/** - * Create new worker - * - */ - INSERT INTO worker(id, code, firstName, lastName, userFk, bossFk) - VALUES (vUserFk, vWorkerCode, vFirstname, vSurnames, vUserFk, vBossFk); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` 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,lastName,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 `workerCreate__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCreate__`( - vFirstname VARCHAR(50), - vSurnames VARCHAR(50), - vFi VARCHAR(9), - vWorkerCode CHAR(3), - vBossFk INT, - vUserFk INT -) -BEGIN -/** - * Create new worker - * - */ - INSERT INTO worker(code, firstName, lastName, fi, userFk, bossFk) - VALUES (vWorkerCode, vFirstname, vSurnames, vFi, vUserFk, vBossFk); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerDepartmentByDate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDepartmentByDate`(vDate DATE) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.workerDepartmentByDate; - CREATE TEMPORARY TABLE tmp.workerDepartmentByDate - ENGINE = MEMORY - SELECT - w.userFk, - p.name, - p.firstname, - d.name AS department, - d.id as departmentFk, - b.date_start, - d.isProduction, - CAST(12 * blp.importepactado / clt.hours_week / 52 AS DECIMAL(10,2)) as costeHora , - p.nif - - FROM postgresql.person p - JOIN postgresql.profile pr ON p.person_id = pr.person_id - JOIN postgresql.business b ON b.client_id = pr.profile_id - JOIN postgresql.business_labour bl ON bl.business_id = b.business_id - JOIN postgresql.calendar_labour_type clt ON clt.calendar_labour_type_id = bl.calendar_labour_type_id - JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id - JOIN vn.department d ON d.id = bl.department_id - JOIN vn.worker w ON w.id = p.id_trabajador - WHERE b.date_start <= vDate AND IFNULL(b.date_end,'3000-01-01') > vDate - ; - - -- SELECT * FROM tmp.workerDepartmentByDate; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8 */ ; -/*!50003 SET character_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`@`localhost` PROCEDURE `workerDisable`(vUserId int) -mainLabel:BEGIN - - IF (SELECT COUNT(*) FROM workerDisableExcluded WHERE workerFk = vUserId AND (dated > CURDATE() OR dated IS NULL)) > 0 THEN - LEAVE mainLabel; - END IF; - DELETE FROM account.account - WHERE id = vUserId; - - UPDATE account.user - SET role = 2 - WHERE id = vUserId; - - DELETE FROM pbx.sip - WHERE user_id = vUserId; - - UPDATE `client` c - JOIN payMethod p ON p.name = 'CONTADO' - SET c.credit = 0, c.payMethodFk = p.id, hasCoreVnl = FALSE - WHERE c.id = vUserId; - - UPDATE `client` c - SET c.salesPersonFk = null - WHERE c.salesPersonFk = 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 `workerDisableAll` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisableAll`() -BEGIN - DECLARE done BOOL DEFAULT FALSE; - DECLARE vUserFk INT; - - DECLARE rs CURSOR FOR - SELECT a.id - FROM ((SELECT * FROM (select date_end,date_start,business_id, client_id - FROM postgresql.business - ORDER BY client_id, date_end IS NULL DESC , date_end DESC) - c GROUP BY client_id) c - INNER JOIN postgresql.business b ON c.client_id = b.client_id AND c.business_id = b.business_id - INNER JOIN postgresql.profile pr ON b.client_id = pr.profile_id - INNER JOIN postgresql.person p ON pr.person_id = p.person_id - - INNER JOIN vn.worker w ON p.id_trabajador = w.id) - INNER JOIN account.account a ON w.userFk = a.id - WHERE ((b.date_end) IS NOT NULL - AND (b.date_end) < CURDATE() - AND (b.date_end) > TIMESTAMPADD(DAY, -70,CURDATE()) ); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - OPEN rs; - - FETCH rs INTO vUserFk; - - WHILE NOT done DO - CALL workerDisable(vUserFk); - FETCH rs INTO vUserFk; - - END WHILE; - - CLOSE rs; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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__` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `workerDisable__`(vUserId int) -mainLabel:BEGIN - - IF vUserId = 14255 THEN - LEAVE mainLabel; - END IF; - DELETE FROM account.account - WHERE id = vUserId; - - UPDATE account.user - SET role = 2 - WHERE id = vUserId; - - DELETE FROM pbx.sip - WHERE user_id = vUserId; - - UPDATE `client` c - JOIN payMethod p ON p.name = 'CONTADO' - SET c.credit = 0, c.payMethodFk = p.id, hasCoreVnl = FALSE - WHERE c.id = 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 `workerForAllCalculateBoss` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerForAllCalculateBoss`() -BEGIN -/** -* Actualiza la tabla workerBosses utilizando el procedimiento -* vn.workerCalculateBoss(), actualiza todos los trabajadores en esa tabla -* -*/ - DECLARE vWorker INT; - DECLARE vDone BOOL; - - DECLARE cur CURSOR FOR - SELECT id FROM worker; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - OPEN cur; - - l: LOOP - SET vDone = FALSE; - FETCH cur INTO vWorker; - - IF vDone THEN - LEAVE l; - END IF; - - CALL workerCalculateBoss(vWorker); - END LOOP; - - CLOSE cur; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerJourneyReplaceLauncher__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerJourneyReplaceLauncher__`() -BEGIN - - DECLARE vDateStart DATE; - DECLARE vDateEnd DATE; - - SET vDateStart = TIMESTAMPADD(MONTH,-1,CURDATE()); - SET vDateEnd = util.yesterday(); - - CALL vn.workerJourneyReplace(vDateStart,vDateEnd,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 `workerJourneyReplace__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerJourneyReplace__`(vFromDate DATE, vToDate DATE, vUserFk INT) -BEGIN - - /* Actualiza la tabla workerJourney para que actue como caché permanente revisable de las jornadas laborales. - * vUserFk es opcional. El valor 0 indica que se tenga en cuenta a todos los usuarios. - * - * PAK Julio '18 - */ - - DELETE - FROM workerJourney - WHERE dated BETWEEN vFromDate AND vToDate - AND isPaid = FALSE - AND isUpdated = FALSE - AND vUserFk IN (0,userFk); - - - -- Se inicia la tabla con todas las fechas posibles para cada uno de los trabajadores que han fichado en el rango de fechas. - INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) - SELECT w.userFk, tm.dated, b.business_id - FROM vn.worker w - JOIN postgresql.person pe ON pe.id_trabajador = w.id - JOIN postgresql.profile p ON p.person_id = pe.person_id - JOIN postgresql.business b ON b.client_id = p.profile_id - JOIN postgresql.business_labour bl ON bl.business_id = b.business_id - JOIN vn.time tm ON tm.dated BETWEEN b.date_start AND IFNULL(b.date_end,CURDATE()) - WHERE b.date_start <= vToDate - AND IFNULL(b.date_end, CURDATE()) >= vFromDate - -- AND bl.porhoras - AND vUserFk IN (0,w.userFk); - - - - - - -- Se actualiza la cantidad total de horas prácticas, así como el tiempo de almuerzo remunerado, si corresponde - - /*UPDATE workerJourney wj - JOIN workerTimeControl_Journey j ON wj.dated = j.dated AND wj.userFk = j.userFk - SET wj.total = j.Journey, - wj.lunch = IF(j.Journey < 5,0,0.33) - WHERE wj.dated BETWEEN vFromDate AND vToDate - AND wj.isPaid = FALSE - AND wj.isUpdated = FALSE - AND vUserFk IN (0,wj.userFk); */ - - - IF vUserFk = 0 THEN - CALL vn.timeControl_calculateAll( vFromDate , CONCAT(REPLACE(vToDate, '00:00:00', ''), ' 23:59:59')); - ELSE - CALL vn.timeControl_calculateByUser( vUserFk, vFromDate , CONCAT(REPLACE(vToDate, '00:00:00', ''), ' 23:59:59')); - END IF; - - UPDATE workerJourney wj - JOIN tmp.timeControlCalculate t ON wj.dated = t.dated AND wj.userFk = t.userFk - SET wj.total = CAST(IF(t.timeWorkDecimal >= 5.33,t.timeWorkDecimal-0.33,t.timeWorkDecimal) AS DECIMAL (10,2)), - wj.lunch = IF(t.timeWorkDecimal >= 5.33,0.33,0) - WHERE wj.dated BETWEEN vFromDate AND vToDate - AND wj.isPaid = FALSE - AND wj.isUpdated = FALSE - AND vUserFk IN (0,wj.userFk); - - DROP TEMPORARY TABLE tmp.timeControlCalculate; - - - - /********** NOCTURNIDAD ************/ - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControl; - - CREATE TEMPORARY TABLE tmp.workerTimeControl - SELECT w.*, 0 as Non - FROM vn.workerTimeControl w - WHERE timed BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,userFk) - ORDER BY userFk, timed; - - -- Regalamos un segundo para evitar que hayan fichadas en las horas claves de inicio y fin de la nocturnidad. - UPDATE tmp.workerTimeControl - SET timed = TIMESTAMPADD(SECOND,-1,timed) - WHERE TIME(timed) IN ('06:00:00','22:00:00'); - - -- Fichada virtual a las 6:00 h, hora en que empieza la jornada diurna - INSERT INTO tmp.workerTimeControl(userFk, timed) - SELECT userFk, TIMESTAMPADD(HOUR, 6, DATE(timed)) - FROM vn.workerTimeControl - WHERE vUserFk IN (0,userFk) - GROUP BY userFk, DATE(timed); - - -- Fichada virtual a las 22:00 h, momento en que empieza la jornada nocturna. - INSERT INTO tmp.workerTimeControl(userFk, timed) - SELECT userFk, TIMESTAMPADD(HOUR, 22, DATE(timed)) - FROM vn.workerTimeControl - WHERE vUserFk IN (0,userFk) - GROUP BY userFk, DATE(timed); - - -- Establece el orden en que se han de leer las fichadas - CALL vn.workerTimeControlSetOrder; - - -- Marca los impares para facilitar la consulta siguiente - UPDATE tmp.workerTimeControl - SET Non = 1 - WHERE `order` mod 2; - - -- Actualizamos la nocturnidad - UPDATE workerJourney wj - JOIN - ( SELECT userFk, Dia, sum(Nocturnidad) as Nocturnidad FROM - ( - SELECT userFk, - date(timed) as Dia, - (( - IF( TIME(timed) < '06:00:00' OR (TIME(timed) = '06:00:00' AND Non = FALSE ) , IF(Non,-1,1),0) - + - IF(TIME(timed) > '22:00:00' OR (TIME(timed) = '22:00:00' AND Non = TRUE), If(Non,-1,1),0) - ) - * (HOUR(`timed`) + MINUTE(`timed`) / 60) - ) as Nocturnidad - FROM tmp.workerTimeControl - ) sub - GROUP BY Dia, userFk - HAVING Nocturnidad - ) night ON night.userFk = wj.userFk AND night.Dia = wj.dated - SET wj.nocturn = night.Nocturnidad - WHERE wj.isPaid = FALSE AND isUpdated = FALSE; - - -- Horas téoricas y precio de la hora ordinaria - UPDATE vn.workerJourney wj - JOIN postgresql.business_labour_payroll blp ON blp.business_id = wj.businessFk - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - JOIN postgresql.calendar_labour_type pclt ON pclt.calendar_labour_type_id = bl.calendar_labour_type_id - SET wj.priceOrdinaryHour = (12 * blp.importepactado) / (52 * pclt.hours_week), - wj.contractJourney = pclt.hours_week/5 - WHERE wj.dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,wj.userFk) - AND wj.isPaid = FALSE - AND isUpdated = FALSE; - - -- Precio Extras, Vacaciones y Nocturnas - UPDATE vn.workerJourney wj - JOIN - ( - SELECT dated, hollidayInc, nightInc, extraInc - FROM ( - SELECT tm.dated , hollidayInc, nightInc, extraInc - FROM vn.time tm - JOIN vn.workerHourPrice whp ON tm.dated >= whp.dated - ORDER BY tm.dated, whp.dated DESC - ) sub - GROUP BY dated - ) conv ON conv.dated = wj.dated - SET wj.priceHollydayHour = wj.priceOrdinaryHour * conv.hollidayInc, - wj.priceNocturnHour = wj.priceOrdinaryHour * conv.nightInc, - wj.priceExtraHour = wj.priceOrdinaryHour * conv.extraInc - WHERE wj.dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,wj.userFk) - AND wj.isPaid = FALSE - AND wj.isUpdated = FALSE; - - -- Elimina el precio de las horas extras para los contratos parciales. - UPDATE vn.workerJourney wj - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - JOIN postgresql.calendar_labour_type clt ON clt.calendar_labour_type_id = bl.calendar_labour_type_id - SET wj.priceExtraHour = 0 - WHERE clt.isPartial - AND wj.dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,wj.userFk) - AND wj.isPaid = FALSE - AND wj.isUpdated = FALSE; - - -- Bajas, vacaciones y festivos personales - /* UPDATE vn.workerJourney wj - JOIN postgresql.calendar_employee pce ON pce.date = wj.dated AND pce.business_id = wj.businessFk - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - SET wj.permission = IF(pce.calendar_state_id = 6, 0.5, 1) * wj.contractJourney, - wj.contractJourney = IF(pce.calendar_state_id = 6, 0.5, 0) * wj.contractJourney,-- Vacaciones medio dia - wj.hollyday = wj.total - IF(pce.calendar_state_id = 6, 0.5, 0) * wj.contractJourney - WHERE wj.dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,wj.userFk) - AND wj.isPaid = FALSE - AND wj.isUpdated = FALSE;*/ - - UPDATE vn.workerJourney wj - JOIN postgresql.calendar_employee pce ON pce.date = wj.dated AND pce.business_id = wj.businessFk - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - JOIN postgresql.calendar_state cs ON cs.calendar_state_id = pce.calendar_state_id - SET wj.permission = cs.permissionRate * wj.contractJourney, - wj.contractJourney = IF(cs.permissionRate = 1, 0, cs.permissionRate) * wj.contractJourney, - wj.hollyday = wj.total - IF(cs.permissionRate = 1, 0, cs.permissionRate) * wj.contractJourney - WHERE cs.permissionRate > 0 - AND wj.dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,wj.userFk) - AND wj.isPaid = FALSE - AND wj.isUpdated = FALSE; - - - - - -- Festivos por centro de trabajo -UPDATE vn.workerJourney wj - JOIN vn.calendarHolidays ch ON ch.dated = wj.dated - JOIN postgresql.business_labour pbl ON wj.businessFk = pbl.business_id AND pbl.workcenter_id = ch.workcenterFk - SET wj.hollyday = wj.total, - wj.permission = wj.contractJourney, - wj.contractJourney = 0 - WHERE wj.dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,wj.userFk) - AND wj.isPaid = FALSE - AND wj.isUpdated = FALSE; - - -- Domingos - UPDATE vn.workerJourney - SET hollyday = total, - contractJourney = 0 - WHERE weekday(dated) = 6 - AND dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,userFk) - AND isPaid = FALSE - AND isUpdated = FALSE; - - -- Sábados - UPDATE vn.workerJourney - SET contractJourney = 0 - WHERE weekday(dated) = 5 - AND dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,userFk) - AND isPaid = FALSE - AND isUpdated = FALSE; - - - -- Horas extras - UPDATE workerJourney - SET extra = lunch + total - contractJourney - WHERE dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,userFk) - AND isPaid = FALSE - AND isUpdated = FALSE; - - -- Contratos NO por horas - INSERT IGNORE INTO workerJourney( userFk, - dated, - businessFk, - priceOrdinaryHour, - contractJourney, - total) - SELECT w.userFk, - tm.dated, - b.business_id, - (12 * blp.importepactado) / (52 * pclt.hours_week) as priceOrdinaryHour, - IF(weekday(tm.dated) IN (5,6),0, pclt.hours_week/5) as contractJourney, - IF(weekday(tm.dated) IN (5,6),0, pclt.hours_week/5) as total - FROM vn.worker w - JOIN postgresql.person pe ON pe.id_trabajador = w.id - JOIN postgresql.profile p ON p.person_id = pe.person_id - JOIN postgresql.business b ON b.client_id = p.profile_id - JOIN postgresql.business_labour bl ON bl.business_id = b.business_id - JOIN postgresql.calendar_labour_type pclt ON pclt.calendar_labour_type_id = bl.calendar_labour_type_id - JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id - JOIN vn.time tm ON tm.dated BETWEEN b.date_start AND IFNULL(b.date_end,CURDATE()) - WHERE b.date_start <= vToDate - AND IFNULL(b.date_end, CURDATE()) >= vFromDate - AND bl.porhoras = FALSE - AND vUserFk IN (0,w.userFk); - - -- Elimina dias sin fichadas ni contrato - /* DELETE FROM workerJourney - WHERE contractJourney = 0 - AND total = 0 - AND permission = 0 - AND dated BETWEEN vFromDate AND vToDate - AND vUserFk IN (0,userFk) - AND isPaid = FALSE - AND isUpdated = 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 `workerJourney_replace` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerJourney_replace`(vDatedFrom DATE, vDatedTo DATE, vWorkerFk INT) -BEGIN -/** - * Actualiza la tabla workerJourney para que actue como caché permanente revisable de las jornadas laborales. - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - * @param vWorkerFk, en caso de pasar 0 ó NULL se aplica a todos - */ - - DECLARE vDatedTimeTo DATETIME; - DECLARE vMaxTimePerDay INT; - DECLARE vMinHoursToBreak DECIMAL(10,2); - DECLARE vBreakHours DECIMAL(10,2); - DECLARE vMonthByYear INT; - DECLARE vWeeksByYear INT DEFAULT 52; - DECLARE vMonthsByYear INT DEFAULT 12; - DECLARE vDaysByWeek INT DEFAULT 5; - DECLARE vDatedFromYesterday DATETIME; - DECLARE vDatedToTomorrow DATETIME; - - SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) - INTO vDatedFromYesterday, vDatedToTomorrow; - - SET vDatedTimeTo = util.dayEnd(vDatedTo); - - SELECT minHoursToBreak, breakHours, maxTimePerDay - INTO vMinHoursToBreak, vBreakHours, vMaxTimePerDay - FROM workerTimeControlConfig; - - DELETE FROM workerJourney - WHERE dated BETWEEN vDatedFrom AND vDatedTo - AND NOT isPaid - AND NOT isUpdated - AND (vWorkerFk IS NULL OR userFK = vWorkerFk); - - -- Se inserta todos los días del periodo por worker y business en el rango de fechas. - INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) - SELECT w.workerFk, t.dated, w.businessFk - FROM workerLabour w - JOIN time t ON t.dated BETWEEN w.started AND IFNULL(w.ended,CURDATE()) - WHERE t.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR w.workerFk = vWorkerFk) - ORDER BY w.workerFk, t.dated, w.businessFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.`user`; - - IF vWorkerFk THEN - CALL timeControl_calculateByUser(vWorkerFk, vDatedFrom , vDatedTimeTo); - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` - SELECT vWorkerFk userFk; - ELSE - CALL timeControl_calculateAll(vDatedFrom, vDatedTimeTo); - CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` - SELECT id userFk - FROM vn.worker w; - END IF; - - UPDATE workerJourney wj - JOIN tmp.timeControlCalculate t ON wj.dated = t.dated AND wj.userFk = t.userFk - SET wj.total = CAST(IF(t.timeWorkDecimal >= vMinHoursToBreak, t.timeWorkDecimal - vBreakHours, t.timeWorkDecimal) AS DECIMAL (10,2)), - wj.lunch = IF(t.timeWorkDecimal >= vMinHoursToBreak , vBreakHours , 0) - WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo - AND NOT wj.isPaid - AND NOT wj.isUpdated - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk); - - -- NOCTURNIDAD - CALL vn.timeControl_getError(vDatedFrom, vDatedTimeTo); - - SET @vIsOdd := TRUE; - SET @vDated := NULL; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControl; - CREATE TEMPORARY TABLE tmp.workerTimeControl - (INDEX (userFk), INDEX (timed)) - ENGINE = MEMORY - SELECT DISTINCT(wtc.id), - wtc.userFk, - wtc.timed, - wtc.direction - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id - WHERE wtc.timed BETWEEN vDatedFrom AND vDatedToTomorrow - AND tce.id IS NULL - AND (vWorkerFk IS NULL OR wtc.userFk = vWorkerFk) - ORDER BY wtc.userFk, wtc.timed ASC; - - SELECT MAX(id) INTO @vCont - FROM tmp.workerTimeControl; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; - CREATE TEMPORARY TABLE tmp.workerTimeControlAux ( - `id` int(11) , - `userFk` int(10) unsigned , - `timed` datetime, - `direction` enum('in', 'out','middle') - ) ENGINE=MEMORY; - - SET @counter := 0; - SET @vIsOdd := FALSE; - - -- Cambio de dia en medio de un descanso - INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1 id, userFk, util.dayEnd(dated) timed, 'middle' direction - FROM(SELECT wtc.userFk, - DATE(@lastTimed) dated, - (@vIsOdd := NOT @vIsOdd) isOdd, - IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, - @lastTimed := wtc.timed - FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed - )sub - WHERE hasBreak; - - SET @counter := 0; - SET @vIsOdd := FALSE; - - INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1, userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'middle' - FROM(SELECT wtc.userFk, - DATE(@lastTimed) dated, - (@vIsOdd := NOT @vIsOdd) isOdd, - IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, - @lastTimed := wtc.timed - FROM tmp.workerTimeControl wtc - ORDER BY wtc.userFk, wtc.timed - )sub - WHERE hasBreak; - - -- Cambio de dia - INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1 id, sub.userFk, util.dayEnd(sub.dated) timed, 'out' direction - FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id - WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow - AND tce.id IS NULL - GROUP BY wtc.userFk, DATE(wtc.timed) - ) sub - JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk - WHERE wtc.direction <> 'out'; - - INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) - SELECT @vCont:= @vCont + 1, sub.userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'in' - FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated - FROM workerTimeControl wtc - JOIN tmp.`user` w ON w.userFk = wtc.userFk - LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id - WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow - AND tce.id IS NULL - GROUP BY wtc.userFk, DATE(wtc.timed) - ) sub - JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk - WHERE wtc.direction <> 'out'; - - INSERT INTO tmp.workerTimeControl (id, userFk, timed, direction) - SELECT id, userFk, timed, direction - FROM tmp.workerTimeControlAux; - - UPDATE workerJourney wj - JOIN (SELECT sub.dated, userFk, SUM(NigthlyHours) NigthlyHours - FROM(SELECT (@vIsOdd := NOT @vIsOdd) isOdd, - IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd), - IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed), - IF(direction='in', @vDated := DATE(wtc.timed), @vDated ) dated, - wtc.userFk, - IF(UNIX_TIMESTAMP(timed)- @vLastTimed < vMaxTimePerDay, - vn.workerNigthlyHours_calculate(FROM_UNIXTIME(@vLastTimed), wtc.timed), - 0) NigthlyHours - FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction - FROM tmp.workerTimeControl wtc - LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id - WHERE wtc.timed BETWEEN vDatedFrom AND util.dayEnd(vDatedToTomorrow) - AND tce.id IS NULL - ORDER BY userFk, timed ASC - ) wtc - )sub - WHERE sub.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY userFk, sub.dated - )night ON night.userFk = wj.userFk AND night.dated = wj.dated - SET wj.nocturn = night.NigthlyHours - WHERE NOT wj.isPaid - AND NOT isUpdated - AND night.NigthlyHours <> 0; - - -- Horas téoricas y precio de la hora ordinaria - UPDATE workerJourney wj - JOIN postgresql.business_labour_payroll blp ON blp.business_id = wj.businessFk - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - SET wj.priceOrdinaryHour = (vMonthsByYear * blp.importepactado) / (vWeeksByYear * cl.hours_week), - wj.contractJourney = cl.hours_week / vDaysByWeek - WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT isUpdated; - - -- Precio Extras, Vacaciones y Nocturnas - UPDATE workerJourney wj - JOIN(SELECT MAX(w.dated), t.dated, w.holidayInc, w.nightInc, w.extraInc - FROM time t - JOIN workerHourPrice w ON w.dated <= t.dated - WHERE t.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY t.dated - ) sub ON sub.dated = wj.dated - SET wj.priceHolidayHour = wj.priceOrdinaryHour * sub.holidayInc, - wj.priceNocturnHour = wj.priceOrdinaryHour * sub.nightInc, - wj.priceExtraHour = wj.priceOrdinaryHour * sub.extraInc - WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT wj.isUpdated; - - -- Elimina el precio de las horas extras para los contratos parciales. - UPDATE workerJourney wj - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - SET wj.priceExtraHour = 0 - WHERE cl.isPartial - AND wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT wj.isUpdated; - - -- Ausencias - UPDATE workerJourney wj - JOIN businessCalendar bc ON bc.businessFk = wj.businessFk AND bc.dated = wj.dated - JOIN absenceType ab ON ab.id = bc.absenceTypeFk - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - SET wj.permission = ab.permissionRate * wj.contractJourney, - wj.contractJourney = IF(ab.permissionRate = 1, 0, ab.permissionRate) * wj.contractJourney - WHERE ab.permissionRate > 0 - AND wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT wj.isUpdated; - - -- Sábados / Domingos - UPDATE workerJourney - SET holiday = IF(DAYNAME(dated)='sábado', 0, total), - contractJourney = 0 - WHERE DAYNAME(dated) IN ('sábado', 'domingo') - AND dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR userFk = vWorkerFk) - AND NOT isPaid - AND NOT isUpdated; - - -- Festivos por centro de trabajo - UPDATE workerJourney wj - JOIN calendarHolidays ch ON ch.dated = wj.dated - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - AND bl.workcenter_id = ch.workcenterFk - SET wj.holiday = wj.total, - wj.permission = wj.contractJourney, - wj.contractJourney = 0 - WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT wj.isUpdated; - - -- Horas extras - UPDATE workerJourney - SET extra = lunch + total - contractJourney - WHERE dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR userFk = vWorkerFk) - AND NOT isPaid - AND NOT isUpdated; - - DROP TEMPORARY TABLE tmp.timeControlCalculate; - DROP TEMPORARY TABLE tmp.`user`; - DROP TEMPORARY TABLE tmp.timeControlError; - DROP TEMPORARY TABLE tmp.workerTimeControlAux; - DROP TEMPORARY TABLE tmp.workerTimeControl; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerJourney_replace__` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `workerJourney_replace__`(vDatedFrom DATE, vDatedTo DATE, vWorkerFk INT) -BEGIN -/** - * Actualiza la tabla workerJourney para que actue como caché permanente revisable de las jornadas laborales. - * @param vDatedFrom workerTimeControl - * @param vDatedTo workerTimeControl - * @param vWorkerFk, en caso de pasar 0 ó NULL se aplica a todos - */ - - DECLARE vDatedTimeTo DATETIME; - DECLARE vMaxTimePerDay INT; - DECLARE vMinHoursToBreak DECIMAL(10,2); - DECLARE vBreakHours DECIMAL(10,2); - DECLARE vMonthByYear INT; - DECLARE vWeeksByYear INT DEFAULT 52; - DECLARE vMonthsByYear INT DEFAULT 12; - DECLARE vDaysByWeek INT DEFAULT 5; - - SET vDatedTimeTo = util.dayEnd(vDatedTo); - - SELECT minHoursToBreak, breakHours, maxTimePerDay - INTO vMinHoursToBreak, vBreakHours, vMaxTimePerDay - FROM workerTimeControlConfig; - - DELETE FROM workerJourney - WHERE dated BETWEEN vDatedFrom AND vDatedTo - AND NOT isPaid - AND NOT isUpdated - AND (vWorkerFk IS NULL OR userFK = vWorkerFk); - - -- Se inserta todos los días del periodo por worker y business en el rango de fechas. - INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) - SELECT w.workerFk, t.dated, w.businessFk - FROM workerLabour w - JOIN time t ON t.dated BETWEEN w.started AND IFNULL(w.ended,CURDATE()) - WHERE t.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR w.workerFk = vWorkerFk) - ORDER BY w.workerFk, t.dated, w.businessFk; - - IF vWorkerFk THEN - CALL timeControl_calculateByUser(vWorkerFk, vDatedFrom , vDatedTimeTo); - ELSE - CALL timeControl_calculateAll(vDatedFrom, vDatedTimeTo); - END IF; - - UPDATE workerJourney wj - JOIN tmp.timeControlCalculate t ON wj.dated = t.dated AND wj.userFk = t.userFk - SET wj.total = CAST(IF(t.timeWorkDecimal >= vMinHoursToBreak, t.timeWorkDecimal - vBreakHours, t.timeWorkDecimal) AS DECIMAL (10,2)), - wj.lunch = IF(t.timeWorkDecimal >= vMinHoursToBreak , vBreakHours , 0) - WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo - AND NOT wj.isPaid - AND NOT wj.isUpdated - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk); - - -- NOCTURNIDAD - - SET @vIsOdd := TRUE; - SET @vDated := NULL; - CALL vn.workerTimeControl_calculateOddDays(); - - UPDATE workerJourney wj - JOIN (SELECT sub.dated, userFk, SUM(NigthlyHours) NigthlyHours - FROM(SELECT IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE), - IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd), - IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed), - IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated, - wtc.userFk, - IF(UNIX_TIMESTAMP(timed)- @vLastTimed < vMaxTimePerDay, - vn.workerNigthlyHours_calculate(FROM_UNIXTIME(@vLastTimed), wtc.timed), - 0) NigthlyHours - FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction - FROM workerTimeControl wtc - WHERE wtc.timed BETWEEN vDatedFrom AND util.dayEnd(DATE_ADD(vDatedTo, INTERVAL 1 DAY)) - ORDER BY userFk, timed ASC - ) wtc - )sub - LEFT JOIN tmp.workerTimeControlOddDays wo ON wo.workerFk = sub.userFk - AND wo.dated = sub.dated - WHERE sub.dated BETWEEN vDatedFrom AND vDatedTo - AND wo.workerFk IS NULL - GROUP BY userFk, sub.dated - )night ON night.userFk = wj.userFk AND night.dated = wj.dated - SET wj.nocturn = night.NigthlyHours - WHERE NOT wj.isPaid - AND NOT isUpdated - AND night.NigthlyHours <> 0; - - -- Horas téoricas y precio de la hora ordinaria - UPDATE workerJourney wj - JOIN postgresql.business_labour_payroll blp ON blp.business_id = wj.businessFk - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - SET wj.priceOrdinaryHour = (vMonthsByYear * blp.importepactado) / (vWeeksByYear * cl.hours_week), - wj.contractJourney = cl.hours_week / vDaysByWeek - WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT isUpdated; - - -- Precio Extras, Vacaciones y Nocturnas - UPDATE workerJourney wj - JOIN(SELECT MAX(w.dated), t.dated, w.holidayInc, w.nightInc, w.extraInc - FROM time t - JOIN workerHourPrice w ON w.dated <= t.dated - WHERE t.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY t.dated - ) sub ON sub.dated = wj.dated - SET wj.priceHolidayHour = wj.priceOrdinaryHour * sub.holidayInc, - wj.priceNocturnHour = wj.priceOrdinaryHour * sub.nightInc, - wj.priceExtraHour = wj.priceOrdinaryHour * sub.extraInc - WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT wj.isUpdated; - - -- Elimina el precio de las horas extras para los contratos parciales. - UPDATE workerJourney wj - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id - SET wj.priceExtraHour = 0 - WHERE cl.isPartial - AND wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT wj.isUpdated; - - -- Ausencias - UPDATE workerJourney wj - JOIN businessCalendar bc ON bc.businessFk = wj.businessFk AND bc.dated = wj.dated - JOIN absenceType ab ON ab.id = bc.absenceTypeFk - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - SET wj.permission = ab.permissionRate * wj.contractJourney, - wj.contractJourney = IF(ab.permissionRate = 1, 0, ab.permissionRate) * wj.contractJourney - WHERE ab.permissionRate > 0 - AND wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT wj.isUpdated; - - -- Sábados / Domingos - UPDATE workerJourney - SET holiday = IF(DAYNAME(dated)='sábado', 0, total), - contractJourney = 0 - WHERE DAYNAME(dated) IN ('sábado', 'domingo') - AND dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR userFk = vWorkerFk) - AND NOT isPaid - AND NOT isUpdated; - - -- Festivos por centro de trabajo - UPDATE workerJourney wj - JOIN calendarHolidays ch ON ch.dated = wj.dated - JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk - AND bl.workcenter_id = ch.workcenterFk - SET wj.holiday = wj.total, - wj.permission = wj.contractJourney, - wj.contractJourney = 0 - WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) - AND NOT wj.isPaid - AND NOT wj.isUpdated; - - -- Horas extras - UPDATE workerJourney - SET extra = lunch + total - contractJourney - WHERE dated BETWEEN vDatedFrom AND vDatedTo - AND (vWorkerFk IS NULL OR userFk = vWorkerFk) - AND NOT isPaid - AND NOT isUpdated; - - DROP TEMPORARY TABLE tmp.timeControlCalculate; - DROP TEMPORARY TABLE tmp.workerTimeControlOddDays; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerMistakeType_get` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistakeType_get`() -BEGIN - -/** - * Obtiene los tipos de error para los trabajadores - */ - - SELECT code, description - FROM workerMistakeType - ORDER BY description; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerMistake_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10), vUserFk INT ) -BEGIN - -/** - * Añade error al trabajador - * - * @param vWorkerFk id del trabajador al cual se le va a añadir error - * @param vWorkerMistakeTypeFk code del tipo de error - * @param vUserFk id del usuario que pone el error - * - */ - DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vUserFk); - - IF(account.user_hasRole(vWorkerName,'coolerBoss')) - THEN - INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk) - VALUES(vWorkerFk, vWorkerMistakeTypeFk); - ELSE - CALL util.throw('No tienes permisos para realizar la acción'); - - 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 `workerShelving_Add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerShelving_Add`(vWorkerFk INT, vBarcode VARCHAR(12)) -BEGIN -/* - * Inserta en workerShelving asociando los carros al trabajador - * @Param vWorkerFk es id del trabajador - * @Param vBarcode se puede pasar tanto el smarttag como el shelving - */ - DECLARE vIsShelvingFk BOOL; - - SELECT COUNT(*) > 0 INTO vIsShelvingFk - FROM vn.shelving s - WHERE s.code = vBarcode COLLATE utf8_general_ci; - - IF NOT vIsShelvingFk THEN - - SELECT st.shelvingFk INTO vBarcode - FROM vn.smartTag st - WHERE st.code = vBarcode COLLATE utf8_general_ci; - - END IF; - - INSERT INTO vn.workerShelving (workerFk, shelvingFk) - VALUES(vWorkerFk, vBarcode); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerShelving_delete` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerShelving_delete`(vWorkerFk INT, vBarcode VARCHAR(12)) -BEGIN -/* - * Borra de workerShelving el carro o etiqueta insertado por el trabajador - * @param vWorkerFk es id del trabajador - * @param vBarcode se puede pasar tanto el smarttag como el shelving - */ - DECLARE vIsShelvingFk BOOL; - - - SELECT COUNT(*) > 0 INTO vIsShelvingFk - FROM vn.shelving s - WHERE s.code = vBarcode COLLATE utf8_general_ci; - - - IF NOT vIsShelvingFk THEN - - SELECT st.shelvingFk INTO vBarcode - FROM vn.smartTag st - WHERE st.code = vBarcode COLLATE utf8_general_ci; - - END IF; - - DELETE FROM vn.workerShelving - WHERE shelvingFk = vBarcode COLLATE utf8_general_ci - AND workerFk = vWorkerFk ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControlAdd` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlAdd`(IN vUserFk INT, IN vWarehouseFk INT, IN vDated DATETIME) -BEGIN - - /*INSERT INTO workerTimeControl(userFk, timed, manual, warehouseFk) - VALUES(vUserFk, vDated, FALSE, vWarehouseFk); - - CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/ - - CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,NOW(),FALSE); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlNonDays__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlNonDays__`() -BEGIN - SET @cont := 0; - SELECT sub2.userFk, sub2.dated Fecha, CONCAT (w.firstName," ", w.lastName) worker, au.name Boss, d.name - FROM (SELECT userFk, - dated, - COUNT(*) cont2 - FROM (SELECT DATE(wtc.timed) dated, - userFk, - IFNULL(@cont, @cont := 0 ), - IF(direction = 'in', @cont:=@cont+1, TRUE), - @cont cont - FROM vn.workerTimeControl wtc - WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND CURDATE() - ORDER BY userFk, timed)sub - GROUP BY cont - HAVING cont2 MOD 2 = 1)sub2 - JOIN worker w ON w.userFk = sub2.userFk - LEFT JOIN worker wb ON wb.id = w.bossFk - LEFT JOIN account.user au ON au.id = wb.userFK - LEFT JOIN workerDepartment wd ON wd.workerFk = w.id - LEFT JOIN department d ON d.id = wd.departmentFk - ORDER BY Boss ASC; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControlPinGenerate` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlPinGenerate`( - vWorkerFk INT) -BEGIN -/** - * Create new pin for workerFk or new pin for all workers if vWorkerFk is null - * - */ - - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSetOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSetOrder`() -BEGIN - - SET @order := 1; - SET @userFk := 0; - SET @day := 0; - - UPDATE tmp.workerTimeControl - SET `order` = IF(userFk = @userFk AND day(timed) = @day, @order := @order + 1, @order := 1), - userFk = @userFk := userFk, - manual = manual + (0 * @day := day(timed)) - ORDER BY userFk, timed; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControlSetOrder_by_User_and_dateRange` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSetOrder_by_User_and_dateRange`(vUserFk INT, vStarted DATE, vFinished DATE) -BEGIN - - SET @order := 0; - SET @day := '2000-01-01'; - - UPDATE vn.workerTimeControl w - SET w.`order` = @order := IF(@day = @day := date(timed), @order, 0) + 1 - WHERE w.userFk = vUserFk - AND w.timed BETWEEN vStarted AND util.dayend(vFinished) - ORDER BY w.timed; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSOWP` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSOWP`(IN vUserFk INT, IN vDated DATE) -BEGIN - SET @order := 0; - - UPDATE workerTimeControl - SET `order` = @order := @order + 1 - WHERE vUserFk =userFk - AND vDated = DATE(timed) - ORDER BY timed; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_add` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_add`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL) -BEGIN - - - SELECT workerTimeControl_add(vUserFk,vWarehouseFk,vTimed,vIsManual); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_add__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_add__`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL) -BEGIN - - DECLARE vDirection VARCHAR(6); - DECLARE vLastIn DATETIME; - DECLARE vDayStayMax INT; - DECLARE vHasDirectionOut INT; - - SELECT dayStayMax INTO vDayStayMax - FROM vn.workerTimeControlParams; - - SELECT vn.timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; - - IF vDirection = 'out' THEN - - SELECT MAX(timed) INTO vLastIn - FROM vn.workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in' - AND timed < vTimed; - - UPDATE vn.workerTimeControl wtc - SET wtc.direction = 'middle' - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vLastIn AND vTimed; - - ELSE IF vDirection = 'in' THEN - - SELECT COUNT(*) INTO vHasDirectionOut - FROM vn.workerTimeControl wtc - WHERE userFk = vUserFk - AND direction = 'out' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - UPDATE vn.workerTimeControl wtc - SET wtc.direction = IF (vHasDirectionOut,'middle','out') - WHERE userFk = vUserFk - AND direction = 'in' - AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); - - END IF; - END IF; - - INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) - VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); - - CALL vn.workerTimeControlSOWP(vUserFk, vTimed); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_calculateOddDays` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_calculateOddDays`() -BEGIN -/* - * Calculo de las fichadas impares por empleado y dia - * @return tmp.workerTimeControlOddDays (userFk, dated) - */ - SET @cont := FALSE; - SET @lastUserFk:= NULL; - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlOddDays; - CREATE TEMPORARY TABLE tmp.workerTimeControlOddDays - SELECT sub2.userFk workerFk, sub2.dated - FROM (SELECT userFk, - dated, - COUNT(*) cont2 - FROM (SELECT DATE(wtc.timed) dated, - userFk, - IFNULL(@cont, @cont := TRUE ), - IF(direction = 'in' OR userFk <> @lastUserFk, @cont := @cont+1, TRUE), - @cont cont, - @lastUserFk := userFk - FROM workerTimeControl wtc - WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND util.dayEnd(CURDATE()) - ORDER BY userFk, timed)sub - GROUP BY cont - HAVING cont2 MOD 2 = 1)sub2 - JOIN worker w ON w.userFk = sub2.userFk; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControl_check` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) -proc: BEGIN -/** - * Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a workerTimeControlAdd - * - * @param vUserFk Identificador del trabajador - * @return Retorna si encuentra un problema 'odd','maxTimeWork','breakDay','breakWeek' ; - * En caso de tener algun problema retorna el primero que encuentra - */ - DECLARE vLastIn DATETIME ; - DECLARE vLastOut DATETIME ; - DECLARE vDayWorkMax INT; - DECLARE vDayBreak INT; - DECLARE vWeekBreak INT ; - DECLARE vWeekScope INT; - DECLARE vDayStayMax INT; - DECLARE vProblem VARCHAR(20) DEFAULT NULL; - DECLARE vTimedWorked INT; - DECLARE vCalendarStateType VARCHAR(20) DEFAULT NULL; - DECLARE vDepartmentFk INT; - DECLARE vTo VARCHAR(50) DEFAULT NULL; - DECLARE vUserName VARCHAR(50) DEFAULT NULL; - DECLARE vBody VARCHAR(255) DEFAULT NULL; - - SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax - INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax - FROM workerTimeControlParams; - - SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in'; - - SELECT MAX(timed) INTO vLastOut - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'out'; - - SELECT CONCAT(u.name,'@verdnatura.es') INTO vTo - FROM account.user u - WHERE u.id = (SELECT bossFk FROM worker WHERE id = vUserFk); - - SELECT CONCAT(firstName,' ',lastName) INTO vUserName - FROM worker w - WHERE w.id = vUserFk; - - - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA - - -- VERIFICAR DESCANSO DIARIO - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN - SELECT "Descansos 12 h" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - END IF; - - -- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ - IF (SELECT MOD(COUNT(*),2) -- <>0 - FROM workerTimeControl - WHERE userFk = vUserFk - AND timed >= vLastIn - ) THEN - SELECT "Dias con fichadas impares" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - END IF; - - -- VERIFICAR VACACIONES - SELECT cs.type INTO vCalendarStateType - FROM postgresql.calendar_employee ce - JOIN postgresql.business b USING(business_id) - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN postgresql.calendar_state cs USING(calendar_state_id) - JOIN worker w ON w.id = p.id_trabajador - WHERE ce.date = CURDATE() - AND cs.isAllowedToWork = FALSE - AND w.userFk = vUserFk - LIMIT 1; - - IF(LENGTH(vCalendarStateType)) THEN - SELECT vCalendarStateType AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - - END IF; - - - -- VERIFICAR CONTRATO EN VIGOR - IF (SELECT COUNT(*) - FROM postgresql.business b - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN worker w ON w.id = p.id_trabajador - WHERE w.userFk = vUserFk - AND b.date_start <= vDated - AND IFNULL(b.date_end,vDated) >= vDated - ) = 0 THEN - SELECT "No hay un contrato en vigor" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - - END IF; - - -- VERIFICAR DESCANSO SEMANAL - SET @vHasBreakWeek:= FALSE; - SET @vLastTimed:= UNIX_TIMESTAMP((NOW() - INTERVAL vWeekScope SECOND)); - - DROP TEMPORARY TABLE IF EXISTS tmp.trash; - CREATE TEMPORARY TABLE tmp.trash - SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, - @vLastTimed:= UNIX_TIMESTAMP(timed) - FROM workerTimeControl - WHERE timed>= (NOW() - INTERVAL vWeekScope SECOND) - AND userFk= vUserFk - AND direction IN ('in','out') - ORDER BY timed ASC; - - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA - SELECT "Descansos 36 h" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - END IF; - - DROP TEMPORARY TABLE tmp.trash; - - ELSE -- DIA ACTUAL - - -- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO - SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(NOW()), 0) INTO vTimedWorked - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND timed >= vLastIn - ORDER BY timed; - - IF vTimedWorked > vDayWorkMax THEN - SELECT "Jornadas" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Jornadas") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - END IF; - - END IF; - - -- VERIFICAR DEPARTAMENTO - /* IF vTabletFk IS NOT NULL THEN - SELECT wtcu.departmentFk INTO vDepartmentFk - FROM workerTimeControlUserInfo wtcu - WHERE wtcu.userFk = vUserFk; - IF (SELECT COUNT(td.tabletFk) - FROM tabletDepartment td - WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk - ) = 0 THEN - SELECT "No perteneces a este departamento." AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - 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 DROP PROCEDURE IF EXISTS `workerTimeControl_checkTest` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_checkTest`(vUserFk INT, vTimed DATETIME, vTabletFk VARCHAR(100)) -BEGIN - -/** - * Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a vn.workerTimeControlAdd - * @param vUserFk Identificador del trabajador - * @return Retorna si encuentra un problema 'odd','maxTimeWork','breakDay','breakWeek' ; - * En caso de tener algun problema retorna el primero que encuentra - */ - DECLARE vLastIn DATETIME ; - DECLARE vLastOut DATETIME ; - DECLARE vDayWorkMax INT; - DECLARE vDayBreak INT; - DECLARE vWeekBreak INT ; - DECLARE vWeekMaxBreak INT; - DECLARE vWeekScope INT; - DECLARE vWeekMaxScope INT; - DECLARE vDayStayMax INT; - DECLARE vAskInOut INT; - DECLARE vTimedWorked INT; - DECLARE vCalendarStateType VARCHAR(20) DEFAULT NULL; - DECLARE vDepartmentFk INT; - DECLARE vTo VARCHAR(50) DEFAULT NULL; - DECLARE vUserName VARCHAR(50) DEFAULT NULL; - DECLARE vBody VARCHAR(255) DEFAULT NULL; - - IF (vTimed IS NULL) THEN - SET vTimed = NOW(); - END IF; - - SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax, weekMaxBreak, weekMaxScope, askInOut - INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax, vWeekMaxBreak, vWeekMaxScope, vAskInOut - FROM vn.workerTimeControlParams; - - SELECT MAX(timed) INTO vLastIn - FROM vn.workerTimeControl - WHERE userFk = vUserFk AND - direction = 'in'; - - SELECT MAX(timed) INTO vLastOut - FROM vn.workerTimeControl - WHERE userFk = vUserFk AND - direction = 'out'; - - - SELECT email INTO vTo - FROM account.user w - WHERE w.id = (SELECT bossFk FROM vn.worker WHERE id = vUserFk); - - SELECT CONCAT(firstName,' ',lastName) INTO vUserName - FROM vn.worker w - WHERE w.id = vUserFk; - - -- VERIFICAR CONTRATO EN VIGOR - IF (SELECT COUNT(*) - FROM postgresql.business b - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN vn.worker w ON w.id = p.id_trabajador - WHERE w.userFk = vUserFk AND - b.date_start <= CURDATE() AND - IFNULL(b.date_end,CURDATE()) >= CURDATE() - ) = 0 THEN - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody; - CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); - CALL util.throw("No hay un contrato en vigor"); - END IF; - - -- VERIFICAR DEPARTAMENTO - /*IF vTabletFk IS NOT NULL THEN - IF ( SELECT COUNT(*) - FROM vn.tabletDepartment td - JOIN vn.workerTimeControlUserInfo wtcu ON wtcu.departmentFk = td.departmentFk - WHERE td.tabletFk = vTabletFk AND wtcu.userFk = vUserFk - ) = 0 THEN - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody; - CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); - CALL util.throw("No perteneces a este departamento."); - END IF; - END IF;*/ - - SELECT IFNULL(dayBreak, vDayBreak) INTO vDayBreak - FROM postgresql.business b - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN postgresql. business_labour bl ON b.business_id = bl.business_id - JOIN postgresql.professional_category pc ON bl.professional_category_id = pc.professional_category_id - WHERE p.id_trabajador = vUserFk AND - b.date_start <= DATE(vTimed) AND - IFNULL(b.date_end, DATE(vTimed)) >= DATE(vTimed); - -- VERIFICAR DESCANSO DIARIO - -- 12 / 9 horas dependiendo del valor de vDayBreak - IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos ", FORMAT(vDayBreak/3600,0) ," h") INTO vBody; - CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); - CALL util.throw(CONCAT("Descansos ", FORMAT(vDayBreak/3600,0) ," h")); - END IF; - - -- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ - IF (SELECT MOD(COUNT(*),2) -- <>0 - FROM vn.workerTimeControl - WHERE userFk = vUserFk AND - timed >= vLastIn - ) THEN - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody; - CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); - CALL util.throw("Dias con fichadas impares"); - END IF; - -- VERIFICAR VACACIONES - SELECT cs.type INTO vCalendarStateType - FROM postgresql.calendar_employee ce - JOIN postgresql.business b USING(business_id) - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN postgresql.calendar_state cs USING(calendar_state_id) - JOIN vn.worker w ON w.id = p.id_trabajador - WHERE ce.date = CURDATE() AND - cs.isAllowedToWork = FALSE AND - w.userFk = vUserFk - LIMIT 1; - - IF(LENGTH(vCalendarStateType)) THEN - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody; - CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); - CALL util.throw(vCalendarStateType); - END IF; - - -- VERIFICAR DESCANSO SEMANAL - SET @vHasBreakWeek:= FALSE; - SET @vLastTimed:= UNIX_TIMESTAMP((vTimed - INTERVAL vWeekScope SECOND)); - - DROP TEMPORARY TABLE IF EXISTS tmp.trash; - CREATE TEMPORARY TABLE tmp.trash - SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, - @vLastTimed:= UNIX_TIMESTAMP(timed) - FROM workerTimeControl - WHERE timed>= (vTimed - INTERVAL vWeekScope SECOND) AND - userFk= vUserFk AND - direction IN ('in','out') - ORDER BY timed ASC; - - IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA - SET @vHasBreakWeek:= FALSE; - SET @vLastTimed:= UNIX_TIMESTAMP((vTimed - INTERVAL vWeekMaxScope SECOND)); - DROP TEMPORARY TABLE tmp.trash; - CREATE TEMPORARY TABLE tmp.trash - SELECT IF(vWeekMaxBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, - @vLastTimed:= UNIX_TIMESTAMP(timed) - FROM workerTimeControl - WHERE timed>= (vTimed - INTERVAL vWeekMaxScope SECOND) AND - userFk= vUserFk AND - direction IN ('in','out') - ORDER BY timed ASC; - IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) < vWeekMaxBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos ", FORMAT(vWeekMaxBreak/3600,0) ," h") INTO vBody; - CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); - CALL util.throw(CONCAT( "Descansos ", FORMAT(vWeekMaxBreak/3600,0) ," h")); - END IF; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos ", FORMAT(vWeekBreak/3600,0) ," h") INTO vBody; - CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); - CALL util.warn(CONCAT( "Descansos ", FORMAT(vWeekBreak/3600,0) ," h")); - END IF; - DROP TEMPORARY TABLE tmp.trash; - - -- Preguntar dirección de la fichada - IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastIn) >= vAskInOut AND (SELECT MOD(COUNT(*),2) - FROM vn.workerTimeControl WHERE userFk = vUserFk AND timed >= vLastIn) THEN - CALL util.warn("AskInOut"); - 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 `workerTimeControl_check__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_check__`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) -proc: BEGIN -/** - * Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a workerTimeControlAdd - * - * @param vUserFk Identificador del trabajador - * @return Retorna si encuentra un problema 'odd','maxTimeWork','breakDay','breakWeek' ; - * En caso de tener algun problema retorna el primero que encuentra - */ - DECLARE vLastIn DATETIME ; - DECLARE vLastOut DATETIME ; - DECLARE vDayWorkMax INT; - DECLARE vDayBreak INT; - DECLARE vWeekBreak INT ; - DECLARE vWeekScope INT; - DECLARE vDayStayMax INT; - DECLARE vProblem VARCHAR(20) DEFAULT NULL; - DECLARE vTimedWorked INT; - DECLARE vCalendarStateType VARCHAR(20) DEFAULT NULL; - DECLARE vDepartmentFk INT; - DECLARE vTo VARCHAR(50) DEFAULT NULL; - DECLARE vUserName VARCHAR(50) DEFAULT NULL; - DECLARE vBody VARCHAR(255) DEFAULT NULL; - - SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax - INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax - FROM workerTimeControlParams; - - SELECT MAX(timed) INTO vLastIn - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'in'; - - SELECT MAX(timed) INTO vLastOut - FROM workerTimeControl - WHERE userFk = vUserFk - AND direction = 'out'; - - SELECT CONCAT(u.name,'@verdnatura.es') INTO vTo - FROM account.user u - WHERE u.id = (SELECT bossFk FROM worker WHERE id = vUserFk); - - SELECT CONCAT(firstName,' ',lastName) INTO vUserName - FROM worker w - WHERE w.id = vUserFk; - - - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA - - -- VERIFICAR DESCANSO DIARIO - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN - SELECT "Descansos 12 h" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - END IF; - - -- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ - IF (SELECT MOD(COUNT(*),2) -- <>0 - FROM workerTimeControl - WHERE userFk = vUserFk - AND timed >= vLastIn - ) THEN - SELECT "Dias con fichadas impares" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - END IF; - - -- VERIFICAR VACACIONES - SELECT cs.type INTO vCalendarStateType - FROM postgresql.calendar_employee ce - JOIN postgresql.business b USING(business_id) - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN postgresql.calendar_state cs USING(calendar_state_id) - JOIN worker w ON w.id = p.id_trabajador - WHERE ce.date = CURDATE() - AND cs.isAllowedToWork = FALSE - AND w.userFk = vUserFk - LIMIT 1; - - IF(LENGTH(vCalendarStateType)) THEN - SELECT vCalendarStateType AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - - END IF; - - - -- VERIFICAR CONTRATO EN VIGOR - IF (SELECT COUNT(*) - FROM postgresql.business b - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN worker w ON w.id = p.id_trabajador - WHERE w.userFk = vUserFk - AND b.date_start <= vDated - AND IFNULL(b.date_end,vDated) >= vDated - ) = 0 THEN - SELECT "No hay un contrato en vigor" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - - END IF; - - -- VERIFICAR DESCANSO SEMANAL - SET @vHasBreakWeek:= FALSE; - SET @vLastTimed:= UNIX_TIMESTAMP((NOW() - INTERVAL vWeekScope SECOND)); - - DROP TEMPORARY TABLE IF EXISTS tmp.trash; - CREATE TEMPORARY TABLE tmp.trash - SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, - @vLastTimed:= UNIX_TIMESTAMP(timed) - FROM workerTimeControl - WHERE timed>= (NOW() - INTERVAL vWeekScope SECOND) - AND userFk= vUserFk - AND direction IN ('in','out') - ORDER BY timed ASC; - - IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA - SELECT "Descansos 36 h" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - END IF; - - DROP TEMPORARY TABLE tmp.trash; - - ELSE -- DIA ACTUAL - - -- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO - SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(NOW()), 0) INTO vTimedWorked - FROM workerTimeControl wtc - WHERE userFk = vUserFk - AND timed >= vLastIn - ORDER BY timed; - - IF vTimedWorked > vDayWorkMax THEN - SELECT "Jornadas" AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Jornadas") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - END IF; - - END IF; - - -- VERIFICAR DEPARTAMENTO - IF vTabletFk IS NOT NULL THEN - SELECT wtcu.departmentFk INTO vDepartmentFk - FROM workerTimeControlUserInfo wtcu - WHERE wtcu.userFk = vUserFk; - IF (SELECT COUNT(td.tabletFk) - FROM tabletDepartment td - WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk - ) = 0 THEN - SELECT "No perteneces a este departamento." AS problem; - -- ENVIAMOS CORREO AL BOSSFK - SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody; - CALL mail_insert(vTo,vTo,'error al fichar',vBody); - LEAVE proc; - 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 DROP PROCEDURE IF EXISTS `workerTimeControl_clockIn` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`(vWorker INT, vTimed DATETIME, vDirection VARCHAR(10)) -BEGIN -/** - * Verifica si el empleado puede fichar - * @param vWorker Identificador del trabajador - * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW() - * @param vDirection solo se pueden pasa los valores del campo workerTimeControl.direction ENUM('in', 'out', 'middle') - * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. Si hay algún problema, devuelve el mesaje a que se debe mostrar al usuario - * Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá fichada a la tabla vn.workerTimeControl - */ - DECLARE vLastIn DATETIME; - DECLARE vLastOut DATETIME; - DECLARE vNextIn DATETIME; - DECLARE vLastDirection VARCHAR(6); - DECLARE vNextDirection VARCHAR(6); - DECLARE vDayBreak INT; - DECLARE vShortWeekBreak INT; - DECLARE vLongWeekBreak INT; - DECLARE vWeekScope INT; - DECLARE vGap INT; - DECLARE vMailTo VARCHAR(50) DEFAULT NULL; - DECLARE vUserName VARCHAR(50) DEFAULT NULL; - DECLARE vIsError BOOLEAN DEFAULT FALSE; - DECLARE vErrorMessage VARCHAR(255) DEFAULT NULL; - DECLARE vErrorCode VARCHAR(50); - DECLARE vDated DATE; - DECLARE vIsAllowedToWork VARCHAR(50); - DECLARE vDepartmentFk INT; - DECLARE vTimedLoop INT; - DECLARE vTimedLoopPrevious INT; - DECLARE vHasBreakWeek BOOLEAN DEFAULT FALSE; - DECLARE vManual BOOLEAN DEFAULT TRUE; - DECLARE vDone INT DEFAULT FALSE; - - DECLARE vCursor CURSOR FOR - SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) - UNION - SELECT UNIX_TIMESTAMP(NOW()) - UNION - (SELECT UNIX_TIMESTAMP(timed) - FROM workerTimeControl - WHERE timed BETWEEN (vTimed - INTERVAL vGap SECOND) AND vTimed AND - userFk = vWorker AND - direction IN ('in', 'out') - ORDER BY timed ASC); - - DECLARE vCursor2 CURSOR FOR - SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) - UNION - SELECT UNIX_TIMESTAMP(NOW()) - UNION - SELECT UNIX_TIMESTAMP(timed) - FROM workerTimeControl - WHERE timed BETWEEN vTimed AND (vTimed - INTERVAL vGap SECOND) AND - userFk = vWorker AND - direction IN ('in', 'out') - ORDER BY timed ASC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLSTATE '45000' - BEGIN - - SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT(w.firstName, ' ', w.lastName) - INTO vMailTo, vUserName - FROM account.user u - JOIN worker w ON w.bossFk = u.id - WHERE w.id = vWorker; - - CASE vErrorCode - WHEN 'IS_NOT_ALLOWED_FUTURE' THEN - SELECT 'No se permite fichar a futuro' INTO vErrorMessage; - WHEN 'INACTIVE_BUSINESS' THEN - SELECT 'No hay un contrato en vigor' INTO vErrorMessage; - WHEN 'IS_NOT_ALLOWED_WORK' THEN - SELECT 'No está permitido trabajar' INTO vErrorMessage; - WHEN 'ODD_WORKERTIMECONTROL' THEN - SELECT 'Fichadas impares' INTO vErrorMessage; - WHEN 'BREAK_DAY' THEN - SELECT CONCAT('Descanso diario ', FORMAT(vDayBreak/3600, 0) , 'h.') INTO vErrorMessage; - WHEN 'BREAK_WEEK' THEN - SELECT CONCAT('Descanso semanal ', - FORMAT(vShortWeekBreak / 3600,0) ,'h. / ', - FORMAT(vLongWeekBreak / 3600, 0) ,'h.') INTO vErrorMessage; - WHEN 'WRONG_DIRECTION' THEN - SELECT 'Dirección incorrecta' INTO vErrorMessage; - ELSE - SELECT 'Error sin definir'INTO vErrorMessage; - END CASE; - - SELECT vErrorMessage `error`; - SELECT CONCAT(vUserName, ' no ha podido fichar por el siguiente problema: ', vErrorMessage) INTO vErrorMessage; - CALL mail_insert( vMailTo, vMailTo, 'Error al fichar', vErrorMessage); - - END; - - IF (vTimed IS NULL) THEN - SET vTimed = NOW(); - SET vManual = FALSE; - END IF; - - SET vDated = DATE(vTimed); - - SELECT IF(pc.category_name = 'Conductor +3500kg', wc.dayBreakDriver, wc.dayBreak), - wc.shortWeekBreak, - wc.longWeekBreak, - wc.weekScope - INTO vDayBreak, - vShortWeekBreak, - vLongWeekBreak, - vWeekScope - FROM workerLabour w - JOIN postgresql.business_labour bl ON bl.business_id = w.businessFk - JOIN postgresql.professional_category pc ON pc.professional_category_id = bl.professional_category_id - JOIN workerTimeControlConfig wc ON TRUE - WHERE w.workerFk = vWorker - AND vDated BETWEEN w.started AND IFNULL(w.ended, vDated); - - SELECT timed INTO vLastIn - FROM workerTimeControl - WHERE userFk = vWorker - AND direction = 'in' - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - SELECT timed INTO vLastOut - FROM workerTimeControl - WHERE userFk = vWorker - AND direction = 'out' - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - SELECT timed INTO vNextIn - FROM workerTimeControl - WHERE userFk = vWorker - AND direction = 'in' - AND timed > vTimed - ORDER BY timed ASC - LIMIT 1; - - SELECT direction INTO vNextDirection - FROM workerTimeControl - WHERE userFk = vWorker - AND timed > vTimed - ORDER BY timed ASC - LIMIT 1; - - SELECT direction INTO vLastDirection - FROM workerTimeControl - WHERE userFk = vWorker - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - -- FICHADAS A FUTURO - IF vTimed > DATE_ADD(NOW(), INTERVAL 60 SECOND) THEN - SET vErrorCode = 'IS_NOT_ALLOWED_FUTURE'; - CALL util.throw(vErrorCode); - END IF; - - -- CONTRATO EN VIGOR - IF vDayBreak IS NULL THEN - SET vErrorCode = 'INACTIVE_BUSINESS'; - CALL util.throw(vErrorCode); - END IF; - - -- VERIFICAR SI ESTÁ PERMITIDO TRABAJAR - CALL timeBusiness_calculateByWorker(vWorker, vDated, vDated); - SELECT isAllowedToWork INTO vIsAllowedToWork - FROM tmp.timeBusinessCalculate; - DROP TEMPORARY TABLE tmp.timeBusinessCalculate; - - IF NOT vIsAllowedToWork THEN - SET vErrorCode = 'IS_NOT_ALLOWED_WORK'; - CALL util.throw(vErrorCode); - END IF; - - -- DIRECCION CORRECTA - CALL vn.workerTimeControl_direction(vWorker, vTimed); - IF (SELECT IF(IF(option1 IN ('inMiddle', 'outMiddle'), 'middle', option1) <> vDirection - AND IF(option2 IN ('inMiddle', 'outMiddle'), 'middle', IFNULL(option2, '')) <> vDirection, TRUE , FALSE) - FROM tmp.workerTimeControlDirection) THEN - SET vIsError = TRUE; - END IF; - - DROP TEMPORARY TABLE tmp.workerTimeControlDirection; - IF vIsError = TRUE THEN - SET vErrorCode = 'WRONG_DIRECTION'; - CALL util.throw(vErrorCode); - END IF; - - -- FICHADAS IMPARES - IF (SELECT IF(vDirection = 'in', MOD(COUNT(*), 2) , IF (vDirection = 'out', NOT MOD(COUNT(*), 2), FALSE)) - FROM workerTimeControl - WHERE userFk = vWorker - AND timed BETWEEN vLastIn AND vTimed - ) THEN - SET vErrorCode = 'ODD_WORKERTIMECONTROL'; - CALL util.throw(vErrorCode); - END IF; - - -- DESCANSO DIARIO - CASE vDirection - WHEN 'in' THEN - IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) <= vDayBreak THEN - SET vIsError = TRUE; - END IF; - WHEN 'out' THEN - IF UNIX_TIMESTAMP(vNextIn) - UNIX_TIMESTAMP(vTimed) <= vDayBreak THEN - SET vIsError = TRUE; - END IF; - ELSE BEGIN END; - END CASE; - - IF vIsError THEN - SET vErrorCode = 'BREAK_DAY'; - CALL util.throw(vErrorCode); - END IF; - - -- VERIFICAR DESCANSO SEMANAL - IF (vDirection IN('in', 'out')) THEN - -- VERIFICA DESCANSO CORTO EN LA ÚLTIMA SEMANA - SET vGap = vWeekScope; - SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND)); - SET vDone = FALSE; - OPEN vCursor; - l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN - LEAVE l; - END IF; - IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN - SET vHasBreakWeek = TRUE; - LEAVE l; - END IF; - SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; - -- VERIFICA DESCANSO LARGO EN LA ÚLTIMAS 2 SEMANAS - IF NOT vHasBreakWeek THEN - SET vGap = vWeekScope * 2; - SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND)); - SET vDone = FALSE; - OPEN vCursor; - l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN - LEAVE l; - END IF; - IF vLongWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN - SET vHasBreakWeek = TRUE; - LEAVE l; - END IF; - SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; - END IF; - - IF vManual THEN - -- VERIFICA DESCANSO CORTO EN LA PRÓXIMA SEMANA - SET vGap = vWeekScope; - SET vTimedLoopPrevious = vTimed; - SET vDone = FALSE; - OPEN vCursor; - l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN - LEAVE l; - END IF; - IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN - SET vHasBreakWeek = TRUE; - LEAVE l; - END IF; - SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; - -- VERIFICA DESCANSO LARGO EN LAS PRÓXIMAS 2 SEMANAS - IF NOT vHasBreakWeek THEN - SET vGap = vWeekScope * 2; - SET vTimedLoopPrevious = vTimed; - SET vDone = FALSE; - OPEN vCursor; - l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN - LEAVE l; - END IF; - IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN - SET vHasBreakWeek = TRUE; - LEAVE l; - END IF; - SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; - END IF; - END IF; - IF NOT vHasBreakWeek THEN - SET vErrorCode = 'BREAK_WEEK'; - CALL util.throw(vErrorCode); - END IF; - END IF; - - -- SE PERMITE FICHAR - INSERT INTO workerTimeControl(userFk, timed, direction, manual) - VALUES(vWorker, vTimed, vDirection, vManual); - - 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 `workerTimeControl_direction` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `workerTimeControl_direction`(vWorkerFk VARCHAR(10), vTimed DATETIME) -BEGIN -/** - * Devuelve que direcciones de fichadas son lógicas a partir de la anterior fichada - * @param vWorkerFk Identificador del trabajador - * @return (option1, option2) - * Los valores posibles de retorno son ('in', 'inMiddle', 'outMiddle', 'out') - */ - DECLARE vLastIn DATETIME ; - DECLARE vIsMiddleOdd BOOLEAN ; - - IF (vTimed IS NULL) THEN - SET vTimed = NOW(); - END IF; - - SELECT timed INTO vLastIn - FROM workerTimeControl - WHERE userFk = vWorkerFk - AND direction = 'in' - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - SELECT (COUNT(*)mod 2 = 1) INTO vIsMiddleOdd - FROM workerTimeControl - WHERE userFk = vWorkerFk - AND direction = 'middle' - AND timed BETWEEN vLastIn AND NOW(); - - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection; - CREATE TEMPORARY TABLE tmp.workerTimeControlDirection - SELECT IF(isCorrect, option1, NULL) option1, - IF(isCorrect, option2, NULL) option2 - FROM( SELECT IF(w.direction <> 'out' AND (UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(w.timed) > wc.dayBreak), FALSE, TRUE) isCorrect, - CASE WHEN w.direction ='in' THEN 'inMiddle' - WHEN w.direction = 'out' THEN 'in' - WHEN w.direction = 'middle' AND vIsMiddleOdd THEN 'outMiddle' - WHEN w.direction IS NULL THEN 'in' - ELSE 'inMiddle' - END option1, - CASE WHEN w.direction ='in' THEN 'out' - WHEN w.direction = 'out' THEN NULL - WHEN w.direction = 'middle' AND vIsMiddleOdd THEN NULL - WHEN w.direction IS NULL THEN NULL - ELSE 'out' - END option2 - FROM workerTimeControl w - JOIN workerTimeControlConfig wc ON TRUE - WHERE w.timed <= vTimed - AND w.userFk = vWorkerFk - ORDER BY w.timed DESC - LIMIT 1)sub; - - IF (SELECT IF(COUNT(*)=0, TRUE, FALSE) FROM tmp.workerTimeControlDirection ) THEN - INSERT INTO tmp.workerTimeControlDirection (option1, option2) - VALUES('in', 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 */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_direction__` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `workerTimeControl_direction__`(vWorkerFk VARCHAR(10), vTimed DATETIME) -BEGIN -/** - * Devuelve que direcciones de fichadas son lógicas a partir de la anterior fichada - * @param vWorkerFk Identificador del trabajador - * @return (option1, option2) - * Los valores posibles de retorno son ('in', 'inMiddle', 'outMiddle', 'out') - */ - DECLARE vLastIn DATETIME ; - DECLARE vIsMiddleOdd BOOLEAN ; - - IF (vTimed IS NULL) THEN - SET vTimed = NOW(); - END IF; - - SELECT timed INTO vLastIn - FROM workerTimeControl - WHERE userFk = vWorkerFk - AND direction = 'in' - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - SELECT (COUNT(*)mod 2 = 1) INTO vIsMiddleOdd - FROM workerTimeControl - WHERE userFk = vWorkerFk - AND direction = 'middle' - AND timed BETWEEN vLastIn AND NOW(); - - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection; - - CREATE TEMPORARY TABLE tmp.workerTimeControlDirection - SELECT CASE WHEN w.direction ='in' THEN 'inMiddle' - WHEN w.direction = 'out' THEN 'in' - WHEN w.direction = 'middle' AND vIsMiddleOdd THEN 'outMiddle' - WHEN w.direction IS NULL THEN 'in' - ELSE 'inMiddle' - END option1, - CASE WHEN w.direction ='in' THEN 'out' - WHEN w.direction = 'out' THEN NULL - WHEN w.direction = 'middle' AND vIsMiddleOdd THEN NULL - WHEN w.direction IS NULL THEN NULL - ELSE 'out' - END option2 - FROM workerTimeControl w - WHERE w.timed <= vTimed - AND w.userFk = vWorkerFk - ORDER BY w.timed DESC - LIMIT 1; - - IF (SELECT IF(COUNT(*)=0, TRUE, FALSE) FROM tmp.workerTimeControlDirection ) THEN - INSERT INTO tmp.workerTimeControlDirection (option1, option2) - VALUES('in', 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 */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_getClockIn` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_getClockIn`(vUserFk INT, vDated DATE) -BEGIN - -/** - * Muestra una tabla con los 7 días inmediatamente anteriores a la fecha proporcionada - * y las fichadas de cada dia, en columnas por día - * - */ - - CALL workerTimeControl_setOrder(vUserFk,TIMESTAMPADD(DAY,-8,vDated),vDated); - - DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming; - CREATE TEMPORARY TABLE tmp.workerWeekTiming - SELECT orden `orden`, - max(hace7dias) 7_dias_antes, - max(hace6dias) 6_dias_antes, - max(hace5dias) 5_dias_antes, - max(hace4dias) 4_dias_antes, - max(hace3dias) 3_dias_antes, - max(antesdeayer) 2_dias_antes, - max(ayer) 1_dia_antes, - max(hoy) mismo_dia - FROM - ( - SELECT IF(dias = 7, fichada, '') as hace7dias, - IF(dias = 6, fichada, '') as hace6dias, - IF(dias = 5, fichada, '') as hace5dias, - IF(dias = 4, fichada, '') as hace4dias, - IF(dias = 3, fichada, '') as hace3dias, - IF(dias = 2, fichada, '') as antesdeayer, - IF(dias = 1, fichada, '') as ayer, - IF(dias = 0, fichada, '') as hoy, - orden - - FROM - ( - SELECT `order` as orden, datediff(vDated, timed) as dias, date(timed) as fecha, TIME_FORMAT(timed,'%H:%i') as fichada - FROM vn.workerTimeControl wtc - WHERE userFk = vUserFk - AND timed >= TIMESTAMPADD(DAY, -7, vDated) - ) sub - )sub2 - GROUP BY orden; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming_Aux; - CREATE TEMPORARY TABLE tmp.workerWeekTiming_Aux - SELECT * FROM tmp.workerWeekTiming; - - INSERT INTO tmp.workerWeekTiming( 7_dias_antes, 6_dias_antes, 5_dias_antes, 4_dias_antes, 3_dias_antes, 2_dias_antes, 1_dia_antes, mismo_dia) - VALUES('total','','','','','','',''); - - INSERT INTO tmp.workerWeekTiming( orden, 7_dias_antes, 6_dias_antes, 5_dias_antes, 4_dias_antes, 3_dias_antes, 2_dias_antes, 1_dia_antes, mismo_dia) - SELECT 0, - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(7_dias_antes), TIME_TO_SEC(7_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(6_dias_antes), TIME_TO_SEC(6_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(5_dias_antes), TIME_TO_SEC(5_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(4_dias_antes), TIME_TO_SEC(4_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(3_dias_antes), TIME_TO_SEC(3_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(2_dias_antes), TIME_TO_SEC(2_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(1_dia_antes), TIME_TO_SEC(1_dia_antes)))),'%H:%i'),''), - '' - FROM tmp.workerWeekTiming_Aux; - - INSERT INTO tmp.workerWeekTiming_Aux( orden, 1_dia_antes) - SELECT 0, ROUND(( - IFNULL(TIME_TO_SEC(7_dias_antes),0) + - IFNULL(TIME_TO_SEC(6_dias_antes),0) + - IFNULL(TIME_TO_SEC(5_dias_antes),0) + - IFNULL(TIME_TO_SEC(4_dias_antes),0) + - IFNULL(TIME_TO_SEC(3_dias_antes),0) + - IFNULL(TIME_TO_SEC(2_dias_antes),0) + - IFNULL(TIME_TO_SEC(1_dia_antes),0) - ) / 3600,1) - FROM tmp.workerWeekTiming - WHERE orden = 0; - - - INSERT INTO tmp.workerWeekTiming( 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes,mismo_dia) - SELECT '','','','','','',1_dia_antes,'' - FROM tmp.workerWeekTiming_Aux - WHERE orden = 0; - - SELECT 7_dias_antes, 6_dias_antes, 5_dias_antes, 4_dias_antes, 3_dias_antes, 2_dias_antes, 1_dia_antes, mismo_dia FROM tmp.workerWeekTiming; - - DROP TEMPORARY TABLE tmp.workerWeekTiming; - DROP TEMPORARY TABLE tmp.workerWeekTiming_Aux; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControl_login` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_login`(vWorkerFk VARCHAR(10)) -BEGIN -/** - * Consulta la información del usuario y los botones que tiene que activar en la tablet tras hacer login - * Solo retornará 1 ó 2 opciones de las 4 posibles - * @param vWorkerFk Identificador del trabajador - * @return (name, surname, userFk, departmentFk, button1, button2) - * Los valores posibles para button son ('in', 'inMiddle', 'outMiddle', 'out') - */ - CALL vn.workerTimeControl_direction(vWorkerFk, NOW()); - - SELECT wi.name, - wi.surname, - wi.userFk, - wi.departmentFk, - w.option1 button1, - w.option2 button2 - FROM workerTimeControlUserInfo wi - JOIN tmp.workerTimeControlDirection w - WHERE wi.userFk = vWorkerFk - LIMIT 1; - - DROP TEMPORARY TABLE tmp.workerTimeControlDirection; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControl_remove` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_remove`(IN vUserFk INT, IN vTimed DATETIME) -BEGIN - - DECLARE vDirectionRemove VARCHAR(6); - DECLARE vDirectionPrevious VARCHAR(6); - DECLARE vTimedPrevious DATETIME; - - SELECT direction INTO vDirectionRemove - FROM vn.workerTimeControl - WHERE userFk = vUserFk - AND timed = vTimed ; - - IF vDirectionRemove = 'out' THEN - - SELECT timed, direction INTO vTimedPrevious, vDirectionPrevious - FROM vn.workerTimeControl - WHERE userFk = vUserFk - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - IF vDirectionPrevious = "middle" THEN - UPDATE vn.workerTimeControl - SET direction = "out" - WHERE userFk = vUserFk - AND timed = vTimedPrevious; - END IF; - - ELSE IF vDirectionRemove = 'in' THEN - - UPDATE vn.workerTimeControl - SET direction = "in" - WHERE userFk = vUserFk - AND timed > vTimed - ORDER BY timed ASC - LIMIT 1; - END IF; - - END IF; - - DELETE FROM vn.workerTimeControl - WHERE userFk = vUserFk - AND timed = vTimed; - - CALL vn.workerTimeControlSOWP(vUserFk, vTimed); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_repair` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_repair`() -proc: BEGIN -/** - * Corrige las fichadas - * - */ - -/*1- poner todos a middle*/ -UPDATE vn.workerTimeControl SET direction = 'middle'; - -/*2- poner los out*/ -UPDATE vn.workerTimeControl wtc - JOIN - (SELECT userFk,MAX(timed) maxTimed FROM - (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub - GROUP BY userFk,dated - )sub - SET direction = "out" - WHERE wtc.userFk = sub.userFk - AND wtc.timed = sub.maxTimed; - - /*3- poner los in*/ -UPDATE vn.workerTimeControl wtc - JOIN - (SELECT userFk,MIN(timed) maxTimed FROM - (SELECT id, userFk, timed, date(timed) dated - FROM vn.workerTimeControl - ) sub - GROUP BY userFk,dated - )sub - SET direction = "in" - WHERE wtc.userFk = sub.userFk - AND wtc.timed = sub.maxTimed ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControl_sendMail` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMail`(vWeek INT, vYear INT, vWorkerFk INT) -BEGIN -/** - * Inserta en la tabla vn.mail para notificar a los empleados que teletrabajan de las jornadas que se han registrado. - * Inserta fichadas en el casos que se determina que el empleado está realizando teletrabajo - * - * @param vWeek - * @param vYear - * @param vWorkerFk -> En el caso de querer generarlo para todos los empleados deberá de informarse como NULL - */ - DECLARE vStarted VARCHAR(25); - DECLARE vEnded VARCHAR(25); - DECLARE vDone BOOL; - DECLARE vReceiver VARCHAR(255); - DECLARE vReceiverOld VARCHAR(255); - DECLARE vDated DATE; - DECLARE vTimeWorkDecimal DECIMAL(5,2); - DECLARE vTimeWorkSexagesimal VARCHAR(5); - DECLARE vTimeWorkedDecimal DECIMAL(5,2); - DECLARE vTimeWorkedSexagesimal VARCHAR(5); - DECLARE vTimeWorkDecimalTotal DECIMAL(5,2); - DECLARE vTimeTable VARCHAR(100); - DECLARE vTimeTableDecimal DECIMAL(5,2); - DECLARE vWorkerFkOld INTEGER; - DECLARE vBusinessFk INTEGER; - DECLARE vHeader TEXT; - DECLARE vBody TEXT; - DECLARE vFooter TEXT; - DECLARE vReturn INTEGER; - DECLARE vAbsenceType VARCHAR(50); - DECLARE vWorkerInfo VARCHAR(90); - DECLARE vPermissionRate DECIMAL(5,2); - DECLARE vIsTeleworking BOOL; - DECLARE vIsTeleworkingOld BOOL; - - DECLARE vCursor CURSOR FOR - SELECT CONCAT(u.name, '@verdnatura.es'), u.id, tb.dated, tb.timeWorkDecimal, LEFT(tb.timeWorkSexagesimal,5) timeWorkSexagesimal, - tb.timeTable, tc.timeWorkDecimal timeWorkedDecimal, LEFT(tc.timeWorkSexagesimal,5) timeWorkedSexagesimal, tb.type, tb.businessFk,tb.permissionRate, d.isTeleworking - FROM tmp.timeBusinessCalculate tb - JOIN user u ON u.id = tb.userFk - JOIN department d ON d.id = tb.departmentFk - JOIN postgresql.business b ON b.business_id = tb.businessFk - JOIN company c ON c.id = b.provider_id - LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated - JOIN (SELECT tb.userFk, - SUM(IF(tb.type IS NULL, - IF(tc.timeWorkDecimal > 0, FALSE, IF(tb.timeWorkDecimal > 0, TRUE, FALSE)), - TRUE))isTeleworkingWeek - FROM tmp.timeBusinessCalculate1 tb - LEFT JOIN tmp.timeControlCalculate1 tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated - GROUP BY tb.userFk - HAVING isTeleworkingWeek > 0 - )sub ON sub.userFk = u.id - WHERE d.hasToRefill AND - IFNULL(vWorkerFk,u.id) = u.id AND - c.code = 'VNL' - ORDER BY u.id, tb.dated; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DROP TABLE IF EXISTS tmp.timeControlCalculate; - DROP TABLE IF EXISTS tmp.timeBusinessCalculate; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; - DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate; - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate1; - DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate1; - - SELECT CONCAT (MIN(dated), ' 00:00:00'), CONCAT (MAX(dated), ' 23:59:59') INTO vStarted, vEnded - FROM time - WHERE year = vYear AND - week = vWeek; - - DELETE FROM workerTimeControl - WHERE IFNULL(vWorkerFk, userFk) = userFk AND - timed BETWEEN vStarted AND vEnded AND - isSendMail; - - UPDATE workerTimeControlMail - SET updated = NOW(), state = 'SENDED' - WHERE year = vYear AND - week = vWeek AND - IFNULL(vWorkerFk, workerFk) = workerFk ; - - IF vWorkerFk IS NULL THEN - CALL timeControl_calculateAll(vStarted,vEnded); - CALL timeBusiness_calculateAll(vStarted,vEnded); - ELSE - CALL timeControl_calculateByUser(vWorkerFk,vStarted,vEnded); - CALL timeBusiness_calculateByUser(vWorkerFk,vStarted,vEnded); - END IF; - - CREATE TEMPORARY TABLE tmp.timeControlCalculate1 - SELECT * FROM tmp.timeControlCalculate; - CREATE TEMPORARY TABLE tmp.timeBusinessCalculate1 - SELECT * FROM tmp.timeBusinessCalculate; - - SET vTimeWorkDecimalTotal = 0; - SET vBody= ''; - OPEN vCursor; - FETCH vCursor INTO vReceiver, vWorkerFk, vDated, vTimeWorkDecimal, vTimeWorkSexagesimal, vTimeTable, vTimeWorkedDecimal, vTimeWorkedSexagesimal, vAbsenceType, vBusinessFk, vPermissionRate, vIsTeleworking ; - SET vWorkerFkOld = vWorkerFk ; - SET vReceiverOld = vReceiver; - SET vIsTeleworkingOld = vIsTeleworking; -proc: LOOP - IF vDone THEN - LEAVE proc; - END IF; - - IF vTimeWorkDecimal>0 AND vTimeWorkedDecimal IS NULL AND IFNULL(vPermissionRate, TRUE) THEN - IF vTimeTable IS NULL THEN - INSERT INTO workerTimeControl (userFk, timed, manual, direction, isSendMail) - SELECT vWorkerFk, CONCAT(vDated,' 08:00'), TRUE, 'in', TRUE; - IF vTimeWorkDecimal >= 5 THEN - INSERT INTO workerTimeControl (userFk, timed, manual, direction, isSendMail) - SELECT vWorkerFk, CONCAT(vDated,' 09:00'), TRUE, 'middle', TRUE; - INSERT INTO workerTimeControl (userFk, timed, manual, direction, isSendMail) - SELECT vWorkerFk, CONCAT(vDated,' 09:20'), TRUE, 'middle', TRUE; - END IF; - INSERT INTO workerTimeControl (userFk, timed, manual, direction, isSendMail) - SELECT vWorkerFk,CONCAT(vDated,' ', LEFT (SEC_TO_TIME(28800 + (vTimeWorkDecimal * 3600)), 5)), TRUE, 'out', TRUE; - ELSE - SELECT SUM(TIME_TO_SEC(j.end)-TIME_TO_SEC(j.start))/3600 INTO vTimeTableDecimal - FROM postgresql.journey j - WHERE j.business_id = vBusinessFk AND - j.day_id = WEEKDAY(vDated)+1; - IF vTimeWorkDecimal = vTimeTableDecimal THEN - INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) - SELECT vWorkerFk, CONCAT(vDated, ' ', j.start), TRUE, TRUE - FROM postgresql.journey j - WHERE j.business_id = vBusinessFk AND - j.day_id = WEEKDAY(vDated)+1; - - INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) - SELECT vWorkerFk, CONCAT(vDated, ' ', j.end), TRUE, TRUE - FROM postgresql.journey j - WHERE j.business_id = vBusinessFk AND - j.day_id = WEEKDAY(vDated)+1; - ELSE - INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) - SELECT vWorkerFk, CONCAT(vDated, ' ', MIN(j.start)), TRUE, TRUE - FROM postgresql.journey j - WHERE j.business_id = vBusinessFk AND - j.day_id = WEEKDAY(vDated)+1; - INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) - SELECT vWorkerFk, CONCAT(vDated, ' ', SEC_TO_TIME(TIME_TO_SEC(MIN(j.start)) + (vTimeWorkDecimal * 3600))), TRUE, TRUE - FROM postgresql.journey j - WHERE j.business_id = vBusinessFk AND - j.day_id = WEEKDAY(vDated)+1; - END IF; - - IF vTimeWorkDecimal >= 5 THEN - INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) - SELECT vWorkerFk, CONCAT(vDated, ' ', SEC_TO_TIME(TIME_TO_SEC(MIN(j.start)) + 3600)), TRUE, TRUE - FROM postgresql.journey j - WHERE j.business_id = vBusinessFk AND - j.day_id = WEEKDAY(vDated)+1; - INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) - SELECT vWorkerFk, CONCAT(vDated, ' ', SEC_TO_TIME(TIME_TO_SEC(MIN(j.start)) + 4800)), TRUE, TRUE - FROM postgresql.journey j - WHERE j.business_id = vBusinessFk AND - j.day_id = WEEKDAY(vDated)+1; - END IF; - - UPDATE workerTimeControl wtc - JOIN (SELECT id FROM workerTimeControl - WHERE userFk = vWorkerFk AND - timed BETWEEN vDated AND CONCAT(vDated, ' 23:59:59') - ORDER BY timed ASC - LIMIT 1)sub on sub.id= wtc.id - SET direction = 'in' ; - - UPDATE workerTimeControl wtc - JOIN (SELECT id FROM workerTimeControl - WHERE userFk = vWorkerFk AND - timed BETWEEN vDated AND CONCAT(vDated, ' 23:59:59') - ORDER BY timed DESC - LIMIT 1)sub on sub.id= wtc.id - SET direction = 'out' ; - - END IF; - END IF; - - SELECT CONCAT(IFNULL(vBody,""), " - ", DATE_FORMAT(vDated, "%d/%m/%Y"), " - ", CASE WEEKDAY(vDated)+1 - WHEN 1 THEN 'Lunes' - WHEN 2 THEN 'Martes' - WHEN 3 THEN 'Miércoles' - WHEN 4 THEN 'Jueves' - WHEN 5 THEN 'Viernes' - WHEN 6 THEN 'Sábado' - WHEN 7 THEN 'Domingo' - END , " - ", IFNULL(GROUP_CONCAT(MID(timed, 12, 5) ORDER BY timed ASC SEPARATOR ' - '), " - ")," - ", IFNULL(vAbsenceType, IF (vTimeWorkedDecimal>0, "Presencial", IF(vTimeWorkDecimal>0, "Teletrabajo", " - "))), " - ", IFNULL(vTimeWorkedSexagesimal,IF(IFNULL(vPermissionRate, TRUE), vTimeWorkDecimal, 0)), " - ") INTO vBody - FROM workerTimeControl - WHERE userFk = vWorkerFk AND - timed BETWEEN vDated AND CONCAT(vDated," 23:59:59"); - SET vTimeWorkDecimalTotal = vTimeWorkDecimalTotal + IFNULL(vTimeWorkedDecimal, IF( IFNULL(vPermissionRate, TRUE), vTimeWorkDecimal, 0)); - SET vDone = FALSE; - FETCH vCursor INTO vReceiver, vWorkerFk, vDated, vTimeWorkDecimal, vTimeWorkSexagesimal, vTimeTable, vTimeWorkedDecimal, vTimeWorkedSexagesimal, vAbsenceType, vBusinessFk, vPermissionRate, vIsTeleworking; - - IF vWorkerFk <> vWorkerFkOld OR vDone THEN - SELECT CONCAT( IFNULL(nif, ''), ' - ', firstName, ' ', name ) INTO vWorkerInfo - FROM postgresql.person - WHERE id_trabajador = vWorkerFkOld; - SET vHeader = CONCAT("


-
-

", vWorkerInfo , "

- - - - - - - - - - - - "); - - SET vFooter = CONCAT(" - - - - -
- Según la información recogida en el sistema adjuntamos la tabla con los registros de las horas trabajadas en el período indicado. - Si está conforme tiene que contestar indicando únicamente la palabra OK, en caso contrario puede contestar detallando la causa de la disconformidad. - Rogamos nos conteste lo antes posible. -

-
FechaDíaFichadasDescripciónHoras
TOTAL", IFNULL(LEFT (SEC_TO_TIME(vTimeWorkDecimalTotal * 3600), 5), 0), "
-
"); - - IF vIsTeleworkingOld THEN - CALL mail_insert( - vReceiverOld, - 'timecontrol@verdnatura.es', - CONCAT('Registro de horas semana ', vWeek, ' año ', vYear) , - CONCAT(vHeader, ' ' , vBody, ' ', vFooter) - ); - - INSERT IGNORE INTO workerTimeControlMail (workerFk, year, week) - VALUES(vWorkerFkOld, vYear, vWeek); - END IF; - - SET vBody = ''; - SET vTimeWorkDecimalTotal = 0; - SET vWorkerFkOld = vWorkerFk; - SET vIsTeleworkingOld = vIsTeleworking; - SET vReceiverOld = vReceiver; - END IF; - END LOOP; - CLOSE vCursor; - - DROP TABLE tmp.timeControlCalculate; - DROP TABLE tmp.timeBusinessCalculate; - DROP TABLE tmp.timeControlCalculate1; - DROP TABLE tmp.timeBusinessCalculate1; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControl_sendMailByDepartment` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartment`(IN vDatedFrom DATETIME, IN vDatedTo DATETIME, IN vWorkerFk INT) -BEGIN -/** - * Inserta el registro de horario semanalmente de PRODUCCION, CAMARA, REPARTO, TALLER NATURAL y TALLER ARTIFICIAL en vn.mail. - * - * @param vDatedFrom - * @param vDatedTo - * @param vWorkerFk -> En el caso de querer generarlo para todos los empleados deberá de pasarse = NULL - */ - SET session group_concat_max_len = 15000; - - DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; - DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate; - DROP TEMPORARY TABLE IF EXISTS tmp.reportHours; - - IF vWorkerFk IS NULL THEN - CALL timeControl_calculateAll(vDatedFrom,vDatedTo); - CALL timeBusiness_calculateAll(vDatedFrom,vDatedTo); - ELSE - CALL timeControl_calculateByUser(vWorkerFk,vDatedFrom,vDatedTo); - CALL timeBusiness_calculateByUser(vWorkerFk,vDatedFrom,vDatedTo); - END IF; - - CREATE TEMPORARY TABLE tmp.reportHours - SELECT t.dated, - IF (tm.hoursWeek IS NULL,'', GROUP_CONCAT(DATE_FORMAT(wtc.timed,'%H:%i') ORDER BY wtc.timed ASC SEPARATOR ' ') ) timeWorkDay, - SEC_TO_TIME(IFNULL(tm.timeWorkSeconds, 0)) tm, - SEC_TO_TIME(IFNULL(tc.timeWorkSeconds, 0)) tc, - SEC_TO_TIME(IFNULL(tc.timeWorkSeconds, 0) - IFNULL(tm.timeWorkSeconds, 0)) balance, - w.lastName, - w.firstname, - c.fi, - w.id, - MONTHNAME(t.dated) mes, - YEAR(t.dated) año, - w.userFk, - tm.hoursWeek, - tm.type, - wl.started, - wl.ended, - d.name, - tm.businessFk - FROM time t - LEFT JOIN tmp.timeBusinessCalculate tm ON tm.dated = t.dated - LEFT JOIN tmp.timeControlCalculate tc ON tc.dated = tm.dated AND tc.userFk = tm.userFk - LEFT JOIN vn.workerTimeControl wtc ON wtc.userFk = tm.userFk AND DATE(wtc.timed) = t.dated - LEFT JOIN workerLabour wl ON wl.workerFk = tm.userFk AND wl.businessFk = tm.businessFk - LEFT JOIN workCenter wc ON wc.id = wl.workCenterFk - LEFT JOIN department d ON d.id = wl.departmentFk - LEFT JOIN worker w ON w.id = tm.userFk - LEFT JOIN client c ON c.id = w.id - WHERE wc.name NOT IN ('VNH') - AND d.hasToSendMail - GROUP BY tm.userFk,t.dated - ORDER BY tm.userFk,t.dated; - - INSERT INTO vn.mail (receiver, replyTo, subject, body) - SELECT eu.email, 'laboral@verdnatura.es', CONCAT('Registro de horas semana ', WEEK(vDatedFrom), ' año ', YEAR(vDatedFrom)) , - CONCAT(' - - - - - - -
-

REGISTRO DE LA JORNADA DE LOS TRABAJADORES

- - - - - - - - - - - - - - - - -
- Según la información recogida en el sistema, adjuntamos la tabla con los registros. Cualquier incidencia rogamos la comunique a laboral@verdnatura.es. -
De no recibir incidencia por su parte, se entenderá que el registro es correcto.
-
Empresa: Verdnatura Levante SL
Trabajador: ',rh.firstname,' ',rh.lastName, ' NIF: ',rh.fi, '
AÑO: ',rh.año, ' MES: ',UPPER(rh.mes), ' Calendario Laboral: ',rh.hoursWeek,' horas semanales
-
- - - - - - - - - ', - GROUP_CONCAT(DISTINCT '' ORDER BY rh.dated SEPARATOR ''), - ' - - - - - - -
Fecha:Día:Fichadas:Horas a trabajar:Horas trabajadas:Balance:
', DATE_FORMAT( rh.dated, '%d-%m-%y'), - ' ', CONCAT(UCASE(LEFT(DAYNAME(rh.dated), 1)), SUBSTRING(DAYNAME(rh.dated), 2)), - ' ', IFNULL(rh.timeWorkDay,' '),' ', IFNULL(rh.type,' '), - ' ', rh.tm, - ' ', SUBSTRING_INDEX(rh.tc, '.', 1), - ' ', SUBSTRING_INDEX(rh.balance, '.', 1), '
Total horas trabajadas: ', SUBSTRING_INDEX(SEC_TO_TIME(SUM(TIME_TO_SEC(rh.tc))), '.', 1),'', SUBSTRING_INDEX(SEC_TO_TIME(SUM(TIME_TO_SEC(rh.balance))), '.', 1),'
- ') - FROM tmp.reportHours rh - JOIN account.emailUser eu ON rh.id = eu.userFk - GROUP BY rh.id; - - DROP TEMPORARY TABLE tmp.timeControlCalculate; - DROP TEMPORARY TABLE tmp.timeBusinessCalculate; - DROP TEMPORARY TABLE tmp.reportHours; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workerTimeControl_sendMailByDepartmentLauncher` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartmentLauncher`() -BEGIN - DECLARE vDatedFrom, vDatedTo DATETIME; - - IF (DAYNAME(CURDATE()) = 'miércoles') THEN - SELECT DATE_SUB(CURDATE(), INTERVAL 9 DAY), CONCAT(DATE_SUB(CURDATE(), INTERVAL 3 DAY), ' 23:59:59') INTO vDatedFrom, vDatedTo; - - CALL vn.workerTimeControl_sendMailByDepartment(vDatedFrom, vDatedTo, 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 */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_setOrder` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_setOrder`(vUserFk INT, vStarted DATE, vFinished DATE) -BEGIN - - SET @order := 0; - SET @day := '2000-01-01'; - - UPDATE vn.workerTimeControl w - SET w.`order` = @order := IF(@day = @day := date(timed), @order, 0) + 1 - WHERE w.userFk = vUserFk - AND w.timed BETWEEN vStarted AND util.dayend(vFinished) - ORDER BY w.timed; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 DROP PROCEDURE IF EXISTS `workerWeekControl` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerWeekControl`(vUserFk INT, vDated DATE, vTabletFk VARCHAR(100)) -BEGIN - -/* Devuelve la cantidad de descansos de 12h y de 36 horas que ha disfrutado el trabajador -* en la semana inmediatamente anterior a la fecha que pasa como parámetro. -* -* UPDATED PAK 2019/09/02 -* PENDING REVIEW -*/ - -DECLARE vDescansos12h INT; -DECLARE vDescansos36h INT; -DECLARE vJornadas INT; -DECLARE vImpares INT; -DECLARE vHasSignedToday BOOLEAN; -DECLARE v12hoursInMinutes INT DEFAULT 719; -DECLARE v36hoursInMinutes INT DEFAULT 2159; -DECLARE vCantWork VARCHAR(50) DEFAULT ''; -DECLARE vDepartmentFk INT; -DECLARE isEnabled BOOLEAN DEFAULT TRUE; - - -SELECT COUNT(*) INTO vHasSignedToday - FROM vn.workerTimeControl WHERE timed >= vDated AND userFk = vUserFk; - -SET @day := 0; -SET @lastTimed := NOW(); - -SELECT SUM(IF(interval_in_minutes >= v12hoursInMinutes,1,0)), SUM(FLOOR(interval_in_minutes/ v36hoursInMinutes)) , SUM(jornadas) - INTO vDescansos12h, vDescansos36h, vJornadas - FROM - ( - SELECT fichada_anterior, fichada_actual, interval_in_minutes, jornadas - FROM - ( - SELECT @lastTimed fichada_anterior, - timed, - CAST(time_to_sec(timediff(timed,@lastTimed )) / 60 AS UNSIGNED) as interval_in_minutes, - IF(day(timed) != @day, 1, 0) as jornadas, - @day := day(timed) dia_del_mes, - @lastTimed := timed fichada_actual - FROM - ( - SELECT day(timed) as dayNumber, dayname(timed) as dayName, timed - FROM - (SELECT TIMESTAMPADD(DAY, -11, NOW()) as timed, vUserFk as userFk -- Fichada virtual para los en los que no se ha trabajado la semana anterior - UNION ALL - SELECT timed, userFk - FROM vn.workerTimeControl wtc - WHERE userFk = vUserFk - AND timed >= TIMESTAMPADD(DAY, -10,vDated) - UNION ALL - SELECT IF(vHasSignedToday, '2000-01-01 00:00', NOW()) as timed, vUserFk - ) sub4 - ORDER BY timed - ) sub - - ) sub2 - WHERE fichada_actual >= TIMESTAMPADD(WEEK, -1, vDated) - ) sub3 ; - -SELECT IFNULL(SUM(impar),0) into vImpares -FROM ( - SELECT day(timed) as dayNumber, - count(*) mod 2 as impar - FROM vn.workerTimeControl wtc - WHERE userFk = vUserFk - AND timed >= TIMESTAMPADD(WEEK, -1,vDated) AND timed < vDated - GROUP BY dayNumber - ) sub; - --- Vacaciones -SELECT cs.type INTO vCantWork - FROM postgresql.calendar_employee ce - JOIN postgresql.business b USING(business_id) - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN postgresql.calendar_state cs USING(calendar_state_id) - JOIN vn.worker w ON w.id = p.id_trabajador - WHERE ce.date = CURDATE() - AND cs.isAllowedToWork = FALSE - AND w.userFk = vUserFk - LIMIT 1; - --- Contrato en vigor -SELECT IF(COUNT(*),vCantWork,'Sin contrato') INTO vCantWork - FROM postgresql.business b - JOIN postgresql.profile pr ON pr.profile_id = b.client_id - JOIN postgresql.person p ON p.person_id = pr.person_id - JOIN vn.worker w ON w.id = p.id_trabajador - WHERE w.userFk = vUserFk - AND b.date_start <= vDated - AND IFNULL(b.date_end,vDated) >= vDated; - --- Departamento si vTabletFk es 0 no hacemos comprobacion (Madrid y Vilassar) -IF vTabletFk <> '0' THEN --- 1 Obtener el departamento del usuario - SELECT wtcu.departmentFk INTO vDepartmentFk - FROM vn.workerTimeControlUserInfo wtcu - WHERE wtcu.userFk = vUserFk; --- 2 Comprobar si la tablet pertenece al departamento - SELECT COUNT(td.tabletFk) INTO isEnabled - FROM vn.tabletDepartment td - WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk; - -END IF; - - - -IF vJornadas IS NOT NULL THEN - - SELECT 'Jornadas' as Item, vJornadas as Cantidad, 'Correcto' AS Análisis - - UNION ALL - - SELECT 'Descansos 12 h' as Item, vDescansos12h as Cantidad, IF(vDescansos12h >= vJornadas, 'Correcto','Error: 1 por jornada') as Análisis - - UNION ALL - - SELECT 'Descansos 36 h' as Item, vDescansos36h as Cantidad, IF(vDescansos36h / 2 >= FLOOR(vJornadas/10), 'Correcto','Error: mínimo 2 cada 14 dias') as Análisis - - UNION ALL - - SELECT 'Dias con fichadas impares' as Item, vImpares as Cantidad, IF(vImpares = 0, 'Correcto','Error') as Análisis - - UNION ALL - - SELECT IF (LENGTH(vCantWork),CONCAT('Dia no laborable: ', vCantWork),'Dia laborable') as Item, - '' as Cantidad, - IF(LENGTH(vCantWork),'Error', 'Correcto') as Análisis - - UNION ALL - - SELECT 'El fichador no pertenece a tu departamento.' as Item, '' as Cantidad, IF(isEnabled, 'Correcto','Error') as Análisis - - ; - -ELSE - - - SELECT 'Jornadas' as Item, vJornadas as Cantidad, 'Correcto' AS Análisis - - UNION ALL - - SELECT 'Descansos 12 h' as Item, vDescansos12h as Cantidad, 'Correcto' as Análisis - - UNION ALL - - SELECT 'Descansos 36 h' as Item, vDescansos36h as Cantidad, 'Correcto' as Análisis - - UNION ALL - - SELECT 'Dias con fichadas impares' as Item, vImpares as Cantidad, 'Correcto' as Análisis - - UNION ALL - - SELECT IF (LENGTH(vCantWork),CONCAT('Dia no laborable: ', vCantWork),'Dia laborable') as Item, - '' as Cantidad, IF(LENGTH(vCantWork),'Error', 'Correcto') as Análisis - - UNION ALL - - SELECT 'El fichador no pertenece a tu departamento.' as Item, '' as Cantidad, IF(isEnabled, 'Correcto','Error') as Análisis - ; - -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 `workerWeekTiming` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workerWeekTiming`(vUserFk INT, vDated DATE) -BEGIN - -/* -* Muestra una tabla con los 7 dias inmediatamente anteriores a la fecha proporcionada -* y las fichadas de cada dia, en columnas por dia -* -*/ - -CALL vn.workerTimeControlSetOrder_by_User_and_dateRange(vUserFk,TIMESTAMPADD(DAY,-8,vDated),vDated); - -DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming; -CREATE TEMPORARY TABLE tmp.workerWeekTiming -SELECT orden `orden`, - max(hace7dias) 7_dias_antes, - max(hace6dias) 6_dias_antes, - max(hace5dias) 5_dias_antes, - max(hace4dias) 4_dias_antes, - max(hace3dias) 3_dias_antes, - max(antesdeayer) 2_dias_antes, - max(ayer) 1_dia_antes, - max(hoy) mismo_dia - FROM - ( - SELECT IF(dias = 7, fichada, '') as hace7dias, - IF(dias = 6, fichada, '') as hace6dias, - IF(dias = 5, fichada, '') as hace5dias, - IF(dias = 4, fichada, '') as hace4dias, - IF(dias = 3, fichada, '') as hace3dias, - IF(dias = 2, fichada, '') as antesdeayer, - IF(dias = 1, fichada, '') as ayer, - IF(dias = 0, fichada, '') as hoy, - orden - - FROM - ( - SELECT `order` as orden, datediff(vDated, timed) as dias, date(timed) as fecha, TIME_FORMAT(timed,'%H:%i') as fichada - FROM vn.workerTimeControl wtc - WHERE userFk = vUserFk - AND timed >= TIMESTAMPADD(DAY, -7, vDated) - ) sub - )sub2 - GROUP BY orden - ; - -DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming_Aux; -CREATE TEMPORARY TABLE tmp.workerWeekTiming_Aux - SELECT * FROM tmp.workerWeekTiming; - -INSERT INTO tmp.workerWeekTiming( 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes,mismo_dia) - VALUES('total','','','','','','',''); - -INSERT INTO tmp.workerWeekTiming( orden, 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes, mismo_dia) -SELECT 0, - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(7_dias_antes), TIME_TO_SEC(7_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(6_dias_antes), TIME_TO_SEC(6_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(5_dias_antes), TIME_TO_SEC(5_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(4_dias_antes), TIME_TO_SEC(4_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(3_dias_antes), TIME_TO_SEC(3_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(2_dias_antes), TIME_TO_SEC(2_dias_antes)))),'%H:%i'),''), - IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(1_dia_antes), TIME_TO_SEC(1_dia_antes)))),'%H:%i'),''), - '' - FROM tmp.workerWeekTiming_Aux; - -INSERT INTO tmp.workerWeekTiming_Aux( orden, 1_dia_antes) -SELECT 0, ROUND(( - IFNULL(TIME_TO_SEC(7_dias_antes),0) + - IFNULL(TIME_TO_SEC(6_dias_antes),0) + - IFNULL(TIME_TO_SEC(5_dias_antes),0) + - IFNULL(TIME_TO_SEC(4_dias_antes),0) + - IFNULL(TIME_TO_SEC(3_dias_antes),0) + - IFNULL(TIME_TO_SEC(2_dias_antes),0) + - IFNULL(TIME_TO_SEC(1_dia_antes),0) - ) / 3600,1) - FROM tmp.workerWeekTiming - WHERE orden = 0; - - -INSERT INTO tmp.workerWeekTiming( 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes,mismo_dia) - SELECT '','','','','','',1_dia_antes,'' - FROM tmp.workerWeekTiming_Aux - WHERE orden = 0; - -SELECT 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes,mismo_dia FROM tmp.workerWeekTiming; - -DROP TEMPORARY TABLE tmp.workerWeekTiming; -DROP TEMPORARY TABLE tmp.workerWeekTiming_Aux; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_calculateCommission` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_calculateCommission`(vYear INT, vQuarter INT) -BEGIN - - DECLARE vPlusTeamAmount INT; - DECLARE vPlusNewBornAmount INT; - DECLARE vPlusSalesAmount INT; - DECLARE vMinimumSalesByQuarter INT; - DECLARE vPlusTeamRange INT; - DECLARE vPlusNewBornRange INT; - DECLARE vRankingSalesRange INT; - -/* - -- Jerarquia - DROP TEMPORARY TABLE IF EXISTS rankingHierarchy; - CREATE TEMPORARY TABLE rankingHierarchy - SELECT COUNT(*) - 1 teamMembers, wb.bossFk - FROM vn.worker ww - JOIN vn.worker wb ON ww.id = wb.bossFk - GROUP BY wb.bossFk; - */ - - SELECT plusTeamAmount, plusNewBornAmount, plusSalesAmount, minimumSalesByQuarter, plusTeamRange, plusNewBornRange, rankingSalesRange - INTO vPlusTeamAmount, vPlusNewBornAmount, vPlusSalesAmount, vMinimumSalesByQuarter, vPlusTeamRange, vPlusNewBornRange, vRankingSalesRange - FROM commissionConfig; - -- Ventas - DROP TEMPORARY TABLE IF EXISTS rankingSale; - CREATE TEMPORARY TABLE rankingSale - (PRIMARY KEY(workerFk)) ENGINE = MEMORY - SELECT IF(SUM(v.importe) > vMinimumSalesByQuarter, - SUM(IFNULL(v.comision,0)), - 0) as commission, - SUM(v.importe) sales, - v.Id_Trabajador workerFk - FROM bs.vendedores v - WHERE v.año = vYear AND CEIL(mes/3) = vQuarter - GROUP BY v.Id_Trabajador; - - -- Ranking ventas - SET @position:= 0; - DROP TEMPORARY TABLE IF EXISTS rankingSelling; - CREATE TEMPORARY TABLE rankingSelling - (PRIMARY KEY(userFk)) ENGINE = MEMORY - SELECT userFk, @position:= @position + 1 position - FROM ( - SELECT SUM(`v`.`importe`) AS `importe`, - `u`.`name` AS `name`, - `u`.`id` AS `userFk` - FROM - (`bs`.`vendedores` `v` - JOIN `account`.`user` `u` ON (`u`.`id` = `v`.`Id_Trabajador`)) - WHERE - `v`.`año` = vYear - AND CEIL(`v`.`mes` / 3) = vQuarter - AND `u`.`name` NOT IN ('ismaelalcolea' , 'ruben') - GROUP BY `v`.`Id_Trabajador` - ORDER BY SUM(`v`.`importe`) DESC - LIMIT vRankingSalesRange - ) t; - - CALL rankingTeamByQuarter(vYear, vQuarter); - - -- comerciales que computan / total integrantes - DROP TEMPORARY TABLE IF EXISTS teamNames; - CREATE TEMPORARY TABLE teamNames - (PRIMARY KEY(departmentFk)) ENGINE = MEMORY - SELECT DISTINCT departmentFk, teamPeople - FROM tmp.rankingTeam; - - -- Ranking por equipos - DROP TEMPORARY TABLE IF EXISTS rankingTeam; - CREATE TEMPORARY TABLE rankingTeam - (PRIMARY KEY(departmentFk)) ENGINE = MEMORY - SELECT DISTINCT departmentFk - FROM teamNames - LIMIT vPlusTeamRange; - - -- Ranking por nuevos clientes - SET @position:= 0; - DROP TEMPORARY TABLE IF EXISTS rankingNewBorn; - CREATE TEMPORARY TABLE rankingNewBorn - (PRIMARY KEY(userFk)) ENGINE = MEMORY - SELECT userFk, @position:= @position + 1 position - FROM ( - SELECT SUM(amount) AS total, - n.userFk - FROM newBornSales n - WHERE n.dated >= util.quarterFirstDay(vYear, vQuarter) - AND n.firstShipped >= util.quarterFirstDay(vYear -1, vQuarter) - GROUP BY userFk - ORDER BY SUM(amount) DESC - LIMIT vPlusNewBornRange - ) t; - - -- Sumatorio de ventas - SELECT uBoss.`name` as team, - u.`name`, - r.commission, - -- IF(rh.bossFk, 200 + (teamMembers * 30), 0) plusResponsibility, - @plusRankingSellers := ((vRankingSalesRange + 1) - rs.position) * 40 plusRankingSellers, - @plusRankingTeam := IF(rt.departmentFk, vPlusTeamAmount, 0) plusRankingTeam, - @plusRankingNewBorn := ((vPlusNewBornRange + 1) - rnb.position) * vPlusNewBornAmount plusRankingNewBorn, - IFNULL(r.commission,0) + IFNULL(@plusRankingSellers,0) + @plusRankingTeam + IFNULL(@plusRankingNewBorn, 0) total, - sales, rs.position, teamPeople, - vYear year, - vQuarter quarter - FROM rankingSale r - -- LEFT JOIN rankingHierarchy rh ON rh.bossFk = r.workerFk - JOIN account.user u ON u.id = r.workerFk - JOIN vn2008.jerarquia j ON j.worker_id = r.workerFk - LEFT JOIN `account`.`user` uBoss ON uBoss.id = j.boss_id - LEFT JOIN rankingSelling rs ON rs.userFk = r.workerFk - LEFT JOIN workerDepartment wd ON wd.workerFk = r.workerFk - LEFT JOIN rankingTeam rt ON rt.departmentFk = wd.departmentFk AND r.commission - LEFT JOIN teamNames tn ON tn.departmentFk = wd.departmentFk - LEFT JOIN vn.rankingNewBorn rnb ON rnb.userFk = r.workerFk; - - DROP TEMPORARY TABLE tmp.rankingTeam; - DROP TEMPORARY TABLE - rankingSelling, - rankingTeam, - teamNames, - rankingNewBorn, - rankingSale; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_calculateCommission__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_calculateCommission__`(vYear INT, vQuarter INT) -BEGIN - - DECLARE vQuarterFirstDayLastYear DATE; - DECLARE vQuarterFirstDay DATE; -/* - -- Jerarquia - DROP TEMPORARY TABLE IF EXISTS rankingHierarchy; - CREATE TEMPORARY TABLE rankingHierarchy - SELECT COUNT(*) - 1 teamMembers, wb.bossFk - FROM vn.worker ww - JOIN vn.worker wb ON ww.id = wb.bossFk - GROUP BY wb.bossFk; - */ - - -- Ranking ventas - SELECT MIN(dated) INTO vQuarterFirstDay - FROM `time` t - WHERE QUARTER(dated) = vQuarter AND t.`year` = vYear; - - SET vQuarterFirstDayLastYear = DATE_ADD(vQuarterFirstDay, INTERVAL -1 YEAR); - - SET @position:= 0; - DROP TEMPORARY TABLE IF EXISTS rankingSelling; - CREATE TEMPORARY TABLE rankingSelling - (PRIMARY KEY(userFk)) ENGINE = MEMORY - SELECT userFk, @position:= @position + 1 position - FROM ( - SELECT SUM(`v`.`importe`) AS `importe`, - `u`.`name` AS `name`, - `u`.`id` AS `userFk` - FROM - (`bs`.`vendedores` `v` - JOIN `account`.`user` `u` ON (`u`.`id` = `v`.`Id_Trabajador`)) - WHERE - `v`.`año` = vYear - AND CEIL(`v`.`mes` / 3) = vQuarter - AND `u`.`name` NOT IN ('ismaelalcolea' , 'ruben') - GROUP BY `v`.`Id_Trabajador` - ORDER BY SUM(`v`.`importe`) DESC - LIMIT 10 - ) t; - - CALL rankingTeamByQuarter(vYear, vQuarter); - - -- comerciales que computan / total integrantes - DROP TEMPORARY TABLE IF EXISTS teamNames; - CREATE TEMPORARY TABLE teamNames - (PRIMARY KEY(departmentFk)) ENGINE = MEMORY - SELECT DISTINCT departmentFk, teamPeople - FROM tmp.rankingTeam; - - -- Ranking por equipos - DROP TEMPORARY TABLE IF EXISTS rankingTeam; - CREATE TEMPORARY TABLE rankingTeam - (PRIMARY KEY(departmentFk)) ENGINE = MEMORY - SELECT DISTINCT departmentFk - FROM teamNames - LIMIT 3; - - -- Ranking por nuevos clientes - SET @position:= 0; - DROP TEMPORARY TABLE IF EXISTS rankingNewBorn; - CREATE TEMPORARY TABLE rankingNewBorn - (PRIMARY KEY(userFk)) ENGINE = MEMORY - SELECT userFk, @position:= @position + 1 position - FROM ( - SELECT SUM(amount) AS total, - n.userFk - FROM newBornSales n - WHERE n.dated >= vQuarterFirstDay - AND n.firstShipped >= vQuarterFirstDayLastYear - GROUP BY userFk - ORDER BY SUM(amount) DESC - LIMIT 10 - ) t; - - -- Ventas - DROP TEMPORARY TABLE IF EXISTS rankingSale; - CREATE TEMPORARY TABLE rankingSale - (PRIMARY KEY(workerFk)) ENGINE = MEMORY - SELECT IF(SUM(v.importe) > 120000, - SUM(IFNULL(v.comision,0)),0) as commission, - SUM(v.importe) sales, - v.Id_Trabajador workerFk - FROM bs.vendedores v - WHERE v.año = vYear AND CEIL(mes/3) = vQuarter - GROUP BY v.Id_Trabajador; - - -- Sumatorio de ventas - SELECT uBoss.`name` as team, - u.`name`, - r.commission, - -- IF(rh.bossFk, 200 + (teamMembers * 30), 0) plusResponsibility, - @plusRankingSellers := (11 - rs.position) * 40 plusRankingSellers, - @plusRankingTeam := IF(rt.departmentFk, 800, 0) plusRankingTeam, - @plusRankingNewBorn := (11 - rnb.position) * 40 plusRankingNewBorn, - IFNULL(r.commission,0) + IFNULL(@plusRankingSellers,0) + @plusRankingTeam + IFNULL(@plusRankingNewBorn, 0) total, - sales, rs.position, teamPeople, - vYear year, - vQuarter quarter - FROM rankingSale r - -- LEFT JOIN rankingHierarchy rh ON rh.bossFk = r.workerFk - JOIN account.user u ON u.id = r.workerFk - JOIN vn2008.jerarquia j ON j.worker_id = r.workerFk - LEFT JOIN `account`.`user` uBoss ON uBoss.id = j.boss_id - LEFT JOIN rankingSelling rs ON rs.userFk = r.workerFk - LEFT JOIN workerDepartment wd ON wd.workerFk = r.workerFk - LEFT JOIN rankingTeam rt ON rt.departmentFk = wd.departmentFk AND r.commission - LEFT JOIN teamNames tn ON tn.departmentFk = wd.departmentFk - LEFT JOIN vn.rankingNewBorn rnb ON rnb.userFk = r.workerFk; - - DROP TEMPORARY TABLE tmp.rankingTeam; - DROP TEMPORARY TABLE - rankingSelling, - rankingTeam, - teamNames, - rankingNewBorn, - rankingSale; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_calculateSalaryRoleDelivery` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_calculateSalaryRoleDelivery`(vWorkerFk INTEGER,vDateFrom DATE,vDateTo DATE) -BEGIN -/** - * Calcula el salario de trabajadores para los departamentos de reparto, paletizado - * - * @param vDateFrom - * @param vDateTo - * @param vWorkerFk - * @return tmp.workerSalaryRoleDelivery - */ - DROP TEMPORARY TABLE IF EXISTS tmp.workerSalaryRoleDelivery; - - CREATE TEMPORARY TABLE tmp.workerSalaryRoleDelivery - SELECT w.id workerFk, - r.created dated, - r.id, - SUM(t.packages) packages, - CAST(time_to_sec(TIMEDIFF( DATE_FORMAT(r.finished, '%H:%i:%s'),DATE_FORMAT(r.time, '%H:%i:%s'))) / (60 * 60) AS DECIMAL(10, 1)) hours , - r.kmEnd-r.kmStart km, - r.m3 m3Delivery, - CAST(r.m3/loadWorker AS DECIMAL(10,2)) m3Load, - CAST(rc.m3Distribution*r.m3 AS DECIMAL(10,2)) amountDelivery, - CASE loadWorker - WHEN 1 THEN CAST(r.m3/ loadWorker*rc.load1m3 AS DECIMAL(10,2)) - WHEN 2 THEN CAST(r.m3/ loadWorker*rc.load2m3 AS DECIMAL(10,2)) - WHEN 3 THEN CAST(r.m3/ loadWorker*rc.load3m3 AS DECIMAL(10,2)) - WHEN 4 THEN CAST(r.m3/ loadWorker*rc.load4m3 AS DECIMAL(10,2)) - WHEN 5 THEN CAST(r.m3/ loadWorker*rc.load5m3 AS DECIMAL(10,2)) - ELSE CAST(r.m3/ loadWorker*rc.load6m3 AS DECIMAL(10,2)) - END amountLoad, - IF(v.isKmTruckRate, rc.kmTruckRate, rc.kmRate)*(r.kmEnd-r.kmStart) amountKm, - CAST('' AS CHAR(45)) description, - CAST( 0 AS DECIMAL(10,2)) extra, - CAST( 0 AS DECIMAL(10,2)) maxSalary - FROM route r - LEFT JOIN ticket t ON t.routeFk = r.id - LEFT JOIN vehicle v ON v.id = r.vehicleFk - LEFT JOIN worker w ON w.id = r.workerFk - LEFT JOIN routeConfig rc ON TRUE - LEFT JOIN (SELECT rw.routeFk, COUNT(rw.workerFk) loadWorker - FROM routeLoadWorker rw - JOIN routeLoadWorker rw2 ON rw.routeFk = rw2.routeFk AND rw2.workerFk = vWorkerFk - GROUP BY rw2.routeFk - ) sub ON sub.routeFk=r.id - WHERE r.created BETWEEN vDateFrom AND vDateTo AND w.id = vWorkerFk - GROUP BY r.id; - - INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, - dated, - id, - packages, - km, - m3Load, - amountLoad) - SELECT w.id , - r.created , - r.id, - SUM(t.packages) , - r.kmEnd-r.kmStart , - CAST(r.m3/loadWorker AS DECIMAL(10,2)) , - CASE loadWorker - WHEN 1 THEN CAST(r.m3/ loadWorker*rc.load1m3 AS DECIMAL(10,2)) - WHEN 2 THEN CAST(r.m3/ loadWorker*rc.load2m3 AS DECIMAL(10,2)) - WHEN 3 THEN CAST(r.m3/ loadWorker*rc.load3m3 AS DECIMAL(10,2)) - WHEN 4 THEN CAST(r.m3/ loadWorker*rc.load4m3 AS DECIMAL(10,2)) - WHEN 5 THEN CAST(r.m3/ loadWorker*rc.load5m3 AS DECIMAL(10,2)) - ELSE CAST(r.m3/ loadWorker*rc.load6m3 AS DECIMAL(10,2)) - END - FROM (SELECT rw.routeFk, COUNT(rw.workerFk) loadWorker - FROM routeLoadWorker rw - JOIN routeLoadWorker rw2 ON rw.routeFk = rw2.routeFk AND rw2.workerFk = vWorkerFk - GROUP BY rw2.routeFk) sub - LEFT JOIN route r ON sub.routeFk = r.id - LEFT JOIN ticket t ON t.routeFk = r.id - LEFT JOIN worker w ON w.id = r.workerFk - LEFT JOIN routeConfig rc ON TRUE - WHERE r.created BETWEEN vDateFrom AND vDateTo AND w.id <> vWorkerFk - GROUP BY r.id; - - INSERT INTO tmp.workerSalaryRoleDelivery(workerFk, - dated, - description, - extra) - SELECT workerFk, - dated, - GROUP_CONCAT(ra.name) , - CAST(SUM(rc.price) AS DECIMAL(9,2)) - FROM routeComplement rc - JOIN routeAction ra ON rc.routeActionFk=ra.id - WHERE dated BETWEEN vDateFrom AND vDateTo AND workerFk=vWorkerFk - GROUP BY dated; - - CALL timeBusiness_calculateByWorker(vWorkerFk, vDateFrom, vDateTo); - - INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, - dated, - description, - extra) - SELECT w.id, - tb.dated, - tb.type COLLATE utf8_general_ci, - CASE - WHEN tb.type = 'Vacaciones 1/2 día' OR tb.type = 'Permiso retribuido 1/2 día' - THEN CAST(((12 * blp.importepactado) / (52 * tb.hoursWeek)) * 4 AS DECIMAL(10,2)) - WHEN tb.type = 'Vacaciones' OR tb.type = 'Baja enfermedad común' OR tb.type = 'Permiso retribuido' OR tb.type = 'Festivo' - THEN CAST(((12 * blp.importepactado) / (52 * tb.hoursWeek)) * 8 AS DECIMAL(10,2)) - WHEN tb.type = 'Maternidad/Paternidad' - THEN 0 - END - FROM worker w - JOIN tmp.timeBusinessCalculate tb ON tb.userFk = w.id - JOIN postgresql.business_labour_payroll blp ON blp.business_id = tb.businessFk - JOIN time tm ON tm.dated = tb.dated - WHERE tb.dated BETWEEN vDateFrom AND vDateTo AND - w.id = vWorkerFk AND - tb.type IN ('Vacaciones 1/2 día', 'Vacaciones', 'Baja enfermedad común','Festivo','Permiso retribuido 1/2 día','Permiso retribuido', 'Maternidad/Paternidad') - GROUP BY tb.dated; - - INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, - dated, - m3Delivery, - amountLoad, - description) - SELECT wdc.workerFk , - r.created, - SUM(r.m3) , - CASE - WHEN wdc.category = 1 - THEN CAST(SUM(r.m3) * rc.distributionM3Category1 AS DECIMAL (10,2)) - WHEN wdc.category = 2 - THEN CAST(SUM(r.m3) * rc.distributionM3Category2 AS DECIMAL (10,2)) - END amountLoad, - 'Gestión de la distribución' description - FROM route r - JOIN agencyMode am ON am.id= r.agencyModeFk - JOIN agency a ON a.id = am.agencyFk - JOIN workerDistributionCategory wdc ON wdc.workerFk = vWorkerFk - JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND wl.workerFk = wdc.workerFk AND a.workCenterFk = wl.workCenterFk - JOIN department v ON v.id = departmentFk - JOIN routeConfig rc - WHERE r.m3>0 AND created BETWEEN vDateFrom AND vDateTo AND - am.name NOT LIKE "REC_%" AND - v.name= "REPARTO" - GROUP BY r.created; - - INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, - dated, - m3Delivery, - amountLoad, - description) - SELECT sub.workerFk, - r.created, - SUM(r.m3), - CAST( (SUM(r.m3)*sub.percentage /100) * rc.m3Palletization AS DECIMAL (10,2) ), - 'Gestión de paletizado' - FROM route r - JOIN agencyMode am ON am.id= r.agencyModeFk - JOIN agency a ON a.id = am.agencyFk - JOIN (SELECT percentage,workerFk ,dated - FROM routeUserPercentage ru - WHERE workerFk = vWorkerFk AND ru.dated <= vDateTo - ORDER BY dated DESC LIMIT 1 - ) sub - JOIN routeConfig rc - JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND - wl.workerFk = sub.workerFk - JOIN department v ON v.id = departmentFk - WHERE r.m3>0 AND - r.created BETWEEN vDateFrom AND vDateTo AND - am.name NOT LIKE "REC_%" AND - v.name= "PALETIZADO" - GROUP BY r.created; - - DROP TEMPORARY TABLE IF EXISTS tmp.daysToRateHoliday; - CREATE TEMPORARY TABLE tmp.daysToRateHoliday - SELECT * - FROM tmp.workerSalaryRoleDelivery tb - WHERE (tb.description IN ('Festivo') OR dayofweek(tb.dated)=1) AND tb.extra = 0 ; - -/* INSERT INTO tmp.workerSalaryRoleDelivery (workerFk,dated,id,packages,hours,km,m3Delivery,m3Load,amountDelivery,amountLoad,AmountKm,description, extra) - SELECT workerFk, - dated, - d.id, - packages, - hours, - km, - m3Delivery, - m3Load, - amountDelivery * r.rateHoliday, - amountLoad * r.rateHoliday, - AmountKm * r.rateHoliday, - CONCAT('Plus festivo: ',description), - extra - FROM tmp.daysToRateHoliday d - LEFT JOIN routeConfig r ON TRUE;*/ - - DROP TEMPORARY TABLE IF EXISTS tmp.daysToDelete; - CREATE TEMPORARY TABLE tmp.daysToDelete - SELECT dated - FROM tmp.workerSalaryRoleDelivery d - WHERE d.description IN ('Baja enfermedad común', 'Maternidad/Paternidad'); - - DELETE d - FROM tmp.workerSalaryRoleDelivery d - JOIN tmp.daysToDelete dd on dd.dated = d.dated - WHERE d.description NOT IN ('Baja enfermedad común', 'Maternidad/Paternidad'); - - INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, - dated, - description, - extra, - maxSalary) - SELECT wdc.workerFk , - CONCAT(YEAR(t.dated),'-', MONTH(t.dated),'-01') , - CASE - WHEN wdc.category = 1 - THEN rc.plusCategory1Concept - WHEN wdc.category = 2 - THEN rc.plusCategory2Concept - END, - CASE - WHEN wdc.category = 1 - THEN CAST(rc.plusCategory1 AS DECIMAL (10,2)) - WHEN wdc.category = 2 - THEN CAST(rc.plusCategory2 AS DECIMAL (10,2)) - END, - CASE - WHEN wdc.category = 1 - THEN CAST(rc.maxSalaryCategory1 AS DECIMAL (10,2)) - WHEN wdc.category = 2 - THEN CAST(rc.maxSalaryCategory2 AS DECIMAL (10,2)) - END - FROM worker w - JOIN workerDistributionCategory wdc ON wdc.workerFk = w.id - JOIN routeConfig rc - JOIN time t on t.dated BETWEEN vDateFrom AND vDateTo - WHERE w.id = vWorkerFk - GROUP BY MONTH(t.dated), YEAR(t.dated); - - DROP TEMPORARY TABLE tmp.daysToRateHoliday; - DROP TEMPORARY TABLE tmp.daysToDelete; - DROP TEMPORARY TABLE tmp.timeBusinessCalculate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_calculateSalaryRoleDelivery__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_calculateSalaryRoleDelivery__`(vWorkerFk INTEGER,vDateFrom DATE,vDateTo DATE) -BEGIN -/** - * Calcula el salario de trabajadores para los departamentos de reparto, paletizado - * - * @param vDateFrom - * @param vDateTo - * @param vWorkerFk - * @return tmp.workerSalaryRoleDelivery - */ - DROP TEMPORARY TABLE IF EXISTS tmp.workerSalaryRoleDelivery; - - CREATE TEMPORARY TABLE tmp.workerSalaryRoleDelivery - SELECT w.id workerFk, - r.created dated, - r.id, - SUM(t.packages) packages, - CAST(time_to_sec(TIMEDIFF( DATE_FORMAT(r.finished, '%H:%i:%s'),DATE_FORMAT(r.time, '%H:%i:%s'))) / (60 * 60) AS DECIMAL(10, 1)) hours , - r.kmEnd-r.kmStart km, - r.m3 m3Delivery, - CAST(r.m3/loadWorker AS DECIMAL(10,2)) m3Load, - CAST(rc.m3Distribution*m3 AS DECIMAL(10,2)) amountDelivery , - CASE loadWorker - WHEN 1 THEN CAST(r.m3/ loadWorker*rc.load1m3 AS DECIMAL(10,2)) - WHEN 2 THEN CAST(r.m3/ loadWorker*rc.load2m3 AS DECIMAL(10,2)) - WHEN 3 THEN CAST(r.m3/ loadWorker*rc.load3m3 AS DECIMAL(10,2)) - WHEN 4 THEN CAST(r.m3/ loadWorker*rc.load4m3 AS DECIMAL(10,2)) - WHEN 5 THEN CAST(r.m3/ loadWorker*rc.load5m3 AS DECIMAL(10,2)) - ELSE CAST(r.m3/ loadWorker*rc.load6m3 AS DECIMAL(10,2)) - END amountLoad, - rc.kmRate*(r.kmEnd-r.kmStart) amountKm, - w.code, - CAST('' AS CHAR(45)) description, - CAST( 0 AS DECIMAL(10,2)) extra - FROM ticket t - LEFT JOIN route r ON t.routeFk = r.id - LEFT JOIN worker w ON w.id = r.workerFk - LEFT JOIN routeConfig rc ON TRUE - LEFT JOIN (SELECT rw.routeFk, COUNT(rw.workerFk) loadWorker - FROM routeLoadWorker rw - JOIN routeLoadWorker rw2 ON rw.routeFk = rw2.routeFk AND rw2.workerFk = vWorkerFk - GROUP BY rw2.routeFk - ) sub ON sub.routeFk=r.id - WHERE r.created BETWEEN vDateFrom AND vDateTo AND w.id = vWorkerFk - GROUP BY r.id; - - INSERT INTO tmp.workerSalaryRoleDelivery - SELECT w.id workerFk, - r.created dated, - r.id, - SUM(t.packages) packages, - NULL hours, - r.kmEnd-r.kmStart km, - NULL m3Delivery, - CAST(r.m3/loadWorker AS DECIMAL(10,2)) m3Load, - NULL amountDelivery, - CASE loadWorker - WHEN 1 THEN CAST(r.m3/ loadWorker*rc.load1m3 AS DECIMAL(10,2)) - WHEN 2 THEN CAST(r.m3/ loadWorker*rc.load2m3 AS DECIMAL(10,2)) - WHEN 3 THEN CAST(r.m3/ loadWorker*rc.load3m3 AS DECIMAL(10,2)) - WHEN 4 THEN CAST(r.m3/ loadWorker*rc.load4m3 AS DECIMAL(10,2)) - WHEN 5 THEN CAST(r.m3/ loadWorker*rc.load5m3 AS DECIMAL(10,2)) - ELSE CAST(r.m3/ loadWorker*rc.load6m3 AS DECIMAL(10,2)) - END amountLoad, - NULL amountKm, - w.code, - NULL description, - NULL extra - FROM (SELECT rw.routeFk, COUNT(rw.workerFk) loadWorker - FROM routeLoadWorker rw - JOIN routeLoadWorker rw2 ON rw.routeFk = rw2.routeFk AND rw2.workerFk = vWorkerFk - GROUP BY rw2.routeFk) sub - LEFT JOIN route r ON sub.routeFk = r.id - LEFT JOIN ticket t ON t.routeFk = r.id - LEFT JOIN worker w ON w.id = r.workerFk - LEFT JOIN routeConfig rc ON TRUE - WHERE r.created BETWEEN vDateFrom AND vDateTo AND w.id <> vWorkerFk - GROUP BY r.id; - - INSERT INTO tmp.workerSalaryRoleDelivery - SELECT workerFk, - dated, - NULL id, - NULL packages, - NULL hours, - NULL km, - NULL m3Delivery, - NULL m3Load, - NULL amountDelivery, - NULL amountLoad, - NULL amountKm, - NULL workerCode, - GROUP_CONCAT(ra.name) description, - CAST(SUM(rc.price) AS DECIMAL(9,2)) extra - FROM routeComplement rc - JOIN routeAction ra ON rc.routeActionFk=ra.id - WHERE dated BETWEEN vDateFrom AND vDateTo AND workerFk=vWorkerFk - GROUP BY dated; - - CALL timeBusiness_calculateByWorker(vWorkerFk, vDateFrom, vDateTo); - - INSERT INTO tmp.workerSalaryRoleDelivery - SELECT w.id workerFk, - tb.dated, - NULL id, - NULL packages, - NULL hours, - NULL km, - NULL m3Delivery, - NULL m3Load, - NULL amountDelivery, - NULL amountLoad, - NULL amountKm, - NULL workerCode, - tb.type COLLATE utf8_general_ci description, - CASE - WHEN tb.type = 'Vacaciones 1/2 día' OR tb.type = 'Permiso retribuido 1/2 día' - THEN CAST(((12 * blp.importepactado) / (52 * tb.hoursWeek)) * 4 AS DECIMAL(10,2)) - WHEN tb.type = 'Vacaciones' OR tb.type = 'Baja enfermedad común' OR tb.type = 'Permiso retribuido' OR tb.type = 'Festivo' - THEN CAST(((12 * blp.importepactado) / (52 * tb.hoursWeek)) * 8 AS DECIMAL(10,2)) - END extra - FROM worker w - JOIN tmp.timeBusinessCalculate tb ON tb.userFk = w.id - JOIN postgresql.business_labour_payroll blp ON blp.business_id = tb.businessFk - JOIN time tm ON tm.dated = tb.dated - WHERE tb.dated BETWEEN vDateFrom AND vDateTo AND - w.id = vWorkerFk AND - tb.type IN ('Vacaciones 1/2 día', 'Vacaciones', 'Baja enfermedad común','Festivo','Permiso retribuido 1/2 día','Permiso retribuido') - GROUP BY tb.dated; - - INSERT INTO tmp.workerSalaryRoleDelivery - SELECT sub.workerFk workerFk, - r.created dated, - NULL id, - NULL packages, - NULL hours, - NULL km, - SUM(r.m3) m3Delivery, - NULL m3Load, - NULL amountDelivery, - CAST( (SUM(r.m3)*sub.percentage /100) * rc.m3Management AS DECIMAL (10,2) ) amountLoad, - NULL amountKm, - NULL workerCode, - 'Gestión de la distribución' description, - NULL extra - FROM route r - JOIN agencyMode am ON am.id= r.agencyModeFk - JOIN agency a ON a.id = am.agencyFk - JOIN (SELECT percentage,workerFk ,dated - FROM routeUserPercentage ru - WHERE workerFk = vWorkerFk AND ru.dated <= vDateTo - ORDER BY dated DESC LIMIT 1 - ) sub - JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND wl.workerFk = sub.workerFk AND a.workCenterFk = wl.workCenterFk - JOIN department v ON v.id = departmentFk - JOIN routeConfig rc - WHERE r.m3>0 AND created BETWEEN vDateFrom AND vDateTo AND - am.name NOT LIKE "REC_%" AND - v.name= "REPARTO" - GROUP BY r.created; - - INSERT INTO tmp.workerSalaryRoleDelivery - SELECT sub.workerFk workerFk, - r.created dated, - NULL id, - NULL packages, - NULL hours, - NULL km, - SUM(r.m3) m3Delivery, - NULL m3Load, - NULL amountDelivery, - CAST( (SUM(r.m3)*sub.percentage /100) * rc.m3Palletization AS DECIMAL (10,2) ) amountLoad, - NULL amountKm, - NULL workerCode, - 'Gestión de paletizado' description, - NULL extra - FROM route r - JOIN agencyMode am ON am.id= r.agencyModeFk - JOIN agency a ON a.id = am.agencyFk - JOIN (SELECT percentage,workerFk ,dated - FROM routeUserPercentage ru - WHERE workerFk = vWorkerFk AND ru.dated <= vDateTo - ORDER BY dated DESC LIMIT 1 - ) sub - JOIN routeConfig rc - JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND - wl.workerFk = sub.workerFk - JOIN department v ON v.id = departmentFk - WHERE r.m3>0 AND - r.created BETWEEN vDateFrom AND vDateTo AND - am.name NOT LIKE "REC_%" AND - v.name= "PALETIZADO" - GROUP BY r.created; - - DROP TEMPORARY TABLE IF EXISTS tmp.daysToRateHoliday; - CREATE TEMPORARY TABLE tmp.daysToRateHoliday - SELECT * - FROM tmp.workerSalaryRoleDelivery tb - WHERE (tb.description IN ('Festivo') OR dayofweek(tb.dated)=1) AND tb.extra = 0 ; - - INSERT INTO tmp.workerSalaryRoleDelivery (workerFk,dated,id,packages,hours,km,m3Delivery,m3Load,amountDelivery,amountLoad,AmountKm,code,description, extra) - SELECT workerFk, - dated, - d.id, - packages, - hours, - km, - m3Delivery, - m3Load, - amountDelivery * r.rateHoliday, - amountLoad * r.rateHoliday, - AmountKm * r.rateHoliday, - code, - CONCAT('Plus festivo: ',description), - extra - FROM tmp.daysToRateHoliday d - LEFT JOIN routeConfig r ON TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.daysToDelete; - CREATE TEMPORARY TABLE tmp.daysToDelete - SELECT dated - FROM tmp.workerSalaryRoleDelivery d - WHERE d.description IN ('Baja enfermedad común'); - - DELETE d - FROM tmp.workerSalaryRoleDelivery d - JOIN tmp.daysToDelete dd on dd.dated = d.dated - WHERE d.description NOT IN ('Baja enfermedad común'); - - DROP TEMPORARY TABLE tmp.daysToRateHoliday; - DROP TEMPORARY TABLE tmp.daysToDelete; - DROP TEMPORARY TABLE tmp.timeBusinessCalculate; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_getFromHasMistake` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getFromHasMistake`(vDepartmentFk INT) -BEGIN - -/** - * Obtiene los trabajadores de los departamentos que se les puede poner error - * @param vDepartmentFk id del departamento - * - */ - - SELECT w.id,w.firstName, w.lastName,d.name - FROM worker w - JOIN workerDepartment wd ON wd.workerFk = w.id - JOIN department d ON d.id = wd.departmentFk - WHERE d.id = vDepartmentFk - ORDER BY firstName; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_getHierarchy` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getHierarchy`(vBoss INT) -BEGIN - DECLARE EXIT HANDLER FOR 1062 BEGIN - CALL util.throw('INFINITE_LOOP'); - END; - - DROP TEMPORARY TABLE IF EXISTS workerHierarchy; - CREATE TEMPORARY TABLE workerHierarchy - (PRIMARY KEY (workerFk)) - ENGINE = MEMORY - SELECT vBoss AS workerFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchyList; - CREATE TEMPORARY TABLE tmp.workerHierarchyList - (PRIMARY KEY (workerFk)) - ENGINE = MEMORY - SELECT vBoss AS workerFk, 0 AS isChecked; - - - WHILE (SELECT COUNT(*) FROM tmp.workerHierarchyList WHERE NOT isChecked) > 0 DO - - INSERT INTO tmp.workerHierarchyList - SELECT w.id, 0 - FROM worker w - JOIN workerHierarchy wh ON wh.workerFk = w.bossFk; - - UPDATE tmp.workerHierarchyList whl - JOIN workerHierarchy wh ON wh.workerFk = whl.workerFk - SET whl.isChecked = 1; - - TRUNCATE workerHierarchy; - - INSERT INTO workerHierarchy - SELECT workerFk - FROM tmp.workerHierarchyList - WHERE NOT isChecked; - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS workerHierarchy; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_getHierarch__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getHierarch__`(vBoss INT) -BEGIN --- eliminar no se usa - -- usar worker_getHierarchy - DECLARE EXIT HANDLER FOR 1062 BEGIN - CALL util.throw('INFINITE_LOOP'); - END; - - DROP TEMPORARY TABLE IF EXISTS workerHierarch; - CREATE TEMPORARY TABLE workerHierarch - (PRIMARY KEY (workerFk)) - ENGINE = MEMORY - SELECT vBoss AS workerFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchList; - CREATE TEMPORARY TABLE tmp.workerHierarchList - (PRIMARY KEY (workerFk)) - ENGINE = MEMORY - SELECT vBoss AS workerFk, 0 AS isChecked; - - - WHILE (SELECT COUNT(*) FROM tmp.workerHierarchList WHERE NOT isChecked) > 0 DO - - INSERT INTO tmp.workerHierarchList - SELECT w.id, 0 - FROM worker w - JOIN workerHierarch wh ON wh.workerFk = w.bossFk; - - UPDATE tmp.workerHierarchList whl - JOIN workerHierarch wh ON wh.workerFk = whl.workerFk - SET whl.isChecked = 1; - - TRUNCATE workerHierarch; - - INSERT INTO workerHierarch - SELECT workerFk - FROM tmp.workerHierarchList - WHERE NOT isChecked; - - END WHILE; - - DROP TEMPORARY TABLE IF EXISTS workerHierarch; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_getProductionErrors__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getProductionErrors__`(vAction VARCHAR(25), vDepartment VARCHAR(25), vStateCode VARCHAR(25) CHARSET utf8, vDatedFrom DATETIME, vDatedTo DATETIME) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.total; - - IF (vDepartment = 'Encajadores') - THEN - CREATE TEMPORARY TABLE tmp.total - ENGINE = MEMORY - SELECT e.workerFk, Count(DISTINCT t.id) AS ticketCount - FROM expedition e - JOIN ticket t ON e.ticketFk = t.id - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo - GROUP BY e.workerFk; - ELSE - CREATE TEMPORARY TABLE tmp.total - ENGINE = MEMORY - SELECT st.workerFk, Count(DISTINCT t.id) AS ticketCount - FROM state ss - JOIN vn.saleTracking st ON st.stateFk = ss.id - JOIN vn.sale s ON s.id = st.saleFk - JOIN ticket t ON s.ticketFk = t.id - WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND ss.code = vStateCode - GROUP BY st.workerFk; - END IF; - - SELECT sub1.id, sub1.firstName, sub1.lastName, CAST(sub1.totalTickets AS DECIMAL(10,0)) AS totalTickets, CAST(IFNULL(sub1.errors,0) + IFNULL(sub2.errors,0) AS DECIMAL(10,0)) AS errors, (IFNULL(sub1.errors,0) + IFNULL(sub2.errors,0))/sub1.totalTickets AS ratio, IF(vDepartment = 'Revisadores', NULL, volume) AS volume - FROM( - SELECT w.id, w.code, w.firstName, w.lastName, t.ticketCount AS totalTickets, sub.errors, sub2.volume - FROM tmp.total AS t - JOIN worker w ON w.id = t.workerFk - LEFT JOIN ( - SELECT COUNT(c.ticketFk) AS errors, cd.workerFk - FROM claimDevelopment cd - JOIN claim c ON cd.claimFk = c.id - JOIN ticket t ON c.ticketFk = t.id - JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id - WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = vDepartment - GROUP BY cd.workerFk - )sub ON t.workerFk = sub.workerFk - LEFT JOIN ( -- Añadir volume - SELECT SUM(w.volume) AS volume, w.workerFk - FROM bs.workerProductivity w - INNER JOIN vn.`role` r ON r.id=w.roleFk - WHERE IF(vDepartment = 'Encajadores', r.name='packager', r.name='itemPicker') AND w.dated BETWEEN vDatedFrom AND vDatedTo - GROUP BY w.workerFk) sub2 ON w.id = sub2.workerFk - GROUP BY w.code) sub1 - LEFT JOIN( - SELECT sub1.workerFk, COUNT(id) AS errors - FROM ( - SELECT st.workerFk, t.id - FROM vn.saleMistake sm - JOIN vn.saleTracking st ON sm.saleFk = st.saleFk - JOIN state ss ON ss.id = st.stateFk - JOIN vncontrol.accion a ON a.accion_id = st.actionFk - JOIN vn.sale s ON s.id = sm.saleFk - JOIN vn.ticket t on t.id = s.ticketFk - WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND a.accion = vAction AND ss.code = vStateCode - GROUP BY s.ticketFk - ) sub1 - GROUP BY sub1.workerFk) sub2 ON sub2.workerFk = sub1.id; - - DROP TEMPORARY TABLE tmp.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 `worker_getSector` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `worker_getSector`() -BEGIN - -/** - * Obtiene el sector del usuario conectado -*/ - - SELECT s.id,s.description,s.warehouseFk - FROM sector s - JOIN worker w ON w.sectorFk = s.id - WHERE w.id = account.userGetId(); - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `worker_updateSector` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `worker_updateSector`(vSectorFk INT) -BEGIN - -/** - * ACtualiza el sector del usuario conectado - * - * @param vSectorFk id del sector -*/ - UPDATE worker - SET sectorFk = vSectorFk - WHERE id = account.userGetId(); - - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `workingHours` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHours`(username varchar(255), logon boolean) -BEGIN - DECLARE userid int(11); - - SELECT vn.getUserId(username) INTO userid; - SELECT username, userid; - IF userid IS NOT NULL THEN - IF (logon) THEN - CALL vn.workingHoursTimeIn(userid); - ELSE - CALL vn.workingHoursTimeOut(userid); - 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 DROP PROCEDURE IF EXISTS `workingHoursTimeIn` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeIn`(vUserId INT(11)) -BEGIN - INSERT INTO vn.workingHours (timeIn, userId) - VALUES (NOW(),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 `workingHoursTimeOut` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeOut`(vUserId INT(11)) -BEGIN - UPDATE vn.workingHours - SET timeOut = NOW() - WHERE userId = vUserId - AND DATE(timeIn) = 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 `wrongEqualizatedClient` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `wrongEqualizatedClient`() -BEGIN - SELECT clientFk, c.name, c.isActive, c.isTaxDataChecked, count(ie) as num - FROM vn.client c - JOIN - ( - SELECT DISTINCT - `a`.`clientFk` , - a.isEqualizated = 0 as ie - - FROM - `vn`.`address` `a` - ) sub ON sub.clientFk = c.id - WHERE c.hasToInvoiceByAddress = FALSE - - GROUP BY clientFk - HAVING num > 1 - UNION ALL - SELECT DISTINCT c.id, c.name, c.isActive, c.isTaxDataChecked,1 - FROM - `vn`.`address` `a` - JOIN `vn`.`client` `c` ON `c`.`id` = `a`.`clientFk` - WHERE ABS(a.isEqualizated) <> ABS(c.isEqualizated) - AND c.hasToInvoiceByAddress = 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 `xdiarioNextId__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `xdiarioNextId__`() -BEGIN -/** - * @deprecated Use ledger_next - */ - DECLARE vNewAsien INT; - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - ROLLBACK; - RESIGNAL; - END; - - START TRANSACTION; - - SELECT bookFk + 1 INTO vNewAsien FROM config FOR UPDATE; - UPDATE config SET bookFk = vNewAsien; - COMMIT; - - SELECT vNewAsien; - - DROP TEMPORARY TABLE IF EXISTS tmp.xdiarioNextId; - CREATE TEMPORARY TABLE tmp.xdiarioNextId AS - SELECT vNewAsien ; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zoneClosure_recalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneClosure_recalc`() -proc: BEGIN -/** - * Recalculates the delivery time (hour) for every zone in days + scope in future - */ - DECLARE vScope INT; - DECLARE vCounter INT DEFAULT 0; - DECLARE vShipped DATE DEFAULT CURDATE(); - - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('vn.zoneClosure_recalc'); - RESIGNAL; - END; - - IF NOT GET_LOCK('vn.zoneClosure_recalc', 0) THEN - LEAVE proc; - END IF; - - SELECT scope INTO vScope - FROM zoneConfig; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE tmp.zone - (INDEX (id)) - ENGINE = MEMORY - SELECT id FROM zone; - - TRUNCATE TABLE zoneClosure; - - WHILE vCounter <= vScope DO - - CALL zone_getOptionsForShipment(vShipped, TRUE); - - REPLACE zoneClosure(zoneFk, dated, `hour`) - SELECT zoneFk, vShipped, `hour` - FROM tmp.zoneOption; - - SET vCounter = vCounter + 1; - SET vShipped = TIMESTAMPADD(DAY, 1, vShipped); - END WHILE; - - -- DROP TEMPORARY TABLE tmp.zone; - DO RELEASE_LOCK('vn.zoneClosure_recalc'); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zoneClosure_recalc_beta__` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneClosure_recalc_beta__`() -proc: BEGIN -/** - * Recalculates the delivery time (hour) for every zone in days + scope in future - */ - DECLARE vScope INT; - DECLARE vCounter INT DEFAULT 0; - DECLARE vShipped DATE DEFAULT CURDATE(); - - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('vn.zoneClosure_recalc'); - RESIGNAL; - END; - - IF NOT GET_LOCK('vn.zoneClosure_recalc', 0) THEN - LEAVE proc; - END IF; - - SELECT scope INTO vScope - FROM zoneConfig; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE tmp.zone - (INDEX (id)) - ENGINE = MEMORY - SELECT id FROM zone; - - WHILE vCounter <= vScope DO - - DELETE FROM zoneClosure - WHERE dated = vShipped; - - SELECT vShipped; - - CALL zone_getOptionsForShipment_beta(vShipped, TRUE); - - REPLACE zoneClosure(zoneFk, dated, `hour`) - SELECT zoneFk, vShipped, `hour` - FROM tmp.zoneOption; - - SET vCounter = vCounter + 1; - SET vShipped = TIMESTAMPADD(DAY, 1, vShipped); - END WHILE; - - SELECT * - FROM tmp.zoneOption; - - -- DROP TEMPORARY TABLE tmp.zone; - DO RELEASE_LOCK('vn.zoneClosure_recalc'); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zoneGeo_calcTree` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_calcTree`() -BEGIN -/** - * Calculates the #path, #lft, #rgt, #sons and #depth columns of - * the #zoneGeo table. To build the tree, it uses the #parentFk - * column. - */ - DECLARE vIndex INT DEFAULT 0; - DECLARE vSons INT; - - DROP TEMPORARY TABLE IF EXISTS tNestedTree; - CREATE TEMPORARY TABLE tNestedTree - SELECT id, path, lft, rgt, depth, sons - FROM zoneGeo LIMIT 0; - - SET max_sp_recursion_depth = 5; - CALL zoneGeo_calcTreeRec(NULL, '/', 0, vIndex, vSons); - SET max_sp_recursion_depth = 0; - - UPDATE zoneGeo z - JOIN tNestedTree t ON t.id = z.id - SET z.path = t.path, - z.lft = t.lft, - z.rgt = t.rgt, - z.depth = t.depth, - z.sons = t.sons; - - DROP TEMPORARY TABLE tNestedTree; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zoneGeo_calcTreeRec` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_calcTreeRec`( - vSelf INT, - vPath VARCHAR(255), - vDepth INT, - INOUT vIndex INT, - OUT vSons INT -) -BEGIN -/** - * Calculates and sets the #path, #lft, #rgt, #sons and #depth - * columns for all children of the passed node. Once calculated - * the last node rgt index and the number of sons are returned. - * To update it's children, this procedure calls itself recursively - * for each one. - * - * @vSelf The node identifier - * @vPath The initial path - * @vDepth The initial depth - * @vIndex The initial lft index - * @vSons The number of direct sons - */ - DECLARE vChildFk INT; - DECLARE vLft INT; - DECLARE vMySons INT; - DECLARE vDone BOOL; - DECLARE vChildren CURSOR FOR - SELECT id FROM zoneGeo - WHERE (vSelf IS NULL AND parentFk IS NULL) - OR (vSelf IS NOT NULL AND parentFk = vSelf); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SET vSons = 0; - - OPEN vChildren; - myLoop: LOOP - SET vDone = FALSE; - FETCH vChildren INTO vChildFk; - - IF vDone THEN - LEAVE myLoop; - END IF; - - SET vIndex = vIndex + 1; - SET vLft = vIndex; - SET vSons = vSons + 1; - - CALL zoneGeo_calcTreeRec( - vChildFk, - CONCAT(vPath, vChildFk, '/'), - vDepth + 1, - vIndex, - vMySons - ); - - SET vIndex = vIndex + 1; - - INSERT INTO tNestedTree - SET id = vChildFk, - path = vPath, - lft = vLft, - rgt = vIndex, - depth = vDepth, - sons = vMySons; - END LOOP; - CLOSE vChildren; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zoneGeo_checkName` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_checkName`(vName VARCHAR(255)) -BEGIN - IF vName = '' THEN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Column `name` cannot be empty'; - 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 `zoneGeo_delete` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_delete`(vSelf INT) -BEGIN -/** - * Deletes a node from the #zoneGeo table. Also sets a mark - * to force the tree recalculation. - * - * @vSelf The node identifier - */ - DELETE FROM zoneGeo WHERE id = vSelf; - UPDATE zoneGeoRecalc SET isChanged = 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 `zoneGeo_doCalc` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_doCalc`() -proc: BEGIN -/** - * Recalculates the zones tree. - */ - DECLARE vIsChanged BOOL; - - DECLARE CONTINUE HANDLER FOR SQLEXCEPTION - BEGIN - DO RELEASE_LOCK('vn.zoneGeo_doCalc'); - RESIGNAL; - END; - - IF !GET_LOCK('vn.zoneGeo_doCalc', 0) THEN - LEAVE proc; - END IF; - - SELECT isChanged INTO vIsChanged - FROM zoneGeoRecalc; - - IF vIsChanged THEN - UPDATE zoneGeoRecalc SET isChanged = FALSE; - CALL vn.zoneGeo_calcTree; - END IF; - - DO RELEASE_LOCK('vn.zoneGeo_doCalc'); -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zoneGeo_setParent` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_setParent`(vSelf INT, vParentFk INT) -BEGIN -/** - * Updates the parent of a node. Also sets a mark - * to force the tree recalculation. - * - * @vSelf The node identifier - * @vParentFk The new parent identifier - */ - UPDATE zoneGeo SET parentFk = vParentFk - WHERE id = vSelf; - - UPDATE zoneGeoRecalc SET isChanged = 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 `zoneGeo_throwNotEditable` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_throwNotEditable`() -BEGIN - SIGNAL SQLSTATE '45000' - SET MESSAGE_TEXT = 'Column `geoFk` cannot be modified'; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_doCalcInitialize` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_doCalcInitialize`() -proc: BEGIN -/** - * Initialize ticket - */ - DECLARE vDone BOOL; - DECLARE vLanded DATE; - DECLARE vZoneFk INT; - - DECLARE cCur CURSOR FOR - SELECT t.landed, t.zoneFk - FROM ticket t - WHERE shipped >= '2020-03-01' - AND zoneFk IS NOT NULL and zonePrice IS NULL - GROUP BY zoneFk, shipped; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - OPEN cCur; - - myLoop: LOOP - SET vDone = FALSE; - FETCH cCur INTO vLanded, vZoneFk; - - IF vDone THEN - LEAVE myLoop; - END IF; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE tmp.zone - (INDEX (id)) - ENGINE = MEMORY - SELECT vZoneFk id; - - CALL zone_getOptionsForLanding(vLanded, TRUE); - - UPDATE ticket t - LEFT JOIN tmp.zoneOption zo ON TRUE - SET zonePrice = zo.price, zoneBonus = zo.bonus - WHERE t.zoneFk = vZoneFk AND t.landed = vLanded - AND t.zonePrice IS NULL; - - END LOOP; - - CLOSE cCur; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_ETD_byTime` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_ETD_byTime`() -BEGIN - - SET @m := 0; - - DROP TEMPORARY TABLE IF EXISTS tmpZone; - CREATE TEMPORARY TABLE tmpZone - SELECT remainingVolume, - hourTheoretical, - @m := @m + minutesLess totalMinutes - FROM zoneEstimatedDelivery ze - WHERE ze.remainingVolume - ORDER BY ze.hourTheoretical DESC; - - SELECT * FROM tmpZone; - - DROP TABLE tmpZone; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getAgency` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAgency`(vAddress INT, vLanded DATE) -BEGIN -/** - * Devuelve el listado de agencias disponibles para la fecha - * y dirección pasadas. - * - * @param vAddress Id de dirección de envío, %NULL si es recogida - * @param vLanded Fecha de recogida - * @return tmp.zoneGetAgency Listado de agencias disponibles - */ - CALL zone_getFromGeo(address_getGeo(vAddress)); - CALL zone_getOptionsForLanding(vLanded, FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetAgency; - CREATE TEMPORARY TABLE tmp.zoneGetAgency - (INDEX (agencyModeFk)) ENGINE = MEMORY - SELECT am.name agencyMode, - am.description, - z.agencyModeFk, - am.deliveryMethodFk, - TIMESTAMPADD(DAY,-zo.travelingDays, vLanded) shipped, - TRUE isIncluded, - zo.zoneFk, - am.web AS isVisible - FROM tmp.zoneOption zo - JOIN zone z ON z.id = zo.zoneFk - JOIN agencyMode am ON am.id = z.agencyModeFk - GROUP BY agencyModeFk; - - DROP TEMPORARY TABLE - tmp.zone, - tmp.zoneOption; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getAvailable` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAvailable`(vAddress INT, vLanded DATE) -BEGIN - CALL zone_getFromGeo(address_getGeo(vAddress)); - CALL zone_getOptionsForLanding(vLanded, FALSE); - - SELECT * FROM tmp.zoneOption; - - DROP TEMPORARY TABLE - tmp.zone, - tmp.zoneOption; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getClosed` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getClosed`() -proc:BEGIN -/** - * Devuelve una tabla con las zonas cerradas para hoy - * - * @table tmp.closedZones(zoneFk, warehouseFk); - */ - DROP TEMPORARY TABLE IF EXISTS tmp.closedZones; - - CREATE TEMPORARY TABLE tmp.closedZones ( - `zoneFk` int(11) NOT NULL, - `warehouseFk` smallint(6) unsigned NOT NULL, - PRIMARY KEY `zoneFk` (`zoneFk`,`warehouseFk`), - KEY `warehouseFk` (`warehouseFk`)) - ENGINE=MEMORY DEFAULT CHARSET=utf8; - - INSERT INTO tmp.closedZones(zoneFk, warehouseFk) - SELECT zoneFk, warehouseFk - FROM ( - SELECT t.zoneFk, t.warehouseFk, count(DISTINCT t.id) numTickets, pc.minTicketsToCloseZone - FROM vn.ticket t - JOIN vn.expedition e ON e.ticketFk = t.id - JOIN vn.`zone`z on z.id = t.zoneFk - JOIN vn.agencyMode am ON am.id = z.agencyModeFk - JOIN vn.agency a ON a.id = am.agencyFk - JOIN vn.productionConfig pc - WHERE a.isOwn - AND pc.isZoneClosedByExpeditionActivated - AND e.created >= CURDATE() - GROUP BY t.zoneFk, t.warehouseFk - HAVING numTickets >= minTicketsToCloseZone) sub; - END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getCollisions` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getCollisions`() -BEGIN -/** - * Calcula si para un mismo codigo postal y dia - * hay mas de una zona configurada y manda correo - * - */ - DECLARE vGeoFk INT DEFAULT NULL; - DECLARE vZoneFk INT; - DECLARE vIsDone INT DEFAULT FALSE; - DECLARE vTableCollisions TEXT; - DECLARE cur1 CURSOR FOR SELECT zoneFk from tmp.zoneOption; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE tmp.zone - SELECT z.id - FROM zone z - JOIN agencyMode am ON am.id = z.agencyModeFk - JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE dm.code IN ('AGENCY','DELIVERY'); - - CALL zone_getOptionsForShipment(CURDATE(),FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.zoneNodes; - CREATE TEMPORARY TABLE tmp.zoneNodes ( - geoFk INT, - name VARCHAR(100), - parentFk INT, - sons INT, - isChecked BOOL DEFAULT 0, - zoneFk INT, - PRIMARY KEY zoneFkk (zoneFk, geoFk), - INDEX(geoFk)) - ENGINE = MEMORY; - - OPEN cur1; - cur1Loop: LOOP - SET vIsDone = FALSE; - FETCH cur1 INTO vZoneFk; - IF vIsDone THEN - LEAVE cur1Loop; - END IF; - - CALL zone_getLeaves2(vZoneFk, NULL, NULL); - - myLoop: LOOP - SET vGeoFk = NULL; - SELECT geoFk INTO vGeoFk - FROM tmp.zoneNodes zn - WHERE NOT isChecked - LIMIT 1; - - IF vGeoFk IS NULL THEN - LEAVE myLoop; - END IF; - - CALL zone_getLeaves2(vZoneFk, vGeoFk, NULL); - UPDATE tmp.zoneNodes - SET isChecked = TRUE - WHERE geoFk = vGeoFk; - END LOOP; - - END LOOP; - CLOSE cur1; - DELETE FROM tmp.zoneNodes - WHERE sons > 0; - - DROP TEMPORARY TABLE IF EXISTS geoCollision; - CREATE TEMPORARY TABLE geoCollision - SELECT z.agencyModeFk, zn.geoFk, zw.warehouseFk - FROM tmp.zoneNodes zn - JOIN zone z ON z.id = zn.zoneFk - JOIN zoneWarehouse zw ON z.id = zw.zoneFk - GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk - HAVING count(*) > 1; - - SELECT ' - - - - - - - - ' INTO vTableCollisions; - - INSERT INTO mail (receiver,replyTo,subject,body) - SELECT 'pepe@verdnatura.es' receiver, - 'noreply@verdnatura.es' replyTo, - CONCAT('Colisiones en zonas ', CURDATE()) subject, - CONCAT(vTableCollisions, - GROUP_CONCAT(sub.td SEPARATOR ''), - '
C.PostalNúmero de zonaPrecioZonaAlmacénSalix
') body - FROM(SELECT - CONCAT(' - ', zn.name, ' - ', zoneFk,' - ', z.price,' - ', z.name,' - ', w.name, ' - ', CONCAT('' - 'https://salix.verdnatura.es/#!/zone/', - zoneFk, - '/location?q=%7B%22search%22:%22', - zn.name, - '%22%7D'),' - ') td - FROM tmp.zoneNodes zn - JOIN zone z ON z.id = zn.zoneFk - JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk - JOIN warehouse w ON w.id = gc.warehouseFk) sub; - - DROP TEMPORARY TABLE - geoCollision, - tmp.zone, - tmp.zoneNodes; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getEvents` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getEvents`( - vGeoFk INT, - vAgencyModeFk INT) -BEGIN -/** - * Returns available events for the passed province/postcode and agency. - * - * @param vGeoFk The geo id - * @param vAgencyModeFk The agency mode id - */ - DECLARE vDeliveryMethodFk VARCHAR(255); - - DROP TEMPORARY TABLE IF EXISTS tZone; - CREATE TEMPORARY TABLE tZone - (id INT PRIMARY KEY) - ENGINE = MEMORY; - - SELECT dm.`code` INTO vDeliveryMethodFk - FROM agencyMode am - JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE am.id = vAgencyModeFk; - - IF vDeliveryMethodFk = 'PICKUP' THEN - INSERT INTO tZone - SELECT id - FROM zone - WHERE agencyModeFk = vAgencyModeFk; - ELSE - CALL zone_getFromGeo(vGeoFk); - - IF vAgencyModeFk IS NOT NULL THEN - INSERT INTO tZone - SELECT t.id - FROM tmp.zone t - JOIN zone z ON z.id = t.id - WHERE z.agencyModeFk = vAgencyModeFk; - ELSE - INSERT INTO tZone - SELECT t.id - FROM tmp.zone t - JOIN zone z ON z.id = t.id - JOIN agencyMode am ON am.id = z.agencyModeFk - JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - WHERE dm.`code` IN ('AGENCY', 'DELIVERY'); - END IF; - DROP TEMPORARY TABLE tmp.zone; - END IF; - - SELECT e.zoneFk, e.`type`, e.dated, e.`started`, e.`ended`, e.weekDays - FROM tZone t - JOIN zoneEvent e ON e.zoneFk = t.id; - - SELECT e.zoneFk, e.dated - FROM tZone t - JOIN zoneExclusion e ON e.zoneFk = t.id; - - DROP TEMPORARY TABLE tZone; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getFromGeo` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getFromGeo`(vGeoFk INT) -BEGIN -/** - * Returns all zones which have the passed geo included. - * - * @param vGeoFk The geo id - * @return tmp.zone(id) The list of zones - */ - DECLARE vChildFk INT DEFAULT vGeoFk; - DECLARE vParentFk INT; - DECLARE vLevel INT DEFAULT 1; - - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes - (PRIMARY KEY (id)) - ENGINE = MEMORY - SELECT vGeoFk id, vLevel `level`; - - myLoop: LOOP - SELECT parentFk INTO vParentFk - FROM zoneGeo - WHERE id = vChildFk; - - SET vChildFk = vParentFk; - SET vLevel = vLevel + 1; - - INSERT IGNORE INTO tNodes - SELECT vChildFk, vLevel - FROM DUAL - WHERE vChildFk IS NOT NULL; - - IF ROW_COUNT() = 0 THEN - LEAVE myLoop; - END IF; - END LOOP; - - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - CREATE TEMPORARY TABLE tmp.zone - (INDEX (id)) - ENGINE = MEMORY - SELECT id FROM ( - SELECT zoneFk id, isIncluded - FROM ( - SELECT i.zoneFk, i.isIncluded - FROM tNodes n - JOIN zoneIncluded i ON i.geoFk = n.id - ORDER BY zoneFk, n.`level` - ) t - GROUP BY id HAVING isIncluded - ) t; - - DROP TEMPORARY TABLE tNodes; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getLanded` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN) -BEGIN -/** - * Devuelve una tabla temporal con el dia de recepcion para vShipped. - * Excluye las que tengan cajas preparadas - * - * @param vShipped Fecha de preparacion de mercancia - * @param vAddressFk Id de consignatario, %NULL para recogida - * @param vAgencyModeFk Id agencia - * @param vWarehouseFk vWarehouseFk - * @table tmp.zoneGetLanded Datos de recepción - */ - CALL vn.zone_getFromGeo(address_getGeo(vAddressFk)); - - CALL vn.zone_getOptionsForShipment(vShipped, vShowExpiredZones); - - CALL vn.zone_getClosed(); - - DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; - CREATE TEMPORARY TABLE tmp.zoneGetLanded - ENGINE = MEMORY - SELECT vWarehouseFk warehouseFk, - TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed, - zo.zoneFk - FROM tmp.zoneOption zo - JOIN vn.`zone` z ON z.id = zo.zoneFk - JOIN vn.zoneWarehouse zw ON zw.zoneFk = z.id - LEFT JOIN tmp.closedZones cz - ON cz.warehouseFk = zw.warehouseFk - AND cz.zoneFk = zw.zoneFk - AND zo.shipped = CURDATE() - WHERE z.agencyModeFk = vAgencyModeFk - AND zw.warehouseFk = vWarehouseFk - AND (ISNULL(cz.zoneFk) OR vShowExpiredZones); - - DROP TEMPORARY TABLE - tmp.`zone`, - tmp.zoneOption, - tmp.closedZones; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getLeaves` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves`(vSelf INT, vParentFk INT, vSearch VARCHAR(255)) -BEGIN -/** - * Devuelve las ubicaciones incluidas en la ruta y que sean hijos de parentFk. - * @param vSelf Id de la zona - * @param vParentFk Id del geo a calcular - * @param vSearch cadena a buscar - */ - DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; - - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes - (UNIQUE (id)) - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - IF vIsSearch THEN - SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - - INSERT INTO tNodes - SELECT id - FROM zoneGeo - WHERE (vIsNumber AND `name` = vSearch) - OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) - LIMIT 1000; - - ELSEIF vParentFk IS NULL THEN - INSERT INTO tNodes - SELECT geoFk - FROM zoneIncluded - WHERE zoneFk = vSelf; - END IF; - - IF vParentFk IS NULL THEN - DROP TEMPORARY TABLE IF EXISTS tChilds; - CREATE TEMPORARY TABLE tChilds - ENGINE = MEMORY - SELECT id - FROM tNodes; - - DROP TEMPORARY TABLE IF EXISTS tParents; - CREATE TEMPORARY TABLE tParents - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - myLoop: LOOP - DELETE FROM tParents; - INSERT INTO tParents - SELECT parentFk id - FROM zoneGeo g - JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - - INSERT IGNORE INTO tNodes - SELECT id - FROM tParents; - - IF ROW_COUNT() = 0 THEN - LEAVE myLoop; - END IF; - - DELETE FROM tChilds; - INSERT INTO tChilds - SELECT id - FROM tParents; - END LOOP; - - DROP TEMPORARY TABLE tChilds, tParents; - END IF; - - IF !vIsSearch THEN - INSERT IGNORE INTO tNodes - SELECT id - FROM zoneGeo - WHERE parentFk <=> vParentFk; - END IF; - - SELECT g.id, - g.name, - g.parentFk, - g.sons, - isIncluded selected - FROM zoneGeo g - JOIN tNodes n ON n.id = g.id - LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf - ORDER BY `depth`, selected DESC, name; - - DROP TEMPORARY TABLE tNodes; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getLeaves2` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves2`(vSelf INT, vParentFk INT, vSearch VARCHAR(255)) -BEGIN -/** - * Devuelve los geoFk incluidos en la ruta y que sean hijos de parentFk - * @param vSelf Id de la zona - * @param vParentFk Id del geo a calcular - * @param vSearch cadena a buscar - * - * @return tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - * - */ - DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; - - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes - (UNIQUE (id)) - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - IF vIsSearch THEN - SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - - INSERT INTO tNodes - SELECT id - FROM zoneGeo - WHERE (vIsNumber AND `name` = vSearch) - OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) - LIMIT 1000; - - ELSEIF vParentFk IS NULL THEN - INSERT INTO tNodes - SELECT geoFk - FROM zoneIncluded - WHERE zoneFk = vSelf; - END IF; - - IF vParentFk IS NULL THEN - DROP TEMPORARY TABLE IF EXISTS tChilds; - CREATE TEMPORARY TABLE tChilds - (INDEX(id)) - ENGINE = MEMORY - SELECT id - FROM tNodes; - - DROP TEMPORARY TABLE IF EXISTS tParents; - CREATE TEMPORARY TABLE tParents - (INDEX(id)) - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - myLoop: LOOP - DELETE FROM tParents; - INSERT INTO tParents - SELECT parentFk id - FROM zoneGeo g - JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - - INSERT IGNORE INTO tNodes - SELECT id - FROM tParents; - - IF ROW_COUNT() = 0 THEN - LEAVE myLoop; - END IF; - - DELETE FROM tChilds; - INSERT INTO tChilds - SELECT id - FROM tParents; - END LOOP; - - DROP TEMPORARY TABLE tChilds, tParents; - END IF; - - IF !vIsSearch THEN - INSERT IGNORE INTO tNodes - SELECT id - FROM zoneGeo - WHERE parentFk <=> vParentFk; - END IF; - - INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - SELECT g.id, - g.`name`, - g.parentFk, - g.sons, - NOT g.sons OR type = 'country', - vSelf - FROM zoneGeo g - JOIN tNodes n ON n.id = g.id - LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf - WHERE i.isIncluded = TRUE - OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL); - - DROP TEMPORARY TABLE tNodes; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getLeaves___` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves___`( - vSelf INT, - vParentFk INT, - vSearch VARCHAR(255) -) -BEGIN - DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; - - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes - (UNIQUE (id)) - ENGINE = MEMORY - SELECT id FROM zoneGeo LIMIT 0; - - IF vIsSearch THEN - SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - - INSERT INTO tNodes - SELECT id FROM zoneGeo - WHERE (vIsNumber AND `name` = vSearch) - OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) - LIMIT 1000; - ELSEIF vParentFk IS NULL THEN - INSERT INTO tNodes - SELECT geoFk FROM zoneIncluded - WHERE zoneFk = vSelf; - END IF; - - IF vParentFk IS NULL THEN - DROP TEMPORARY TABLE IF EXISTS tChilds; - CREATE TEMPORARY TABLE tChilds - ENGINE = MEMORY - SELECT id FROM tNodes; - - DROP TEMPORARY TABLE IF EXISTS tParents; - CREATE TEMPORARY TABLE tParents - ENGINE = MEMORY - SELECT id FROM zoneGeo LIMIT 0; - - myLoop: LOOP - DELETE FROM tParents; - INSERT INTO tParents - SELECT parentFk id - FROM zoneGeo g - JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - - INSERT IGNORE INTO tNodes - SELECT id FROM tParents; - - IF ROW_COUNT() = 0 THEN - LEAVE myLoop; - END IF; - - DELETE FROM tChilds; - INSERT INTO tChilds - SELECT id FROM tParents; - END LOOP; - - DROP TEMPORARY TABLE - tChilds, - tParents; - END IF; - - IF !vIsSearch THEN - INSERT IGNORE INTO tNodes - SELECT id FROM zoneGeo - WHERE parentFk <=> vParentFk; - END IF; - - - INSERT IGNORE INTO zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - SELECT g.id, - g.`name`, - g.parentFk, - g.sons, - NOT g.sons OR type = 'country', - vSelf - FROM zoneGeo g - JOIN tNodes n ON n.id = g.id - LEFT JOIN zoneIncluded i - ON i.geoFk = g.id AND i.zoneFk = vSelf - WHERE (i.isIncluded = TRUE - OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL)) - ; - - DROP TEMPORARY TABLE tNodes; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getOptionsForLanding` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForLanding`(vLanded DATE, vShowExpiredZones BOOLEAN) -BEGIN -/** - * Gets computed options for the passed zones and delivery date. - * - * @table tmp.zone(id) The zones ids - * @param vLanded The delivery date - * @return tmp.zoneOption The computed options - */ - DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; - CREATE TEMPORARY TABLE tmp.zoneOption - ENGINE = MEMORY - SELECT - zoneFk, - `hour`, - travelingDays, - price, - bonus, - TIMESTAMPADD(DAY, -travelingDays, vLanded) shipped - FROM ( - SELECT t.id zoneFk, - TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, - IFNULL(e.travelingDays, z.travelingDays) travelingDays, - IFNULL(e.price, z.price) price, - IFNULL(e.bonus, z.bonus) bonus - FROM tmp.zone t - JOIN zone z ON z.id = t.id - JOIN zoneEvent e ON e.zoneFk = t.id - WHERE ( - e.`type` = 'day' - AND e.dated = vLanded - ) OR ( - e.`type` != 'day' - AND e.weekDays & (1 << WEEKDAY(vLanded)) - AND (e.`started` IS NULL OR vLanded >= e.`started`) - AND (e.`ended` IS NULL OR vLanded <= e.`ended`) - ) - ORDER BY - zoneFk, - CASE - WHEN e.`type` = 'day' - THEN 1 - WHEN e.`type` = 'range' - THEN 2 - ELSE 3 - END - ) t - GROUP BY zoneFk; - - DELETE t FROM tmp.zoneOption t - JOIN zoneExclusion e - ON e.zoneFk = t.zoneFk AND e.`dated` = vLanded; - - IF NOT vShowExpiredZones THEN - DELETE FROM tmp.zoneOption - WHERE shipped < CURDATE() - OR (shipped = CURDATE() AND CURTIME() > `hour`); - 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 `zone_getOptionsForShipment` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN) -BEGIN -/** - * Gets computed options for the passed zones and shipping date. - * - * @table tmp.zones(id) The zones ids - * @param vShipped The shipping date - * @return tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, specificity) The computed options - */ - DECLARE vHour TIME DEFAULT TIME(NOW()); - - DROP TEMPORARY TABLE IF EXISTS tLandings; - CREATE TEMPORARY TABLE tLandings - (INDEX (eventFk)) - ENGINE = MEMORY - SELECT e.id eventFk, - @travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays, - TIMESTAMPADD(DAY, @travelingDays, vShipped) landed - FROM tmp.zone t - JOIN zone z ON z.id = t.id - JOIN zoneEvent e ON e.zoneFk = t.id; - - DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; - CREATE TEMPORARY TABLE tmp.zoneOption - ENGINE = MEMORY - SELECT * - FROM ( - SELECT t.id zoneFk, - TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, - l.travelingDays, - IFNULL(e.price, z.price) price, - IFNULL(e.bonus, z.bonus) bonus, - l.landed, - vShipped shipped - FROM tmp.zone t - JOIN zone z ON z.id = t.id - JOIN zoneEvent e ON e.zoneFk = t.id - JOIN tLandings l ON l.eventFk = e.id - WHERE ( - e.`type` = 'day' - AND e.`dated` = l.landed - ) OR ( - e.`type` != 'day' - AND e.weekDays & (1 << WEEKDAY(l.landed)) - AND (e.`started` IS NULL OR l.landed >= e.`started`) - AND (e.`ended` IS NULL OR l.landed <= e.`ended`) - ) - ORDER BY - zoneFk, - CASE - WHEN e.`type` = 'day' - THEN 1 - WHEN e.`type` = 'range' - THEN 2 - ELSE 3 - END - ) t - GROUP BY zoneFk; - - DROP TEMPORARY TABLE tLandings; - - DELETE t FROM tmp.zoneOption t - JOIN zoneExclusion e - ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; - - IF NOT vShowExpiredZones THEN - DELETE FROM tmp.zoneOption - WHERE vShipped < CURDATE() - OR (vShipped = CURDATE() AND CURTIME() > `hour`); - 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 `zone_getShipped` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vShowExpiredZones BOOLEAN) -BEGIN -/** - * Devuelve la mínima fecha de envío para cada warehouse - * Excluye aquellas zonas que ya tienen cajas preparadas en ese almacén - * - * @param vLanded La fecha de recepcion - * @param vAddressFk Id del consignatario - * @param vAgencyModeFk Id de la agencia - * @return tmp.zoneGetShipped - */ - CALL vn.zone_getFromGeo(address_getGeo(vAddressFk)); - CALL vn.zone_getOptionsForLanding(vLanded, vShowExpiredZones); - CALL vn.zone_getClosed(); - - DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetShipped; - CREATE TEMPORARY TABLE tmp.zoneGetShipped - ENGINE = MEMORY - SELECT * FROM ( - SELECT zo.zoneFk, - zo.shipped, - zo.`hour`, - zw.warehouseFk, - z.agencyModeFk, - zo.price, - zo.bonus - FROM tmp.zoneOption zo - JOIN vn.zoneWarehouse zw ON zw.zoneFk = zo.zoneFk - JOIN vn.`zone` z ON z.id = zo.zoneFk - LEFT JOIN tmp.closedZones cz - ON cz.warehouseFk = zw.warehouseFk - AND cz.zoneFk = zw.zoneFk - AND zo.shipped = CURDATE() - WHERE z.agencyModeFk = vAgencyModeFk - AND (ISNULL(cz.zoneFk) OR vShowExpiredZones) - ORDER BY shipped) t - GROUP BY warehouseFk; - - DROP TEMPORARY TABLE - tmp.`zone`, - tmp.zoneOption, - tmp.closedZones; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getState` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getState`(vDated DATE) -BEGIN -/** - * Devuelve las zonas y el estado para la fecha solicitada - * - * @param vDated Fecha en cuestión - */ - DROP TEMPORARY TABLE IF EXISTS tmp.zone; - - CREATE TEMPORARY TABLE tmp.zone ( - id INT PRIMARY KEY) - ENGINE=MEMORY; - - INSERT INTO tmp.zone(id) - SELECT id - FROM vn.zone; - - CALL vn.zone_getOptionsForShipment(vDated, TRUE); - - CALL vn.zone_getClosed(); - - SELECT zo.zoneFk, - zo.`hour`etd, - (zo.`hour` <= TIME(now())) isLate, - !ISNULL(cz.zoneFk) isFull, - zw.warehouseFk, - zo.landed - FROM tmp.zoneOption zo - JOIN vn.zone z ON z.id = zo.zoneFk - JOIN vn.zoneWarehouse zw ON zw.zoneFk = z.id - LEFT JOIN tmp.closedZones cz - ON cz.warehouseFk = zw.warehouseFk - AND cz.zoneFk = zo.zoneFk; - - DROP TEMPORARY TABLE - tmp.closedZones, - tmp.zoneOption, - tmp.zone; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_getWarehouse` */; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT) -BEGIN -/** - * Devuelve el listado de agencias disponibles para la fecha, - * dirección y almacén pasados. - * - * @param vAddress - * @param vWarehouse warehouse - * @param vLanded Fecha de recogida - * @select Listado de agencias disponibles - */ - - CALL zone_getFromGeo(address_getGeo(vAddress)); - CALL zone_getOptionsForLanding(vLanded, FALSE); - - SELECT am.id agencyModeFk, - am.name agencyMode, - am.description, - am.deliveryMethodFk, - TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped, - zw.warehouseFk, - z.id zoneFk - FROM tmp.zoneOption zo - JOIN zone z ON z.id = zo.zoneFk - JOIN agencyMode am ON am.id = z.agencyModeFk - JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk - WHERE zw.warehouseFk = vWarehouse - GROUP BY z.agencyModeFk - ORDER BY agencyMode; - - DROP TEMPORARY TABLE - tmp.zone, - tmp.zoneOption; - -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!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 `zone_upcomingDeliveries` */; -/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `zone_upcomingDeliveries`() -BEGIN - - DECLARE vForwardDays INT; - - SELECT forwardDays INTO vForwardDays FROM zoneConfig; - CALL util.time_createTable(CURDATE(), DATE_ADD(CURDATE(), INTERVAL vForwardDays DAY)); - - DROP TEMPORARY TABLE IF EXISTS tLandings; - CREATE TEMPORARY TABLE tLandings - (INDEX (eventFk)) - ENGINE = MEMORY - SELECT e.id eventFk, - @travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays, - TIMESTAMPADD(DAY, @travelingDays, ti.dated) landed, - ti.dated shipped - FROM zone z - JOIN zoneEvent e ON e.zoneFk = z.id - JOIN tmp.time ti ON ti.dated BETWEEN curdate() AND TIMESTAMPADD(DAY, vForwardDays, curdate()); - - DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; - CREATE TEMPORARY TABLE tmp.zoneOption - ENGINE = MEMORY - SELECT * - FROM ( - SELECT z.id zoneFk, - TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, - l.travelingDays, - IFNULL(e.price, z.price) price, - IFNULL(e.bonus, z.bonus) bonus, - l.landed, - l.shipped - FROM zone z - JOIN zoneEvent e ON e.zoneFk = z.id - JOIN tLandings l ON l.eventFk = e.id - WHERE ( - e.`type` = 'day' - AND e.`dated` = l.landed - ) OR ( - e.`type` != 'day' - AND e.weekDays & (1 << WEEKDAY(l.landed)) - AND (e.`started` IS NULL OR l.landed >= e.`started`) - AND (e.`ended` IS NULL OR l.landed <= e.`ended`) - ) - ORDER BY - zoneFk, - CASE - WHEN e.`type` = 'day' - THEN 1 - WHEN e.`type` = 'range' - THEN 2 - ELSE 3 - END - ) t - GROUP BY zoneFk, landed; - - DELETE t FROM tmp.zoneOption t - JOIN zoneExclusion e - ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; - - SELECT MAX(zo.`hour`) `hour`, zg.`name`, zo.shipped, zo.zoneFk - FROM tmp.zoneOption zo - JOIN `zone` z ON z.id = zo.zoneFk - JOIN agencyMode am ON am.id = z.agencyModeFk - JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk - JOIN zoneIncluded zi ON zi.zoneFk = z.id - JOIN zoneGeo zg ON zg.id = zi.geoFk AND zg.type = 'province' - WHERE dm.code = 'DELIVERY' - GROUP BY shipped, zg.`name` - ORDER BY shipped, zg.`name`; - - DROP TEMPORARY TABLE tmp.time, tLandings; -END ;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_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: `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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -/*!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(10) unsigned DEFAULT NULL, - PRIMARY KEY (`inter_id`), - KEY `currante` (`Id_Trabajador`), - KEY `responsable` (`Id_Supervisor`), - KEY `ticket` (`Id_Ticket`), - KEY `inter_state` (`state_id`), - KEY `inter_id` (`Id_Ticket`,`inter_id`) USING BTREE, - CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn`.`state` (`id`) ON UPDATE CASCADE, - CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE -) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_beforeInsert` - BEFORE INSERT ON `inter` - FOR EACH ROW -BEGIN - DECLARE vState VARCHAR(15); - DECLARE vZoneFk INT; - DECLARE vHasStowAway BOOLEAN; - DECLARE vBoardingStateFk INT; - - SELECT s.code INTO vState - FROM vn.state s - WHERE s.id = NEW.state_id; - - SELECT t.zonefk INTO vZoneFk - FROM vn.ticket t - WHERE t.id = NEW.Id_Ticket; - - IF vState = 'OK' AND vZoneFk IS NULL THEN - CALL util.throw("ASSIGN_ZONE_FIRST"); - END IF; - -END */;; -DELIMITER ; -/*!50003 SET sql_mode = @saved_sql_mode */ ; -/*!50003 SET character_set_client = @saved_cs_client */ ; -/*!50003 SET character_set_results = @saved_cs_results */ ; -/*!50003 SET collation_connection = @saved_col_connection */ ; -/*!50003 SET @saved_cs_client = @@character_set_client */ ; -/*!50003 SET @saved_cs_results = @@character_set_results */ ; -/*!50003 SET @saved_col_connection = @@collation_connection */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_afterInsert` - AFTER INSERT ON `inter` - FOR EACH ROW -BEGIN - - DECLARE vNumTicketsPrepared INT; - - REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) - SELECT NEW.Id_Ticket, NEW.inter_id, `name` - FROM vn.state - WHERE 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_afterUpdate` - AFTER UPDATE ON `inter` - FOR EACH ROW -BEGIN - DECLARE vTicketFk INT; - DECLARE vTicketTrackingFk INT; - DECLARE vStateName VARCHAR(15); - - IF NEW.state_id <> OLD.state_id THEN - REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) - SELECT NEW.Id_Ticket, NEW.inter_id, `name` - FROM vn.state - WHERE id = NEW.state_id; - END IF; - - IF NEW.Id_Ticket <> OLD.Id_Ticket THEN - SELECT i.Id_Ticket, i.inter_id, s.`name` - INTO vTicketFk, vTicketTrackingFk, vStateName - FROM vncontrol.inter i - JOIN vn.state s ON i.state_id = s.id - WHERE Id_Ticket = NEW.Id_Ticket - ORDER BY odbc_date DESC - LIMIT 1; - - IF vTicketFk > 0 THEN - REPLACE INTO vn.ticketLastState(ticketFk, ticketTrackingFk,name) - VALUES(vTicketFk, vTicketTrackingFk, vStateName); - 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 = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_afterDelete` - AFTER DELETE ON `inter` - FOR EACH ROW -BEGIN - DECLARE vTicketFk INT; - DECLARE vTicketTrackingFk INT; - DECLARE vStateName VARCHAR(15); - - DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' - BEGIN - DELETE FROM vn.ticketLastState - WHERE ticketFk = OLD.Id_Ticket; - END; - - SELECT i.Id_Ticket, i.inter_id, s.`name` - INTO vTicketFk, vTicketTrackingFk, vStateName - FROM vncontrol.inter i - JOIN vn.state s ON i.state_id = s.id - WHERE Id_Ticket = OLD.Id_Ticket - ORDER BY odbc_date DESC - LIMIT 1; - - IF vTicketFk > 0 THEN - REPLACE INTO vn.ticketLastState(ticketFk, ticketTrackingFk,name) - VALUES(vTicketFk, vTicketTrackingFk, vStateName); - 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 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 */ ; -/*!50003 SET character_set_client = utf8mb4 */ ; -/*!50003 SET character_set_results = utf8mb4 */ ; -/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; -/*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; -DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() -BEGIN - DECLARE vDate DATETIME DEFAULT TIMESTAMPADD(MONTH, -2, CURDATE()); - DELETE i FROM inter i JOIN vn.ticket t ON i.Id_Ticket = t.id - WHERE t.shipped <= 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 */ ; - --- --- Current Database: `account` --- - -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 */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `accountDovecot` AS select `u`.`name` AS `name`,`u`.`password` AS `password` from (`user` `u` join `account` `a` on((`a`.`id` = `u`.`id`))) where `u`.`active` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `emailUser` --- - -/*!50001 DROP TABLE IF EXISTS `emailUser`*/; -/*!50001 DROP VIEW IF EXISTS `emailUser`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `emailUser` AS select `u`.`id` AS `userFk`,concat(`u`.`name`,'@',`mc`.`domain`) AS `email` from (`user` `u` join `mailConfig` `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 `myRole` --- - -/*!50001 DROP TABLE IF EXISTS `myRole`*/; -/*!50001 DROP VIEW IF EXISTS `myRole`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myRole` AS select `r`.`inheritsFrom` AS `id` from (`roleRole` `r` join `user` `u` on((`u`.`role` = `r`.`role`))) where (`u`.`id` = `myUser_getId`()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `myUser` --- - -/*!50001 DROP TABLE IF EXISTS `myUser`*/; -/*!50001 DROP VIEW IF EXISTS `myUser`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myUser` 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` = `myUserGetName`()) */ -/*!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: `bs` --- - -USE `bs`; - --- --- Final view structure for view `bajasLaborales` --- - -/*!50001 DROP TABLE IF EXISTS `bajasLaborales`*/; -/*!50001 DROP VIEW IF EXISTS `bajasLaborales`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bajasLaborales` AS select `p`.`firstname` AS `firstname`,`p`.`name` AS `name`,`b`.`business_id` AS `business_id`,max(`ce`.`date`) AS `lastDate`,max(ifnull(`b`.`date_end`,curdate())) AS `endContract`,`cs`.`type` AS `type`,cast(count(0) as decimal(10,0)) AS `dias`,`w`.`userFk` AS `userFk` from (((((`postgresql`.`calendar_employee` `ce` join `postgresql`.`business` `b` on((`b`.`business_id` = `ce`.`business_id`))) join `postgresql`.`profile` `pr` on((`pr`.`profile_id` = `b`.`client_id`))) join `postgresql`.`person` `p` on((`p`.`person_id` = `pr`.`person_id`))) join `postgresql`.`calendar_state` `cs` on((`cs`.`calendar_state_id` = `ce`.`calendar_state_id`))) join `vn`.`worker` `w` on((`w`.`id` = `p`.`id_trabajador`))) where ((`ce`.`date` >= (curdate() + interval -(1) year)) and (`cs`.`type` not in ('Vacaciones','Vacaciones 1/2 día','Compensar','Festivo'))) group by `p`.`firstname`,`p`.`name`,`cs`.`type` having (`endContract` >= 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 `lastIndicators` --- - -/*!50001 DROP TABLE IF EXISTS `lastIndicators`*/; -/*!50001 DROP VIEW IF EXISTS `lastIndicators`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastIndicators` AS select `i`.`updated` AS `updated`,`i`.`lastYearSales` AS `lastYearSales`,(`i`.`lastYearSales` - `yi`.`lastYearSales`) AS `incLastYearSales`,`i`.`totalGreuge` AS `totalGreuge`,(`i`.`totalGreuge` - `yi`.`totalGreuge`) AS `incTotalGreuge`,`i`.`latePaymentRate` AS `latePaymentRate`,(`i`.`latePaymentRate` - `yi`.`latePaymentRate`) AS `incLatePaymentRate`,`i`.`countEmployee` AS `countEmployee`,(`i`.`countEmployee` - `yi`.`countEmployee`) AS `incCountEmployee`,`i`.`averageMana` AS `averageMana`,(`i`.`averageMana` - `yi`.`averageMana`) AS `incAverageMana`,`i`.`bankingPool` AS `bankingPool`,(`i`.`bankingPool` - `yi`.`bankingPool`) AS `incbankingPool`,`i`.`lastMonthActiveClients` AS `lastMonthActiveClients`,(`i`.`lastMonthActiveClients` - `yi`.`lastMonthActiveClients`) AS `incLastMonthActiveClients`,`i`.`lastMonthLostClients` AS `lastMonthLostClients`,(`i`.`lastMonthLostClients` - `yi`.`lastMonthLostClients`) AS `incLastMonthLostClients`,`i`.`lastMonthNewClients` AS `lastMonthNewClients`,(`i`.`lastMonthNewClients` - `yi`.`lastMonthNewClients`) AS `incLastMonthNewClients`,`i`.`lastMonthWebBuyingRate` AS `lastMonthWebBuyingRate`,(`i`.`lastMonthWebBuyingRate` - `yi`.`lastMonthWebBuyingRate`) AS `incLastMonthWebBuyingRate`,`i`.`productionHours__` AS `productionHours__`,`i`.`dailyWorkersCost__` AS `dailyWorkersCost__`,`i`.`volumeM3__` AS `volumeM3__`,`i`.`salesValue__` AS `salesValue__`,`i`.`valueM3__` AS `valueM3__`,`i`.`hoursM3__` AS `hoursM3__`,`i`.`workerCostM3__` AS `workerCostM3__`,`i`.`salesWorkersCostRate__` AS `salesWorkersCostRate__`,`i`.`thisWeekSales` AS `thisWeekSales`,`i`.`lastYearWeekSales` AS `lastYearWeekSales` from (`indicators` `i` join `indicators` `yi` on((`yi`.`updated` = (select (max(`indicators`.`updated`) + interval -(1) day) from `indicators`)))) where (`i`.`updated` = (select max(`indicators`.`updated`) from `indicators`)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `m3Silla__` --- - -/*!50001 DROP TABLE IF EXISTS `m3Silla__`*/; -/*!50001 DROP VIEW IF EXISTS `m3Silla__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `m3Silla__` AS select `m3`.`fecha` AS `fecha`,`m3`.`year` AS `year`,`m3`.`month` AS `month`,`m3`.`week` AS `week`,`m3`.`day` AS `day`,`m3`.`dayName` AS `dayName`,cast(sum(`m3`.`m3`) as decimal(10,0)) AS `Volumen`,cast(sum(`m3`.`euros`) as decimal(10,0)) AS `Euros` from `m3` where (`m3`.`warehouseFk` in (1,44)) group by `m3`.`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 `manaCustomer` --- - -/*!50001 DROP TABLE IF EXISTS `manaCustomer`*/; -/*!50001 DROP VIEW IF EXISTS `manaCustomer`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `manaCustomer` AS select `cmc`.`clientFk` AS `Id_Cliente`,`cmc`.`mana` AS `Mana`,`cmc`.`dated` AS `dated` from `vn`.`clientManaCache` `cmc` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `manaSpellersExcluded` --- - -/*!50001 DROP TABLE IF EXISTS `manaSpellersExcluded`*/; -/*!50001 DROP VIEW IF EXISTS `manaSpellersExcluded`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `manaSpellersExcluded` AS select `m`.`Id_Trabajador` AS `workerFk` from `bs`.`mana_spellers_excluded` `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 `mana_spellers` --- - -/*!50001 DROP TABLE IF EXISTS `mana_spellers`*/; -/*!50001 DROP VIEW IF EXISTS `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mana_spellers` AS select `wm`.`workerFk` AS `Id_Trabajador`,`wm`.`size` AS `size`,`wm`.`amount` AS `used`,`wm`.`pricesModifierRate` AS `prices_modifier_rate`,`wm`.`isPricesModifierActivated` AS `prices_modifier_activated`,`wm`.`minRate` AS `minRate`,`wm`.`maxRate` AS `maxRate` from `vn`.`workerMana` `wm` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `mana_spellers_excluded` --- - -/*!50001 DROP TABLE IF EXISTS `mana_spellers_excluded`*/; -/*!50001 DROP VIEW IF EXISTS `mana_spellers_excluded`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mana_spellers_excluded` AS select `wme`.`workerFk` AS `Id_Trabajador` from `vn`.`workerManaExcluded` `wme` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `packingSpeed` --- - -/*!50001 DROP TABLE IF EXISTS `packingSpeed`*/; -/*!50001 DROP VIEW IF EXISTS `packingSpeed`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `packingSpeed` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,((`p`.`width` * `p`.`height`) * `p`.`depth`)) AS `cm3`,`t`.`warehouseFk` AS `warehouse_id`,`e`.`created` AS `odbc_date` from ((`vn`.`expedition` `e` join `vn`.`packaging` `p` on((`p`.`id` = `e`.`packagingFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) where (`e`.`created` between curdate() and `util`.`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 `s1_ticketDetail` --- - -/*!50001 DROP TABLE IF EXISTS `s1_ticketDetail`*/; -/*!50001 DROP VIEW IF EXISTS `s1_ticketDetail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `s1_ticketDetail` AS select `s`.`ticketFk` AS `ticketFk`,cast(sum((`s`.`price` * `s`.`quantity`)) as decimal(10,2)) AS `ticketAmount`,count(`s`.`id`) AS `ticketLines`,cast(sum(`sv`.`volume`) as decimal(10,2)) AS `ticketM3`,cast(`t`.`shipped` as date) AS `shipped` from ((`vn`.`ticket` `t` join `vn`.`sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where (`t`.`shipped` between '2021-09-01' and '2021-10-31 23:59') group by `s`.`ticketFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `s21_saleDetail` --- - -/*!50001 DROP TABLE IF EXISTS `s21_saleDetail`*/; -/*!50001 DROP VIEW IF EXISTS `s21_saleDetail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `s21_saleDetail` AS select dayofmonth(`t`.`shipped`) AS `dia`,year(`t`.`shipped`) AS `año`,month(`t`.`shipped`) AS `mes`,`s`.`concept` AS `concepto`,`s`.`quantity` AS `unidades`,`s`.`price` AS `precio`,(`s`.`quantity` * `s`.`price`) AS `venta`,`it`.`name` AS `familia`,`w`.`code` AS `comprador`,`s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`sv`.`volume` AS `volume` from ((((((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `vn`.`worker` `w` on((`w`.`id` = `it`.`workerFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where (((`t`.`shipped` between '2020-10-21' and '2020-10-28') or (`t`.`shipped` between '2019-10-21' and '2019-10-28') or (`t`.`shipped` between '2021-09-1' and '2021-10-28')) and (`t`.`warehouseFk` in (1,60)) and `c`.`isRelevant` and (`s`.`quantity` > 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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sale__` AS select `v`.`Id_Movimiento` AS `saleFk`,`v`.`importe` AS `amount`,`v`.`recargo` AS `surcharge`,`v`.`fecha` AS `dated`,`v`.`tipo_id` AS `typeFk`,`v`.`Id_Cliente` AS `clientFk`,`v`.`empresa_id` AS `companyFk`,`v`.`margen` AS `margin` from `ventas` `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 `salesPerson__` --- - -/*!50001 DROP TABLE IF EXISTS `salesPerson__`*/; -/*!50001 DROP VIEW IF EXISTS `salesPerson__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesPerson__` AS select `v`.`Id_Trabajador` AS `workerFk`,`v`.`año` AS `year`,`v`.`mes` AS `month`,`v`.`importe` AS `amount`,`v`.`comision` AS `commission`,`v`.`comisionArrendada` AS `leasedCommission`,`v`.`comisionCedida` AS `cededCommission`,`v`.`comisionNuevos` AS `newCommission`,`v`.`sustitucionArrendada` AS `leasedReplacement`,`v`.`itemTypeBorrowed` AS `itemTypeBorrowed`,`v`.`portfolioWeight` AS `portfolioWeight`,`v`.`updated` AS `updated` from `vendedores` `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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `v_ventas__` AS select (`ventas`.`importe` * `Movimientos`.`Cantidad`) AS `importe`,`ventas`.`recargo` AS `recargo`,`time`.`year` AS `year`,`time`.`month` AS `month`,`time`.`week` AS `week`,`time`.`day` AS `day` from ((`bs`.`ventas` join `vn2008`.`time` on((`time`.`date` = `ventas`.`fecha`))) join `vn2008`.`Movimientos` on((`ventas`.`Id_Movimiento` = `Movimientos`.`Id_Movimiento`))) group by `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 */; - --- --- Final view structure for view `vendedores` --- - -/*!50001 DROP TABLE IF EXISTS `vendedores`*/; -/*!50001 DROP VIEW IF EXISTS `vendedores`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `vendedores` AS select `sp`.`workerFk` AS `Id_Trabajador`,`sp`.`year` AS `año`,`sp`.`month` AS `mes`,`sp`.`amount` AS `importe`,`sp`.`commission` AS `comision`,`sp`.`leasedCommission` AS `comisionArrendada`,`sp`.`cededCommission` AS `comisionCedida`,`sp`.`newCommission` AS `comisionNuevos`,`sp`.`leasedReplacement` AS `sustitucionArrendada`,`sp`.`itemTypeBorrowed` AS `itemTypeBorrowed`,`sp`.`portfolioWeight` AS `portfolioWeight`,`sp`.`updated` AS `updated` from `salesPerson` `sp` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `ventas` --- - -/*!50001 DROP TABLE IF EXISTS `ventas`*/; -/*!50001 DROP VIEW IF EXISTS `ventas`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ventas` AS select `s`.`saleFk` AS `Id_Movimiento`,`s`.`amount` AS `importe`,`s`.`surcharge` AS `recargo`,`s`.`dated` AS `fecha`,`s`.`typeFk` AS `tipo_id`,`s`.`clientFk` AS `Id_Cliente`,`s`.`companyFk` AS `empresa_id`,`s`.`margin` AS `margen` from `sale` `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 `workerMana` --- - -/*!50001 DROP TABLE IF EXISTS `workerMana`*/; -/*!50001 DROP VIEW IF EXISTS `workerMana`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerMana` AS select `m`.`Id_Trabajador` AS `workerFk`,`m`.`used` AS `amount` from `bs`.`mana_spellers` `m` */; -/*!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` --- - -USE `cache`; - --- --- Current Database: `edi` --- - -USE `edi`; - --- --- Final view structure for view `errorList` --- - -/*!50001 DROP TABLE IF EXISTS `errorList`*/; -/*!50001 DROP VIEW IF EXISTS `errorList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `errorList` AS select `po`.`id` AS `id`,`c`.`name` AS `name`,`i`.`longName` AS `longName`,`po`.`quantity` AS `quantity`,left(`po`.`error`,4) AS `stock`,`po`.`error` AS `error`,`po`.`deliveryInformationID` AS `deliveryInformationID`,`po`.`supplyResponseID` AS `supplyResponseID`,`po`.`OrderTradeLineDateTime` AS `OrderTradeLineDateTime`,`po`.`EndUserPartyGLN` AS `EndUserPartyGLN` from ((`edi`.`putOrder` `po` left join `vn`.`client` `c` on((`c`.`id` = `po`.`EndUserPartyGLN`))) left join `vn`.`item` `i` on((`i`.`supplyResponseFk` = `po`.`supplyResponseID`))) where ((`po`.`OrderTradeLineDateTime` > (curdate() + interval -(12) hour)) and (`po`.`OrderStatus` = 3) and (left(`po`.`error`,4) <> '(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 `supplyOffer` --- - -/*!50001 DROP TABLE IF EXISTS `supplyOffer`*/; -/*!50001 DROP VIEW IF EXISTS `supplyOffer`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `supplyOffer` AS select `sr`.`vmpID` AS `vmpID`,`di`.`ID` AS `diId`,`sr`.`ID` AS `srId`,`sr`.`Item_ArticleCode` AS `Item_ArticleCode`,`sr`.`VBNOmschrijving` AS `product_name`,`s`.`company_name` AS `company_name`,cast(`sr`.`Price` as decimal(10,3)) AS `Price`,`sr`.`Quality` AS `Quality`,`sr`.`s1` AS `s1`,`sr`.`s2` AS `s2`,`sr`.`s3` AS `s3`,`sr`.`s4` AS `s4`,`sr`.`s5` AS `s5`,`sr`.`s6` AS `s6`,`sr`.`NumberOfUnits` AS `NumberOfUnits`,least(if((`sr`.`EmbalageCode` = 800),((`sr`.`EmbalageCode` * 10) + `sr`.`NumberOfItemsPerCask`),`sr`.`EmbalageCode`),ifnull(`idt`.`bucket_id`,'999')) AS `EmbalageCode`,`di`.`LatestDeliveryDateTime` AS `LatestDeliveryDateTime`,`di`.`EarliestDespatchDateTime` AS `EarliestDespatchDateTime`,`di`.`FirstOrderDateTime` AS `FirstOrderDateTime`,`di`.`LatestOrderDateTime` AS `LatestOrderDateTime`,`sr`.`NumberOfItemsPerCask` AS `NumberOfItemsPerCask`,`sr`.`NumberOfLayersPerTrolley` AS `NumberOfLayersPerTrolley`,`sr`.`MinimumNumberToOrder` AS `MinimumNumberToOrder`,`sr`.`MaximumNumberToOrder` AS `MaximumNumberToOrder`,`sr`.`IncrementalOrderableQuantity` AS `IncrementalOrderableQuantity`,`sr`.`PackingPrice` AS `PackingPrice`,`sr`.`MarketPlaceID` AS `MarketPlaceID`,`sr`.`PictureReference` AS `PictureReference`,`sr`.`updated` AS `supplyResponseUpdated`,`i`.`group_id` AS `group_id`,`mp`.`name` AS `marketPlace`,`di`.`DeliveryPrice` AS `DeliveryPrice`,`di`.`ChargeAmount` AS `ChargeAmount`,`di`.`MinimumQuantity` AS `MinimumQuantity`,`di`.`MaximumQuantity Integer` AS `MaximumQuantity`,cast((`sr`.`MinimumNumberToOrder` * (case `sr`.`MinimumOrderUnitType` when 1 then 1 when 2 then (`sr`.`NumberOfItemsPerCask` / `sr`.`NumberBunchesPerCask`) when 3 then `sr`.`NumberOfItemsPerCask` when 4 then (floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) when 5 then ((floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) * `sr`.`NumberOfLayersPerTrolley`) end)) as decimal(10,0)) AS `OrderUnit`,cast((`sr`.`IncrementalOrderableQuantity` * (case `sr`.`IncrementalOrderableQuantityType` when 1 then 1 when 2 then (`sr`.`NumberOfItemsPerCask` / `sr`.`NumberBunchesPerCask`) when 3 then `sr`.`NumberOfItemsPerCask` when 4 then (floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) when 5 then ((floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) * `sr`.`NumberOfLayersPerTrolley`) end)) as decimal(10,0)) AS `IncrementalOrderUnit`,`mp`.`isEarlyBird` AS `isEarlyBird`,`v`.`isVNHSupplier` AS `isVNHSupplier`,`igo`.`expenseFk` AS `expenseFk`,`igo`.`intrastatFk` AS `intrastatFk`,`igo`.`originFk` AS `originFk`,ifnull(`idt`.`itemTypeFk`,`igo`.`itemTypeFk`) AS `itemTypeFk` from (((((((((`edi`.`deliveryInformation` `di` join `edi`.`supplyResponse` `sr` on((`sr`.`ID` = `di`.`supplyResponseID`))) left join `edi`.`supplier` `s` on((`s`.`glnAddressCode` = `sr`.`SupplierGLN`))) join `edi`.`bucket` `b` on((`b`.`bucket_id` = `sr`.`EmbalageCode`))) join `edi`.`item` `i` on((`i`.`id` = `sr`.`Item_ArticleCode`))) join `edi`.`marketPlace` `mp` on((`mp`.`id` = `sr`.`MarketPlaceID`))) join `vn`.`floramondoConfig` `fm`) left join `edi`.`item_defaultType` `idt` on((`idt`.`item_id` = `i`.`id`))) join `edi`.`VMPSettings` `v` on((`v`.`VMPID` = `sr`.`vmpID`))) join `edi`.`item_groupToOffer` `igo` on((`igo`.`group_code` = `i`.`group_id`))) where ((`v`.`isBlocked` = 0) and (`s`.`isBanned` = 0) and (`sr`.`NumberOfUnits` > 0) and (now() between `di`.`FirstOrderDateTime` and `di`.`LatestOrderDateTime`) and (`mp`.`isOffered` = 1) and (`di`.`LatestDeliveryDateTime` between cast(`fm`.`nextLanded` as date) and concat(cast(`fm`.`nextLanded` as date),' ',`fm`.`MaxLatestDeliveryHour`))) group by `sr`.`ID` having (`EmbalageCode` <> 999) */; -/*!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: `hedera` --- - -USE `hedera`; - --- --- Final view structure for view `mainAccountBank` --- - -/*!50001 DROP TABLE IF EXISTS `mainAccountBank`*/; -/*!50001 DROP VIEW IF EXISTS `mainAccountBank`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mainAccountBank` AS select `e`.`name` AS `name`,`a`.`iban` AS `iban` from ((`hedera`.`mainAccount` `c` join `vn`.`supplierAccount` `a` on((`a`.`id` = `c`.`accountFk`))) join `vn`.`bankEntity` `e` on((`e`.`id` = `a`.`bankEntityFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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`.`agencyModeFk` AS `agencyModeFk` from `vn`.`address` `t` where (`t`.`clientFk` = `account`.`myUser_getId`()) */ -/*!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 `myBasket` --- - -/*!50001 DROP TABLE IF EXISTS `myBasket`*/; -/*!50001 DROP VIEW IF EXISTS `myBasket`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myBasket` AS select `o`.`id` AS `id`,`o`.`date_make` AS `made`,`o`.`date_send` AS `sent`,`o`.`customer_id` AS `clientFk`,`o`.`delivery_method_id` AS `deliveryMethodFk`,`o`.`agency_id` AS `agencyModeFk`,`o`.`address_id` AS `addressFk`,`o`.`company_id` AS `companyFk`,`o`.`note` AS `notes` from `hedera`.`order` `o` where (`o`.`id` = `MYBASKET_GETID`()) */ -/*!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 `myBasketDefaults` --- - -/*!50001 DROP TABLE IF EXISTS `myBasketDefaults`*/; -/*!50001 DROP VIEW IF EXISTS `myBasketDefaults`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myBasketDefaults` AS select coalesce(`dm`.`code`,`cm`.`code`) AS `deliveryMethod`,coalesce(`ad`.`agencyModeFk`,`oc`.`defaultAgencyFk`) AS `agencyModeFk`,`c`.`defaultAddressFk` AS `addressFk`,`oc`.`defaultAgencyFk` AS `defaultAgencyFk` from ((((((`hedera`.`orderConfig` `oc` join `vn`.`agencyMode` `ca` on((`ca`.`id` = `oc`.`defaultAgencyFk`))) join `vn`.`deliveryMethod` `cm` on((`cm`.`id` = `ca`.`deliveryMethodFk`))) left join `vn`.`client` `c` on((`c`.`id` = `account`.`myUser_getId`()))) left join `vn`.`address` `ad` on((`ad`.`id` = `c`.`defaultAddressFk`))) left join `vn`.`agencyMode` `a` on((`a`.`id` = `ad`.`agencyModeFk`))) left join `vn`.`deliveryMethod` `dm` on((`dm`.`id` = `a`.`deliveryMethodFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `myBasketItem` --- - -/*!50001 DROP TABLE IF EXISTS `myBasketItem`*/; -/*!50001 DROP VIEW IF EXISTS `myBasketItem`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myBasketItem` AS select `r`.`id` AS `id`,`r`.`orderFk` AS `orderFk`,`r`.`warehouseFk` AS `warehouseFk`,`r`.`itemFk` AS `itemFk`,`r`.`amount` AS `amount`,`r`.`price` AS `price` from `hedera`.`orderRow` `r` where (`r`.`orderFk` = `MYBASKET_GETID`()) */ -/*!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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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`.`myUser_getId`()) */ -/*!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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myInvoice` AS select `i`.`id` AS `id`,`i`.`ref` AS `ref`,`i`.`issued` AS `issued`,`i`.`amount` AS `amount`,`i`.`hasPdf` AS `hasPdf` from `vn`.`invoiceOut` `i` where (`i`.`clientFk` = `account`.`myUser_getId`()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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`.`myRole` `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 `myOrder` --- - -/*!50001 DROP TABLE IF EXISTS `myOrder`*/; -/*!50001 DROP VIEW IF EXISTS `myOrder`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myOrder` AS select `o`.`id` AS `id`,`o`.`date_send` AS `landed`,`o`.`customer_id` AS `clientFk`,`o`.`delivery_method_id` AS `deliveryMethodFk`,`o`.`agency_id` AS `agencyModeFk`,`o`.`address_id` AS `addressFk`,`o`.`company_id` AS `companyFk`,`o`.`note` AS `note`,`o`.`source_app` AS `sourceApp`,`o`.`confirmed` AS `isConfirmed`,`o`.`date_make` AS `created`,`o`.`first_row_stamp` AS `firstRowStamp`,`o`.`confirm_date` AS `confirmed` from `hedera`.`order` `o` where (`o`.`customer_id` = `account`.`myUser_getId`()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `myOrderRow` --- - -/*!50001 DROP TABLE IF EXISTS `myOrderRow`*/; -/*!50001 DROP VIEW IF EXISTS `myOrderRow`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myOrderRow` AS select `orw`.`id` AS `id`,`orw`.`order_id` AS `Fk`,`orw`.`item_id` AS `itemFk`,`orw`.`warehouse_id` AS `warehouseFk`,`orw`.`shipment` AS `shipped`,`orw`.`amount` AS `amount`,`orw`.`price` AS `price`,`orw`.`rate` AS `rate`,`orw`.`created` AS `created`,`orw`.`Id_Movimiento` AS `saleFk` from (`hedera`.`order_row` `orw` join `hedera`.`myOrder` `o` on((`o`.`id` = `orw`.`order_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 `myOrderTicket` --- - -/*!50001 DROP TABLE IF EXISTS `myOrderTicket`*/; -/*!50001 DROP VIEW IF EXISTS `myOrderTicket`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myOrderTicket` AS select `o`.`id` AS `orderFk`,`ot`.`ticketFk` AS `ticketFk` from (`hedera`.`myOrder` `o` join `hedera`.`orderTicket` `ot` on((`ot`.`orderFk` = `o`.`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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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`.`myUser_getId`()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `myTicketService` --- - -/*!50001 DROP TABLE IF EXISTS `myTicketService`*/; -/*!50001 DROP VIEW IF EXISTS `myTicketService`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myTicketService` AS select `s`.`id` AS `id`,`s`.`description` AS `description`,`s`.`quantity` AS `quantity`,`s`.`price` AS `price`,`s`.`taxClassFk` AS `taxClassFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`ticketServiceTypeFk` AS `ticketServiceTypeFk` from (`vn`.`ticketService` `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 `myTicketState` --- - -/*!50001 DROP TABLE IF EXISTS `myTicketState`*/; -/*!50001 DROP VIEW IF EXISTS `myTicketState`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `myTicketState` 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`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`code` AS `code` from (`vn`.`ticket` `t` left join `vn`.`ticketState` `ts` on((`ts`.`ticketFk` = `t`.`id`))) where (`t`.`clientFk` = `account`.`myUser_getId`()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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`.`myUser_getId`()) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `orderTicket` --- - -/*!50001 DROP TABLE IF EXISTS `orderTicket`*/; -/*!50001 DROP VIEW IF EXISTS `orderTicket`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `orderTicket` AS select `b`.`orderFk` AS `orderFk`,`b`.`ticketFk` AS `ticketFk` from `vn`.`orderTicket` `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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_component` AS select `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_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `order_row` AS select `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 */; - --- --- Current Database: `nst` --- - -USE `nst`; - --- --- Current Database: `pbx` --- - -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 */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cdrConf` 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 `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 `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 */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `followmeConf` AS select `f`.`extension` AS `name`,`c`.`music` AS `music`,`c`.`context` AS `context`,`c`.`takeCall` AS `takecall`,`c`.`declineCall` AS `declinecall` from (`followme` `f` join `followmeConfig` `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 `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 */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `followmeNumberConf` AS select `f`.`extension` AS `name`,1 AS `ordinal`,`f`.`phone` AS `phonenumber`,`c`.`timeout` AS `timeout` from (`followme` `f` join `followmeConfig` `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 `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 */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `queueConf` AS select `q`.`name` AS `name`,`c`.`strategy` AS `strategy`,`c`.`timeout` AS `timeout`,`c`.`retry` AS `retry`,`c`.`weight` AS `weight`,`c`.`maxLen` AS `maxlen`,`c`.`ringInUse` AS `ringinuse` from (`queue` `q` join `queueConfig` `c` on((`q`.`config` = `c`.`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 `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 */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `queueMemberConf` AS select `m`.`id` AS `uniqueid`,`m`.`queue` AS `queue_name`,concat('SIP/',`m`.`extension`) AS `interface`,0 AS `paused` from `queueMember` `m` union all select `p`.`id` AS `id`,`p`.`queue` AS `queue`,concat('Local/',`p`.`phone`,'@outgoing') AS `phone`,0 AS `paused` from `queuePhone` `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 `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 */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,NULL AS `callbackextension`,`s`.`md5Secret` AS `md5secret`,`u`.`nickname` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`careInvite` AS `careinvite`,`c`.`insecure` AS `insecure`,`c`.`transport` AS `transport`,`c`.`nat` AS `nat`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from (((`pbx`.`sip` `s` join `account`.`user` `u` on((`u`.`id` = `s`.`user_id`))) left join `pbx`.`sipReg` `r` on((`s`.`user_id` = `r`.`userId`))) join `pbx`.`sipConfig` `c`) */; -/*!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: `postgresql` --- - -USE `postgresql`; - --- --- Final view structure for view `calendar_employee` --- - -/*!50001 DROP TABLE IF EXISTS `calendar_employee`*/; -/*!50001 DROP VIEW IF EXISTS `calendar_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `calendar_employee` AS select `ce`.`id` AS `id`,`ce`.`businessFk` AS `business_id`,`ce`.`dayOffTypeFk` AS `calendar_state_id`,`ce`.`dated` AS `date` from `vn`.`calendar` `ce` */; -/*!50001 SET character_set_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` --- - -/*!50001 DROP TABLE IF EXISTS `person`*/; -/*!50001 DROP VIEW IF EXISTS `person`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `person` AS select `p`.`id` AS `person_id`,`p`.`surnames` AS `name`,`p`.`nickname` AS `nickname`,`p`.`fi` AS `nif`,`p`.`birth` AS `birth`,`p`.`firstname` AS `firstname`,`p`.`p2` AS `p2`,`p`.`readerId` AS `nis`,`p`.`workerFk` AS `id_trabajador`,`p`.`isDisable` AS `isDisable`,`p`.`isFreelance` AS `isFreelance`,`p`.`isSsDiscounted` AS `isSsDiscounted`,`p`.`sex` AS `sex` from `vn`.`person` `p` */; -/*!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: `sage` --- - -USE `sage`; - --- --- Final view structure for view `clientLastTwoMonths` --- - -/*!50001 DROP TABLE IF EXISTS `clientLastTwoMonths`*/; -/*!50001 DROP VIEW IF EXISTS `clientLastTwoMonths`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientLastTwoMonths` AS select `vn`.`invoiceOut`.`clientFk` AS `clientFk`,`vn`.`invoiceOut`.`companyFk` AS `companyFk` from `vn`.`invoiceOut` where (`vn`.`invoiceOut`.`issued` > (curdate() - interval 2 month)) union select `vn`.`receipt`.`clientFk` AS `clientFk`,`vn`.`receipt`.`companyFk` AS `companyFk` from `vn`.`receipt` where (`vn`.`receipt`.`payed` > (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 `invoiceInList` --- - -/*!50001 DROP TABLE IF EXISTS `invoiceInList`*/; -/*!50001 DROP VIEW IF EXISTS `invoiceInList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInList` AS select `vn`.`invoiceIn`.`id` AS `id`,`vn`.`invoiceIn`.`supplierRef` AS `supplierRef`,`vn`.`invoiceIn`.`serial` AS `serial`,`vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`issued` AS `issued`,if((`vn`.`invoiceIn`.`expenceFkDeductible` > 0),1,0) AS `isVatDeductible`,`vn`.`invoiceIn`.`serialNumber` AS `serialNumber` from `vn`.`invoiceIn` where (`vn`.`invoiceIn`.`issued` >= (date_format(curdate(),'%Y-01-01') + interval -(1) year)) union all select `vn`.`dua`.`id` AS `id`,`vn`.`dua`.`code` AS `code`,'D' AS `D`,`c`.`id` AS `supplierFk`,`vn`.`dua`.`issued` AS `issued`,0 AS `FALSE`,`vn`.`dua`.`id` AS `serialNumber` from (`vn`.`dua` join `vn`.`company` `c` on((`c`.`code` = 'VNL'))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `providerLastThreeMonths` --- - -/*!50001 DROP TABLE IF EXISTS `providerLastThreeMonths`*/; -/*!50001 DROP VIEW IF EXISTS `providerLastThreeMonths`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `providerLastThreeMonths` AS select `vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`companyFk` AS `companyFk` from `vn`.`invoiceIn` where (`vn`.`invoiceIn`.`issued` > (curdate() - interval 3 month)) union select `vn`.`payment`.`supplierFk` AS `supplierFk`,`vn`.`payment`.`companyFk` AS `companyFk` from `vn`.`payment` where (`vn`.`payment`.`received` > (curdate() + interval -(3) 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: `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `Account` 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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `User` AS select `account`.`user`.`id` AS `id`,`account`.`user`.`realm` AS `realm`,`account`.`user`.`name` AS `username`,`account`.`user`.`bcryptPassword` AS `password`,`account`.`user`.`email` AS `email`,`account`.`user`.`emailVerified` AS `emailVerified`,`account`.`user`.`verificationToken` AS `verificationToken` 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 */; - --- --- Current Database: `stock` --- - -USE `stock`; - --- --- Current Database: `util` --- - -USE `util`; - --- --- Current Database: `vn` --- - -USE `vn`; - --- --- Final view structure for view `NewView` --- - -/*!50001 DROP TABLE IF EXISTS `NewView`*/; -/*!50001 DROP VIEW IF EXISTS `NewView`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `NewView` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(((`c`.`id` = `t`.`clientFk`) and (`t`.`shipped` < (curdate() + interval -(`pc`.`rookieDays`) day))))) group by `c`.`id` having (isnull(`lastShipped`) or (`lastShipped` < (curdate() + interval -(`notBuyingMonths`) 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 `__coolerPathDetail` --- - -/*!50001 DROP TABLE IF EXISTS `__coolerPathDetail`*/; -/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `__coolerPathDetail` AS select `c`.`cooler_path_detail_id` AS `id`,`c`.`cooler_path_id` AS `coolerPathFk`,`c`.`pasillo` AS `hallway` from `vn2008`.`cooler_path_detail` `c` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `absenceType` --- - -/*!50001 DROP TABLE IF EXISTS `absenceType`*/; -/*!50001 DROP VIEW IF EXISTS `absenceType`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `absenceType` AS select `cs`.`calendar_state_id` AS `id`,`cs`.`type` AS `name`,`cs`.`rgb` AS `rgb`,`cs`.`code` AS `code`,`cs`.`permissionRate` AS `permissionRate`,`cs`.`holidayEntitlementRate` AS `holidayEntitlementRate`,`cs`.`discountRate` AS `discountRate` from `postgresql`.`calendar_state` `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 `agencyProvince__` --- - -/*!50001 DROP TABLE IF EXISTS `agencyProvince__`*/; -/*!50001 DROP VIEW IF EXISTS `agencyProvince__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `agencyProvince__` AS select `a`.`province_id` AS `provinceFk`,`a`.`agency_id` AS `agencyFk`,`a`.`zona` AS `zone`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`isVolumetric` AS `isVolumetric` from `vn2008`.`Agencias_province` `a` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `annualAverageInvoiced` --- - -/*!50001 DROP TABLE IF EXISTS `annualAverageInvoiced`*/; -/*!50001 DROP VIEW IF EXISTS `annualAverageInvoiced`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `annualAverageInvoiced` AS select `cec`.`clientFk` AS `clientFk`,`cec`.`invoiced` AS `invoiced` from `bs`.`clientAnnualConsumption` `cec` */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `awb__` 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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bank` AS select `a`.`id` AS `id`,`a`.`bank` AS `bank`,`a`.`account` AS `account`,`a`.`accountingTypeFk` AS `cash`,`a`.`entityFk` AS `entityFk`,`a`.`isActive` AS `isActive`,`a`.`currencyFk` AS `currencyFk`,`a`.`code` AS `code` from `accounting` `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 `bankPolicy` --- - -/*!50001 DROP TABLE IF EXISTS `bankPolicy`*/; -/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `bankPolicy` AS select `bp`.`poliza_id` AS `id`,`bp`.`referencia` AS `ref`,`bp`.`importe` AS `amount`,`bp`.`com_dispuesto` AS `balanceInterestDrawn`,`bp`.`com_no_dispuesto` AS `commissionAvailableBalances`,`bp`.`com_anual` AS `openingCommission`,`bp`.`apertura` AS `started`,`bp`.`cierre` AS `ended`,`bp`.`Id_Banco` AS `bankFk`,`bp`.`empresa_id` AS `companyFk`,`bp`.`supplierFk` AS `supplierFk`,`bp`.`description` AS `description`,`bp`.`hasGuarantee` AS `hasGuarantee`,`bp`.`dmsFk` AS `dmsFk`,`bp`.`notaryFk` AS `notaryFk`,`bp`.`currencyFk` AS `currencyFk`,`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,`bp`.`insuranceExpired` AS `insuranceExpired` from `vn2008`.`Bancos_poliza` `bp` order by `bp`.`poliza_id` desc */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `businessCalendar` --- - -/*!50001 DROP TABLE IF EXISTS `businessCalendar`*/; -/*!50001 DROP VIEW IF EXISTS `businessCalendar`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `businessCalendar` AS select `ce`.`id` AS `id`,`ce`.`business_id` AS `businessFk`,`ce`.`calendar_state_id` AS `absenceTypeFk`,`ce`.`date` AS `dated` from `postgresql`.`calendar_employee` `ce` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `buyer` --- - -/*!50001 DROP TABLE IF EXISTS `buyer`*/; -/*!50001 DROP VIEW IF EXISTS `buyer`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `buyer` AS select distinct `u`.`id` AS `userFk`,`u`.`nickname` AS `nickname` from (`account`.`user` `u` join `vn`.`itemType` `it` on((`it`.`workerFk` = `u`.`id`))) where `u`.`active` order by `u`.`nickname` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `buyerSales` --- - -/*!50001 DROP TABLE IF EXISTS `buyerSales`*/; -/*!50001 DROP VIEW IF EXISTS `buyerSales`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `buyerSales` AS select `v`.`importe` AS `importe`,`w`.`code` AS `comprador`,`t`.`year` AS `año`,`t`.`week` AS `semana` from (((`bs`.`ventas` `v` join `vn`.`time` `t` on((`t`.`dated` = `v`.`fecha`))) join `vn`.`itemType` `it` on((`it`.`id` = `v`.`tipo_id`))) join `vn`.`worker` `w` on((`w`.`id` = `it`.`workerFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `calendar__` --- - -/*!50001 DROP TABLE IF EXISTS `calendar__`*/; -/*!50001 DROP VIEW IF EXISTS `calendar__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `calendar__` AS select `ce`.`id` AS `id`,`ce`.`business_id` AS `businessFk`,`ce`.`calendar_state_id` AS `dayOffTypeFk`,`ce`.`date` AS `dated` from `postgresql`.`calendar_employee` `ce` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `claimRatio__` --- - -/*!50001 DROP TABLE IF EXISTS `claimRatio__`*/; -/*!50001 DROP VIEW IF EXISTS `claimRatio__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `claimRatio__` AS select `claims_ratio`.`Id_Cliente` AS `clientFk`,`claims_ratio`.`Consumo` AS `yearSale`,`claims_ratio`.`Reclamaciones` AS `claimAmount`,`claims_ratio`.`Ratio` AS `claimingRate`,`claims_ratio`.`recobro` AS `priceIncreasing`,`claims_ratio`.`inflacion` AS `packingRate` from `bi`.`claims_ratio` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `clientLost` --- - -/*!50001 DROP TABLE IF EXISTS `clientLost`*/; -/*!50001 DROP VIEW IF EXISTS `clientLost`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientLost` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(((`c`.`id` = `t`.`clientFk`) and (`t`.`shipped` < (curdate() + interval -(`pc`.`rookieDays`) day))))) group by `c`.`id` having (isnull(`lastShipped`) or (`lastShipped` < (curdate() + interval -(`notBuyingMonths`) 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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `clientPhoneBook` --- - -/*!50001 DROP TABLE IF EXISTS `clientPhoneBook`*/; -/*!50001 DROP VIEW IF EXISTS `clientPhoneBook`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientPhoneBook` AS select `c`.`id` AS `clientFk`,trim(`c`.`phone`) AS `phone` from `client` `c` where (`c`.`phone` and `c`.`isActive`) union select `c`.`id` AS `clientFk`,trim(`c`.`mobile`) AS `phone` from `client` `c` where (`c`.`mobile` and `c`.`isActive`) union select `a`.`clientFk` AS `clientFk`,trim(`a`.`phone`) AS `phone` from (`address` `a` join `client` `c` on((`c`.`id` = `a`.`clientFk`))) where (`a`.`phone` and `c`.`isActive`) union select `a`.`clientFk` AS `clientFk`,trim(`a`.`mobile`) AS `phone` from (`address` `a` join `client` `c` on((`c`.`id` = `a`.`clientFk`))) where (`a`.`mobile` and `c`.`isActive`) union select `cc`.`clientFk` AS `clientFk`,trim(`cc`.`phone`) AS `phone` from (`clientContact` `cc` left join `client` `c` on((`c`.`id` = `cc`.`clientFk`))) where (`c`.`phone` and `c`.`isActive`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `clientRisk__` --- - -/*!50001 DROP TABLE IF EXISTS `clientRisk__`*/; -/*!50001 DROP VIEW IF EXISTS `clientRisk__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `clientRisk__` AS select `c`.`customer_id` AS `clientFk`,`c`.`company_id` AS `companyFk`,`c`.`amount` AS `amount` from `bi`.`customer_risk__` `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 `cmr_list` --- - -/*!50001 DROP TABLE IF EXISTS `cmr_list`*/; -/*!50001 DROP VIEW IF EXISTS `cmr_list`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `cmr_list` AS select `cmr`.`id` AS `cmrFk`,`cmr`.`ticketFk` AS `ticketFk`,`cmr`.`truckPlate` AS `truckPlate`,`cmr`.`observations` AS `observations`,`cmr`.`senderInstruccions` AS `senderInstruccions`,`cmr`.`paymentInstruccions` AS `paymentInstruccions`,`cmr`.`specialAgreements` AS `specialAgreements`,`cmr`.`created` AS `created`,`cmr`.`packagesList` AS `packagesList`,`aTo`.`nickname` AS `clientName`,`aTo`.`postalCode` AS `clientPostalCode`,`aTo`.`street` AS `clientStreet`,`aTo`.`city` AS `clientCity`,`pTo`.`name` AS `clientProvince`,`cTo`.`country` AS `clientCountry`,`su`.`name` AS `companyName`,`su`.`street` AS `companyStreet`,`su`.`postCode` AS `companyPostCode`,`su`.`city` AS `companyCity`,`cSu`.`country` AS `companyCountry`,concat(`aFrom`.`street`,' ',`aFrom`.`postalCode`,' ',`aFrom`.`city`,' (',`cFrom`.`country`,')') AS `warehouseAddress`,`cmr`.`created` AS `shipped`,`aTo`.`nickname` AS `clientOficialName`,`cmr`.`supplierFk` AS `supplierFk`,`aSu`.`name` AS `carrierName`,`aSu`.`street` AS `carrierStreet`,`aSu`.`postCode` AS `carrierPostCode`,`aSu`.`city` AS `carrierCity`,`cAs`.`country` AS `carrierCountry`,ifnull(`aTo`.`phone`,`client`.`phone`) AS `phone`,ifnull(`aTo`.`mobile`,`client`.`mobile`) AS `mobile`,`aTo`.`id` AS `addressFk`,`c`.`stamp` AS `stamp`,`cmr`.`merchandiseDetail` AS `merchandiseDetail` from ((((((((((((`cmr` left join `address` `aTo` on((`aTo`.`id` = `cmr`.`addressToFk`))) left join `province` `pTo` on((`pTo`.`id` = `aTo`.`provinceFk`))) left join `country` `cTo` on((`cTo`.`id` = `pTo`.`countryFk`))) left join `client` on((`client`.`id` = `aTo`.`clientFk`))) left join `supplier` `su` on((`su`.`id` = `cmr`.`companyFk`))) left join `country` `cSu` on((`cSu`.`id` = `su`.`countryFk`))) left join `address` `aFrom` on((`aFrom`.`id` = `cmr`.`addressFromFk`))) left join `province` `pFrom` on((`pFrom`.`id` = `aFrom`.`provinceFk`))) left join `country` `cFrom` on((`cFrom`.`id` = `pFrom`.`countryFk`))) left join `supplier` `aSu` on((`aSu`.`id` = `cmr`.`supplierFk`))) left join `country` `cAs` on((`cAs`.`id` = `aSu`.`countryFk`))) join `company` `c` on((`c`.`id` = `cmr`.`companyFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `collectionReportSource` --- - -/*!50001 DROP TABLE IF EXISTS `collectionReportSource`*/; -/*!50001 DROP VIEW IF EXISTS `collectionReportSource`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `collectionReportSource` AS select `tc`.`collectionFk` AS `collectionFk`,`tc`.`ticketFk` AS `ticketFk`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`s`.`quantity` AS `quantity`,`ip`.`code` AS `nicho`,`tc`.`level` AS `level` from (((((`collection` `c` join `ticketCollection` `tc` on((`tc`.`collectionFk` = `c`.`id`))) join `ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) left join `itemPlacement` `ip` on(((`ip`.`itemFk` = `s`.`itemFk`) and (`ip`.`warehouseFk` = `t`.`warehouseFk`)))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `collectionSmartTag` --- - -/*!50001 DROP TABLE IF EXISTS `collectionSmartTag`*/; -/*!50001 DROP VIEW IF EXISTS `collectionSmartTag`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `collectionSmartTag` AS select `st`.`code` AS `code`,`tc`.`ticketFk` AS `ticketFk`,`tc`.`level` AS `level`,`tc`.`wagon` AS `wagon`,`st`.`shelvingFk` AS `shelvingFk`,`tc`.`collectionFk` AS `collectionFk`,`am`.`name` AS `agencyFk`,`t`.`clientFk` AS `clientFk` from (((((`ticketCollection` `tc` join `smartTag` `st` on((`st`.`code` = (`tc`.`smartTagFk` collate utf8_general_ci)))) join `ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `collection` `c` on((`c`.`id` = `tc`.`collectionFk`))) join `worker` `w` on((`w`.`id` = `c`.`workerFk`))) join `agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `collectionSmartTag2` --- - -/*!50001 DROP TABLE IF EXISTS `collectionSmartTag2`*/; -/*!50001 DROP VIEW IF EXISTS `collectionSmartTag2`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `collectionSmartTag2` AS select `st`.`code` AS `code`,`tc`.`ticketFk` AS `ticketFk`,`tc`.`level` AS `level`,`tc`.`wagon` AS `wagon`,`st`.`shelvingFk` AS `shelvingFk`,`tc`.`collectionFk` AS `collectionFk`,`am`.`name` AS `agencyFk`,`t`.`clientFk` AS `clientFk`,`u`.`name` AS `worker`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed` from ((((((`vn`.`ticketCollection` `tc` join `vn`.`smartTag` `st` on((`st`.`code` = (`tc`.`smartTagFk` collate utf8_general_ci)))) join `vn`.`ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `vn`.`collection` `c` on((`c`.`id` = `tc`.`collectionFk`))) join `vn`.`worker` `w` on((`w`.`id` = `c`.`workerFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `account`.`user` `u` on((`u`.`id` = `w`.`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 `componentRate__` --- - -/*!50001 DROP TABLE IF EXISTS `componentRate__`*/; -/*!50001 DROP VIEW IF EXISTS `componentRate__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentRate__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `componentTypeRate`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `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 `componentTypeRate__` --- - -/*!50001 DROP TABLE IF EXISTS `componentTypeRate__`*/; -/*!50001 DROP VIEW IF EXISTS `componentTypeRate__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentTypeRate__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `base` from `bi`.`tarifa_componentes_series` `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 `componentType__` --- - -/*!50001 DROP TABLE IF EXISTS `componentType__`*/; -/*!50001 DROP VIEW IF EXISTS `componentType__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `componentType__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `isBase`,`t`.`margen` AS `isMargin` from `bi`.`tarifa_componentes_series` `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 `component__` --- - -/*!50001 DROP TABLE IF EXISTS `component__`*/; -/*!50001 DROP VIEW IF EXISTS `component__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `component__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `typeFk`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `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 `defaulter` --- - -/*!50001 DROP TABLE IF EXISTS `defaulter`*/; -/*!50001 DROP VIEW IF EXISTS `defaulter`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `defaulter` AS select `d`.`clientFk` AS `clientFk`,`d`.`created` AS `created`,`d`.`amount` AS `amount`,`d`.`defaulterSinced` AS `defaulterSinced`,`d`.`hasChanged` AS `hasChanged` from `bs`.`defaulter` `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 `departmentTree` --- - -/*!50001 DROP TABLE IF EXISTS `departmentTree`*/; -/*!50001 DROP VIEW IF EXISTS `departmentTree`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `departmentTree` AS select `node`.`id` AS `id`,concat(convert(repeat(repeat(' ',5),(count(`parent`.`id`) - 1)) using utf8),`node`.`name`) AS `dep` from (`department` `node` join `department` `parent`) where (`node`.`lft` between `parent`.`lft` and `parent`.`rgt`) group by `node`.`id` order by `node`.`lft` */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `ektSubAddress` --- - -/*!50001 DROP TABLE IF EXISTS `ektSubAddress`*/; -/*!50001 DROP VIEW IF EXISTS `ektSubAddress`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ektSubAddress` AS select `eea`.`sub` AS `sub`,`a`.`clientFk` AS `clientFk`,`a`.`nickname` AS `nickname`,`eea`.`addressFk` AS `addressFk` from (`ektEntryAssign` `eea` join `address` `a` on((`a`.`id` = `eea`.`addressFk`))) group by `eea`.`sub` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `entryList` --- - -/*!50001 DROP TABLE IF EXISTS `entryList`*/; -/*!50001 DROP VIEW IF EXISTS `entryList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `entryList` AS select `e`.`id` AS `entryFk`,if(`tr`.`isReceived`,' x','') AS `isHere`,`tr`.`landed` AS `landed`,ifnull(`s`.`nickname`,`s`.`name`) AS `supplier`,`e`.`ref` AS `entryRef`,`a`.`name` AS `agency`,`tr`.`ref` AS `travelRef`,`tr`.`appointment` AS `appointment`,`e`.`supplierFk` AS `supplierFk`,`tr`.`warehouseInFk` AS `warehouseInFk` from (((`entry` `e` join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) left join `agency` `a` on((`tr`.`agencyFk` = `a`.`id`))) where (`tr`.`landed` between (curdate() + interval -(1) week) and (curdate() + interval 3 month)) order by (`tr`.`landed` < (curdate() + interval 2 day)) desc,`tr`.`landed` desc,ifnull(`s`.`nickname`,`s`.`name`),`e`.`id` desc */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `exchangeInsuranceEntry` --- - -/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceEntry`*/; -/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceEntry`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `exchangeInsuranceEntry` AS select max(`tr`.`landed`) AS `dated`,cast(sum(((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`)) as decimal(10,2)) AS `Dolares`,cast((sum(((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`)) / sum(((((100 + `e`.`commission`) / 100) * (`b`.`buyingValue` + `b`.`freightValue`)) * `b`.`quantity`))) as decimal(10,4)) AS `rate` from ((`entry` `e` join `buy` `b` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) where ((`tr`.`landed` between '2016-01-31' and curdate()) and (`e`.`commission` < 0) and (`e`.`currencyFk` = 2)) group by month(`tr`.`landed`),year(`tr`.`landed`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `exchangeInsuranceIn` --- - -/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceIn`*/; -/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceIn`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `exchangeInsuranceIn` AS select `exchangeInsuranceInPrevious`.`dated` AS `dated`,sum(`exchangeInsuranceInPrevious`.`amount`) AS `amount`,cast((sum((`exchangeInsuranceInPrevious`.`amount` * `exchangeInsuranceInPrevious`.`rate`)) / sum(`exchangeInsuranceInPrevious`.`amount`)) as decimal(10,4)) AS `rate` from `vn`.`exchangeInsuranceInPrevious` group by `exchangeInsuranceInPrevious`.`dated` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `exchangeInsuranceOut` --- - -/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceOut`*/; -/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceOut`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `exchangeInsuranceOut` AS select `p`.`received` AS `received`,sum(`p`.`divisa`) AS `divisa`,(sum(`p`.`divisa`) / sum(`p`.`amount`)) AS `rate` from ((`payment` `p` join `bank` `b` on((`b`.`id` = `p`.`bankFk`))) join `accountingType` `at2` on((`at2`.`id` = `b`.`cash`))) where ((`p`.`currencyFk` = 2) and (`at2`.`code` = 'wireTransfer') and (`p`.`supplierFk` <> 2213)) group by `p`.`received` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `exchangeReportSourcePrevious` --- - -/*!50001 DROP TABLE IF EXISTS `exchangeReportSourcePrevious`*/; -/*!50001 DROP VIEW IF EXISTS `exchangeReportSourcePrevious`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `exchangeReportSourcePrevious` AS select `exchangeInsuranceIn`.`dated` AS `dated`,`exchangeInsuranceIn`.`amount` AS `amountIn`,`exchangeInsuranceIn`.`rate` AS `rateIn`,0.00 AS `amountOut`,0.00 AS `rateOut`,0.00 AS `amountEntry`,0.00 AS `rateEntry` from `vn`.`exchangeInsuranceIn` union all select `exchangeInsuranceOut`.`received` AS `received`,0.00 AS `amountIn`,0.00 AS `ratedIn`,`exchangeInsuranceOut`.`divisa` AS `amountOut`,`exchangeInsuranceOut`.`rate` AS `ratedOut`,0.00 AS `amountEntry`,0.00 AS `rateEntry` from `vn`.`exchangeInsuranceOut` union all select `exchangeInsuranceEntry`.`dated` AS `dated`,0.00 AS `amountIn`,0.00 AS `ratedIn`,0.00 AS `amountOut`,0.00 AS `ratedOut`,`exchangeInsuranceEntry`.`Dolares` AS `amountEntry`,`exchangeInsuranceEntry`.`rate` AS `rateEntry` from `vn`.`exchangeInsuranceEntry` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `expeditionCommon` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionCommon`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionCommon`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionCommon` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `etd`,ifnull(ucase(`et`.`description`),'SIN ESCANEAR') AS `description`,`es`.`palletFk` AS `palletFk`,`t`.`routeFk` AS `routeFk`,`es`.`id` AS `scanFk`,`e`.`id` AS `expeditionFk`,`r`.`expeditionTruckFk` AS `expeditionTruckFk`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `lastPacked`,`t`.`id` AS `ticketFk` from (((((`expeditionTruck` `et` left join `routesMonitor` `r` on((`et`.`id` = `r`.`expeditionTruckFk`))) left join `ticket` `t` on((`r`.`routeFk` = `t`.`routeFk`))) left join `expedition` `e` on((`t`.`id` = `e`.`ticketFk`))) left join `expeditionScan` `es` on((`e`.`id` = `es`.`expeditionFk`))) left join `expeditionPallet` `ep` on((`es`.`palletFk` = `ep`.`id`))) where (`et`.`ETD` >= 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 `expeditionPallet_Print` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionPallet_Print`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionPallet_Print`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,(`et`.`id` <=> `rm`.`expeditionTruckFk`) AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if((`r`.`created` > (curdate() + interval 1 day)),ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`vn`.`expeditionTruck` `et` join `vn`.`expeditionPallet` `ep` on((`ep`.`truckFk` = `et`.`id`))) join `vn`.`expeditionScan` `es` on((`es`.`palletFk` = `ep`.`id`))) join `vn`.`expedition` `e` on((`e`.`id` = `es`.`expeditionFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `vn`.`route` `r` on((`r`.`id` = `t`.`routeFk`))) left join `vn2008`.`Rutas_monitor` `rm` on((`rm`.`Id_Ruta` = `r`.`id`))) left join `vn`.`expeditionTruck` `et2` on((`et2`.`id` = `rm`.`expeditionTruckFk`))) where (`ep`.`isPrint` = 0) group by `ep`.`id`,`t`.`routeFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `expeditionRoute_Monitor` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionRoute_Monitor`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionRoute_Monitor`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionRoute_Monitor` AS select `r`.`id` AS `routeFk`,count(distinct if(isnull(`e`.`id`),`t`.`id`,NULL)) AS `tickets`,count(distinct `e`.`id`) AS `expeditions`,count(distinct `es`.`id`) AS `scanned`,max(`e`.`created`) AS `lastPacked`,`r`.`created` AS `created` from ((((((`route` `r` left join `routesMonitor` `rm` on((`r`.`id` = `rm`.`routeFk`))) left join `expeditionTruck` `et` on((`et`.`id` = `rm`.`expeditionTruckFk`))) join `ticket` `t` on((`t`.`routeFk` = `r`.`id`))) left join `expedition` `e` on((`e`.`ticketFk` = `t`.`id`))) left join `expeditionScan` `es` on((`es`.`expeditionFk` = `e`.`id`))) left join `stowaway` `st` on((`st`.`id` = `t`.`id`))) where ((`r`.`created` >= `util`.`yesterday`()) and isnull(`st`.`id`)) group by `r`.`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 `expeditionRoute_freeTickets` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionRoute_freeTickets`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionRoute_freeTickets`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionRoute_freeTickets` AS select `t`.`routeFk` AS `routeFk`,`tss`.`ticket` AS `ticket`,`s`.`name` AS `code`,`w`.`name` AS `almacen`,`tss`.`updated` AS `updated`,`p`.`code` AS `parkingCode` from ((((((`vn`.`ticketState` `tss` join `vn`.`ticket` `t` on((`t`.`id` = `tss`.`ticket`))) join `vn`.`warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) join `vn`.`state` `s` on((`s`.`id` = `tss`.`state`))) left join `vn`.`stowaway` `st` on((`st`.`id` = `t`.`id`))) left join `vn`.`ticketParking` `tp` on((`tp`.`ticketFk` = `t`.`id`))) left join `vn`.`parking` `p` on((`p`.`id` = `tp`.`parkingFk`))) where ((ifnull(`t`.`packages`,0) = 0) and isnull(`st`.`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 `expeditionScan_Monitor` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionScan_Monitor`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionScan_Monitor`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionScan_Monitor` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `ETD`,`et`.`description` AS `description`,`ep`.`id` AS `palletFk`,`ep`.`position` AS `position`,`ep`.`built` AS `built`,`es`.`id` AS `scanFk`,`es`.`expeditionFk` AS `expeditionFk`,`es`.`scanned` AS `scanned` from ((`expeditionTruck` `et` left join `expeditionPallet` `ep` on((`ep`.`truckFk` = `et`.`id`))) left join `expeditionScan` `es` on((`es`.`palletFk` = `ep`.`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 `expeditionSticker` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionSticker`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionSticker`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionSticker` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',convert(right(`t`.`routeFk`,3) using utf8mb4),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,replace(`am`.`name`,'ZONA ','Z'),`z`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`c`.`mobile`,ifnull(`a`.`mobile`,ifnull(`c`.`phone`,`a`.`phone`))) AS `phone`,`w`.`code` AS `workerCode` from ((((((((((`expedition` `e` join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) left join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) left join `beach` `b` on((`b`.`id` = `rm`.`beachFk`))) left join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `route` `r` on((`r`.`id` = `t`.`routeFk`))) left join `agencyMode` `am` on((`am`.`id` = `r`.`agencyModeFk`))) join `client` `c` on((`c`.`id` = `a`.`clientFk`))) join `worker` `w` on((`w`.`id` = `e`.`workerFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `expeditionSticker__` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionSticker__`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionSticker__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionSticker__` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',convert(right(`t`.`routeFk`,4) using utf8mb4),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,replace(`z`.`name`,'ZONA ','Z'),`am`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`a`.`mobile`,`a`.`phone`) AS `phone` from (((((((`expedition` `e` join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) left join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) left join `beach` `b` on((`b`.`id` = `rm`.`beachFk`))) left join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) join `agencyMode` `am` on((`t`.`agencyModeFk` = `am`.`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 `expeditionTicket_NoBoxes` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionTicket_NoBoxes`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionTicket_NoBoxes`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTicket_NoBoxes` AS select `t`.`id` AS `ticketFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`routeFk` AS `routeFk`,`et`.`description` AS `description` from (((`ticket` `t` left join `expedition` `e` on((`e`.`ticketFk` = `t`.`id`))) join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) join `expeditionTruck` `et` on((`et`.`id` = `rm`.`expeditionTruckFk`))) where (isnull(`e`.`id`) and (`et`.`ETD` > 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 `expeditionTimeExpended` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionTimeExpended`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionTimeExpended`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTimeExpended` AS select `e`.`ticketFk` AS `ticketFk`,min(`e`.`created`) AS `started`,max(`e`.`created`) AS `finished`,max(`e`.`counter`) AS `cajas`,`w`.`code` AS `code`,`t`.`warehouseFk` AS `warehouseFk` from ((`expedition` `e` join `worker` `w` on((`w`.`id` = `e`.`workerFk`))) join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) where (`e`.`created` > curdate()) group by `e`.`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 `expeditionTruck_Control` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `description`,count(distinct if(isnull(`e`.`expeditionFk`),`e`.`ticketFk`,NULL)) AS `ticketsSinBultos`,count(distinct `e`.`palletFk`) AS `pallets`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionFk`) AS `expeditions`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk` order by `fallos` desc,`e`.`etd` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `expeditionTruck_Control_Detail` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control_Detail`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control_Detail`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control_Detail` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionTruckFk`) AS `destinos`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk`,`e`.`palletFk` order by `fallos` desc,`e`.`etd`,`e`.`truckFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `expeditionTruck_Control_Detail_Pallet` --- - -/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control_Detail_Pallet`*/; -/*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control_Detail_Pallet`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `expeditionTruck_Control_Detail_Pallet` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,`e`.`routeFk` AS `route`,count(distinct `e`.`scanFk`) AS `scans`,`et`.`description` AS `destinos`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,`e`.`expeditionTruckFk` AS `expeditionTruckFk`,max(`e`.`lastPacked`) AS `lastPacked` from (`expeditionCommon` `e` left join `expeditionTruck` `et` on((`et`.`id` = `e`.`expeditionTruckFk`))) group by `e`.`truckFk`,`e`.`palletFk`,`e`.`routeFk` order by `fallos` desc,`e`.`palletFk` */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `firstTicketShipped` AS select min(`ticket`.`shipped`) AS `shipped`,`ticket`.`clientFk` AS `clientFk` from `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 `floraHollandBuyedItems` --- - -/*!50001 DROP TABLE IF EXISTS `floraHollandBuyedItems`*/; -/*!50001 DROP VIEW IF EXISTS `floraHollandBuyedItems`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `floraHollandBuyedItems` AS select `b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`b`.`quantity` AS `quantity`,`b`.`buyingValue` AS `buyingValue`,`tr`.`landed` AS `landed`,`e`.`companyFk` AS `companyFk` from (((((`buy` `b` join `item` `i` on((`b`.`itemFk` = `i`.`id`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `itemCategory` `ic` on((`ic`.`id` = `it`.`categoryFk`))) join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on(((`tr`.`id` = `e`.`travelFk`) and (`ic`.`id` not in (8,6)) and (`b`.`buyingValue` <> 0) and (`b`.`quantity` <> 0) and (`e`.`supplierFk` in (1664,1665,1666,1465,1433))))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `holidayDetail__` --- - -/*!50001 DROP TABLE IF EXISTS `holidayDetail__`*/; -/*!50001 DROP VIEW IF EXISTS `holidayDetail__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `holidayDetail__` AS select `cll`.`calendar_labour_legend_id` AS `id`,`cll`.`descripcion` AS `description` from `postgresql`.`calendar_labour_legend__` `cll` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `holidayLegend__` --- - -/*!50001 DROP TABLE IF EXISTS `holidayLegend__`*/; -/*!50001 DROP VIEW IF EXISTS `holidayLegend__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `holidayLegend__` AS select `cll`.`calendar_labour_legend_id` AS `id`,`cll`.`descripcion` AS `description` from `postgresql`.`calendar_labour_legend__` `cll` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `holidayType__` --- - -/*!50001 DROP TABLE IF EXISTS `holidayType__`*/; -/*!50001 DROP VIEW IF EXISTS `holidayType__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `holidayType__` AS select `cf`.`calendar_free_id` AS `id`,`cf`.`type` AS `name`,`cf`.`rgb` AS `rgb` from `postgresql`.`calendar_free__` `cf` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `holiday__` --- - -/*!50001 DROP TABLE IF EXISTS `holiday__`*/; -/*!50001 DROP VIEW IF EXISTS `holiday__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `holiday__` AS select `cl`.`calendar_labour_legend_id` AS `holidayDetailFk`,`cl`.`calendar_free_id` AS `holidayTypeFk`,`cl`.`workcenter_id` AS `workCenterFk`,`cl`.`day` AS `dated` from `postgresql`.`calendar_labour__` `cl` */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `inkL10n` AS select `k`.`id` AS `id`,ifnull(`i`.`name`,`k`.`name`) AS `name` from (`ink` `k` left join `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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 (`sale` `s` join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) where (`t`.`shipped` > (curdate() + interval -(3) year)) */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `foreignValue`,`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 `invoiceInIntrastat2__` --- - -/*!50001 DROP TABLE IF EXISTS `invoiceInIntrastat2__`*/; -/*!50001 DROP VIEW IF EXISTS `invoiceInIntrastat2__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `invoiceInIntrastat2__` AS select `id`.`id` AS `id`,`id`.`recibida_id` AS `invoiceInFk`,`id`.`neto` AS `net`,`id`.`intrastat_id` AS `intrastatFk`,`id`.`importe` AS `amount`,`id`.`unidades` AS `stems`,`id`.`Paises_Id` AS `countryFk`,`id`.`odbc_date` AS `dated`,`id`.`valorestadistico` AS `statisticalValue` from `vn2008`.`intrastat_data` `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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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`,`r`.`isVatDeductible` AS `isVatDeductible`,`r`.`withholdingSageFk` AS `withholdingSageFk` 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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,concat(`g`.`name`,' ',ifnull(`s`.`name`,'')) AS `ediBotanic` from ((`itemBotanical` `ib` left join `specie` `s` on((`s`.`id` = `ib`.`specieFk`))) left join `genus` `g` on((`g`.`id` = `ib`.`genusFk`))) */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemCategoryL10n` AS select `c`.`id` AS `id`,ifnull(`i`.`name`,`c`.`name`) AS `name` from (`itemCategory` `c` left join `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 `itemColor` --- - -/*!50001 DROP TABLE IF EXISTS `itemColor`*/; -/*!50001 DROP VIEW IF EXISTS `itemColor`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemColor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `color` from (`itemTag` `it` join `tag` `t` on((`t`.`id` = `it`.`tagFk`))) where (`t`.`code` = 'COLOR') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemEntryIn` --- - -/*!50001 DROP TABLE IF EXISTS `itemEntryIn`*/; -/*!50001 DROP VIEW IF EXISTS `itemEntryIn`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemEntryIn` AS select `t`.`warehouseInFk` AS `warehouseInFk`,`t`.`landed` AS `landed`,`b`.`itemFk` AS `itemFk`,`b`.`quantity` AS `quantity`,`t`.`isReceived` AS `isReceived`,`e`.`isRaid` AS `isVirtualStock`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on((`b`.`entryFk` = `e`.`id`))) join `travel` `t` on((`e`.`travelFk` = `t`.`id`))) where ((`e`.`isInventory` = 0) and (`b`.`quantity` <> 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 `itemEntryOut` --- - -/*!50001 DROP TABLE IF EXISTS `itemEntryOut`*/; -/*!50001 DROP VIEW IF EXISTS `itemEntryOut`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemEntryOut` AS select `t`.`warehouseOutFk` AS `warehouseOutFk`,`t`.`shipped` AS `shipped`,`b`.`itemFk` AS `itemFk`,-(`b`.`quantity`) AS `quantity`,`t`.`isDelivered` AS `isDelivered`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on((`b`.`entryFk` = `e`.`id`))) join `travel` `t` on((`e`.`travelFk` = `t`.`id`))) where ((`e`.`isInventory` = 0) and (`e`.`isRaid` = 0) and (`b`.`quantity` <> 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 `itemInk` --- - -/*!50001 DROP TABLE IF EXISTS `itemInk`*/; -/*!50001 DROP VIEW IF EXISTS `itemInk`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemInk` AS select `i`.`longName` AS `longName`,`i`.`inkFk` AS `inkFk`,`ink`.`name` AS `color` from (`item` `i` join `ink` on((`ink`.`id` = `i`.`inkFk`))) where `ink`.`isRealColor` group by `i`.`longName` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemPlacementSupplyList` --- - -/*!50001 DROP TABLE IF EXISTS `itemPlacementSupplyList`*/; -/*!50001 DROP VIEW IF EXISTS `itemPlacementSupplyList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,(`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0))) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,`ips`.`sectorFk` AS `sectorFk` from ((((`itemPlacementSupply` `ips` join `item` `i` on((`i`.`id` = `ips`.`itemFk`))) left join `worker` `w` on((`w`.`userFk` = `ips`.`userFk`))) left join `worker` `rw` on((`rw`.`userFk` = `ips`.`repoUserFk`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemPlacementSupplyFk` = `ips`.`id`))) where (`ips`.`created` >= curdate()) group by `ips`.`priority`,`ips`.`id`,`ips`.`sectorFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemProductor` --- - -/*!50001 DROP TABLE IF EXISTS `itemProductor`*/; -/*!50001 DROP VIEW IF EXISTS `itemProductor`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemProductor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `productor` from (`itemTag` `it` join `tag` `t` on((`t`.`id` = `it`.`tagFk`))) where (`t`.`code` = 'PRODUCER') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemSearch` --- - -/*!50001 DROP TABLE IF EXISTS `itemSearch`*/; -/*!50001 DROP VIEW IF EXISTS `itemSearch`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemSearch` AS select `s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`t`.`nickname` AS `nickname`,`t`.`shipped` AS `shipped` from ((`sale` `s` join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`tomorrow`()) and (`w`.`name` in ('VNH','Floramondo'))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemShelvingAvailable` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingAvailable`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingAvailable`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `st` on((`st`.`id` = `tst`.`state`))) join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemShelvingStock` `stock` on((`stock`.`itemFk` = `i`.`id`))) left join `vn`.`saleTracking` `stk` on((`stk`.`saleFk` = `s`.`id`))) left join `vn`.`zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(curdate())) and isnull(`stk`.`id`) and (`stock`.`visible` > 0) and isnull(`stk`.`saleFk`) and `st`.`isPreviousPreparable`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemShelvingList` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingList`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingList` AS select `ish`.`shelvingFk` AS `shelvingFk`,`ish`.`visible` AS `visible`,`ish`.`created` AS `created`,`pk`.`code` AS `parking`,`ish`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`parked` AS `parked`,`pk`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `parking` `pk` on((`pk`.`id` = `sh`.`parkingFk`))) order by `ish`.`created` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemShelvingPlacementSupplyStock` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingPlacementSupplyStock`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingPlacementSupplyStock`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) group by `ish`.`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 `itemShelvingPlacementSupplyStock__` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingPlacementSupplyStock__`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingPlacementSupplyStock__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingPlacementSupplyStock__` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`quantity` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority` from (((((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `itemShelvingSale` `iss` on((`iss`.`itemShelvingFk` = `ish`.`id`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemShelvingFk` = `ish`.`id`))) group by `ish`.`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 `itemShelvingSaleSum` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingSaleSum`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingSaleSum`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingSaleSum` AS select `iss`.`id` AS `id`,`iss`.`itemShelvingFk` AS `itemShelvingFk`,`iss`.`saleFk` AS `saleFk`,sum(`iss`.`quantity`) AS `quantity`,`iss`.`created` AS `created`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelvingSale` `iss` join `itemShelving` `ish` on((`ish`.`id` = `iss`.`itemShelvingFk`))) join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) group by `iss`.`saleFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemShelvingStock` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingStock`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingStock`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`s`.`isPreviousPrepared` AS `isPreviousPrepared` from (((`itemShelving` `ish` left join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) left join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) where ((`ish`.`visible` <> 0) and `p`.`sectorFk`) group by `ish`.`itemFk`,`p`.`sectorFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `itemShelvingStockFull` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingStockFull`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingStockFull`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStockFull` AS select `ish`.`itemFk` AS `itemFk`,`ish`.`visible` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`grouping` AS `grouping`,`s`.`description` AS `sector`,`issr`.`removed` AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created` from ((((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) left join `itemShelvingStockRemoved` `issr` on((`issr`.`itemShelvingFk` = `ish`.`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 `itemShelvingStockRemoved` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingStockRemoved`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingStockRemoved`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStockRemoved` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,0 AS `removed` from ((`itemShelving` `ish` left join `itemShelvingSale` `iss` on((`iss`.`itemShelvingFk` = `ish`.`id`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemShelvingFk` = `ish`.`id`))) group by `ish`.`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 `itemShelvingStock_byWarehouse` --- - -/*!50001 DROP TABLE IF EXISTS `itemShelvingStock_byWarehouse`*/; -/*!50001 DROP VIEW IF EXISTS `itemShelvingStock_byWarehouse`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemShelvingStock_byWarehouse` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,`s`.`warehouseFk` AS `warehouseFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) group by `ish`.`itemFk`,`s`.`warehouseFk` */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `itemTicketOut` --- - -/*!50001 DROP TABLE IF EXISTS `itemTicketOut`*/; -/*!50001 DROP VIEW IF EXISTS `itemTicketOut`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTicketOut` AS select `t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`s`.`itemFk` AS `itemFk`,-(`s`.`quantity`) AS `quantity`,`s`.`isPicked` AS `isPicked`,`s`.`reserved` AS `reserved`,`t`.`refFk` AS `refFk`,`s`.`id` AS `saleFk`,`s`.`ticketFk` AS `ticketFk` from (`sale` `s` join `ticket` `t` on((`s`.`ticketFk` = `t`.`id`))) where (`s`.`quantity` <> 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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `itemTypeL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`itemType` `t` left join `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 `item_Free_Id` --- - -/*!50001 DROP TABLE IF EXISTS `item_Free_Id`*/; -/*!50001 DROP VIEW IF EXISTS `item_Free_Id`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `item_Free_Id` AS select (`i1`.`id` + 1) AS `newId` from (`item` `i1` left join `item` `i2` on(((`i1`.`id` + 1) = `i2`.`id`))) where (isnull(`i2`.`id`) and (`i1`.`id` > 400000)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `labelInfo` --- - -/*!50001 DROP TABLE IF EXISTS `labelInfo`*/; -/*!50001 DROP VIEW IF EXISTS `labelInfo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `labelInfo` AS select `i`.`id` AS `itemId`,`i`.`name` AS `itemName`,`b`.`stickers` AS `stickers`,`b`.`printedStickers` AS `life`,`i`.`inkFk` AS `colorCode`,`i`.`stems` AS `stems`,`i`.`category` AS `category`,`i`.`subName` AS `productor`,`b`.`packing` AS `packing`,`clb`.`warehouse_id` AS `warehouse_id`,`i`.`size` AS `size`,`b`.`isPickedOff` AS `isPickedOff`,`e`.`evaNotes` AS `notes`,`w`.`name` AS `wh_in`,`e`.`id` AS `entryId`,`b`.`id` AS `buyId` from (((((`vn`.`buy` `b` join `vn`.`item` `i` on((`i`.`id` = `b`.`itemFk`))) join `cache`.`last_buy` `clb` on((`clb`.`item_id` = `i`.`id`))) join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) left join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `lastHourProduction` --- - -/*!50001 DROP TABLE IF EXISTS `lastHourProduction`*/; -/*!50001 DROP VIEW IF EXISTS `lastHourProduction`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastHourProduction` AS select `t`.`warehouseFk` AS `warehouseFk`,cast(sum((ifnull(`p`.`volume`,((`p`.`width` * `p`.`height`) * `p`.`depth`)) / 1000000)) as decimal(5,1)) AS `m3` from (((`warehouse` `w` join `ticket` `t` on((`t`.`warehouseFk` = `w`.`id`))) left join `expedition` `e` on((`t`.`id` = `e`.`ticketFk`))) left join `packaging` `p` on((`p`.`id` = `e`.`packagingFk`))) where (`e`.`created` between (now() - interval 1 hour) and now()) group by `t`.`warehouseFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `lastPurchases` --- - -/*!50001 DROP TABLE IF EXISTS `lastPurchases`*/; -/*!50001 DROP VIEW IF EXISTS `lastPurchases`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastPurchases` AS select `tr`.`landed` AS `landed`,`w`.`id` AS `warehouseFk`,`w`.`name` AS `warehouse`,`i`.`longName` AS `longName`,`i`.`subName` AS `subName`,`e`.`id` AS `entryFk`,`b`.`stickers` AS `stickers`,`b`.`packing` AS `packing`,`e`.`ref` AS `ref`,`b`.`itemFk` AS `itemFk`,`ek`.`pro` AS `pro`,`ek`.`ref` AS `ektRef`,`ek`.`agj` AS `agj` from (((((`vn`.`buy` `b` join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `vn`.`item` `i` on((`i`.`id` = `b`.`itemFk`))) join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) left join `edi`.`ekt` `ek` on((`ek`.`id` = `b`.`ektFk`))) where ((`tr`.`landed` between `util`.`yesterday`() and `util`.`tomorrow`()) and (`e`.`isRaid` = 0) and (`b`.`stickers` > 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 `lastTopClaims` --- - -/*!50001 DROP TABLE IF EXISTS `lastTopClaims`*/; -/*!50001 DROP VIEW IF EXISTS `lastTopClaims`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `lastTopClaims` AS select `s`.`itemFk` AS `itemFk`,`i`.`longName` AS `itemName`,`it`.`name` AS `itemTypeName`,count(0) AS `claimsNumber`,round(sum(((((`cb`.`quantity` * `s`.`price`) * (1 - ((`c`.`responsibility` - 1) / 4))) * (100 - `s`.`discount`)) / 100)),2) AS `claimedAmount`,round(sum((((`cb`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)),2) AS `totalAmount` from ((((`claim` `c` join `claimBeginning` `cb` on((`cb`.`claimFk` = `c`.`id`))) join `sale` `s` on((`s`.`id` = `cb`.`saleFk`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) where (`c`.`created` >= (curdate() + interval -(1) week)) group by `s`.`itemFk` having (((`claimedAmount` > 100) and (`claimsNumber` > 2)) or (`claimsNumber` > 4)) order by `claimsNumber` 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 `mistake` --- - -/*!50001 DROP TABLE IF EXISTS `mistake`*/; -/*!50001 DROP VIEW IF EXISTS `mistake`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mistake` AS select `wr`.`code` AS `revisador`,`s`.`concept` AS `concept`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk` from (((((`saleMistake` `sm` join `mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) join `worker` `wr` on((`wr`.`id` = `sm`.`userFk`))) join `sale` `s` on((`s`.`id` = `sm`.`saleFk`))) join `itemShelvingSale` `iss` on((`iss`.`saleFk` = `sm`.`saleFk`))) join `worker` `w` on((`w`.`id` = `iss`.`userFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `mistakeRatio` --- - -/*!50001 DROP TABLE IF EXISTS `mistakeRatio`*/; -/*!50001 DROP VIEW IF EXISTS `mistakeRatio`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `mistakeRatio` AS select `wr`.`code` AS `revisador`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk`,`sm`.`saleFk` AS `saleFk` from ((((`itemShelvingSale` `iss` join `worker` `w` on((`w`.`id` = `iss`.`userFk`))) left join `saleMistake` `sm` on((`iss`.`saleFk` = `sm`.`saleFk`))) left join `mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `worker` `wr` on((`wr`.`id` = `sm`.`userFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `newBornSales` --- - -/*!50001 DROP TABLE IF EXISTS `newBornSales`*/; -/*!50001 DROP VIEW IF EXISTS `newBornSales`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `newBornSales` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from ((((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) join `account`.`role` `r` on((`r`.`id` = `u`.`role`))) where ((`r`.`name` = 'salesPerson') and (`u`.`name` not in ('ismaelalcolea','ruben'))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `newBornSales__` --- - -/*!50001 DROP TABLE IF EXISTS `newBornSales__`*/; -/*!50001 DROP VIEW IF EXISTS `newBornSales__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `newBornSales__` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from (((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) where ((`u`.`role` = 18) and (`u`.`name` not in ('ismaelalcolea','ruben'))) */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `originL10n` AS select `o`.`id` AS `id`,ifnull(`i`.`name`,`o`.`name`) AS `name` from (`origin` `o` left join `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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `packageEquivalentItem` AS select `p`.`itemFk` AS `itemFk`,`p2`.`itemFk` AS `equivalentFk` from ((`packageEquivalent` `pe` join `packaging` `p` on((`p`.`id` = `pe`.`packagingFk`))) join `packaging` `p2` on((`p2`.`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 `payDemDetail__` --- - -/*!50001 DROP TABLE IF EXISTS `payDemDetail__`*/; -/*!50001 DROP VIEW IF EXISTS `payDemDetail__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `payDemDetail__` AS select `pdd`.`id` AS `id`,`pdd`.`detalle` AS `detail` from `vn2008`.`pay_dem_det` `pdd` */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `payment__` AS select `p`.`id` AS `id`,`p`.`fecha` AS `received`,`p`.`dueDated` AS `dueDated`,`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 `payMethodFk`,`p`.`empresa_id` AS `companyFk`,`p`.`pago_sdc_id` AS `exchangeInsuranceFk`,`p`.`conciliado` AS `isConciliated` 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 `personMedia` --- - -/*!50001 DROP TABLE IF EXISTS `personMedia`*/; -/*!50001 DROP VIEW IF EXISTS `personMedia`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `personMedia` AS select `p`.`id_trabajador` AS `workerFk`,`m`.`value` AS `mediaValue` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `po` on((`po`.`person_id` = `p`.`person_id`))) join `postgresql`.`profile_media` `pom` on((`pom`.`profile_id` = `po`.`profile_id`))) join `postgresql`.`media` `m` on((`m`.`media_id` = `pom`.`media_id`))) join `postgresql`.`media_type` `mt` on((`mt`.`media_type_id` = `m`.`media_type_id`))) where (`mt`.`name` = 'movil personal') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `printer__` --- - -/*!50001 DROP TABLE IF EXISTS `printer__`*/; -/*!50001 DROP VIEW IF EXISTS `printer__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `printer__` AS select `i`.`Id_Impresora` AS `id`,`i`.`Ruta` AS `path`,`i`.`Impresora` AS `name`,`i`.`referencia` AS `reference`,`i`.`isLabeler` AS `isLabeler`,`i`.`description` AS `description` from `vn2008`.`Impresoras__` `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 `productionVolume` --- - -/*!50001 DROP TABLE IF EXISTS `productionVolume`*/; -/*!50001 DROP VIEW IF EXISTS `productionVolume`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `productionVolume` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,ifnull(((`p`.`width` * `p`.`height`) * `p`.`depth`),94500)) AS `cm3`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `created` from (((`expedition` `e` left join `packaging` `p` on((`p`.`itemFk` = `e`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `client` `c` on((`c`.`id` = `t`.`clientFk`))) where ((`e`.`created` between curdate() and `util`.`dayend`(curdate())) and `c`.`isRelevant`) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `productionVolume_LastHour` --- - -/*!50001 DROP TABLE IF EXISTS `productionVolume_LastHour`*/; -/*!50001 DROP VIEW IF EXISTS `productionVolume_LastHour`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `productionVolume_LastHour` AS select cast(sum((`productionVolume`.`cm3` / 1000000)) as decimal(10,0)) AS `m3`,`productionVolume`.`warehouseFk` AS `warehouseFk` from `productionVolume` where ((`productionVolume`.`created` > (now() + interval -(1) hour)) and (`productionVolume`.`warehouseFk` in (1,44,60))) group by `productionVolume`.`warehouseFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `rankingNewBornByQuarter__` --- - -/*!50001 DROP TABLE IF EXISTS `rankingNewBornByQuarter__`*/; -/*!50001 DROP VIEW IF EXISTS `rankingNewBornByQuarter__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `rankingNewBornByQuarter__` AS select sum(`v`.`importe`) AS `total`,`u`.`name` AS `name`,now() AS `time_sec`,`u`.`id` AS `userFk` from (((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) where ((`v`.`fecha` >= '2020-07-01') and (`cn`.`firstShipped` >= '2019-07-01') and (`u`.`role` = 18) and (`u`.`name` not in ('ismaelalcolea','ruben'))) group by `u`.`id` order by sum(`v`.`importe`) desc limit 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 `rankingSellingByQuarter__` --- - -/*!50001 DROP TABLE IF EXISTS `rankingSellingByQuarter__`*/; -/*!50001 DROP VIEW IF EXISTS `rankingSellingByQuarter__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `rankingSellingByQuarter__` AS select sum(`v`.`importe`) AS `importe`,`u`.`name` AS `name`,`u`.`id` AS `userFk`,now() AS `time_sec` from (`bs`.`vendedores` `v` join `account`.`user` `u` on((`u`.`id` = `v`.`Id_Trabajador`))) where ((`v`.`año` = year(curdate())) and (quarter(concat(year(curdate()),'-',`v`.`mes`,'-01')) = quarter(curdate())) and (`u`.`name` not in ('ismaelalcolea','ruben'))) group by `v`.`Id_Trabajador` order by sum(`v`.`importe`) desc limit 15 */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `rate__` --- - -/*!50001 DROP TABLE IF EXISTS `rate__`*/; -/*!50001 DROP VIEW IF EXISTS `rate__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `rate__` AS select `r`.`tarifa_id` AS `id`,`r`.`fecha` AS `dated`,`r`.`warehouse_id` AS `warehouseFk`,`r`.`t0` AS `rate0`,`r`.`t1` AS `rate1`,`r`.`t2` AS `rate2`,`r`.`t3` AS `rate3` from `vn2008`.`tarifas` `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `saleCost` --- - -/*!50001 DROP TABLE IF EXISTS `saleCost`*/; -/*!50001 DROP VIEW IF EXISTS `saleCost`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleCost` AS select `s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`s`.`discount` AS `discount`,`s`.`price` AS `price`,`c`.`name` AS `component`,`sc`.`value` AS `coste` from (((`sale` `s` join `saleComponent` `sc` on((`sc`.`saleFk` = `s`.`id`))) join `component` `c` on((`c`.`id` = `sc`.`componentFk`))) join `componentType` `ct` on((`ct`.`id` = `c`.`typeFk`))) where (`ct`.`type` = 'coste') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `saleMistakeList` --- - -/*!50001 DROP TABLE IF EXISTS `saleMistakeList`*/; -/*!50001 DROP VIEW IF EXISTS `saleMistakeList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleMistakeList` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `saleMistake_list__` --- - -/*!50001 DROP TABLE IF EXISTS `saleMistake_list__`*/; -/*!50001 DROP VIEW IF EXISTS `saleMistake_list__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleMistake_list__` AS select `st`.`saleFk` AS `saleFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) where (`st`.`created` > '2020-10-01') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `saleMistake_list__2` --- - -/*!50001 DROP TABLE IF EXISTS `saleMistake_list__2`*/; -/*!50001 DROP VIEW IF EXISTS `saleMistake_list__2`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleMistake_list__2` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `saleSaleTracking` --- - -/*!50001 DROP TABLE IF EXISTS `saleSaleTracking`*/; -/*!50001 DROP VIEW IF EXISTS `saleSaleTracking`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleSaleTracking` AS select distinct `st`.`saleFk` AS `saleFk` from `saleTracking` `st` where (`st`.`created` >= (curdate() + interval -(1) 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 `saleValue` --- - -/*!50001 DROP TABLE IF EXISTS `saleValue`*/; -/*!50001 DROP VIEW IF EXISTS `saleValue`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleValue` AS select `wh`.`name` AS `warehouse`,`c`.`name` AS `client`,`c`.`typeFk` AS `clientTypeFk`,`u`.`name` AS `buyer`,`it`.`id` AS `itemTypeFk`,`it`.`name` AS `family`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,(((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) AS `cost`,((((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) * `s`.`quantity`) AS `value`,`tm`.`year` AS `year`,`tm`.`week` AS `week` from (((((((((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `account`.`user` `u` on((`u`.`id` = `it`.`workerFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) join `vn`.`warehouse` `wh` on((`wh`.`id` = `t`.`warehouseFk`))) join `vn`.`time` `tm` on((`tm`.`dated` = cast(`t`.`shipped` as date)))) join `cache`.`last_buy` `lb` on(((`lb`.`item_id` = `i`.`id`) and (`lb`.`warehouse_id` = `wh`.`id`)))) join `vn`.`buy` `b` on((`b`.`id` = `lb`.`buy_id`))) where (`wh`.`isManaged` <> 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 `saleVolume` --- - -/*!50001 DROP TABLE IF EXISTS `saleVolume`*/; -/*!50001 DROP VIEW IF EXISTS `saleVolume`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(((`ic`.`cm3delivery` * `s`.`quantity`) / 1000),0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `volume`,((`s`.`quantity` * `ic`.`grams`) / 1000) AS `physicalWeight`,(((`s`.`quantity` * `ic`.`cm3delivery`) * greatest(`i`.`density`,167)) / 1000000) AS `weight`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `physicalVolume`,(((`s`.`quantity` * `ic`.`cm3delivery`) * ifnull(`t`.`zonePrice`,`z`.`price`)) / (`vc`.`standardFlowerBox` * 1000)) AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked`,(((`s`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100) AS `eurosValue`,`i`.`itemPackingTypeFk` AS `itemPackingTypeFk` from (((((`sale` `s` join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) join `volumeConfig` `vc`) join `itemCost` `ic` on(((`ic`.`itemFk` = `s`.`itemFk`) and (`ic`.`warehouseFk` = `t`.`warehouseFk`)))) where (`s`.`quantity` > 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 `saleVolume_Today_VNH` --- - -/*!50001 DROP TABLE IF EXISTS `saleVolume_Today_VNH`*/; -/*!50001 DROP VIEW IF EXISTS `saleVolume_Today_VNH`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `saleVolume_Today_VNH` AS select `t`.`nickname` AS `Cliente`,`p`.`name` AS `Provincia`,`c`.`country` AS `Pais`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `volume` from (((((`saleVolume` `sv` join `ticket` `t` on((`t`.`id` = `sv`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) join `country` `c` on((`c`.`id` = `p`.`countryFk`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) where ((`w`.`name` = 'VNH') and (`t`.`shipped` between curdate() and `util`.`dayend`(curdate()))) group by `t`.`nickname`,`p`.`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 `sale_freightComponent` --- - -/*!50001 DROP TABLE IF EXISTS `sale_freightComponent`*/; -/*!50001 DROP VIEW IF EXISTS `sale_freightComponent`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `sale_freightComponent` AS select `t`.`id` AS `ticketFk`,(`sc`.`value` * `s`.`quantity`) AS `amount`,`t`.`shipped` AS `shipped` from ((((`ticket` `t` straight_join `sale` `s` on((`t`.`id` = `s`.`ticketFk`))) join `saleComponent` `sc` on((`sc`.`saleFk` = `s`.`id`))) join `component` `c` on((`c`.`id` = `sc`.`componentFk`))) join `componentType` `ct` on(((`ct`.`id` = `c`.`typeFk`) and (`ct`.`type` = 'agencia')))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `salesPersonSince` --- - -/*!50001 DROP TABLE IF EXISTS `salesPersonSince`*/; -/*!50001 DROP VIEW IF EXISTS `salesPersonSince`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesPersonSince` AS select `p`.`id_trabajador` AS `workerFk`,min(`b`.`date_start`) AS `started` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join `postgresql`.`business` `b` on((`pr`.`profile_id` = `b`.`client_id`))) left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `postgresql`.`professional_category` `pc` on((`pc`.`professional_category_id` = `bl`.`professional_category_id`))) where (`pc`.`category_name` = 'Aux ventas') group by `p`.`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 `salesPreparedLastHour` --- - -/*!50001 DROP TABLE IF EXISTS `salesPreparedLastHour`*/; -/*!50001 DROP VIEW IF EXISTS `salesPreparedLastHour`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesPreparedLastHour` AS select `t`.`warehouseFk` AS `warehouseFk`,`st`.`saleFk` AS `saleFk`,`st`.`isChecked` AS `isChecked`,`st`.`originalQuantity` AS `originalQuantity`,`a`.`accion` AS `accion`,`st`.`created` AS `created`,`e`.`code` AS `code`,`w`.`firstName` AS `firstname`,`w`.`lastName` AS `lastName`,`w`.`code` AS `workerCode`,((`ic`.`cm3delivery` * `s`.`quantity`) / 1000) AS `litros`,`s`.`concept` AS `concept`,`d`.`name` AS `departmentName` from (((((((((`vn`.`saleTracking` `st` left join `vn`.`salesPreviousPreparated` `prevPrepSales` on((`prevPrepSales`.`saleFk` = `st`.`saleFk`))) join `vn`.`sale` `s` on((`s`.`id` = `st`.`saleFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`itemCost` `ic` on(((`ic`.`warehouseFk` = `t`.`warehouseFk`) and (`ic`.`itemFk` = `s`.`itemFk`)))) join `vn`.`worker` `w` on((`w`.`id` = `st`.`workerFk`))) join `vn`.`state` `e` on((`e`.`id` = `st`.`stateFk`))) join `vncontrol`.`accion` `a` on((`a`.`accion_id` = `st`.`actionFk`))) join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `st`.`workerFk`))) join `vn`.`department` `d` on((`d`.`id` = `wd`.`departmentFk`))) where ((`st`.`created` > (now() + interval -(1) hour)) and isnull(`prevPrepSales`.`saleFk`) and (not((`d`.`name` like 'EQUIPO%')))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `salesPreviousPreparated` --- - -/*!50001 DROP TABLE IF EXISTS `salesPreviousPreparated`*/; -/*!50001 DROP VIEW IF EXISTS `salesPreviousPreparated`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesPreviousPreparated` AS select `st`.`saleFk` AS `saleFk` from (`saleTracking` `st` join `state` `e` on((`e`.`id` = `st`.`stateFk`))) where ((`st`.`created` > curdate()) and (`e`.`code` like 'PREVIOUS_PREPARATION')) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `salesToPrePrepare__` --- - -/*!50001 DROP TABLE IF EXISTS `salesToPrePrepare__`*/; -/*!50001 DROP VIEW IF EXISTS `salesToPrePrepare__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `salesToPrePrepare__` AS select `m`.`ticketFk` AS `Id_Ticket`,`mk`.`Id_Movimiento` AS `Id_Movimiento`,`mk`.`Id_Movimiento_mark` AS `Id_Movimiento_mark`,`mk`.`Id_Trabajador` AS `Id_Trabjador`,`mk`.`valor` AS `isChecked`,`mk`.`odbc_date` AS `created`,`m`.`itemFk` AS `Id_Article`,`m`.`concept` AS `Concepte`,`art`.`subName` AS `subName`,ifnull(`m`.`quantity`,0) AS `Cantidad`,ifnull(`m`.`originalQuantity`,`m`.`quantity`) AS `original_quantity`,hour(`t`.`shipped`) AS `Hora`,hour(`t`.`shipped`) AS `Departure`,minute(`t`.`shipped`) AS `Minuto`,`am`.`agencyFk` AS `agency_id`,`t`.`warehouseFk` AS `warehouse_id`,`a`.`provinceFk` AS `province_id`,`is`.`quantity` AS `picked`,`t`.`CodigoTrabajador` AS `trabajador`,`is`.`sectorFk` AS `sectorFk`,`mk`.`stateFk` AS `stateFk` from ((((((((`vn2008`.`Movimientos_mark` `mk` join `vn`.`state` `st` on((`st`.`id` = `mk`.`stateFk`))) join `vn`.`sale` `m` on((`m`.`id` = `mk`.`Id_Movimiento`))) join `vn`.`ticket` `t` on((`m`.`ticketFk` = `t`.`id`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`address` `a` on((`a`.`id` = `t`.`addressFk`))) left join `vn`.`itemShelvingSaleSum` `is` on((`is`.`saleFk` = `mk`.`Id_Movimiento`))) join `vn2008`.`Articles` `art` on((`art`.`Id_Article` = `m`.`itemFk`))) left join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `mk`.`Id_Trabajador`))) where (`st`.`code` like 'PREVIOUS_PREPARATION') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `supplierPackaging` --- - -/*!50001 DROP TABLE IF EXISTS `supplierPackaging`*/; -/*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `supplierPackaging` AS select `e`.`supplierFk` AS `supplierFk`,`b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`s`.`name` AS `supplier`,`b`.`entryFk` AS `entryFk`,`tr`.`landed` AS `landed`,-(least(`b`.`quantity`,0)) AS `out`,greatest(`b`.`quantity`,0) AS `in`,`w`.`name` AS `warehouse`,`b`.`buyingValue` AS `buyingValue` from ((((((`buy` `b` join `item` `i` on((`i`.`id` = `b`.`itemFk`))) join `packaging` `p` on((`p`.`itemFk` = `i`.`id`))) join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) where `p`.`isPackageReturnable` */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `ticketLabel_Source` --- - -/*!50001 DROP TABLE IF EXISTS `ticketLabel_Source`*/; -/*!50001 DROP VIEW IF EXISTS `ticketLabel_Source`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketLabel_Source` AS select concat(`tc`.`collectionFk`,' ',`tc`.`wagon`,'-',`tc`.`level`) AS `level`,`t`.`id` AS `Id_Ticket`,(case when (`t`.`routeFk` is not null) then if(`agr`.`showAgencyName`,concat(right(left(`agr`.`name`,(locate(' ',`agr`.`name`) - 1)),2),'- R',convert(right(`t`.`routeFk`,3) using utf8)),`agr`.`name`) else if((`am`.`deliveryMethodFk` = 2),`zo`.`name`,`am`.`name`) end) AS `Agencia`,`t`.`clientFk` AS `Id_Cliente`,`t`.`notes` AS `Notas`,'CDT' AS `Sacador`,1 AS `ncarro`,if(hour(`t`.`shipped`),date_format(`t`.`shipped`,'%H:%i'),date_format(`zo`.`hour`,'%H:%i')) AS `horaagencia`,`t`.`shipped` AS `fecha`,if(((now() + interval 1 hour) > `ze`.`etc`),'!!!','') AS `urgente` from (((((((`vn`.`ticket` `t` join `vn`.`agencyMode` `am` on((`t`.`agencyModeFk` = `am`.`id`))) left join `vn`.`address` `a` on((`a`.`id` = `t`.`addressFk`))) left join `vn`.`route` `r` on((`t`.`routeFk` = `r`.`id`))) left join `vn`.`zoneEstimatedDelivery` `ze` on((`ze`.`zoneFk` = `t`.`zoneFk`))) left join `vn`.`ticketCollection` `tc` on((`tc`.`ticketFk` = `t`.`id`))) left join `vn`.`agencyMode` `agr` on((`r`.`agencyModeFk` = `agr`.`id`))) left join `vn`.`zone` `zo` on((`t`.`zoneFk` = `zo`.`id`))) where (`t`.`shipped` between `util`.`yesterday`() and `util`.`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 `ticketLastUpdated` --- - -/*!50001 DROP TABLE IF EXISTS `ticketLastUpdated`*/; -/*!50001 DROP VIEW IF EXISTS `ticketLastUpdated`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketLastUpdated` AS select `ticketLastUpdatedList`.`ticketFk` AS `ticketFk`,max(`ticketLastUpdatedList`.`created`) AS `lastUpdated` from `vn`.`ticketLastUpdatedList` group by `ticketLastUpdatedList`.`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 `ticketLastUpdatedList` --- - -/*!50001 DROP TABLE IF EXISTS `ticketLastUpdatedList`*/; -/*!50001 DROP VIEW IF EXISTS `ticketLastUpdatedList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketLastUpdatedList` AS select `s`.`ticketFk` AS `ticketFk`,`st`.`created` AS `created` from (`vn`.`saleTracking` `st` join `vn`.`sale` `s` on((`s`.`id` = `st`.`saleFk`))) where (`st`.`created` > curdate()) union all select `i`.`Id_Ticket` AS `Id_Ticket`,`i`.`odbc_date` AS `odbc_date` from `vncontrol`.`inter` `i` where (`i`.`odbc_date` > curdate()) union all select `s`.`ticketFk` AS `ticketFk`,`iss`.`created` AS `created` from (`vn`.`itemShelvingSale` `iss` join `vn`.`sale` `s` on((`s`.`id` = `iss`.`saleFk`))) where (`iss`.`created` > 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 `ticketLocation` --- - -/*!50001 DROP TABLE IF EXISTS `ticketLocation`*/; -/*!50001 DROP VIEW IF EXISTS `ticketLocation`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketLocation` AS select `tl`.`Id_Ticket` AS `ticketFk`,`tl`.`longitude` AS `longitude`,`tl`.`latitude` AS `latitude` from `vn2008`.`ticket_location` `tl` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `ticketMRW` --- - -/*!50001 DROP TABLE IF EXISTS `ticketMRW`*/; -/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketMRW` AS select `Tickets`.`Id_Agencia` AS `id_Agencia`,`Tickets`.`empresa_id` AS `empresa_id`,`Consignatarios`.`consignatario` AS `Consignatario`,`Consignatarios`.`domicilio` AS `DOMICILIO`,`Consignatarios`.`poblacion` AS `POBLACION`,`Consignatarios`.`codPostal` AS `CODPOSTAL`,`Consignatarios`.`telefono` AS `telefono`,ifnull(ifnull(ifnull(ifnull(`Consignatarios`.`movil`,`Clientes`.`movil`),`Consignatarios`.`telefono`),`Clientes`.`telefono`),0) AS `movil`,`Clientes`.`if` AS `IF`,`Tickets`.`Id_Ticket` AS `Id_Ticket`,`Tickets`.`warehouse_id` AS `warehouse_id`,`Consignatarios`.`id_consigna` AS `Id_Consigna`,`Paises`.`Codigo` AS `CodigoPais`,`Tickets`.`Fecha` AS `Fecha`,`province`.`province_id` AS `province_id`,`Tickets`.`landing` AS `landing` from ((((`vn2008`.`Clientes` join `vn2008`.`Consignatarios` on((`Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente`))) join `vn2008`.`Tickets` on((`Consignatarios`.`id_consigna` = `Tickets`.`Id_Consigna`))) join `vn2008`.`province` on((`Consignatarios`.`province_id` = `province`.`province_id`))) join `vn2008`.`Paises` on((`province`.`Paises_Id` = `Paises`.`Id`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `ticketNotInvoiced` --- - -/*!50001 DROP TABLE IF EXISTS `ticketNotInvoiced`*/; -/*!50001 DROP VIEW IF EXISTS `ticketNotInvoiced`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketNotInvoiced` AS select `t`.`companyFk` AS `companyFk`,`cm`.`code` AS `companyCode`,`t`.`clientFk` AS `clientFk`,`c`.`name` AS `clientName`,`t`.`shipped` AS `shipped`,cast(sum((((`s`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)) as decimal(10,2)) AS `value` from (((`ticket` `t` join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `client` `c` on((`c`.`id` = `t`.`clientFk`))) join `company` `cm` on((`cm`.`id` = `t`.`companyFk`))) where (isnull(`t`.`refFk`) and (`t`.`shipped` > '2017-01-01')) group by `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 `ticketPackingList` --- - -/*!50001 DROP TABLE IF EXISTS `ticketPackingList`*/; -/*!50001 DROP VIEW IF EXISTS `ticketPackingList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_general_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketPackingList` AS select `t`.`nickname` AS `nickname`,`t`.`id` AS `ticketFk`,`am`.`name` AS `agencyMode`,`am`.`flag` AS `flag`,`p`.`name` AS `province`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`sv`.`litros` AS `litros`,`to`.`description` AS `observaciones` from (((((((`ticket` `t` join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) join `agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) left join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) left join `saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) join `observationType` `ot` on((`ot`.`code` = 'packager'))) left join `ticketObservation` `to` on(((`to`.`ticketFk` = `t`.`id`) and (`ot`.`id` = `to`.`observationTypeFk`)))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `ticketPreviousPreparingList` --- - -/*!50001 DROP TABLE IF EXISTS `ticketPreviousPreparingList`*/; -/*!50001 DROP VIEW IF EXISTS `ticketPreviousPreparingList`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketPreviousPreparingList` AS select `s`.`ticketFk` AS `ticketFk`,`w`.`code` AS `code`,count(`s`.`id`) AS `saleLines`,sum((`s`.`isPicked` <> 0)) AS `alreadyMadeSaleLines`,(sum((`s`.`isPicked` <> 0)) / count(`s`.`id`)) AS `madeRate`,`sg`.`created` AS `created`,`p`.`code` AS `parking`,`iss`.`sectorFk` AS `sectorFk`,`al`.`code` AS `alertCode` from (((((((`vn`.`saleGroup` `sg` join `vn`.`saleGroupDetail` `sgd` on((`sgd`.`saleGroupFk` = `sg`.`id`))) join `vn`.`sale` `s` on((`s`.`id` = `sgd`.`saleFk`))) join `vn`.`ticketState` `tls` on((`tls`.`ticketFk` = `s`.`ticketFk`))) join `vn`.`alertLevel` `al` on((`al`.`id` = `tls`.`alertLevel`))) join `vn`.`worker` `w` on((`w`.`id` = `sg`.`userFk`))) left join `vn`.`parking` `p` on((`p`.`id` = `sg`.`parkingFk`))) join `vn`.`itemShelvingStock` `iss` on((`iss`.`itemFk` = `s`.`itemFk`))) where (`sg`.`created` >= (curdate() + interval 0.1 day)) group by `sg`.`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 `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `ticketState` AS select `i`.`odbc_date` AS `updated`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `workerFk`,`tls`.`ticketFk` AS `ticketFk`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alertLevel` AS `alertLevel`,`s`.`code` AS `code`,`tls`.`ticketFk` AS `ticket`,`i`.`Id_Trabajador` AS `worker`,`s`.`isPreviousPreparable` AS `isPreviousPreparable`,`s`.`isPicked` AS `isPicked` from ((`vn`.`ticketLastState` `tls` join `vncontrol`.`inter` `i` on((`i`.`inter_id` = `tls`.`ticketTrackingFk`))) join `vn`.`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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` 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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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`,`t`.`yearMonth` AS `yearMonth` 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 `tr2` --- - -/*!50001 DROP TABLE IF EXISTS `tr2`*/; -/*!50001 DROP VIEW IF EXISTS `tr2`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `tr2` AS select `travel`.`id` AS `id`,`travel`.`shipped` AS `shipped`,`travel`.`shipmentHour` AS `shipmentHour`,`travel`.`landed` AS `landed`,`travel`.`landingHour` AS `landingHour`,`travel`.`warehouseInFk` AS `warehouseInFk`,`travel`.`warehouseOutFk` AS `warehouseOutFk`,`travel`.`agencyFk` AS `agencyFk`,`travel`.`ref` AS `ref`,`travel`.`isDelivered` AS `isDelivered`,`travel`.`isReceived` AS `isReceived`,`travel`.`m3` AS `m3`,`travel`.`kg` AS `kg`,`travel`.`cargoSupplierFk` AS `cargoSupplierFk`,`travel`.`totalEntries` AS `totalEntries` from `travel` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `traceabilityBuy` --- - -/*!50001 DROP TABLE IF EXISTS `traceabilityBuy`*/; -/*!50001 DROP VIEW IF EXISTS `traceabilityBuy`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `traceabilityBuy` AS select `b`.`id` AS `buyFk`,`b`.`quantity` AS `quantity`,`tr`.`landed` AS `landed`,`w`.`name` AS `warehouseName`,`b`.`entryFk` AS `entryFk`,`s`.`name` AS `supplierName`,ifnull(`b`.`itemOriginalFk`,`b`.`itemFk`) AS `itemFk` from ((((`buy` `b` join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) join `warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `traceabilitySale` --- - -/*!50001 DROP TABLE IF EXISTS `traceabilitySale`*/; -/*!50001 DROP VIEW IF EXISTS `traceabilitySale`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `traceabilitySale` AS select `s`.`ticketFk` AS `ticketFk`,`sb`.`buyFk` AS `buyFk`,`t`.`shipped` AS `shipped`,`t`.`nickname` AS `nickname`,`s`.`quantity` AS `quantity`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `worker` from (((`saleBuy` `sb` join `sale` `s` on((`s`.`id` = `sb`.`saleFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `worker` `w` on((`w`.`id` = `sb`.`workerFk`))) */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `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 `workerBusinessDated` --- - -/*!50001 DROP TABLE IF EXISTS `workerBusinessDated`*/; -/*!50001 DROP VIEW IF EXISTS `workerBusinessDated`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerBusinessDated` AS select `t`.`dated` AS `dated`,`b`.`business_id` AS `business_id`,`w`.`id` AS `workerFk` from ((((`vn`.`time` `t` left join `postgresql`.`business` `b` on((`t`.`dated` between `b`.`date_start` and ifnull(`b`.`date_end`,curdate())))) left join `postgresql`.`profile` `pr` on((`b`.`client_id` = `pr`.`profile_id`))) left join `postgresql`.`person` `p` on((`pr`.`person_id` = `p`.`person_id`))) left join `vn`.`worker` `w` on((`p`.`id_trabajador` = `w`.`id`))) where (`t`.`dated` > (curdate() + interval -(2) year)) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerCalendar` --- - -/*!50001 DROP TABLE IF EXISTS `workerCalendar`*/; -/*!50001 DROP VIEW IF EXISTS `workerCalendar`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerCalendar` AS select `ce`.`business_id` AS `businessFk`,`p`.`id_trabajador` AS `workerFk`,`ce`.`calendar_state_id` AS `absenceTypeFk`,`ce`.`date` AS `dated` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`calendar_employee` `ce` on((`ce`.`business_id` = `b`.`business_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 `workerDepartment` --- - -/*!50001 DROP TABLE IF EXISTS `workerDepartment`*/; -/*!50001 DROP VIEW IF EXISTS `workerDepartment`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` >= curdate()) and (`b`.`date_start` <= 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 `workerDepartmentTest` --- - -/*!50001 DROP TABLE IF EXISTS `workerDepartmentTest`*/; -/*!50001 DROP VIEW IF EXISTS `workerDepartmentTest`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerDepartmentTest` AS select `p`.`workerFk` AS `workerFk`,`d`.`id` AS `departmentFk` from ((((`vn`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where (curdate() between `b`.`date_start` and ifnull(`b`.`date_end`,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 `workerLabour` --- - -/*!50001 DROP TABLE IF EXISTS `workerLabour`*/; -/*!50001 DROP VIEW IF EXISTS `workerLabour`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerLabour` AS select `b`.`business_id` AS `businessFk`,`p`.`id_trabajador` AS `workerFk`,`bl`.`workcenter_id` AS `workCenterFk`,`b`.`date_start` AS `started`,`b`.`date_end` AS `ended`,`d`.`id` AS `departmentFk`,`b`.`payedHolidays` AS `payedHolidays` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) order by `b`.`date_start` 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 `workerMana__` --- - -/*!50001 DROP TABLE IF EXISTS `workerMana__`*/; -/*!50001 DROP VIEW IF EXISTS `workerMana__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerMana__` AS select `ms`.`Id_Trabajador` AS `workerFk`,`ms`.`size` AS `size`,`ms`.`used` AS `amount`,`ms`.`prices_modifier_rate` AS `pricesModifierRate`,`ms`.`prices_modifier_activated` AS `isPricesModifierActivated`,`ms`.`minRate` AS `minRate`,`ms`.`maxRate` AS `maxRate` from `bs`.`mana_spellers` `ms` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerMedia` --- - -/*!50001 DROP TABLE IF EXISTS `workerMedia`*/; -/*!50001 DROP VIEW IF EXISTS `workerMedia`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerMedia` AS select `p`.`id_trabajador` AS `workerFk`,`m`.`value` AS `mediaValue` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `po` on((`po`.`person_id` = `p`.`person_id`))) join `postgresql`.`profile_media` `pom` on((`pom`.`profile_id` = `po`.`profile_id`))) join `postgresql`.`media` `m` on((`m`.`media_id` = `pom`.`media_id`))) join `postgresql`.`media_type` `mt` on((`mt`.`media_type_id` = `m`.`media_type_id`))) where (`mt`.`name` = 'movil empresa') */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerSpeedExpedition` --- - -/*!50001 DROP TABLE IF EXISTS `workerSpeedExpedition`*/; -/*!50001 DROP VIEW IF EXISTS `workerSpeedExpedition`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerSpeedExpedition` AS select `sv`.`ticketFk` AS `ticketFk`,sum(`sv`.`litros`) AS `litros`,sum(if((`sub`.`started` > (now() + interval -(1) hour)),`sv`.`litros`,0)) AS `literLastHour`,cast(((60 * sum(`sv`.`litros`)) / time_to_sec(timediff(max(`sub`.`finished`),min(`sub`.`started`)))) as decimal(10,1)) AS `litersByMinute`,`sub`.`code` AS `workerCode`,`sub`.`cajas` AS `cajas`,`sub`.`warehouseFk` AS `warehouseFk` from (`saleVolume` `sv` join `expeditionTimeExpended` `sub` on((`sub`.`ticketFk` = `sv`.`ticketFk`))) group by `workerCode` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerSpeedSaleTracking` --- - -/*!50001 DROP TABLE IF EXISTS `workerSpeedSaleTracking`*/; -/*!50001 DROP VIEW IF EXISTS `workerSpeedSaleTracking`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerSpeedSaleTracking` AS select `salesPreparedLastHour`.`warehouseFk` AS `warehouseFk`,`salesPreparedLastHour`.`accion` AS `accion`,`salesPreparedLastHour`.`workerCode` AS `workerCode`,sum(`salesPreparedLastHour`.`litros`) AS `sumaLitros`,min(`salesPreparedLastHour`.`created`) AS `started`,max(`salesPreparedLastHour`.`created`) AS `finished`,sum(if((`salesPreparedLastHour`.`created` >= (now() + interval -(1) hour)),`salesPreparedLastHour`.`litros`,0)) AS `sumaLitrosLastHour`,cast(((60 * sum(`salesPreparedLastHour`.`litros`)) / time_to_sec(timediff(max(`salesPreparedLastHour`.`created`),min(`salesPreparedLastHour`.`created`)))) as decimal(10,1)) AS `litersByMinute`,`salesPreparedLastHour`.`departmentName` AS `departmentName` from `vn`.`salesPreparedLastHour` group by `salesPreparedLastHour`.`warehouseFk`,`salesPreparedLastHour`.`accion`,`salesPreparedLastHour`.`workerCode` */; -/*!50001 SET character_set_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 = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`workerFk` AS `workerFk`,`t`.`workerFk` AS `collegueFk` from (`workerTeam` `w` join `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 `workerTimeControlUserInfo` --- - -/*!50001 DROP TABLE IF EXISTS `workerTimeControlUserInfo`*/; -/*!50001 DROP VIEW IF EXISTS `workerTimeControlUserInfo`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`u`.`bcryptPassword` AS `bcryptPassword`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on((`w`.`userFk` = `u`.`id`))) join `vn`.`client` `c` on((`c`.`id` = `u`.`id`))) left join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `w`.`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 `workerTimeControlWorking` --- - -/*!50001 DROP TABLE IF EXISTS `workerTimeControlWorking`*/; -/*!50001 DROP VIEW IF EXISTS `workerTimeControlWorking`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControlWorking` AS select `wtc`.`userFk` AS `userFk`,`wtc`.`timed` AS `timed`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`pm`.`mediaValue` AS `phone`,`wm`.`mediaValue` AS `workerPhone`,`d`.`name` AS `department`,`wc`.`name` AS `workerCenter`,count(`wtc`.`order`) AS `maxOrder` from (((((((`vn`.`workerTimeControl` `wtc` join `vn`.`worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) left join `vn`.`personMedia` `pm` on((`pm`.`workerFk` = `w`.`id`))) left join `vn`.`workerMedia` `wm` on((`wm`.`workerFk` = `w`.`id`))) left join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `w`.`id`))) left join `vn`.`department` `d` on((`d`.`id` = `wd`.`departmentFk`))) left join `vn`.`workerLabour` `wl` on((`wl`.`businessFk` = (select `wl2`.`businessFk` from `vn`.`workerLabour` `wl2` where (`wl2`.`workerFk` = `w`.`id`) order by `wl2`.`started` desc limit 1)))) left join `vn`.`workCenter` `wc` on((`wc`.`id` = `wl`.`workCenterFk`))) where (cast(`wtc`.`timed` as date) = curdate()) group by `wtc`.`userFk` having ((`maxOrder` % 2) = 1) order by `wtc`.`timed` 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 `workerTimeControl_Journey__` --- - -/*!50001 DROP TABLE IF EXISTS `workerTimeControl_Journey__`*/; -/*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeControl_Journey__` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,cast(sum((if((`wtc`.`order` % 2),-(1),1) * (hour(`wtc`.`timed`) + (minute(`wtc`.`timed`) / 60)))) as decimal(10,2)) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) group by cast(`wtc`.`timed` as date),`wtc`.`userFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerTimeJourneyNG` --- - -/*!50001 DROP TABLE IF EXISTS `workerTimeJourneyNG`*/; -/*!50001 DROP VIEW IF EXISTS `workerTimeJourneyNG`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerTimeJourneyNG` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,(if((`wtc`.`order` % 2),-(1),1) * (hour(`wtc`.`timed`) + (minute(`wtc`.`timed`) / 60))) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerWithoutDevice__` --- - -/*!50001 DROP TABLE IF EXISTS `workerWithoutDevice__`*/; -/*!50001 DROP VIEW IF EXISTS `workerWithoutDevice__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerWithoutDevice__` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones` from ((`collection` `c` join `client` `cl` on((`cl`.`id` = `c`.`workerFk`))) left join `deviceProductionUser` `dpu` on((`dpu`.`userFk` = `c`.`workerFk`))) where ((`c`.`created` > curdate()) and isnull(`dpu`.`userFk`)) group by `c`.`workerFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `workerWithoutTractor` --- - -/*!50001 DROP TABLE IF EXISTS `workerWithoutTractor`*/; -/*!50001 DROP VIEW IF EXISTS `workerWithoutTractor`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `workerWithoutTractor` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones`,max(`c`.`created`) AS `created` from ((`collection` `c` join `client` `cl` on((`cl`.`id` = `c`.`workerFk`))) left join `machineWorker` `mw` on(((`mw`.`workerFk` = `c`.`workerFk`) and (`mw`.`inTimed` > curdate())))) where ((`c`.`created` > curdate()) and isnull(`mw`.`workerFk`)) group by `c`.`workerFk` */; -/*!50001 SET character_set_client = @saved_cs_client */; -/*!50001 SET character_set_results = @saved_cs_results */; -/*!50001 SET collation_connection = @saved_col_connection */; - --- --- Final view structure for view `zoneEstimatedDelivery` --- - -/*!50001 DROP TABLE IF EXISTS `zoneEstimatedDelivery`*/; -/*!50001 DROP VIEW IF EXISTS `zoneEstimatedDelivery`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,cast((curdate() + interval ((hour(ifnull(`zc`.`hour`,`z`.`hour`)) * 60) + minute(ifnull(`zc`.`hour`,`z`.`hour`))) minute) as time) AS `hourTheoretical`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `totalVolume`,cast(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0)) as decimal(5,1)) AS `remainingVolume`,greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) AS `speed`,cast((`zc`.`hour` + interval ((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) minute) as time) AS `hourEffective`,floor(((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)))) AS `minutesLess`,cast((`zc`.`hour` + interval ((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) minute) as time) AS `etc` from (((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `s` on((`s`.`id` = `tst`.`state`))) join `vn`.`saleVolume` `sv` on((`sv`.`ticketFk` = `t`.`id`))) left join `vn`.`lastHourProduction` `lhp` on((`lhp`.`warehouseFk` = `t`.`warehouseFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) join `vn`.`warehouseAlias` `wa` on((`wa`.`id` = `w`.`aliasFk`))) join `vn`.`zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `vn`.`zoneClosure` `zc` on(((`zc`.`zoneFk` = `t`.`zoneFk`) and (`zc`.`dated` = curdate())))) left join `cache`.`departure_limit` `dl` on(((`dl`.`warehouse_id` = `t`.`warehouseFk`) and (`dl`.`fecha` = curdate())))) where (`w`.`hasProduction` and (cast(`t`.`shipped` as date) = curdate())) group by `t`.`zoneFk` */; -/*!50001 SET character_set_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_ETD__` --- - -/*!50001 DROP TABLE IF EXISTS `zone_ETD__`*/; -/*!50001 DROP VIEW IF EXISTS `zone_ETD__`*/; -/*!50001 SET @saved_cs_client = @@character_set_client */; -/*!50001 SET @saved_cs_results = @@character_set_results */; -/*!50001 SET @saved_col_connection = @@collation_connection */; -/*!50001 SET character_set_client = utf8mb4 */; -/*!50001 SET character_set_results = utf8mb4 */; -/*!50001 SET collation_connection = utf8mb4_unicode_ci */; -/*!50001 CREATE ALGORITHM=UNDEFINED */ -/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ -/*!50001 VIEW `zone_ETD__` AS select `zed`.`zoneFk` AS `zoneFk`,`zed`.`hourTheoretical` AS `HoraTeórica`,`zed`.`totalVolume` AS `volumenTotal`,`zed`.`remainingVolume` AS `volumenPendiente`,`zed`.`speed` AS `velocidad`,`zed`.`hourEffective` AS `HoraPráctica`,`zed`.`minutesLess` AS `minutesLess`,`zed`.`etc` AS `etc` from `vn`.`zoneEstimatedDelivery` `zed` */; -/*!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`; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2022-05-02 9:27:49 From 1cc199e26bdc79f01fba874300a73ce52fd37ed2 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 4 May 2022 10:26:13 +0200 Subject: [PATCH 064/141] refactor(client-credit) --- modules/client/back/models/client-credit.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/client/back/models/client-credit.js b/modules/client/back/models/client-credit.js index 7070dd6ae..dedc9491a 100644 --- a/modules/client/back/models/client-credit.js +++ b/modules/client/back/models/client-credit.js @@ -7,21 +7,17 @@ module.exports = Self => { where: {id: 1} }); const maxCreditRows = clientConfig.maxCreditRows; - const clientCredit = await models.ClientCredit.find({ where: {clientFk: instance.clientFk}, - order: 'created DESC' + order: 'created DESC', + limit: maxCreditRows }, ctx.options); - if (clientCredit.length > maxCreditRows) { - const creditToDestroy = []; - for (const [index, credit] of clientCredit.entries()) { - if (index >= maxCreditRows) - creditToDestroy.push(credit.id); - } - + const lastCredit = clientCredit[maxCreditRows - 1]; + if (lastCredit) { await models.ClientCredit.destroyAll({ - id: {inq: creditToDestroy} + clientFk: instance.clientFk, + created: {lt: lastCredit.created} }, ctx.options); } }); From 0cae852dea9d91f89188bd3fb47e9d48bc6b2ca0 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 4 May 2022 10:28:17 +0200 Subject: [PATCH 065/141] refactor --- modules/client/back/models/client-credit.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/client/back/models/client-credit.js b/modules/client/back/models/client-credit.js index dedc9491a..01fe8214a 100644 --- a/modules/client/back/models/client-credit.js +++ b/modules/client/back/models/client-credit.js @@ -3,10 +3,9 @@ module.exports = Self => { const instance = ctx.instance; const models = Self.app.models; - const clientConfig = await models.ClientConfig.findOne({ - where: {id: 1} - }); + const clientConfig = await models.ClientConfig.findOne(); const maxCreditRows = clientConfig.maxCreditRows; + const clientCredit = await models.ClientCredit.find({ where: {clientFk: instance.clientFk}, order: 'created DESC', From 66685e7541c12d02a0786e003d4c950913c43953 Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 4 May 2022 10:35:31 +0200 Subject: [PATCH 066/141] feat(ticket.expedition): add popover --- .../10451-april/00-aclExpeditionState.sql | 2 + db/dump/fixtures.sql | 39 +++++++---- .../back/methods/expedition-state/filter.js | 41 ++++++++++++ .../expedition-state/specs/filter.spec.js | 21 ++++++ .../ticket/back/methods/expedition/filter.js | 7 +- modules/ticket/back/model-config.json | 3 + .../ticket/back/models/expedition-state.js | 3 + .../ticket/back/models/expedition-state.json | 28 ++++++++ modules/ticket/front/expedition/index.html | 66 ++++++++++++++----- modules/ticket/front/expedition/index.js | 5 ++ modules/ticket/front/expedition/index.spec.js | 22 ++++++- modules/ticket/front/expedition/locale/es.yml | 1 + 12 files changed, 207 insertions(+), 31 deletions(-) create mode 100644 db/changes/10451-april/00-aclExpeditionState.sql create mode 100644 modules/ticket/back/methods/expedition-state/filter.js create mode 100644 modules/ticket/back/methods/expedition-state/specs/filter.spec.js create mode 100644 modules/ticket/back/models/expedition-state.js create mode 100644 modules/ticket/back/models/expedition-state.json create mode 100644 modules/ticket/front/expedition/locale/es.yml diff --git a/db/changes/10451-april/00-aclExpeditionState.sql b/db/changes/10451-april/00-aclExpeditionState.sql new file mode 100644 index 000000000..d26117bbf --- /dev/null +++ b/db/changes/10451-april/00-aclExpeditionState.sql @@ -0,0 +1,2 @@ +INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) +VALUES('ExpeditionState', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 0849e6708..076c6f566 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -883,18 +883,35 @@ INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPack ('cc', 1640038.00, 56.00, 220.00, 128.00, 1, CURDATE(), 15, 90.00), ('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, CURDATE(), 16, 0.00); -INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`, `externalId`, `packagingFk`) +INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`) VALUES - (1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 15, 1, 1, 18, 'UR9000006041', 94), - (2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 16, 2, 1, 18, 'UR9000006041', 94), - (3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 3, 1, 18, 'UR9000006041', 94), - (4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 4, 1, 18, 'UR9000006041', 94), - (5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94), - (6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL, 1, 1, 18, NULL, 94), - (7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94), - (8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94), - (9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94), - (10, 7, 7, 71, NOW(), NULL, 1, 1, 18, NULL, 94); + (1, 'En reparto', 'ON DELIVERY'), + (2, 'Entregada', 'DELIVERED'), + (3, 'Perdida', 'LOST'); + + +INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`) + VALUES + (1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 15, 1, 1, 18, 'UR9000006041', 94, 1), + (2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 16, 2, 1, 18, 'UR9000006041', 94, 1), + (3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 3, 1, 18, 'UR9000006041', 94, 2), + (4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 4, 1, 18, 'UR9000006041', 94, 2), + (5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 3), + (6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL, 1, 1, 18, NULL, 94, 3), + (7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94, NULL), + (8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94, 1), + (9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 2), + (10, 7, 7, 71, NOW(), NULL, 1, 1, 18, NULL, 94, 3); + + +INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`) + VALUES + (1, CURDATE(), 1, 1, 1), + (2, CURDATE(), 2, 1, 1), + (3, CURDATE(), 3, 1, 1), + (4, CURDATE(), 3, 2, 1106), + (5, CURDATE(), 5, 1, 1106), + (6, CURDATE(), 5, 3, 1106); INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`) VALUES diff --git a/modules/ticket/back/methods/expedition-state/filter.js b/modules/ticket/back/methods/expedition-state/filter.js new file mode 100644 index 000000000..43c293d7d --- /dev/null +++ b/modules/ticket/back/methods/expedition-state/filter.js @@ -0,0 +1,41 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + +module.exports = Self => { + Self.remoteMethod('filter', { + description: 'Find all instances of the model matched by filter from the data source.', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'}, + }, + ], + returns: { + type: ['object'], + root: true, + }, + http: { + path: `/filter`, + verb: 'GET', + }, + }); + + Self.filter = async(filter, options) => { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const stmt = new ParameterizedSQL( + `SELECT es.created, u.name, u.id workerFk, est.description + FROM vn.expeditionState es + JOIN vn.expeditionStateType est ON est.id = es.typeFk + JOIN account.user u ON u.id = es.userFk + `); + stmt.merge(Self.buildSuffix(filter, 'es')); + + return Self.rawStmt(stmt, myOptions); + }; +}; diff --git a/modules/ticket/back/methods/expedition-state/specs/filter.spec.js b/modules/ticket/back/methods/expedition-state/specs/filter.spec.js new file mode 100644 index 000000000..f144606eb --- /dev/null +++ b/modules/ticket/back/methods/expedition-state/specs/filter.spec.js @@ -0,0 +1,21 @@ +const models = require('vn-loopback/server/server').models; + +describe('expeditionState filter()', () => { + it('should return the expedition states matching the filter', async() => { + const tx = await models.ExpeditionState.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const filter = {where: {expeditionFk: 5}}; + const response = await models.ExpeditionState.filter(filter, options); + + expect(response.length).toEqual(2); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/ticket/back/methods/expedition/filter.js b/modules/ticket/back/methods/expedition/filter.js index 5eb7510b7..508e55617 100644 --- a/modules/ticket/back/methods/expedition/filter.js +++ b/modules/ticket/back/methods/expedition/filter.js @@ -47,9 +47,10 @@ module.exports = Self => { e.packagingFk, es.workerFk expeditionScanWorkerFk, su.name scannerUserName, - es.scanned - FROM - vn.expedition e + es.scanned, + est.description + FROM vn.expedition e + LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk LEFT JOIN vn.item i2 ON i2.id = e.itemFk INNER JOIN vn.item i1 ON i1.id = e.isBox LEFT JOIN vn.packaging p ON p.id = e.packagingFk diff --git a/modules/ticket/back/model-config.json b/modules/ticket/back/model-config.json index 5d5f08694..41885ee33 100644 --- a/modules/ticket/back/model-config.json +++ b/modules/ticket/back/model-config.json @@ -14,6 +14,9 @@ "Expedition": { "dataSource": "vn" }, + "ExpeditionState": { + "dataSource": "vn" + }, "Packaging": { "dataSource": "vn" }, diff --git a/modules/ticket/back/models/expedition-state.js b/modules/ticket/back/models/expedition-state.js new file mode 100644 index 000000000..af76af718 --- /dev/null +++ b/modules/ticket/back/models/expedition-state.js @@ -0,0 +1,3 @@ +module.exports = function(Self) { + require('../methods/expedition-state/filter')(Self); +}; diff --git a/modules/ticket/back/models/expedition-state.json b/modules/ticket/back/models/expedition-state.json new file mode 100644 index 000000000..262eb2e38 --- /dev/null +++ b/modules/ticket/back/models/expedition-state.json @@ -0,0 +1,28 @@ +{ + "name": "ExpeditionState", + "base": "VnModel", + "options": { + "mysql": { + "table": "expeditionState" + } + }, + "properties": { + "id": { + "id": true, + "type": "number", + "description": "Identifier" + }, + "created": { + "type": "date" + }, + "expeditionFk": { + "type": "number" + }, + "typeFk": { + "type": "number" + }, + "userFk": { + "type": "number" + } + } +} diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index bdbb2c3e8..946e923ba 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -19,10 +19,9 @@ Package type Counter externalId - Packager Created - Palletizer - Scanned + State + @@ -33,7 +32,7 @@ vn-tooltip="Delete expedition"> - {{expedition.id | zeroFill:6}} + {{expedition.id | zeroFill:6}} {{::expedition.freightItemName}} {{::expedition.counter}} {{::expedition.externalId}} - - - {{::expedition.userName | dashIfEmpty}} - - {{::expedition.created | date:'dd/MM/yyyy HH:mm'}} + {{::expedition.description}} - - {{::expedition.scannerUserName | dashIfEmpty}} - + + - {{::expedition.scanned | date:'dd/MM/yyyy HH:mm'}} @@ -77,4 +71,44 @@ on-accept="$ctrl.onDialogAccept($data)" question="Delete expedition" message="Are you sure you want to delete this expedition?"> - \ No newline at end of file + + + + + + + + + + + State + Worker + Created + + + + + {{::expeditionState.description}} + + + {{::expeditionState.name || 'System' | translate}} + + + {{::expeditionState.created | date:'dd/MM/yyyy HH:mm'}} + + + + + + + + \ No newline at end of file diff --git a/modules/ticket/front/expedition/index.js b/modules/ticket/front/expedition/index.js index 0c395e6ce..120d89bb2 100644 --- a/modules/ticket/front/expedition/index.js +++ b/modules/ticket/front/expedition/index.js @@ -6,6 +6,11 @@ class Controller extends Section { return this.$http.delete(`Expeditions/${id}`) .then(() => this.$.model.refresh()); } + + showLog(expedition) { + this.expedition = expedition; + this.$.statusLog.show(); + } } ngModule.vnComponent('vnTicketExpedition', { diff --git a/modules/ticket/front/expedition/index.spec.js b/modules/ticket/front/expedition/index.spec.js index 425539aef..586ef2109 100644 --- a/modules/ticket/front/expedition/index.spec.js +++ b/modules/ticket/front/expedition/index.spec.js @@ -5,10 +5,12 @@ describe('Ticket', () => { let controller; let $scope; let $httpBackend; + let $window; beforeEach(ngModule('ticket')); - beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => { + beforeEach(inject(($componentController, $rootScope, _$httpBackend_, _$window_) => { + $window = _$window_; $httpBackend = _$httpBackend_; $scope = $rootScope.$new(); $scope.model = { @@ -30,5 +32,23 @@ describe('Ticket', () => { expect($scope.model.refresh).toHaveBeenCalledWith(); }); }); + + describe('showLog()', () => { + it('should show the popover status log', () => { + controller.$.statusLog = {show: () => {}}; + jest.spyOn(controller.$.statusLog, 'show'); + + const expedition = {id: 1}; + + const event = new MouseEvent('click', { + view: $window, + bubbles: true, + cancelable: true + }); + controller.showLog(event, expedition); + + expect(controller.$.statusLog.show).toHaveBeenCalledWith(); + }); + }); }); }); diff --git a/modules/ticket/front/expedition/locale/es.yml b/modules/ticket/front/expedition/locale/es.yml new file mode 100644 index 000000000..d23cf25af --- /dev/null +++ b/modules/ticket/front/expedition/locale/es.yml @@ -0,0 +1 @@ +Status log: Hitorial de estados \ No newline at end of file From dcd5d07a28b06c368214f04446d6eeb0063e14c1 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 4 May 2022 10:43:40 +0200 Subject: [PATCH 067/141] menu order --- modules/supplier/front/routes.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json index 86bfba40c..61420b40d 100644 --- a/modules/supplier/front/routes.json +++ b/modules/supplier/front/routes.json @@ -12,12 +12,12 @@ {"state": "supplier.card.basicData", "icon": "settings"}, {"state": "supplier.card.fiscalData", "icon": "account_balance"}, {"state": "supplier.card.billingData", "icon": "icon-payment"}, - {"state": "supplier.card.address.index", "icon": "icon-delivery"}, + {"state": "supplier.card.log", "icon": "history"}, {"state": "supplier.card.account", "icon": "icon-account"}, {"state": "supplier.card.contact", "icon": "contact_phone"}, - {"state": "supplier.card.agencyTerm.index", "icon": "icon-agency-term"}, - {"state": "supplier.card.log", "icon": "history"}, - {"state": "supplier.card.consumption", "icon": "show_chart"} + {"state": "supplier.card.address.index", "icon": "icon-delivery"}, + {"state": "supplier.card.consumption", "icon": "show_chart"}, + {"state": "supplier.card.agencyTerm.index", "icon": "icon-agency-term"} ] }, "keybindings": [ @@ -97,7 +97,7 @@ "url": "/index", "state": "supplier.card.agencyTerm.index", "component": "vn-supplier-agency-term-index", - "description": "Autonomous", + "description": "Agency Agreement", "params": { "supplier": "$ctrl.supplier" } From 38f5541ef49f112c0874b818c24da771908e97ac Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 4 May 2022 11:27:03 +0200 Subject: [PATCH 068/141] execute jenkins test --- modules/ticket/front/expedition/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 946e923ba..e5b84509f 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -72,7 +72,7 @@ question="Delete expedition" message="Are you sure you want to delete this expedition?"> - + Date: Wed, 4 May 2022 12:00:39 +0200 Subject: [PATCH 069/141] comment frontTest --- modules/ticket/front/expedition/index.spec.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/ticket/front/expedition/index.spec.js b/modules/ticket/front/expedition/index.spec.js index 586ef2109..bb2604132 100644 --- a/modules/ticket/front/expedition/index.spec.js +++ b/modules/ticket/front/expedition/index.spec.js @@ -33,22 +33,22 @@ describe('Ticket', () => { }); }); - describe('showLog()', () => { - it('should show the popover status log', () => { - controller.$.statusLog = {show: () => {}}; - jest.spyOn(controller.$.statusLog, 'show'); + // describe('showLog()', () => { + // it('should show the popover status log', () => { + // controller.$.statusLog = {show: () => {}}; + // jest.spyOn(controller.$.statusLog, 'show'); - const expedition = {id: 1}; + // const expedition = {id: 1}; - const event = new MouseEvent('click', { - view: $window, - bubbles: true, - cancelable: true - }); - controller.showLog(event, expedition); + // const event = new MouseEvent('click', { + // view: $window, + // bubbles: true, + // cancelable: true + // }); + // controller.showLog(event, expedition); - expect(controller.$.statusLog.show).toHaveBeenCalledWith(); - }); - }); + // expect(controller.$.statusLog.show).toHaveBeenCalledWith(); + // }); + // }); }); }); From 93e3ea103acc002b37cb933e768086cc9ad55a4f Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 4 May 2022 12:05:46 +0200 Subject: [PATCH 070/141] added frontTest --- modules/ticket/front/expedition/index.spec.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/ticket/front/expedition/index.spec.js b/modules/ticket/front/expedition/index.spec.js index bb2604132..586ef2109 100644 --- a/modules/ticket/front/expedition/index.spec.js +++ b/modules/ticket/front/expedition/index.spec.js @@ -33,22 +33,22 @@ describe('Ticket', () => { }); }); - // describe('showLog()', () => { - // it('should show the popover status log', () => { - // controller.$.statusLog = {show: () => {}}; - // jest.spyOn(controller.$.statusLog, 'show'); + describe('showLog()', () => { + it('should show the popover status log', () => { + controller.$.statusLog = {show: () => {}}; + jest.spyOn(controller.$.statusLog, 'show'); - // const expedition = {id: 1}; + const expedition = {id: 1}; - // const event = new MouseEvent('click', { - // view: $window, - // bubbles: true, - // cancelable: true - // }); - // controller.showLog(event, expedition); + const event = new MouseEvent('click', { + view: $window, + bubbles: true, + cancelable: true + }); + controller.showLog(event, expedition); - // expect(controller.$.statusLog.show).toHaveBeenCalledWith(); - // }); - // }); + expect(controller.$.statusLog.show).toHaveBeenCalledWith(); + }); + }); }); }); From bfd8c8d47a548f030fd38fb9333a1c51ef3d0917 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 4 May 2022 15:58:36 +0200 Subject: [PATCH 071/141] DB export --- db/dump/dumpedFixtures.sql | 16 +- db/dump/structure.sql | 63253 +++++++++++++++++++++++++++++++++++ db/export-structure.sh | 1 + 3 files changed, 63262 insertions(+), 8 deletions(-) diff --git a/db/dump/dumpedFixtures.sql b/db/dump/dumpedFixtures.sql index 5a2aa3fa7..464933607 100644 --- a/db/dump/dumpedFixtures.sql +++ b/db/dump/dumpedFixtures.sql @@ -54,7 +54,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 7:54:36 +-- Dump completed on 2022-05-04 15:58:27 USE `account`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -140,7 +140,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 7:54:37 +-- Dump completed on 2022-05-04 15:58:27 USE `salix`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -206,7 +206,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 7:54:37 +-- Dump completed on 2022-05-04 15:58:28 USE `vn`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -472,7 +472,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 7:54:37 +-- Dump completed on 2022-05-04 15:58:28 USE `cache`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -508,7 +508,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 7:54:37 +-- Dump completed on 2022-05-04 15:58:28 USE `hedera`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -674,7 +674,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 7:54:38 +-- Dump completed on 2022-05-04 15:58:28 USE `postgresql`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -760,7 +760,7 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 7:54:38 +-- Dump completed on 2022-05-04 15:58:28 USE `sage`; -- MariaDB dump 10.19 Distrib 10.6.7-MariaDB, for debian-linux-gnu (x86_64) -- @@ -816,4 +816,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2022-05-04 7:54:38 +-- Dump completed on 2022-05-04 15:58:29 diff --git a/db/dump/structure.sql b/db/dump/structure.sql index a466c0f81..74bcd8966 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -34947,3 +34947,63256 @@ SET character_set_client = utf8; `sectorFk` tinyint NOT NULL ) ENGINE=MyISAM */; SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `itemShelvingSale` +-- + +DROP TABLE IF EXISTS `itemShelvingSale`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemShelvingSale` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemShelvingFk` int(10) unsigned NOT NULL, + `saleFk` int(11) NOT NULL, + `quantity` decimal(10,0) NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `userFk` int(11) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `itemShelvingSale_fk1_idx` (`itemShelvingFk`), + KEY `itemShelvingSale_fk2_idx` (`saleFk`), + KEY `itemShelvingSale_fk3_idx` (`userFk`), + CONSTRAINT `itemShelvingSale_fk1` FOREIGN KEY (`itemShelvingFk`) REFERENCES `itemShelving` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `itemShelvingSale_fk2` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `itemShelvingSale_fk3` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Detalle del producto que se retira de los carros, relacionando la linea de movimiento correspondiente'; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemShelvingSale_AFTER_INSERT` + AFTER INSERT ON `itemShelvingSale` + FOR EACH ROW +BEGIN + + UPDATE vn.sale + SET isPicked = TRUE + WHERE id = NEW.saleFk; + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Temporary table structure for view `itemShelvingSaleSum` +-- + +DROP TABLE IF EXISTS `itemShelvingSaleSum`; +/*!50001 DROP VIEW IF EXISTS `itemShelvingSaleSum`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemShelvingSaleSum` ( + `id` tinyint NOT NULL, + `itemShelvingFk` tinyint NOT NULL, + `saleFk` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `created` tinyint NOT NULL, + `sectorFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `itemShelvingStock` +-- + +DROP TABLE IF EXISTS `itemShelvingStock`; +/*!50001 DROP VIEW IF EXISTS `itemShelvingStock`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemShelvingStock` ( + `itemFk` tinyint NOT NULL, + `visible` tinyint NOT NULL, + `packing` tinyint NOT NULL, + `grouping` tinyint NOT NULL, + `sector` tinyint NOT NULL, + `visibleOriginal` tinyint NOT NULL, + `removed` tinyint NOT NULL, + `sectorFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `shelvingFk` tinyint NOT NULL, + `parkingCode` tinyint NOT NULL, + `parkingFk` tinyint NOT NULL, + `itemShelvingFk` tinyint NOT NULL, + `created` tinyint NOT NULL, + `isPreviousPrepared` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `itemShelvingStockFull` +-- + +DROP TABLE IF EXISTS `itemShelvingStockFull`; +/*!50001 DROP VIEW IF EXISTS `itemShelvingStockFull`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemShelvingStockFull` ( + `itemFk` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `packing` tinyint NOT NULL, + `grouping` tinyint NOT NULL, + `sector` tinyint NOT NULL, + `removed` tinyint NOT NULL, + `sectorFk` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `shelvingFk` tinyint NOT NULL, + `parkingCode` tinyint NOT NULL, + `parkingFk` tinyint NOT NULL, + `itemShelvingFk` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `itemShelvingStockRemoved` +-- + +DROP TABLE IF EXISTS `itemShelvingStockRemoved`; +/*!50001 DROP VIEW IF EXISTS `itemShelvingStockRemoved`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemShelvingStockRemoved` ( + `itemShelvingFk` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `removed` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `itemShelvingStock_byWarehouse` +-- + +DROP TABLE IF EXISTS `itemShelvingStock_byWarehouse`; +/*!50001 DROP VIEW IF EXISTS `itemShelvingStock_byWarehouse`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemShelvingStock_byWarehouse` ( + `itemFk` tinyint NOT NULL, + `visible` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `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(50) COLLATE utf8_unicode_ci NOT NULL, + `intValue` int(11) DEFAULT NULL, + `priority` int(2) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `itemTagItemUq` (`itemFk`,`tagFk`), + KEY `tagFk` (`tagFk`,`value`), + KEY `priorityItem` (`priority`,`itemFk`), + KEY `value` (`value`), + KEY `itemFk_2` (`itemFk`,`tagFk`,`intValue`), + CONSTRAINT `itemTagItemFk` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `itemTagTagFk` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeInsert` + BEFORE INSERT ON `itemTag` + FOR EACH ROW +BEGIN + SET NEW.intValue = itemTag_getIntValue(NEW.`value`); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_AFTER_INSERT` + AFTER INSERT ON `itemTag` + FOR EACH ROW +trig: BEGIN + DECLARE vItemFk INT; + DECLARE visTriggerDisabled BOOL; + + SELECT isItemTagTriggerDisabled INTO visTriggerDisabled + FROM vn.itemConfig; + + IF @isTriggerDisabled OR visTriggerDisabled THEN + LEAVE trig; + END IF; + + SET vItemFk = NEW.itemFk; + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + SELECT vItemFk id; + CALL item_refreshTags(); + DROP TEMPORARY TABLE 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 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_beforeUpdate` + BEFORE UPDATE ON `itemTag` + FOR EACH ROW +BEGIN + IF !(OLD.`value` <=> NEW.`value`) + OR !(OLD.intValue <=> NEW.intValue) THEN + SET NEW.intValue = itemTag_getIntValue(NEW.`value`); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterUpdate` + AFTER UPDATE ON `itemTag` + FOR EACH ROW +trig: BEGIN + DECLARE vItemFk INT; + DECLARE visTriggerDisabled BOOL; + + SELECT isItemTagTriggerDisabled INTO visTriggerDisabled + FROM vn.itemConfig; + + IF @isTriggerDisabled OR visTriggerDisabled THEN + LEAVE trig; + END IF; + + SET vItemFk = NEW.itemFk; + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + SELECT vItemFk id; + + CALL item_refreshTags(); + DROP TEMPORARY TABLE 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 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemTag_afterDelete` + AFTER DELETE ON `itemTag` + FOR EACH ROW +trig: BEGIN + DECLARE vItemFk INT; + DECLARE visTriggerDisabled BOOL; + + SELECT isItemTagTriggerDisabled INTO visTriggerDisabled + FROM vn.itemConfig; + + IF @isTriggerDisabled OR visTriggerDisabled THEN + LEAVE trig; + END IF; + + SET vItemFk = OLD.itemFk; + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + SELECT vItemFk id; + CALL item_refreshTags(); + DROP TEMPORARY TABLE 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 */ ; + +-- +-- 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 TABLE `itemTagged` ( + `itemFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `itemTaxCountry` +-- + +DROP TABLE IF EXISTS `itemTaxCountry`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemTaxCountry` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemFk` int(11) DEFAULT NULL, + `countryFk` mediumint(8) unsigned DEFAULT NULL, + `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '1', + `effectived` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `itemFk_UNIQUE` (`itemFk`,`countryFk`), + KEY `taxClassFK_idx` (`taxClassFk`), + KEY `countryFK_paises_idx` (`countryFk`), + CONSTRAINT `countryFK_paises` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, + CONSTRAINT `itemFK_Article` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `taxClassFK_Iva_Group` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 `itemTicketOut` +-- + +DROP TABLE IF EXISTS `itemTicketOut`; +/*!50001 DROP VIEW IF EXISTS `itemTicketOut`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `itemTicketOut` ( + `warehouseFk` tinyint NOT NULL, + `shipped` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `isPicked` tinyint NOT NULL, + `reserved` tinyint NOT NULL, + `refFk` tinyint NOT NULL, + `saleFk` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `itemType` +-- + +DROP TABLE IF EXISTS `itemType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemType` ( + `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `gramsMin` int(11) DEFAULT NULL, + `gramsMax` int(11) DEFAULT NULL, + `order` int(11) DEFAULT '0', + `categoryFk` int(10) unsigned NOT NULL, + `workerFk` int(10) unsigned NOT NULL, + `isInventory` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'Se utiliza tanto en el cálculo del inventario, como en el del informe del inventario valorado', + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `f11` tinyint(4) NOT NULL DEFAULT '0', + `transaction` tinyint(4) NOT NULL DEFAULT '0', + `making` int(10) unsigned DEFAULT NULL COMMENT 'Son productos de confección propia', + `location` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `life` smallint(5) unsigned DEFAULT NULL, + `maneuver` double NOT NULL DEFAULT '0.21', + `target` double NOT NULL DEFAULT '0.15', + `topMargin` double NOT NULL DEFAULT '0.3', + `profit` double NOT NULL DEFAULT '0.02', + `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', + `isPackaging` tinyint(1) NOT NULL DEFAULT '0', + `hasComponents` tinyint(1) NOT NULL DEFAULT '1', + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '60', + `compression` decimal(5,2) DEFAULT '1.00', + `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `temperatureFk` varchar(10) CHARACTER SET utf8 DEFAULT NULL, + `isUnconventionalSize` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'familia con productos cuyas medidas no son aptas para la cinta transportadora o paletizar', + PRIMARY KEY (`code`), + UNIQUE KEY `tipo_id_UNIQUE` (`id`), + UNIQUE KEY `Tipo_UNIQUE` (`name`,`categoryFk`), + KEY `Trabajador` (`workerFk`), + KEY `reino_id` (`categoryFk`), + KEY `Tipos_fk3_idx` (`making`), + KEY `warehouseFk5_idx` (`warehouseFk`), + KEY `temperatureFk` (`temperatureFk`), + CONSTRAINT `Tipos_fk3` FOREIGN KEY (`making`) REFERENCES `confectionType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `Trabajador` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `itemType_ibfk_1` FOREIGN KEY (`categoryFk`) REFERENCES `itemCategory` (`id`) ON UPDATE CASCADE, + CONSTRAINT `temperatureFk` FOREIGN KEY (`temperatureFk`) REFERENCES `temperature` (`code`), + CONSTRAINT `warehouseFk5` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`itemType_beforeUpdate` + BEFORE UPDATE ON `itemType` + FOR EACH ROW +-- Edit trigger body code below this line. Do not edit lines above this one +BEGIN + + IF NEW.itemPackingTypeFk = '' THEN + + SET NEW.itemPackingTypeFk = NULL; + + END IF; + + IF NEW.itemPackingTypeFk != OLD.itemPackingTypeFk THEN + + UPDATE vn.item + SET itemPackingTypeFk = NEW.itemPackingTypeFk + WHERE typeFk = 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 `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 `itemTypeRestriction` +-- + +DROP TABLE IF EXISTS `itemTypeRestriction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemTypeRestriction` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemTypeFk` smallint(5) unsigned NOT NULL, + `dated` date NOT NULL, + `minAmount` decimal(10,2) NOT NULL COMMENT 'importe mínimo en la linea de venta', + PRIMARY KEY (`id`), + UNIQUE KEY `itemTypeRestriction_UN` (`itemTypeFk`,`dated`), + KEY `itemTypeRestriction_dated_IDX` (`dated`,`itemTypeFk`) USING BTREE, + CONSTRAINT `itemTypeRestriction_itemType_id_fk` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `itemTypeTag` +-- + +DROP TABLE IF EXISTS `itemTypeTag`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemTypeTag` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemTypeFk` smallint(5) unsigned NOT NULL, + `tagFk` int(11) NOT NULL, + `priority` int(2) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `itemTypeFk_UNIQUE` (`itemTypeFk`,`tagFk`), + KEY `itemTypeTagTipo_idx` (`itemTypeFk`), + KEY `itemTypeTagTag_idx` (`tagFk`), + CONSTRAINT `itemTypeTagTag` FOREIGN KEY (`tagFk`) REFERENCES `tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `itemTypeTagTipos` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `itemVerdecora__` +-- + +DROP TABLE IF EXISTS `itemVerdecora__`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `itemVerdecora__` ( + `itemFk` int(11) NOT NULL, + `codin` int(11) DEFAULT NULL, + PRIMARY KEY (`itemFk`), + CONSTRAINT `itemVerdecora_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona nuestros articulos con los de Verdecora'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `item_Free_Id` +-- + +DROP TABLE IF EXISTS `item_Free_Id`; +/*!50001 DROP VIEW IF EXISTS `item_Free_Id`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `item_Free_Id` ( + `newId` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `labelInfo` +-- + +DROP TABLE IF EXISTS `labelInfo`; +/*!50001 DROP VIEW IF EXISTS `labelInfo`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `labelInfo` ( + `itemId` tinyint NOT NULL, + `itemName` tinyint NOT NULL, + `stickers` tinyint NOT NULL, + `life` tinyint NOT NULL, + `colorCode` tinyint NOT NULL, + `stems` tinyint NOT NULL, + `category` tinyint NOT NULL, + `productor` tinyint NOT NULL, + `packing` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `size` tinyint NOT NULL, + `isPickedOff` tinyint NOT NULL, + `notes` tinyint NOT NULL, + `wh_in` tinyint NOT NULL, + `entryId` tinyint NOT NULL, + `buyId` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `labelReport` +-- + +DROP TABLE IF EXISTS `labelReport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `labelReport` ( + `id` tinyint(3) unsigned NOT NULL, + `name` varchar(50) 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 `labourTree` +-- + +DROP TABLE IF EXISTS `labourTree`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `labourTree` ( + `id` int(11) NOT NULL DEFAULT '0', + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `lft` int(11) NOT NULL, + `rgt` int(11) NOT NULL, + `depth` bigint(22) NOT NULL DEFAULT '0', + `sons` decimal(10,0) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `lastHourProduction` +-- + +DROP TABLE IF EXISTS `lastHourProduction`; +/*!50001 DROP VIEW IF EXISTS `lastHourProduction`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `lastHourProduction` ( + `warehouseFk` tinyint NOT NULL, + `m3` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `lastPurchases` +-- + +DROP TABLE IF EXISTS `lastPurchases`; +/*!50001 DROP VIEW IF EXISTS `lastPurchases`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `lastPurchases` ( + `landed` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `warehouse` tinyint NOT NULL, + `longName` tinyint NOT NULL, + `subName` tinyint NOT NULL, + `entryFk` tinyint NOT NULL, + `stickers` tinyint NOT NULL, + `packing` tinyint NOT NULL, + `ref` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `pro` tinyint NOT NULL, + `ektRef` tinyint NOT NULL, + `agj` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `lastTopClaims` +-- + +DROP TABLE IF EXISTS `lastTopClaims`; +/*!50001 DROP VIEW IF EXISTS `lastTopClaims`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `lastTopClaims` ( + `itemFk` tinyint NOT NULL, + `itemName` tinyint NOT NULL, + `itemTypeName` tinyint NOT NULL, + `claimsNumber` tinyint NOT NULL, + `claimedAmount` tinyint NOT NULL, + `totalAmount` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `ledgerConfig` +-- + +DROP TABLE IF EXISTS `ledgerConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ledgerConfig` ( + `lastBookEntry` int(11) NOT NULL, + PRIMARY KEY (`lastBookEntry`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `lungSize` +-- + +DROP TABLE IF EXISTS `lungSize`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `lungSize` ( + `hora` time NOT NULL, + `size` decimal(5,0) NOT NULL, + `dia` date NOT NULL, + PRIMARY KEY (`hora`,`size`,`dia`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `machine` +-- + +DROP TABLE IF EXISTS `machine`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `machine` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `plate` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `serialNumber` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `maker` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `model` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `purchased` date DEFAULT NULL, + `warehouseFk` int(11) DEFAULT NULL, + `departmentFk` int(11) DEFAULT NULL, + `type` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `use` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `productionYear` int(11) DEFAULT NULL, + `photo` blob, + `workerFk` int(10) unsigned DEFAULT NULL, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `ppeFk` int(11) DEFAULT NULL, + `supplierFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `plate` (`plate`), + UNIQUE KEY `serialNumber` (`serialNumber`), + KEY `machine_FK` (`ppeFk`), + KEY `machine_FK_2` (`supplierFk`), + KEY `machine_FK_1` (`workerFk`), + CONSTRAINT `machine_FK` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `machine_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `machine_FK_2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Maquinaria industrial, vehículos y demás elementos amortizables'; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`machine_BI` + BEFORE INSERT ON `machine` + FOR EACH ROW +BEGIN + + SET NEW.workerFk = vn.getUser(); + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `machineDetail` +-- + +DROP TABLE IF EXISTS `machineDetail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `machineDetail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `machineFk` int(11) NOT NULL, + `dated` date NOT NULL, + `action` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `value` decimal(10,2) DEFAULT NULL, + `workerFk` int(10) unsigned NOT NULL, + `dmsFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `machineDetail_FK` (`machineFk`), + KEY `machineDetail_FK_2` (`dmsFk`), + KEY `machineDetail_FK_1` (`workerFk`), + CONSTRAINT `machineDetail_FK` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `machineDetail_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `machineDetail_FK_2` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `machineDms` +-- + +DROP TABLE IF EXISTS `machineDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `machineDms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `machineFk` int(11) NOT NULL, + `dmsFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `machineDms_UN` (`machineFk`,`dmsFk`), + KEY `machineDms_FK` (`dmsFk`), + CONSTRAINT `machineDms_FK` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `machineDms_FK_1` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `machineWorker` +-- + +DROP TABLE IF EXISTS `machineWorker`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `machineWorker` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `machineFk` int(11) NOT NULL, + `inTimed` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `outTimed` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `machineWorker_FK_1` (`machineFk`), + KEY `machineWorker_FK` (`workerFk`), + CONSTRAINT `machineWorker_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `machineWorker_FK_1` FOREIGN KEY (`machineFk`) REFERENCES `machine` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registros horarios de vehículos de almacén por empleado'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `machineWorkerConfig` +-- + +DROP TABLE IF EXISTS `machineWorkerConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `machineWorkerConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `maxHours` smallint(5) unsigned NOT NULL COMMENT 'Indicates how many hours a user record is reviewed to update or insert', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT 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, + `receiver` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `sender` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `replyTo` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `subject` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `body` text COLLATE utf8_unicode_ci NOT NULL, + `sent` tinyint(2) NOT NULL DEFAULT '0', + `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `attachment` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `status` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'OK', + `senderFk` int(11) DEFAULT NULL, + `recipientFk` int(11) DEFAULT NULL, + `plainTextBody` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + KEY `sent_idx` (`sent`), + KEY `creation_idx` (`creationDate`) +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`mail_beforeInsert` + BEFORE INSERT ON `mail` + FOR EACH ROW +BEGIN + + IF NEW.sender IS NOT NULL THEN + + SET NEW.receiver = NEW.sender; + + 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 `mailTemplates` +-- + +DROP TABLE IF EXISTS `mailTemplates`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mailTemplates` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 NOT NULL, + `attachmentPath` text CHARACTER SET utf8 NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mandate` +-- + +DROP TABLE IF EXISTS `mandate`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mandate` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `clientFk` int(11) NOT NULL, + `companyFk` smallint(5) unsigned NOT NULL, + `code` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `finished` timestamp NULL DEFAULT NULL, + `mandateTypeFk` smallint(5) NOT NULL, + PRIMARY KEY (`id`), + KEY `mandato_fgkey1_idx` (`clientFk`), + KEY `mandato_fgkey2_idx` (`companyFk`), + KEY `mandato_fgkey3_idx` (`mandateTypeFk`), + CONSTRAINT `mandato_fgkey1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `mandato_fgkey2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `mandato_fgkey3` FOREIGN KEY (`mandateTypeFk`) REFERENCES `mandateType` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`mandate_beforeInsert` + BEFORE INSERT ON `mandate` + FOR EACH ROW +BEGIN + IF (NEW.code IS NULL) THEN + SET NEW.code=CONCAT(NEW.clientFk,'-',(SELECT AUTO_INCREMENT + FROM information_schema.TABLES + WHERE TABLE_SCHEMA='vn' and TABLE_NAME='mandate')); + 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 `mandateType` +-- + +DROP TABLE IF EXISTS `mandateType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mandateType` ( + `id` smallint(5) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `medicalCenter` +-- + +DROP TABLE IF EXISTS `medicalCenter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `medicalCenter` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `medicalReview` +-- + +DROP TABLE IF EXISTS `medicalReview`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `medicalReview` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `centerFk` int(11) NOT NULL, + `date` date DEFAULT NULL, + `time` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, + `isFit` tinyint(1) DEFAULT NULL, + `amount` double DEFAULT NULL, + `invoice` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `remark` longtext COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + KEY `frgcenter_idx` (`centerFk`), + KEY `frgnkWorker_idx` (`workerFk`), + CONSTRAINT `frgcenter` FOREIGN KEY (`centerFk`) REFERENCES `medicalCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `frgnkWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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(50) CHARACTER SET utf8 NOT NULL, + `sender` varchar(50) CHARACTER SET utf8 NOT NULL, + `recipient` varchar(50) CHARACTER SET utf8 NOT NULL, + `message` longtext CHARACTER SET utf8, + `sendDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `sender` (`sender`), + KEY `recipient` (`recipient`), + KEY `uuid` (`uuid`(8)) +) ENGINE=InnoDBDEFAULT 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(50) CHARACTER SET utf8 NOT NULL, + `sender` varchar(50) CHARACTER SET utf8 NOT NULL, + `recipient` varchar(45) CHARACTER SET utf8 NOT NULL, + `finalRecipient` varchar(50) CHARACTER SET utf8 NOT NULL, + `message` longtext CHARACTER SET utf8, + `sendDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `read` varchar(45) CHARACTER SET utf8 NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `uuid` (`uuid`(8)), + KEY `finalRecipient` (`finalRecipient`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `mistake` +-- + +DROP TABLE IF EXISTS `mistake`; +/*!50001 DROP VIEW IF EXISTS `mistake`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `mistake` ( + `revisador` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `sacador` tinyint NOT NULL, + `firstName` tinyint NOT NULL, + `lastName` tinyint NOT NULL, + `description` tinyint NOT NULL, + `created` tinyint NOT NULL, + `workerFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `mistakeRatio` +-- + +DROP TABLE IF EXISTS `mistakeRatio`; +/*!50001 DROP VIEW IF EXISTS `mistakeRatio`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `mistakeRatio` ( + `revisador` tinyint NOT NULL, + `sacador` tinyint NOT NULL, + `firstName` tinyint NOT NULL, + `lastName` tinyint NOT NULL, + `description` tinyint NOT NULL, + `created` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `saleFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `mistakeType` +-- + +DROP TABLE IF EXISTS `mistakeType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mistakeType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mobileAppVersionControl` +-- + +DROP TABLE IF EXISTS `mobileAppVersionControl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mobileAppVersionControl` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `appName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `version` varchar(45) COLLATE utf8_unicode_ci NOT NULL DEFAULT '0', + `IsVersionCritical` tinyint(1) DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla para llevar el control de las Versions de las aplicaciones móvil '; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `mrw` +-- + +DROP TABLE IF EXISTS `mrw`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mrw` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ticketFk` int(11) NOT NULL, + `counter` smallint(5) unsigned DEFAULT NULL, + `shipped` date DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `newBornSales` +-- + +DROP TABLE IF EXISTS `newBornSales`; +/*!50001 DROP VIEW IF EXISTS `newBornSales`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `newBornSales` ( + `amount` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `userFk` tinyint NOT NULL, + `dated` tinyint NOT NULL, + `firstShipped` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `newBornSales__` +-- + +DROP TABLE IF EXISTS `newBornSales__`; +/*!50001 DROP VIEW IF EXISTS `newBornSales__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `newBornSales__` ( + `amount` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `userFk` tinyint NOT NULL, + `dated` tinyint NOT NULL, + `firstShipped` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `noticeCategory` +-- + +DROP TABLE IF EXISTS `noticeCategory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `noticeCategory` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `keyName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `subject` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text COLLATE utf8_unicode_ci, + `isEnabled` tinyint(1) NOT NULL DEFAULT '1', + `requiredRole` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `keyName_UNIQUE` (`keyName`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `noticeSubscription` +-- + +DROP TABLE IF EXISTS `noticeSubscription`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `noticeSubscription` ( + `noticeCategoryFk` int(11) NOT NULL DEFAULT '0', + `userFk` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`noticeCategoryFk`,`userFk`), + KEY `noticeSubscription_ibfk_2` (`userFk`), + CONSTRAINT `noticeSubscription_ibfk_1` FOREIGN KEY (`noticeCategoryFk`) REFERENCES `noticeCategory` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `noticeSubscription_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 `observationType` +-- + +DROP TABLE IF EXISTS `observationType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `observationType` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `description` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `hasNewBornMessage` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indica aquellos que deben de recibir un mensaje advirtiendo de un cliente nuevo', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `occupationCode` +-- + +DROP TABLE IF EXISTS `occupationCode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `occupationCode` ( + `code` varchar(1) CHARACTER SET utf8 NOT NULL, + `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Código de ocupación de la seguridad social'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `orderTicket` +-- + +DROP TABLE IF EXISTS `orderTicket`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orderTicket` ( + `orderFk` int(10) unsigned NOT NULL, + `ticketFk` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ticketFk`,`orderFk`), + KEY `order_id` (`orderFk`), + CONSTRAINT `hedera_id` FOREIGN KEY (`orderFk`) REFERENCES `hedera`.`order` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `idTicketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`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 `origin` +-- + +DROP TABLE IF EXISTS `origin`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `origin` ( + `id` tinyint(2) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `warehouseFk` smallint(5) unsigned DEFAULT '4', + `flag` blob, + `nl` tinyint(4) NOT NULL DEFAULT '0', + `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `Abreviatura` (`code`), + KEY `warehouse_id` (`warehouseFk`), + KEY `Id_Paises` (`countryFk`), + CONSTRAINT `origin_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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; + +-- +-- Table structure for table `outgoingInvoiceVat` +-- + +DROP TABLE IF EXISTS `outgoingInvoiceVat`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `outgoingInvoiceVat` ( + `outgoingInvoice` mediumint(8) NOT NULL, + `taxBase` decimal(12,2) DEFAULT NULL, + `equalizationTax` decimal(12,2) DEFAULT NULL, + `Vat` decimal(12,2) DEFAULT NULL, + PRIMARY KEY (`outgoingInvoice`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packageChecked` +-- + +DROP TABLE IF EXISTS `packageChecked`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packageChecked` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `entryFk_UNIQUE` (`itemFk`), + KEY `fkItem_idx` (`itemFk`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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` ( + `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `equivalentFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`packagingFk`,`equivalentFk`), + KEY `packageEquivalent_fk2_idx` (`equivalentFk`), + CONSTRAINT `packageEquivalent_fk1` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `packageEquivalent_fk2` FOREIGN KEY (`equivalentFk`) REFERENCES `packaging` (`id`) 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; + +-- +-- Table structure for table `packaging` +-- + +DROP TABLE IF EXISTS `packaging`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packaging` ( + `id` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `volume` decimal(10,2) DEFAULT '0.00', + `width` decimal(10,2) DEFAULT '0.00', + `depth` decimal(10,2) DEFAULT '0.00', + `height` decimal(10,2) DEFAULT '0.00', + `value` decimal(10,2) DEFAULT '0.00', + `isPackageReturnable` tinyint(1) NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `packagingReturnFk` int(11) DEFAULT NULL, + `lower` int(11) DEFAULT NULL, + `upload` int(11) DEFAULT NULL, + `base` decimal(10,2) DEFAULT NULL, + `itemFk` int(11) DEFAULT NULL, + `price` decimal(10,2) NOT NULL, + `isBox` tinyint(1) NOT NULL DEFAULT '0', + `cubicPackage` decimal(10,2) DEFAULT NULL, + `returnCost` decimal(10,2) NOT NULL DEFAULT '0.00', + `cmrName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `freightItemFk` int(11) DEFAULT NULL, + `hasCompressionVariations` tinyint(1) DEFAULT '0' COMMENT 'Floramondo puede servirlos no llenos del todo', + `conveyorBuildingClassFk` int(11) DEFAULT NULL, + `isTrolley` tinyint(1) NOT NULL DEFAULT '0', + `isPallet` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `packaging_fk1` (`itemFk`), + KEY `packaging_fk2_idx` (`freightItemFk`), + KEY `packaging_FK` (`conveyorBuildingClassFk`), + CONSTRAINT `packaging_FK` FOREIGN KEY (`conveyorBuildingClassFk`) REFERENCES `conveyorBuildingClass` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `packaging_fk1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE, + CONSTRAINT `packaging_fk2` FOREIGN KEY (`freightItemFk`) REFERENCES `item` (`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 */; + +-- +-- Table structure for table `packagingConfig` +-- + +DROP TABLE IF EXISTS `packagingConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packagingConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `upperGap` int(11) NOT NULL, + `previousPreparationMinimumSize` int(11) NOT NULL, + `defaultConveyorBuildingClass` int(11) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Altura mínima para preparar pedidos en preparacion previa'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packagingGifts` +-- + +DROP TABLE IF EXISTS `packagingGifts`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packagingGifts` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `photo` blob, + `started` date NOT NULL, + `ended` date NOT NULL, + `warehouseFk` smallint(5) unsigned DEFAULT NULL, + `provinceFk` smallint(5) unsigned DEFAULT NULL, + `countryFk` mediumint(8) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `PackagingGifts_FK_2` (`countryFk`), + KEY `PackagingGifts_FK` (`provinceFk`), + KEY `PackagingGifts_FK_1` (`warehouseFk`), + CONSTRAINT `PackagingGifts_FK` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`), + CONSTRAINT `PackagingGifts_FK_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`), + CONSTRAINT `PackagingGifts_FK_2` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packingSite` +-- + +DROP TABLE IF EXISTS `packingSite`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packingSite` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `code` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `hostFk` int(11) NOT NULL, + `printerFk` tinyint(3) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `packingSite_UN` (`code`), + KEY `packingSite_FK_1` (`printerFk`), + KEY `packingSite_FK` (`hostFk`), + CONSTRAINT `packingSite_FK` FOREIGN KEY (`hostFk`) REFERENCES `host` (`id`), + CONSTRAINT `packingSite_FK_1` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packingSiteLog` +-- + +DROP TABLE IF EXISTS `packingSiteLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packingSiteLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `packingSiteFk` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `hostFk` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `workerFk` int(10) unsigned NOT NULL, + `printerModelFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `typeErrorFk` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + UNIQUE KEY `packingSiteLog_UN` (`id`), + KEY `packingSiteLog_FK` (`workerFk`), + KEY `packingSiteLog_FK_4` (`typeErrorFk`), + KEY `packingSiteLog_FK_1` (`printerModelFk`), + KEY `packingSiteLog_FK_2` (`packingSiteFk`), + CONSTRAINT `packingSiteLog_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), + CONSTRAINT `packingSiteLog_FK_1` FOREIGN KEY (`printerModelFk`) REFERENCES `printerModel` (`code`) ON UPDATE CASCADE, + CONSTRAINT `packingSiteLog_FK_2` FOREIGN KEY (`packingSiteFk`) REFERENCES `packingSite` (`code`) ON UPDATE CASCADE, + CONSTRAINT `packingSiteLog_FK_4` FOREIGN KEY (`typeErrorFk`) REFERENCES `packingSiteTypeError` (`code`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `packingSiteTypeError` +-- + +DROP TABLE IF EXISTS `packingSiteTypeError`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `packingSiteTypeError` ( + `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `parking` +-- + +DROP TABLE IF EXISTS `parking`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `parking` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `column` varchar(5) CHARACTER SET utf8 DEFAULT '--', + `row` varchar(5) CHARACTER SET utf8 DEFAULT '--', + `sectorFk` int(11) NOT NULL DEFAULT '2', + `code` varchar(8) CHARACTER SET utf8 DEFAULT NULL, + `pickingOrder` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `code_UNIQUE` (`code`), + KEY `parking_fk1_idx` (`sectorFk`), + CONSTRAINT `parking_fk1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla con los parkings del altillo'; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_INSERT` + BEFORE INSERT ON `parking` + FOR EACH ROW +BEGIN + + -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`parking_BEFORE_UPDATE` + BEFORE UPDATE ON `parking` + FOR EACH ROW +BEGIN + + -- SET new.`code` = CONCAT(new.`column`,' - ',new.`row`) ; + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `payDem` +-- + +DROP TABLE IF EXISTS `payDem`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payDem` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `payDem` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `payDemDetail` +-- + +DROP TABLE IF EXISTS `payDemDetail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payDemDetail` ( + `id` tinyint(3) unsigned NOT NULL, + `detail` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`,`detail`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `payDemDetail__` +-- + +DROP TABLE IF EXISTS `payDemDetail__`; +/*!50001 DROP VIEW IF EXISTS `payDemDetail__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `payDemDetail__` ( + `id` tinyint NOT NULL, + `detail` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `payMethod` +-- + +DROP TABLE IF EXISTS `payMethod`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payMethod` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(50) CHARACTER SET utf8 DEFAULT NULL, + `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `solution` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `outstandingDebt` tinyint(3) unsigned zerofill NOT NULL DEFAULT '000', + `graceDays` int(11) unsigned NOT NULL DEFAULT '0', + `isIbanRequiredForClients` tinyint(3) DEFAULT '0', + `isIbanRequiredForSuppliers` tinyint(3) DEFAULT '0', + `isNotified` tinyint(3) NOT NULL DEFAULT '1', + `hasVerified` tinyint(1) DEFAULT '0', + `graceMonthsDisableChecked` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Deshabilita la comprobación de los datos bancarios de todos aquellos proveedores que no hayan recibido un pago en los meses especificados', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `payment` +-- + +DROP TABLE IF EXISTS `payment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `payment` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `received` date NOT NULL, + `supplierFk` int(11) NOT NULL, + `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '1', + `divisa` decimal(10,2) DEFAULT NULL, + `bankFk` int(11) NOT NULL DEFAULT '0', + `payMethodFk` tinyint(3) unsigned NOT NULL, + `bankingFees` double(6,2) unsigned NOT NULL DEFAULT '0.00', + `concept` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + `exchangeInsuranceFk` int(11) DEFAULT NULL, + `dueDated` date DEFAULT NULL, + `workerFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `empresa_id` (`companyFk`), + KEY `id_banco` (`bankFk`), + KEY `id_moneda` (`currencyFk`), + KEY `pay_met` (`payMethodFk`), + KEY `fk_pago_pago_sdc1_idx` (`exchangeInsuranceFk`), + KEY `pagoDueDatedIdx` (`dueDated`), + KEY `pago_ibfk_3` (`supplierFk`), + KEY `payment_FK` (`workerFk`), + CONSTRAINT `pago_ibfk_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pago_moneda_1` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pago_pay_met` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, + CONSTRAINT `payment_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`), + CONSTRAINT `payment_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `payment_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = 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 ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `payment_beforeInsert` BEFORE INSERT ON `payment` FOR EACH ROW +BEGIN + DECLARE cuenta_banco,cuenta_proveedor DOUBLE; + DECLARE vNewBookEntry INT; + DECLARE bolCASH BOOLEAN; + DECLARE isSupplierActive BOOLEAN; + + -- PAK 10/02/15 No se asientan los pagos directamente, salvo en el caso de las cajas de CASH + SELECT (at2.code = 'cash') INTO bolCASH + FROM vn.bank b + JOIN vn.accountingType at2 ON at2.id = b.cash + WHERE b.id = NEW.bankFk; + + IF bolCASH THEN + + SELECT account INTO cuenta_banco + FROM bank + WHERE id = NEW.bankFk; + + SELECT account INTO cuenta_proveedor + FROM supplier + WHERE id = NEW.supplierFk; + + CALL vn.ledger_next(vNewBookEntry); + + INSERT INTO XDiario ( ASIEN, + FECHA, + SUBCTA, + CONTRA, + CONCEPTO, + EURODEBE, + EUROHABER, + empresa_id) + SELECT vNewBookEntry, + NEW.received, + SUBCTA, + CONTRA, + NEW.concept, + EURODEBE, + EUROHABER, + NEW.companyFk + FROM ( SELECT cuenta_banco SUBCTA, + cuenta_proveedor CONTRA, + 0 EURODEBE, + NEW.amount + NEW.bankingFees EUROHABER + UNION ALL + SELECT cuenta_proveedor SUBCTA, + cuenta_banco CONTRA, + NEW.amount EURODEBE, + 0 EUROHABER) gf; + + IF NEW.bankingFees <> 0 THEN + INSERT INTO XDiario ( ASIEN, + FECHA, + SUBCTA, + CONTRA, + CONCEPTO, + EURODEBE, + EUROHABER, + empresa_id) + SELECT vNewBookEntry, + NEW.received, + IF(c.id = 1,6260000002, + IF(CEE = 1,6260000003,6260000004)), + cuenta_banco, + NEW.concept, + NEW.bankingFees, + 0, + NEW.companyFk + FROM supplier s + JOIN country c ON s.countryFk = c.id + WHERE s.id = NEW.supplierFk; + END IF; + END IF; + + SET NEW.dueDated = IFNULL(NEW.dueDated, NEW.received); + + SELECT isActive INTO isSupplierActive + FROM supplier + WHERE id = NEW.supplierFk; + + IF isSupplierActive = FALSE THEN + CALL util.throw('SUPPLIER_INACTIVE'); + END IF; + + IF ISNULL(NEW.workerFk) THEN + SET NEW.workerFk = account.myUser_getId(); + END IF; + + END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`payment_afterInsert` + AFTER INSERT ON `payment` + FOR EACH ROW +BEGIN + DECLARE vIsPayMethodChecked BOOLEAN; + DECLARE vEmail VARCHAR(150); + + SELECT isPayMethodChecked INTO vIsPayMethodChecked + FROM supplier + WHERE id = NEW.supplierFk; + + + IF vIsPayMethodChecked = FALSE THEN + + SELECT notificationEmail INTO vEmail + FROM department + WHERE name = 'FINANZAS'; + + CALL mail_insert( + vEmail, + NULL, + 'Pago con método sin verificar', + CONCAT( + 'Se ha realizado el pago ', + NEW.id, + ' al proveedor ', + NEW.supplierFk, + ' con el método de pago sin verificar.' + ) + ); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER payment_beforeUpdate BEFORE UPDATE ON payment FOR EACH ROW +BEGIN + IF ISNULL(NEW.workerFk) THEN + SET NEW.workerFk = account.myUser_getId(); + 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 */ ; + +-- +-- 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, + `dueDated` tinyint NOT NULL, + `supplierFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `currencyFk` tinyint NOT NULL, + `divisa` tinyint NOT NULL, + `bankFk` tinyint NOT NULL, + `payMethodFk` tinyint NOT NULL, + `companyFk` tinyint NOT NULL, + `exchangeInsuranceFk` tinyint NOT NULL, + `isConciliated` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `pcs` +-- + +DROP TABLE IF EXISTS `pcs`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pcs` ( + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `routeFk` int(10) unsigned DEFAULT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `pallet` int(11) DEFAULT NULL, + `box` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `pcs_graf` +-- + +DROP TABLE IF EXISTS `pcs_graf`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pcs_graf` ( + `id` int(11) NOT NULL DEFAULT '0', + `dia` date DEFAULT NULL, + `created` datetime DEFAULT NULL, + `box` decimal(4,0) DEFAULT NULL, + `pallet` decimal(2,0) DEFAULT NULL, + `routeFk` int(10) unsigned DEFAULT NULL, + `hh` int(11) DEFAULT NULL, + `mm` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `pcs_graf_index1` (`hh`), + KEY `pcs_graf_index2` (`mm`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `pedidosInternos` +-- + +DROP TABLE IF EXISTS `pedidosInternos`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pedidosInternos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `idArticle` int(11) DEFAULT NULL, + `quantity` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `periodicityType` +-- + +DROP TABLE IF EXISTS `periodicityType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `periodicityType` ( + `code` varchar(45) CHARACTER SET utf8 NOT NULL, + `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 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(10) unsigned DEFAULT NULL, + `isDisable` tinyint(1) NOT NULL DEFAULT '0', + `isFreelance` tinyint(1) NOT NULL DEFAULT '0', + `isSsDiscounted` tinyint(1) NOT NULL DEFAULT '0', + `nickname` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `p2` longtext COLLATE utf8_unicode_ci, + `sex` enum('M','F') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'F' COMMENT 'M Masculino F Femenino', + PRIMARY KEY (`id`), + UNIQUE KEY `nif` (`fi`), + UNIQUE KEY `person_UN` (`readerId`), + KEY `nifIndex` (`fi`), + KEY `workerFk_idx` (`workerFk`), + CONSTRAINT `Person_ibfk_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `personMedia` +-- + +DROP TABLE IF EXISTS `personMedia`; +/*!50001 DROP VIEW IF EXISTS `personMedia`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `personMedia` ( + `workerFk` tinyint NOT NULL, + `mediaValue` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `pgc` +-- + +DROP TABLE IF EXISTS `pgc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pgc` ( + `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `rate` decimal(10,2) NOT NULL, + `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `cplusTaxBreakFk` int(10) unsigned DEFAULT '1', + `mod340` tinyint(1) NOT NULL DEFAULT '0', + `mod347` tinyint(1) NOT NULL DEFAULT '0', + `cplusTrascendency477Fk` int(10) unsigned DEFAULT '1', + `isEqualizated` tinyint(1) DEFAULT '0', + PRIMARY KEY (`code`), + KEY `pgc_fk1_idx` (`cplusTaxBreakFk`), + KEY `pgc_fk2_idx` (`cplusTrascendency477Fk`), + CONSTRAINT `pgc_fk1` FOREIGN KEY (`cplusTaxBreakFk`) REFERENCES `cplusTaxBreak` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pgc_fk2` FOREIGN KEY (`cplusTrascendency477Fk`) REFERENCES `cplusTrascendency477` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Plan General Contable'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `pgcEqu` +-- + +DROP TABLE IF EXISTS `pgcEqu`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pgcEqu` ( + `vatFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Cuenta de IVA', + `equFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Cuenta de recargo de equivalencia', + PRIMARY KEY (`vatFk`,`equFk`), + KEY `pgcEqu_fk2_idx` (`equFk`), + CONSTRAINT `pgcEqu_fk1` FOREIGN KEY (`vatFk`) REFERENCES `pgc` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `pgcEqu_fk2` FOREIGN KEY (`equFk`) REFERENCES `pgc` (`code`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge las cuentas contables con recargo de equivalencia e identifica a la que corresponde al iva y la que corresponde al recargo'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `pgcMaster` +-- + +DROP TABLE IF EXISTS `pgcMaster`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pgcMaster` ( + `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='tan solo tiene las cuentas de contaplus'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `plantpassport` +-- + +DROP TABLE IF EXISTS `plantpassport`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `plantpassport` ( + `producerFk` mediumint(3) unsigned NOT NULL, + `plantpassportAuthorityFk` mediumint(3) unsigned NOT NULL, + `number` varchar(25) CHARACTER SET utf8 DEFAULT NULL, + `isRequested` tinyint(2) NOT NULL DEFAULT '0', + PRIMARY KEY (`producerFk`,`plantpassportAuthorityFk`), + KEY `plantpassport_authority_idx` (`plantpassportAuthorityFk`), + KEY `producer_id_idx` (`producerFk`), + CONSTRAINT `plantpassport_authority` FOREIGN KEY (`plantpassportAuthorityFk`) REFERENCES `plantpassportAuthority` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `producer` FOREIGN KEY (`producerFk`) REFERENCES `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 */; + +-- +-- Table structure for table `plantpassportAuthority` +-- + +DROP TABLE IF EXISTS `plantpassportAuthority`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `plantpassportAuthority` ( + `id` mediumint(3) unsigned NOT NULL, + `denomination` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `countryFk` mediumint(8) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `denomination_UNIQUE` (`denomination`), + KEY `Pais_id_idx` (`countryFk`), + CONSTRAINT `Pais_id` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='entidades certificadoras'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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` varchar(30) 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 */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_beforeInsert` + BEFORE INSERT ON `postCode` + FOR EACH ROW +BEGIN + SET NEW.geoFk = zoneGeo_new('postCode', NEW.`code`, + (SELECT geoFk FROM town WHERE id = NEW.townFk)); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_beforeUpdate` + BEFORE UPDATE ON `postCode` + FOR EACH ROW +BEGIN + -- IF !(OLD.geoFk <=> NEW.geoFk) THEN + -- CALL zoneGeo_throwNotEditable; + -- END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_afterUpdate` + AFTER UPDATE ON `postCode` + FOR EACH ROW +BEGIN + IF !(OLD.townFk <=> NEW.townFk) THEN + CALL zoneGeo_setParent(NEW.geoFk, + (SELECT geoFk FROM town WHERE id = NEW.townFk)); + END IF; + + IF !(OLD.`code` <=> NEW.`code`) THEN + UPDATE zoneGeo SET `name` = NEW.`code` + WHERE id = NEW.geoFk; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`postCode_afterDelete` + AFTER DELETE ON `postCode` + FOR EACH ROW +BEGIN + CALL zoneGeo_delete(OLD.geoFk); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `ppe` +-- + +DROP TABLE IF EXISTS `ppe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ppe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `amortization` decimal(10,2) NOT NULL DEFAULT '0.00', + `firstAmortizated` date DEFAULT NULL, + `lastAmortizated` date DEFAULT NULL, + `finished` date DEFAULT NULL, + `value` decimal(10,2) NOT NULL DEFAULT '0.00', + `planFk` int(11) NOT NULL, + `groupFk` int(11) DEFAULT NULL, + `account` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `endowment` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `elementAccount` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `nature` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `location` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL, + `discharged` date DEFAULT NULL, + `cause` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `photo` blob, + `isInvestmentAsset` tinyint(4) NOT NULL DEFAULT '0', + `workerFk` int(10) unsigned DEFAULT NULL, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `ppe_fk1_idx` (`workerFk`), + KEY `ppe_fk2_idx` (`planFk`), + KEY `ppe_fk3_idx` (`groupFk`), + KEY `ppe_fk4_idx` (`companyFk`), + KEY `ppe_fk5_idx` (`account`), + KEY `ppe_fk6` (`endowment`), + KEY `ppe_fk7` (`elementAccount`), + CONSTRAINT `ppe_fk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `ppe_fk2` FOREIGN KEY (`planFk`) REFERENCES `ppePlan` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ppe_fk3` FOREIGN KEY (`groupFk`) REFERENCES `ppeGroup` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `ppe_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ppe_fk5` FOREIGN KEY (`account`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE, + CONSTRAINT `ppe_fk6` FOREIGN KEY (`endowment`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE, + CONSTRAINT `ppe_fk7` FOREIGN KEY (`elementAccount`) REFERENCES `pgcMaster` (`code`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Property, plant & equipment\nInmvolizado, en español'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ppeComponent` +-- + +DROP TABLE IF EXISTS `ppeComponent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ppeComponent` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ppeFk` int(11) NOT NULL, + `invoiceInFk` mediumint(8) unsigned NOT NULL, + `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`id`), + KEY `ppeComponent_fk1_idx` (`ppeFk`), + KEY `ppeComponent_fk2_idx` (`invoiceInFk`), + CONSTRAINT `ppeComponent_fk1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ppeComponent_fk2` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ppeDMS` +-- + +DROP TABLE IF EXISTS `ppeDMS`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ppeDMS` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dmsFk` int(11) NOT NULL, + `ppeFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `ppeDMS_fk1_idx` (`dmsFk`), + KEY `ppeDMS_fk2_idx` (`ppeFk`), + CONSTRAINT `ppeDMS_fk1` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ppeDMS_fk2` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ppeGroup` +-- + +DROP TABLE IF EXISTS `ppeGroup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ppeGroup` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tipo de inmovilizado'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ppePlan` +-- + +DROP TABLE IF EXISTS `ppePlan`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ppePlan` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `rate` decimal(3,2) NOT NULL DEFAULT '1.00', + `days` int(11) NOT NULL DEFAULT '365', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Plan de amortizacion para la tabla ppe'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `priceFixed` +-- + +DROP TABLE IF EXISTS `priceFixed`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `priceFixed` ( + `itemFk` int(10) NOT NULL, + `rate0` double NOT NULL, + `rate1` double NOT NULL, + `rate2` double NOT NULL, + `rate3` double NOT NULL, + `started` date NOT NULL, + `ended` date NOT NULL, + `bonus` double NOT NULL DEFAULT '0', + `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `id` int(11) NOT NULL AUTO_INCREMENT, + `grouping` smallint(5) DEFAULT NULL, + `packing` int(11) DEFAULT NULL, + `box` tinyint(4) DEFAULT NULL, + PRIMARY KEY (`itemFk`,`started`,`ended`,`warehouseFk`), + UNIQUE KEY `price_fixed_id_UNIQUE` (`id`), + KEY `item_id` (`itemFk`), + KEY `date_start` (`started`), + KEY `date_end` (`ended`), + KEY `warehouse_id` (`warehouseFk`), + CONSTRAINT `priceFixed_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `priceFixed_ibfk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`priceFixed_beforeInsert` + BEFORE INSERT ON `priceFixed` + FOR EACH ROW +BEGIN + DECLARE vDated DATE; + IF NEW.started > NEW.ended THEN + SET vDated = NEW.started; + SET NEW.started = NEW.ended; + SET NEW.ended = vDated; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`priceFixed_beforeUpdate` + BEFORE UPDATE ON `priceFixed` + FOR EACH ROW +BEGIN + DECLARE vDated DATE; + IF NEW.started > NEW.ended THEN + SET vDated = NEW.started; + SET NEW.started = NEW.ended; + SET NEW.ended = vDated; + 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 `printServerQueue` +-- + +DROP TABLE IF EXISTS `printServerQueue`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `printServerQueue` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `printerFk` tinyint(3) unsigned DEFAULT NULL, + `priorityFk` tinyint(3) unsigned DEFAULT NULL, + `labelReportFk` tinyint(3) unsigned DEFAULT NULL, + `statusFk` tinyint(3) unsigned DEFAULT '1', + `started` datetime DEFAULT NULL, + `finished` datetime DEFAULT NULL, + `param1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `workerFk` int(11) DEFAULT NULL, + `param2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `param3` text COLLATE utf8_unicode_ci, + `error` text COLLATE utf8_unicode_ci, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `reportFk__` tinyint(3) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Id_estado` (`statusFk`), + KEY `Id_Impresora` (`printerFk`), + KEY `Id_Prioridad` (`priorityFk`), + KEY `Id_Trabajador` (`workerFk`), + KEY `printServerQueue_FK` (`labelReportFk`), + CONSTRAINT `printServerQueue_FK` FOREIGN KEY (`labelReportFk`) REFERENCES `labelReport` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `printServerQueue_ibfk_3` FOREIGN KEY (`priorityFk`) REFERENCES `queuePriority` (`id`) ON UPDATE CASCADE, + CONSTRAINT `printServerQueue_printerFk` FOREIGN KEY (`printerFk`) REFERENCES `printer` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `printServerQueue2` +-- + +DROP TABLE IF EXISTS `printServerQueue2`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `printServerQueue2` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `printerFk` tinyint(3) unsigned DEFAULT NULL, + `priorityFk` tinyint(3) unsigned DEFAULT NULL, + `reportFk` tinyint(3) unsigned DEFAULT '0', + `statusFk` tinyint(3) unsigned DEFAULT '1', + `started` datetime DEFAULT NULL, + `finished` datetime DEFAULT NULL, + `param1` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `workerFk` int(11) DEFAULT NULL, + `param2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `param3` text COLLATE utf8_unicode_ci, + `error` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + UNIQUE KEY `Id_Impresora_2` (`printerFk`,`priorityFk`,`reportFk`,`statusFk`,`param1`,`workerFk`,`param2`), + KEY `Id_estado` (`statusFk`), + KEY `Id_Impresora` (`printerFk`), + KEY `Id_Informe` (`reportFk`), + KEY `Id_Prioridad` (`priorityFk`), + KEY `Id_Trabajador` (`workerFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `printerModel` +-- + +DROP TABLE IF EXISTS `printerModel`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `printerModel` ( + `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `printer__` +-- + +DROP TABLE IF EXISTS `printer__`; +/*!50001 DROP VIEW IF EXISTS `printer__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `printer__` ( + `id` tinyint NOT NULL, + `path` tinyint NOT NULL, + `name` tinyint NOT NULL, + `reference` tinyint NOT NULL, + `isLabeler` tinyint NOT NULL, + `description` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `printingQueueCheck` +-- + +DROP TABLE IF EXISTS `printingQueueCheck`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `printingQueueCheck` ( + `lastCount` int(11) unsigned NOT NULL DEFAULT '0', + `lastCheckSum` int(11) unsigned NOT NULL DEFAULT '0', + `isAlreadyNotified` tinyint(2) NOT NULL DEFAULT '0', + PRIMARY KEY (`lastCount`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Comprueba que el servidor de impresion no esta parado'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `producer` +-- + +DROP TABLE IF EXISTS `producer`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `producer` ( + `id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `isVisible` tinyint(1) NOT NULL DEFAULT '1', + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `productionConfig` +-- + +DROP TABLE IF EXISTS `productionConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `productionConfig` ( + `isPreviousPreparationRequired` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Impide que los sacadores reciban tickets que tengan productos de prep previa', + `ticketPrintedMax` int(10) unsigned NOT NULL DEFAULT '8' COMMENT 'numero máxido de tickets por carro que se ponen en impreso al pedir colección', + `ticketTrolleyMax` int(10) unsigned NOT NULL DEFAULT '4' COMMENT 'numero máximo de tickets por carro para asignar baldas en una colección', + `rookieDays` int(11) NOT NULL DEFAULT '3' COMMENT 'dias en que se cuida con especial cuidado los pedidos de un cliente por ser nuevo o recuperado', + `notBuyingMonths` int(11) NOT NULL DEFAULT '3' COMMENT 'numero de meses que han de pasar desde su ultima compra para considerar nueva la siguiente compra', + `id` int(11) NOT NULL DEFAULT '1', + `isZoneClosedByExpeditionActivated` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'activa el procedimiento vn.zone_getClosed', + `maxNotReadyCollections` int(11) NOT NULL DEFAULT '5', + `minTicketsToCloseZone` int(11) DEFAULT '15' COMMENT 'mínimo numero de tickets que deben de tener expediciones para cerrar una zona', + `movingTicketDelRoute` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Si está activo, al cambiar la fecha de un ticket desde el F11, le quita la ruta', + `defaultZone` int(11) NOT NULL DEFAULT '697', + `defautlAgencyMode` int(11) NOT NULL DEFAULT '1328' COMMENT 'SENDING', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los parámetros que condicionan la producción'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `productionVolume` +-- + +DROP TABLE IF EXISTS `productionVolume`; +/*!50001 DROP VIEW IF EXISTS `productionVolume`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `productionVolume` ( + `hora` tinyint NOT NULL, + `minuto` tinyint NOT NULL, + `cm3` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `productionVolume_LastHour` +-- + +DROP TABLE IF EXISTS `productionVolume_LastHour`; +/*!50001 DROP VIEW IF EXISTS `productionVolume_LastHour`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `productionVolume_LastHour` ( + `m3` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `professionalCategory` +-- + +DROP TABLE IF EXISTS `professionalCategory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `professionalCategory` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `salary` decimal(10,2) DEFAULT NULL, + `salaryorSeniority` decimal(10,2) DEFAULT NULL, + `year` int(2) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `project` +-- + +DROP TABLE IF EXISTS `project`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `project` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `photo` blob, + `started` date DEFAULT NULL, + `finished` date DEFAULT NULL, + `userFk` int(11) unsigned NOT NULL, + `departmentFk` int(11) DEFAULT NULL, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `location` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `amount` decimal(15,2) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `project_FK` (`userFk`), + KEY `project_FK_1` (`departmentFk`), + KEY `project_FK_2` (`companyFk`), + CONSTRAINT `project_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `project_FK_1` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `project_FK_2` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla master de proyectos'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `projectNotes` +-- + +DROP TABLE IF EXISTS `projectNotes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `projectNotes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `txt` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `projectFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `projectNotes_FK` (`projectFk`), + KEY `projectNotes_FK_1` (`userFk`), + CONSTRAINT `projectNotes_FK` FOREIGN KEY (`projectFk`) REFERENCES `project` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `projectNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Historico de notas para project'; +/*!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 = 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 = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER projectNotes_BeforeInsert +BEFORE INSERT +ON projectNotes FOR EACH ROW +BEGIN + + IF ISNULL(NEW.userFk) THEN + + SET NEW.userFk = account.myUser_getId(); + + 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 `property` +-- + +DROP TABLE IF EXISTS `property`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `property` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(250) COLLATE utf8_unicode_ci NOT NULL, + `cadaster` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `smallholding` int(11) DEFAULT NULL, + `area` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `townFk` int(11) NOT NULL, + `registry` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `volume` int(11) DEFAULT NULL, + `book` int(11) DEFAULT NULL, + `page` int(11) DEFAULT NULL, + `farm` int(11) DEFAULT NULL, + `registration` int(11) DEFAULT NULL, + `value` int(11) DEFAULT NULL, + `propertyGroupFk` int(11) NOT NULL, + `companyFk` smallint(5) unsigned NOT NULL, + `photo` blob, + `allocation` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL, + `m2` decimal(10,2) DEFAULT NULL, + `tome` int(11) DEFAULT NULL, + `url` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL, + `protocol` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'numero de protocolo notarial de la escritura de compra venta', + PRIMARY KEY (`id`), + KEY `property_FK` (`propertyGroupFk`), + KEY `property_FK_1` (`townFk`), + KEY `property_company` (`companyFk`), + CONSTRAINT `property_FK` FOREIGN KEY (`propertyGroupFk`) REFERENCES `propertyGroup` (`id`) ON UPDATE CASCADE, + CONSTRAINT `property_FK_1` FOREIGN KEY (`townFk`) REFERENCES `town` (`id`) ON UPDATE CASCADE, + CONSTRAINT `property_company` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `propertyDms` +-- + +DROP TABLE IF EXISTS `propertyDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `propertyDms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dmsFk` int(11) NOT NULL, + `propertyFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `propertyDms_FK` (`dmsFk`), + KEY `propertyDms_FK_1` (`propertyFk`), + CONSTRAINT `propertyDms_FK` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `propertyDms_FK_1` FOREIGN KEY (`propertyFk`) REFERENCES `property` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `propertyGroup` +-- + +DROP TABLE IF EXISTS `propertyGroup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `propertyGroup` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `propertyNotes` +-- + +DROP TABLE IF EXISTS `propertyNotes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `propertyNotes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `propertyFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `note` text COLLATE utf8_unicode_ci NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `propertyNotes_FK_1` (`userFk`), + KEY `propertyNotes_FK` (`propertyFk`), + CONSTRAINT `propertyNotes_FK` FOREIGN KEY (`propertyFk`) REFERENCES `property` (`id`), + CONSTRAINT `propertyNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `province` +-- + +DROP TABLE IF EXISTS `province`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `province` ( + `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `countryFk` mediumint(8) unsigned NOT NULL, + `warehouseFk` smallint(6) unsigned DEFAULT NULL COMMENT 'warehouse responsable de las rutas', + `zoneFk` tinyint(4) DEFAULT NULL, + `geoFk` int(11) DEFAULT NULL, + `autonomyFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Paises_Id` (`countryFk`), + KEY `warehouse_Id` (`warehouseFk`), + KEY `provicne_zone_fk_idx` (`zoneFk`), + KEY `province_FK` (`autonomyFk`), + CONSTRAINT `province_FK` FOREIGN KEY (`autonomyFk`) REFERENCES `autonomy` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `province_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, + CONSTRAINT `province_zone_fk` FOREIGN KEY (`zoneFk`) REFERENCES `vn2008`.`zones` (`zone_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `warehouse_Id` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeInsert` + BEFORE INSERT ON `province` + FOR EACH ROW +BEGIN + + SET NEW.geoFk = zoneGeo_new('province', NEW.`name`, + (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); + + SET NEW.countryFk = (SELECT a.countryFk FROM vn.autonomy a WHERE a.id = NEW.autonomyFk); + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_beforeUpdate` + BEFORE UPDATE ON `province` + FOR EACH ROW +BEGIN + + IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN + + SET NEW.countryFk = (SELECT a.countryFk FROM vn.autonomy a WHERE a.id = NEW.autonomyFk); + + END IF; + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterUpdate` + AFTER UPDATE ON `province` + FOR EACH ROW +BEGIN + IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN + CALL zoneGeo_setParent(NEW.geoFk, + (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); + END IF; + + IF !(OLD.`name` <=> NEW.`name`) THEN + UPDATE zoneGeo SET `name` = NEW.`name` + WHERE id = NEW.geoFk; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterDelete` + AFTER DELETE ON `province` + FOR EACH ROW +BEGIN + CALL zoneGeo_delete(OLD.geoFk); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `punchState` +-- + +DROP TABLE IF EXISTS `punchState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `punchState` ( + `workerFk` int(11) NOT NULL, + `state` tinyint(4) DEFAULT '1', + `created` datetime DEFAULT NULL, + PRIMARY KEY (`workerFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Table for storing punches that have cars with errors'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `queuePriority` +-- + +DROP TABLE IF EXISTS `queuePriority`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `queuePriority` ( + `id` tinyint(3) unsigned NOT NULL DEFAULT '0', + `priority` varchar(50) 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 `rankBonus` +-- + +DROP TABLE IF EXISTS `rankBonus`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `rankBonus` ( + `rank` int(11) DEFAULT NULL, + `bonus` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `rankingNewBornByQuarter__` +-- + +DROP TABLE IF EXISTS `rankingNewBornByQuarter__`; +/*!50001 DROP VIEW IF EXISTS `rankingNewBornByQuarter__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `rankingNewBornByQuarter__` ( + `total` tinyint NOT NULL, + `name` tinyint NOT NULL, + `time_sec` tinyint NOT NULL, + `userFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `rankingSellingByQuarter__` +-- + +DROP TABLE IF EXISTS `rankingSellingByQuarter__`; +/*!50001 DROP VIEW IF EXISTS `rankingSellingByQuarter__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `rankingSellingByQuarter__` ( + `importe` tinyint NOT NULL, + `name` tinyint NOT NULL, + `userFk` tinyint NOT NULL, + `time_sec` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `rate` +-- + +DROP TABLE IF EXISTS `rate`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `rate` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + `rate0` double NOT NULL, + `rate1` double NOT NULL, + `rate2` double NOT NULL, + `rate3` double NOT NULL, + PRIMARY KEY (`id`), + KEY `tarifa_warehouse` (`warehouseFk`), + CONSTRAINT `tarifa_warehouse` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `rateConfig` +-- + +DROP TABLE IF EXISTS `rateConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `rateConfig` ( + `id` int(11) NOT NULL, + `rate0` int(11) DEFAULT NULL, + `rate1` int(11) DEFAULT NULL, + `rate2` int(11) DEFAULT NULL, + `rate3` 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 table structure for view `rate__` +-- + +DROP TABLE IF EXISTS `rate__`; +/*!50001 DROP VIEW IF EXISTS `rate__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `rate__` ( + `id` tinyint NOT NULL, + `dated` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL, + `rate0` tinyint NOT NULL, + `rate1` tinyint NOT NULL, + `rate2` tinyint NOT NULL, + `rate3` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `receipt` +-- + +DROP TABLE IF EXISTS `receipt`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `receipt` ( + `Id` int(11) NOT NULL AUTO_INCREMENT, + `invoiceFk` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'nombre incorrecto, renombrar a description', + `amountPaid` decimal(10,2) NOT NULL DEFAULT '0.00', + `amountUnpaid__` decimal(10,2) NOT NULL DEFAULT '0.00', + `payed` datetime DEFAULT NULL, + `workerFk` int(10) unsigned DEFAULT NULL, + `bankFk` int(11) DEFAULT '0', + `clientFk` int(11) DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `isConciliate` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + PRIMARY KEY (`Id`), + KEY `Id_Banco` (`bankFk`), + KEY `Id_Trabajador` (`workerFk`), + KEY `empresa_id` (`companyFk`), + KEY `clientDate` (`clientFk`,`payed`), + KEY `id_factura` (`invoiceFk`), + KEY `payed` (`payed`), + CONSTRAINT `receiptWorkerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `receipt_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `receipt_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, + CONSTRAINT `recibo_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeInsert` + BEFORE INSERT ON `receipt` + FOR EACH ROW +BEGIN + DECLARE vIsAutoConciliated BOOLEAN; + + IF NEW.isConciliate = FALSE THEN + SELECT isAutoConciliated INTO vIsAutoConciliated + FROM accounting a + JOIN accountingType at2 ON at2.id = a.accountingTypeFk + WHERE a.id = NEW.bankFk; + + SET NEW.isConciliate = vIsAutoConciliated; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterInsert` + AFTER INSERT ON `receipt` + FOR EACH ROW +CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid) */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeUpdate` + BEFORE UPDATE ON `receipt` + FOR EACH ROW +BEGIN + CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid); + CALL clientRisk_update(NEW.clientFk, NEW.companyFk, -NEW.amountPaid); + SET NEW.workerFk = account.myUser_getId(); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterUpdate` + AFTER UPDATE ON `receipt` + FOR EACH ROW +BEGIN + IF NEW.isConciliate = FALSE AND NEW.payed > OLD.payed THEN + CALL mail_insert( + 'finanzas@verdnatura.es', + NULL, + CONCAT('Cambios de recibos del cliente: ', NEW.clientFk), + CONCAT('Se ha cambiado el recibo: ', NEW.Id, ' de ', OLD.payed, ' a ', NEW.payed) + ); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeDelete` + BEFORE DELETE ON `receipt` + FOR EACH ROW +CALL clientRisk_update(OLD.clientFk, OLD.companyFk, OLD.amountPaid) */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `recipe` +-- + +DROP TABLE IF EXISTS `recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemFk` int(11) NOT NULL COMMENT 'bouquet al que hace referencia la receta', + `name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `size` int(10) unsigned DEFAULT NULL, + `originFk` tinyint(2) unsigned DEFAULT NULL, + `typeFk` smallint(5) unsigned DEFAULT NULL, + `longName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `quantity` int(11) NOT NULL DEFAULT '1', + `element` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `inkFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `recipe_ix_1` (`element`), + KEY `recipe_ix_2` (`itemFk`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `recipe_log` +-- + +DROP TABLE IF EXISTS `recipe_log`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `recipe_log` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `recipe_ItemFk` int(11) NOT NULL, + `element` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `selected_ItemFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `recipe_log_ix1` (`recipe_ItemFk`), + KEY `recipe_log_ix2` (`element`), + KEY `recipe_log_ix3` (`selected_ItemFk`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena las decisiones tomadas al generar recetas'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `recovery` +-- + +DROP TABLE IF EXISTS `recovery`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `recovery` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `clientFk` int(11) NOT NULL DEFAULT '0', + `started` date NOT NULL COMMENT 'Fecha a partir de la que comienza el recobro', + `finished` date DEFAULT NULL COMMENT 'Fecha en la que acaba', + `amount` double NOT NULL, + `period` tinyint(3) unsigned NOT NULL DEFAULT '7' COMMENT 'numero de dias que indica cada cuanto hare el recobro', + PRIMARY KEY (`id`), + KEY `cliente_idx` (`clientFk`), + CONSTRAINT `cliente333` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `cliente_cliente` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 */; + +-- +-- Table structure for table `referenceCurrent` +-- + +DROP TABLE IF EXISTS `referenceCurrent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `referenceCurrent` ( + `dated` date NOT NULL, + `value` decimal(10,4) NOT NULL, + `currencyFk` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`dated`,`currencyFk`), + KEY `referenceCurrent_currencyFk _idx` (`currencyFk`), + CONSTRAINT `referenceCurrent_currencyFk ` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`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 `referenceRate` +-- + +DROP TABLE IF EXISTS `referenceRate`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `referenceRate` ( + `currencyFk` tinyint(3) unsigned NOT NULL, + `dated` date NOT NULL, + `value` float unsigned NOT NULL, + PRIMARY KEY (`currencyFk`,`dated`), + KEY `date` (`dated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `referenceRateConfig` +-- + +DROP TABLE IF EXISTS `referenceRateConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `referenceRateConfig` ( + `simulatedValue` float unsigned NOT NULL DEFAULT '1.2309', + PRIMARY KEY (`simulatedValue`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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 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; + +-- +-- Table structure for table `route` +-- + +DROP TABLE IF EXISTS `route`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `route` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned DEFAULT NULL, + `created` date NOT NULL, + `vehicleFk` int(10) unsigned DEFAULT NULL, + `agencyModeFk` int(11) DEFAULT NULL, + `time` datetime DEFAULT NULL, + `isOk` tinyint(1) unsigned NOT NULL DEFAULT '0', + `kmStart` mediumint(9) NOT NULL, + `kmEnd` mediumint(9) NOT NULL, + `started` datetime NOT NULL, + `finished` datetime NOT NULL, + `gestdocFk` int(11) DEFAULT NULL, + `cost` double unsigned DEFAULT NULL, + `m3` decimal(10,1) unsigned DEFAULT NULL, + `description` text COLLATE utf8_unicode_ci, + `zoneFk` int(11) DEFAULT NULL, + `priority` int(11) NOT NULL DEFAULT '0', + `invoiceInFk` mediumint(8) unsigned DEFAULT NULL, + `beachFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `Id_Agencia` (`agencyModeFk`), + KEY `Fecha` (`created`), + KEY `gestdoc_id` (`gestdocFk`), + KEY `route_ibfk_2_idx` (`workerFk`), + KEY `fk_route_1_idx` (`zoneFk`), + KEY `asdfasdf_idx` (`invoiceInFk`), + KEY `route_idxIsOk` (`isOk`), + CONSTRAINT `fk_route_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `route_fk5` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `route_ibfk_1` FOREIGN KEY (`gestdocFk`) REFERENCES `dms` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `route_ibfk_2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `route_invoiceInFk` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_AFTER_INSERT` + AFTER INSERT ON `route` + FOR EACH ROW +BEGIN + IF NEW.kmEnd < NEW.kmStart AND NEW.kmEnd <> 0 THEN + CALL util.throw ('KmEnd menor que kmStart'); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_beforeUpdate` + BEFORE UPDATE ON `route` + FOR EACH ROW +BEGIN + IF NEW.isOk <> FALSE AND OLD.isOk = FALSE THEN + SET NEW.m3 = ( SELECT SUM(litros)/1000 + FROM vn.saleVolume s + JOIN vn.ticket t ON s.ticketFk = t.id + WHERE t.routeFk = NEW.id); + END IF; + + IF NEW.kmEnd < NEW.kmStart AND NEW.kmEnd <> 0 THEN + CALL util.throw ('KmEnd menor que kmStart'); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`route_afterUpdate` + AFTER UPDATE ON `route` + FOR EACH ROW +BEGIN + IF IFNULL(NEW.gestdocFk,0) <> IFNULL(OLD.gestdocFk,0) AND NEW.gestdocFk > 0 THEN + -- JGF 09/09/14 cuando se añade un gestdoc a una ruta, se le asigna automagicamente a todos sus Tickets + + -- Inserta el gestdoc en todos los tickets de la ruta + INSERT INTO ticketDms(ticketFk,dmsFk) + SELECT id, NEW.gestdocFk FROM ticket WHERE routeFk = NEW.id + ON DUPLICATE KEY UPDATE dmsFk = NEW.gestdocFk; + + -- Update del firmado + UPDATE ticket t + JOIN ticketDms tg ON t.id = tg.ticketFk + SET isSigned = 1 WHERE t.routeFk = 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 `routeAction` +-- + +DROP TABLE IF EXISTS `routeAction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeAction` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `price` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routeComplement` +-- + +DROP TABLE IF EXISTS `routeComplement`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeComplement` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `workerFk` int(10) unsigned NOT NULL, + `price` decimal(10,2) NOT NULL, + `routeActionFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `fgn_workerFk_idx` (`workerFk`), + KEY `fgn_routeActionFk_idx` (`routeActionFk`), + CONSTRAINT `fgn_routeActionFk` FOREIGN KEY (`routeActionFk`) REFERENCES `routeAction` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fgn_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routeConfig` +-- + +DROP TABLE IF EXISTS `routeConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeConfig` ( + `id` int(10) unsigned NOT NULL, + `kmRate` decimal(10,4) DEFAULT NULL, + `kmTruckRate` decimal(10,4) DEFAULT NULL, + `m3Distribution` decimal(10,4) DEFAULT NULL, + `m3Management` decimal(10,2) DEFAULT NULL, + `m3Palletization` decimal(10,2) DEFAULT NULL, + `load1m3` decimal(10,4) DEFAULT NULL, + `load2m3` decimal(10,4) DEFAULT NULL, + `load3m3` decimal(10,4) DEFAULT NULL, + `load4m3` decimal(10,4) DEFAULT NULL, + `load5m3` decimal(10,4) DEFAULT NULL, + `load6m3` decimal(10,4) DEFAULT NULL, + `rateHoliday` decimal(5,2) DEFAULT NULL, + `plusCategory1` decimal(5,2) DEFAULT NULL, + `plusCategory2` decimal(5,2) DEFAULT NULL, + `maxSalaryCategory1` decimal(6,2) DEFAULT NULL, + `maxSalaryCategory2` decimal(6,2) DEFAULT NULL, + `distributionM3Category1` decimal(5,2) DEFAULT NULL, + `distributionM3Category2` decimal(5,2) DEFAULT NULL, + `plusCategory1Concept` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `plusCategory2Concept` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `defaultCompanyFk` smallint(5) unsigned DEFAULT '442', + PRIMARY KEY (`id`), + KEY `routeConfig_FK` (`defaultCompanyFk`), + CONSTRAINT `routeConfig_FK` FOREIGN KEY (`defaultCompanyFk`) REFERENCES `company` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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) NOT 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, + `ready` tinyint(4) NOT NULL DEFAULT '0', + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + UNIQUE KEY `routeFk_UNIQUE` (`routeFk`), + KEY `routeGate_fk1_idx` (`gateAreaFk`) +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`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 `routeLoadWorker` +-- + +DROP TABLE IF EXISTS `routeLoadWorker`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeLoadWorker` ( + `routeFk` int(10) unsigned NOT NULL, + `workerFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`routeFk`,`workerFk`), + KEY `frmWorker_idx` (`workerFk`), + CONSTRAINT `frmRutas` FOREIGN KEY (`routeFk`) REFERENCES `route` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `frmWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`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 `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(10) unsigned NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text CHARACTER SET utf8, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `originFk` (`originFk`), + KEY `userFk` (`userFk`), + CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `route` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routeRecalc` +-- + +DROP TABLE IF EXISTS `routeRecalc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeRecalc` ( + `routeFk` int(11) NOT NULL, + PRIMARY KEY (`routeFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Queue of changed volume to recalc route volumen'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routeUserPercentage` +-- + +DROP TABLE IF EXISTS `routeUserPercentage`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routeUserPercentage` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `percentage` decimal(10,2) NOT NULL, + `dated` date NOT NULL, + PRIMARY KEY (`id`), + KEY `routeUserPercentageFk_idx` (`workerFk`), + CONSTRAINT `routeUserPercentageFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `routesMonitor` +-- + +DROP TABLE IF EXISTS `routesMonitor`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `routesMonitor` ( + `routeFk` int(10) unsigned NOT NULL, + `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `beachFk` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `ticketPacked` int(11) DEFAULT NULL, + `ticketFree` int(11) DEFAULT NULL, + `ticketProduction` int(11) DEFAULT NULL, + `packages` int(11) DEFAULT NULL, + `note` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `dated` date DEFAULT NULL, + `dockFk` int(11) DEFAULT NULL, + `m3` decimal(10,1) DEFAULT NULL, + `priority` int(11) NOT NULL DEFAULT '0', + `etd` time DEFAULT NULL, + `expeditionTruckFk` int(11) DEFAULT NULL, + `m3boxes` decimal(10,1) DEFAULT NULL, + `bufferFk` int(11) DEFAULT NULL COMMENT 'Buffer del sorter por el que se quiere sacar esa ruta', + `isPickingAllowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Los tickets de esta ruta se pueden preparar', + PRIMARY KEY (`routeFk`), + KEY `routesMonitor_FK` (`bufferFk`), + CONSTRAINT `routesMonitor_FK` FOREIGN KEY (`bufferFk`) REFERENCES `srt`.`buffer` (`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 */; + +-- +-- Table structure for table `sale` +-- + +DROP TABLE IF EXISTS `sale`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sale` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `itemFk` int(11) NOT NULL, + `ticketFk` int(11) NOT NULL, + `concept` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `quantity` decimal(10,2) NOT NULL DEFAULT '0.00', + `originalQuantity` double(9,1) DEFAULT NULL, + `price` decimal(10,2) DEFAULT '0.00', + `discount` tinyint(2) unsigned NOT NULL DEFAULT '0', + `priceFixed` decimal(10,2) NOT NULL DEFAULT '0.00', + `reserved` tinyint(1) NOT NULL DEFAULT '0', + `isPicked` tinyint(1) NOT NULL DEFAULT '0', + `isPriceFixed` tinyint(1) NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `isAdded` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `Id_Ticket` (`ticketFk`), + KEY `itemFk_ticketFk` (`itemFk`,`ticketFk`), + CONSTRAINT `movement_ticket_id` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `sale_ibfk_1` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterInsert` + AFTER INSERT ON `sale` + FOR EACH ROW +BEGIN + + IF (SELECT COUNT(*) from item i WHERE id = NEW.itemFk AND family = 'SER') THEN + CALL util.throw('Cannot insert a service item into a ticket'); + END IF; + + CALL stock.log_add('sale', NEW.id, NULL); + CALL ticket_requestRecalc(NEW.ticketFk); + + IF NEW.quantity > 0 THEN + + UPDATE vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk + JOIN vn.item i ON i.id = NEW.itemFk + AND (c.itemPackingTypeFk = i.itemPackingTypeFk + OR ISNULL(c.itemPackingTypeFk)) + SET c.saleTotalCount = c.saleTotalCount + 1; + + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.route r ON r.id = t.routeFk + WHERE r.isOk = FALSE + AND s.id = NEW.id + AND r.created >= CURDATE() + GROUP BY r.id; + END IF; + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_beforeUpdate` + BEFORE UPDATE ON `sale` + FOR EACH ROW +BEGIN +/* + IF (SELECT COUNT(*) from item i WHERE id = NEW.itemFk AND family = 'SER') THEN + CALL util.throw('Cannot insert a service item into a ticket'); + END IF; +*/ + IF NEW.discount > 100 THEN + SET NEW.discount = 0; + END IF; + + IF old.discount > 0 AND NEW.discount = 0 THEN + INSERT INTO ticketLog + SET originFk = NEW.ticketFk, userFk = account.myUser_getId(), `action` = 'insert', + description = CONCAT('Cambio de descuento del item :', ' ', new.itemFk, ' de ', old.discount ,' a 0 '); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterUpdate` + AFTER UPDATE ON `sale` + FOR EACH ROW +BEGIN + DECLARE vIsToSendMail BOOL; + DECLARE vPickedLines INT; + DECLARE vCollectionFk INT; + DECLARE vUserRole VARCHAR(255); + + IF !(NEW.id <=> OLD.id) + OR !(NEW.ticketFk <=> OLD.ticketFk) + OR !(NEW.itemFk <=> OLD.itemFk) + OR !(NEW.quantity <=> OLD.quantity) + OR !(NEW.created <=> OLD.created) + OR !(NEW.isPicked <=> OLD.isPicked) THEN + CALL stock.log_add('sale', NEW.id, OLD.id); + END IF; + + IF !(NEW.price <=> OLD.price) + OR !(NEW.ticketFk <=> OLD.ticketFk) + OR !(NEW.itemFk <=> OLD.itemFk) + OR !(NEW.quantity <=> OLD.quantity) + OR !(NEW.discount <=> OLD.discount) THEN + CALL ticket_requestRecalc(NEW.ticketFk); + CALL ticket_requestRecalc(OLD.ticketFk); + END IF; + + IF !(OLD.ticketFk <=> NEW.ticketFk) THEN + UPDATE ticketRequest SET ticketFk = NEW.ticketFk + WHERE saleFk = NEW.id; + END IF; + + SELECT account.myUser_getName() INTO vUserRole; + SELECT account.user_getMysqlRole(vUserRole) INTO vUserRole; + + IF !(OLD.quantity <=> NEW.quantity) THEN + SELECT COUNT(*) INTO vIsToSendMail + FROM vncontrol.inter i + JOIN vn.state s ON s.id = i.state_id + WHERE s.code='PACKED' + AND i.Id_Ticket = OLD.ticketFk + AND vUserRole IN ('salesPerson', 'salesBoss') + LIMIT 1; + + IF vIsToSendMail THEN + CALL vn.mail_insert('jefesventas@verdnatura.es', + 'noreply@verdnatura.es', + CONCAT('Ticket ', OLD.ticketFk ,' modificada cantidad tras encajado'), + CONCAT('Ticket ', OLD.ticketFk ,'.
', + 'Modificada la catidad de ', OLD.quantity, ' a ' , NEW.quantity, + ' del artículo ', OLD.itemFk, ' tras estado encajado del ticket.
', + 'Este email se ha generado automáticamente' ) + ); + END IF; + IF (OLD.quantity > NEW.quantity) THEN + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT NEW.id, cm.id, sc.value + FROM saleComponent sc + JOIN component cd ON cd.id = sc.componentFk + JOIN component cm ON cm.code = 'mana' + WHERE saleFk = NEW.id AND cd.code = 'lastUnitsDiscount' + ON DUPLICATE KEY UPDATE value = sc.value + VALUES(value); + + DELETE sc.* + FROM vn.saleComponent sc + JOIN component c ON c.id = sc.componentFk + WHERE saleFk = NEW.id AND c.code = 'lastUnitsDiscount'; + END IF; + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.route r ON r.id = t.routeFk + WHERE r.isOk = FALSE + AND s.id = NEW.id + AND r.created >= CURDATE() + GROUP BY r.id; + END IF; + + IF !(ABS(NEW.isPicked) <=> ABS(OLD.isPicked)) AND NEW.quantity > 0 THEN + + UPDATE vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk + SET c.salePickedCount = c.salePickedCount + IF(NEW.isPicked != 0, 1, -1); + + END IF; + + IF !(NEW.quantity <=> OLD.quantity) AND (NEW.quantity = 0 OR OLD.quantity = 0) THEN + + UPDATE vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk + SET c.saleTotalCount = c.saleTotalCount + IF(OLD.quantity = 0, 1, -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 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_BEFORE_DELETE` + BEFORE DELETE ON `sale` + FOR EACH ROW +BEGIN + IF OLD.quantity > 0 THEN + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.route r ON r.id = t.routeFk + WHERE r.isOk = FALSE + AND s.id = OLD.id + AND r.created >= CURDATE() + GROUP BY r.id; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sale_afterDelete` + AFTER DELETE ON `sale` + FOR EACH ROW +BEGIN + DECLARE vIsToSendMail BOOL; + DECLARE vUserRole VARCHAR(255); + + CALL stock.log_add('sale', NULL, OLD.id); + CALL ticket_requestRecalc(OLD.ticketFk); + + SELECT account.myUser_getName() INTO vUserRole; + SELECT account.user_getMysqlRole(vUserRole) INTO vUserRole; + + SELECT COUNT(*) INTO vIsToSendMail + FROM vncontrol.inter i + JOIN vn.state s ON s.id = i.state_id + WHERE s.code='PACKED' + AND i.Id_Ticket = OLD.ticketFk + AND vUserRole IN ('salesPerson', 'salesBoss') + LIMIT 1; + + IF vIsToSendMail THEN + CALL vn.mail_insert('jefesventas@verdnatura.es', + 'noreply@verdnatura.es', + CONCAT('Ticket ', OLD.ticketFk ,' eliminado artículo tras encajado' ), + CONCAT('Ticket ', OLD.ticketFk ,'.
', + 'Eliminado artículo ', OLD.itemFk, ' tras estado encajado del ticket.
Este email se ha generado automáticamente' ) + ); + END IF; + + IF OLD.quantity > 0 THEN + + UPDATE vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = OLD.ticketFk + JOIN vn.item i ON i.id = OLD.itemFk + AND (c.itemPackingTypeFk = i.itemPackingTypeFk + OR ISNULL(c.itemPackingTypeFk)) + SET c.saleTotalCount = c.saleTotalCount - 1, + c.salePickedCount = c.salePickedCount - ABS(OLD.isPicked); + + 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 `saleBuy` +-- + +DROP TABLE IF EXISTS `saleBuy`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleBuy` ( + `saleFk` int(11) NOT NULL, + `buyFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `workerFk` int(11) DEFAULT NULL, + PRIMARY KEY (`saleFk`), + KEY `saleBuy_FK` (`buyFk`), + CONSTRAINT `saleBuy_FK` FOREIGN KEY (`buyFk`) REFERENCES `buy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleBuy_FK_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`BEFORE_INSERT` + BEFORE INSERT ON `saleBuy` + FOR EACH ROW +BEGIN + + SET NEW.workerFk = vn.getUser(); + + END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleBuy_AI` + AFTER INSERT ON `saleBuy` + FOR EACH ROW +BEGIN +/* Activar de nuevo cuando volvamos a vender fruta y verdura + * + UPDATE vn.sale s + SET s.concept = CONCAT(s.concept, ' Lote: ', NEW.buyFk) + WHERE s.id = NEW.saleFk; +*/ +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `saleChecked` +-- + +DROP TABLE IF EXISTS `saleChecked`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleChecked` ( + `saleFk` int(11) NOT NULL, + `isChecked` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`saleFk`), + CONSTRAINT `fk_Movimientos_checked_1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`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 `saleCloned` +-- + +DROP TABLE IF EXISTS `saleCloned`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleCloned` ( + `saleClonedFk` int(11) NOT NULL, + `saleOriginalFk` int(11) NOT NULL, + PRIMARY KEY (`saleClonedFk`), + KEY `saleOriginalFk_idx` (`saleOriginalFk`), + CONSTRAINT `saleClonedFk_fk2` FOREIGN KEY (`saleClonedFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleOriginalFk_fk1` FOREIGN KEY (`saleOriginalFk`) REFERENCES `sale` (`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 `saleComponent` +-- + +DROP TABLE IF EXISTS `saleComponent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleComponent` ( + `saleFk` int(11) NOT NULL, + `componentFk` int(11) NOT NULL, + `value` double NOT NULL, + `isGreuge` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Indica si ya se ha tenido en cuenta para calcular el greuge', + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`saleFk`,`componentFk`), + KEY `fk_mov_comp_idx` (`componentFk`), + CONSTRAINT `mc_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `mc_fk2` FOREIGN KEY (`componentFk`) REFERENCES `component` (`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 `saleCost` +-- + +DROP TABLE IF EXISTS `saleCost`; +/*!50001 DROP VIEW IF EXISTS `saleCost`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleCost` ( + `itemFk` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `discount` tinyint NOT NULL, + `price` tinyint NOT NULL, + `component` tinyint NOT NULL, + `coste` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `saleGoal` +-- + +DROP TABLE IF EXISTS `saleGoal`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleGoal` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `month` int(11) DEFAULT NULL, + `year` int(11) DEFAULT NULL, + `rank` smallint(6) NOT NULL, + `walletWeightFrom` int(11) NOT NULL, + `walletWeightTo` int(11) DEFAULT NULL, + `goal` decimal(10,2) DEFAULT NULL, + `goalType` smallint(6) DEFAULT NULL COMMENT 'grado', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `saleGroup` +-- + +DROP TABLE IF EXISTS `saleGroup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleGroup` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `userFk` int(11) DEFAULT NULL, + `parkingFk` int(11) DEFAULT NULL, + `sectorFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='agrupa lineas de venta'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `saleGroupDetail` +-- + +DROP TABLE IF EXISTS `saleGroupDetail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleGroupDetail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `saleFk` int(11) NOT NULL, + `saleGroupFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `saleGroupDetail_FK` (`saleFk`), + KEY `saleGroupDetail_FK_1` (`saleGroupFk`), + CONSTRAINT `saleGroupDetail_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleGroupDetail_FK_1` FOREIGN KEY (`saleGroupFk`) REFERENCES `saleGroup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='relaciona sale y saleGroup'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `saleItemShelving__` +-- + +DROP TABLE IF EXISTS `saleItemShelving__`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleItemShelving__` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `saleFk` int(11) NOT NULL, + `itemShelvingFk` int(10) unsigned NOT NULL, + `quantity` int(11) NOT NULL DEFAULT '0', + `isPicked` tinyint(4) NOT NULL DEFAULT '0', + `ubication` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `saleItemShelving_fk1_idx` (`itemShelvingFk`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `saleMistake` +-- + +DROP TABLE IF EXISTS `saleMistake`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleMistake` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `saleFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL COMMENT 'Controlador', + `typeFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `saleMistake_fk1_idx` (`saleFk`), + KEY `saleMistake_fk2_idx` (`userFk`), + KEY `saleMistake_fk3_idx` (`typeFk`), + CONSTRAINT `saleMistake_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleMistake_fk2` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleMistake_fk3` FOREIGN KEY (`typeFk`) REFERENCES `mistakeType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `saleMistakeList` +-- + +DROP TABLE IF EXISTS `saleMistakeList`; +/*!50001 DROP VIEW IF EXISTS `saleMistakeList`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleMistakeList` ( + `saleFk` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `sacador` tinyint NOT NULL, + `created` tinyint NOT NULL, + `revisador` tinyint NOT NULL, + `description` tinyint NOT NULL, + `controlled` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `saleMistake_list__` +-- + +DROP TABLE IF EXISTS `saleMistake_list__`; +/*!50001 DROP VIEW IF EXISTS `saleMistake_list__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleMistake_list__` ( + `saleFk` tinyint NOT NULL, + `sacador` tinyint NOT NULL, + `created` tinyint NOT NULL, + `revisador` tinyint NOT NULL, + `description` tinyint NOT NULL, + `controlled` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `saleMistake_list__2` +-- + +DROP TABLE IF EXISTS `saleMistake_list__2`; +/*!50001 DROP VIEW IF EXISTS `saleMistake_list__2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleMistake_list__2` ( + `saleFk` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `sacador` tinyint NOT NULL, + `created` tinyint NOT NULL, + `revisador` tinyint NOT NULL, + `description` tinyint NOT NULL, + `controlled` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `saleParking__` +-- + +DROP TABLE IF EXISTS `saleParking__`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleParking__` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `saleFk` int(11) NOT NULL, + `parkingFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `userFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `saleParking_FK` (`saleFk`), + KEY `saleParking_FK_1` (`parkingFk`), + CONSTRAINT `saleParking_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleParking_FK_1` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='ubica las lineas de venta preparadas previamente'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `saleSaleTracking` +-- + +DROP TABLE IF EXISTS `saleSaleTracking`; +/*!50001 DROP VIEW IF EXISTS `saleSaleTracking`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleSaleTracking` ( + `saleFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `saleState` +-- + +DROP TABLE IF EXISTS `saleState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleState` ( + `saleFk` int(11) NOT NULL, + `stateFk` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`saleFk`), + KEY `saleState_fk2_idx` (`stateFk`), + CONSTRAINT `saleState_fk1` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `saleState_fk2` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='cahce para el estado de la linea'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `saleTracking` +-- + +DROP TABLE IF EXISTS `saleTracking`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `saleTracking` ( + `saleFk` int(11) NOT NULL, + `isChecked` tinyint(3) unsigned NOT NULL DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `originalQuantity` double DEFAULT NULL, + `workerFk` int(11) NOT NULL, + `actionFk` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `stateFk` tinyint(3) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `saleTracking_UN` (`saleFk`,`workerFk`,`actionFk`,`stateFk`), + KEY `Id_Movimiento` (`saleFk`), + KEY `fgnStateFk_idx` (`stateFk`), + KEY `saleTracking_idx5` (`created`), + KEY `saleTracking_fk2_idx` (`actionFk`), + CONSTRAINT `fgnStateFk` FOREIGN KEY (`stateFk`) REFERENCES `state` (`id`) ON UPDATE CASCADE, + CONSTRAINT `saleTracking_FK` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_beforeInsert` + BEFORE INSERT ON `saleTracking` + FOR EACH ROW +BEGIN + IF(NEW.stateFk = 14) THEN + SET NEW.actionFk = 3; + END IF; + + IF(NEW.stateFk = 8) THEN + SET NEW.actionFk = 4; + END IF; + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`saleTracking_After_Insert` + AFTER INSERT ON `saleTracking` + FOR EACH ROW +BEGIN + + IF NEW.isChecked THEN + + UPDATE vn.sale s + SET s.isPicked = TRUE + WHERE s.id = NEW.saleFk + AND s.isPicked = 0; + + 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 */ ; + +-- +-- Temporary table structure for view `saleValue` +-- + +DROP TABLE IF EXISTS `saleValue`; +/*!50001 DROP VIEW IF EXISTS `saleValue`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleValue` ( + `warehouse` tinyint NOT NULL, + `client` tinyint NOT NULL, + `clientTypeFk` tinyint NOT NULL, + `buyer` tinyint NOT NULL, + `itemTypeFk` tinyint NOT NULL, + `family` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `cost` tinyint NOT NULL, + `value` tinyint NOT NULL, + `year` tinyint NOT NULL, + `week` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `saleVolume` +-- + +DROP TABLE IF EXISTS `saleVolume`; +/*!50001 DROP VIEW IF EXISTS `saleVolume`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleVolume` ( + `ticketFk` tinyint NOT NULL, + `saleFk` tinyint NOT NULL, + `litros` tinyint NOT NULL, + `routeFk` tinyint NOT NULL, + `shipped` tinyint NOT NULL, + `landed` tinyint NOT NULL, + `volume` tinyint NOT NULL, + `physicalWeight` tinyint NOT NULL, + `weight` tinyint NOT NULL, + `physicalVolume` tinyint NOT NULL, + `freight` tinyint NOT NULL, + `zoneFk` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `isPicked` tinyint NOT NULL, + `eurosValue` tinyint NOT NULL, + `itemPackingTypeFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `saleVolume_Today_VNH` +-- + +DROP TABLE IF EXISTS `saleVolume_Today_VNH`; +/*!50001 DROP VIEW IF EXISTS `saleVolume_Today_VNH`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `saleVolume_Today_VNH` ( + `Cliente` tinyint NOT NULL, + `Provincia` tinyint NOT NULL, + `Pais` tinyint NOT NULL, + `volume` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `sale_freightComponent` +-- + +DROP TABLE IF EXISTS `sale_freightComponent`; +/*!50001 DROP VIEW IF EXISTS `sale_freightComponent`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `sale_freightComponent` ( + `ticketFk` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `shipped` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `salesPersonGoal` +-- + +DROP TABLE IF EXISTS `salesPersonGoal`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `salesPersonGoal` ( + `salesPersonName` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '', + `month` int(11) DEFAULT NULL, + `year` int(11) DEFAULT NULL, + `goal` int(11) DEFAULT NULL, + PRIMARY KEY (`salesPersonName`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `salesPersonSince` +-- + +DROP TABLE IF EXISTS `salesPersonSince`; +/*!50001 DROP VIEW IF EXISTS `salesPersonSince`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `salesPersonSince` ( + `workerFk` tinyint NOT NULL, + `started` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `salesPreparedLastHour` +-- + +DROP TABLE IF EXISTS `salesPreparedLastHour`; +/*!50001 DROP VIEW IF EXISTS `salesPreparedLastHour`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `salesPreparedLastHour` ( + `warehouseFk` tinyint NOT NULL, + `saleFk` tinyint NOT NULL, + `isChecked` tinyint NOT NULL, + `originalQuantity` tinyint NOT NULL, + `accion` tinyint NOT NULL, + `created` tinyint NOT NULL, + `code` tinyint NOT NULL, + `firstname` tinyint NOT NULL, + `lastName` tinyint NOT NULL, + `workerCode` tinyint NOT NULL, + `litros` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `departmentName` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `salesPreviousPreparated` +-- + +DROP TABLE IF EXISTS `salesPreviousPreparated`; +/*!50001 DROP VIEW IF EXISTS `salesPreviousPreparated`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `salesPreviousPreparated` ( + `saleFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `salesToPrePrepare__` +-- + +DROP TABLE IF EXISTS `salesToPrePrepare__`; +/*!50001 DROP VIEW IF EXISTS `salesToPrePrepare__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `salesToPrePrepare__` ( + `Id_Ticket` tinyint NOT NULL, + `Id_Movimiento` tinyint NOT NULL, + `Id_Movimiento_mark` tinyint NOT NULL, + `Id_Trabjador` tinyint NOT NULL, + `isChecked` tinyint NOT NULL, + `created` tinyint NOT NULL, + `Id_Article` tinyint NOT NULL, + `Concepte` tinyint NOT NULL, + `subName` tinyint NOT NULL, + `Cantidad` tinyint NOT NULL, + `original_quantity` tinyint NOT NULL, + `Hora` tinyint NOT NULL, + `Departure` tinyint NOT NULL, + `Minuto` tinyint NOT NULL, + `agency_id` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `province_id` tinyint NOT NULL, + `picked` tinyint NOT NULL, + `trabajador` tinyint NOT NULL, + `sectorFk` tinyint NOT NULL, + `stateFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `sample` +-- + +DROP TABLE IF EXISTS `sample`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sample` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(25) CHARACTER SET utf8 NOT NULL, + `description` varchar(105) COLLATE utf8_unicode_ci NOT NULL, + `isVisible` tinyint(1) unsigned NOT NULL DEFAULT '1', + `hasCompany` tinyint(1) unsigned NOT NULL DEFAULT '0', + `hasPreview` tinyint(1) unsigned NOT NULL DEFAULT '1', + `datepickerEnabled` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sector` +-- + +DROP TABLE IF EXISTS `sector`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sector` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', + `isPreviousPreparedByPacking` tinyint(4) NOT NULL DEFAULT '1', + `code` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `pickingPlacement` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `path` int(11) DEFAULT NULL, + `isPreviousPrepared` tinyint(1) NOT NULL DEFAULT '0', + `isPackagingArea` tinyint(1) NOT NULL DEFAULT '0', + `labelReportFk` tinyint(3) unsigned DEFAULT NULL, + `sonFk` int(11) DEFAULT NULL, + `isMain` tinyint(1) NOT NULL DEFAULT '0', + `itemPackingTypeFk` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `workerFk` int(11) DEFAULT NULL, + `labelReport__` tinyint(3) DEFAULT NULL, + `printerFk` tinyint(3) unsigned DEFAULT NULL, + `isHideForPickers` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'sector a ocultar a los sacadores', + `isReserve` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Sectores de reserva, como Albenfruit o Fuentes', + PRIMARY KEY (`id`,`warehouseFk`), + UNIQUE KEY `code_UNIQUE` (`code`), + KEY `sector_fk1_idx` (`warehouseFk`), + KEY `sector_labelReport` (`labelReportFk`), + CONSTRAINT `sector_fk1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `sector_labelReport` FOREIGN KEY (`labelReportFk`) REFERENCES `labelReport` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sectorCollection` +-- + +DROP TABLE IF EXISTS `sectorCollection`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sectorCollection` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `userFk` int(10) unsigned NOT NULL, + `sectorFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `sectorCollection_FK` (`userFk`), + KEY `sectorCollection_FK_2` (`sectorFk`), + CONSTRAINT `sectorCollection_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `sectorCollection_FK_1` FOREIGN KEY (`sectorFk`) REFERENCES `sector` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Las lineas de preparacion de pedidos por sectores se agrupan bajo el identificador de esta tabla'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sectorCollectionSaleGroup` +-- + +DROP TABLE IF EXISTS `sectorCollectionSaleGroup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sectorCollectionSaleGroup` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `sectorCollectionFk` int(11) NOT NULL, + `saleGroupFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `sectorCollectionSaleGroup_UN` (`sectorCollectionFk`,`saleGroupFk`), + KEY `sectorCollectionSaleGroup_FK_1` (`saleGroupFk`), + CONSTRAINT `sectorCollectionSaleGroup_FK` FOREIGN KEY (`sectorCollectionFk`) REFERENCES `sectorCollection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `sectorCollectionSaleGroup_FK_1` FOREIGN KEY (`saleGroupFk`) REFERENCES `saleGroup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Relaciona las lineas de venta con la coleccion del sector'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sectorProductivity` +-- + +DROP TABLE IF EXISTS `sectorProductivity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sectorProductivity` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(11) DEFAULT NULL, + `firstName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `lastName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `sector` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `ticketCount` int(11) DEFAULT NULL, + `saleCount` int(11) DEFAULT NULL, + `error` int(11) DEFAULT NULL, + `volume` decimal(10,6) DEFAULT NULL, + `hourWorked` decimal(10,2) DEFAULT NULL, + `dated` date DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sharingCart` +-- + +DROP TABLE IF EXISTS `sharingCart`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sharingCart` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `started` date NOT NULL, + `ended` date NOT NULL, + `workerSubstitute` int(10) unsigned NOT NULL, + `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`started`,`ended`,`workerSubstitute`), + KEY `Suplent` (`workerSubstitute`), + CONSTRAINT `Suplent_key` FOREIGN KEY (`workerSubstitute`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Trabajador_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeInsert` + BEFORE INSERT ON `sharingCart` + FOR EACH ROW +BEGIN + IF NEW.workerFk = NEW.workerSubstitute THEN + CALL util.throw ('worker and workerSubstitute must be different'); + ELSE + INSERT IGNORE INTO sharingCartDaily (ownerFk, substituteFk, dated) + SELECT NEW.workerFk, NEW.workerSubstitute, dated + FROM time + WHERE dated BETWEEN NEW.started AND NEW.ended; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeUpdate` + BEFORE UPDATE ON `sharingCart` + FOR EACH ROW +BEGIN + IF NEW.workerFk = NEW.workerSubstitute THEN + CALL util.throw ('worker and workerSubstitute must be different'); + ELSE + DELETE sc FROM sharingCartDaily sc + WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND + sc.ownerFk = OLD.workerFk AND + sc.substituteFk = OLD.workerSubstitute; + + INSERT IGNORE INTO sharingCartDaily (ownerFk, substituteFk, dated) + SELECT NEW.workerFk, NEW.workerSubstitute, dated + FROM time + WHERE dated BETWEEN NEW.started AND NEW.ended; + + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingCart_beforeDelete` + BEFORE DELETE ON `sharingCart` + FOR EACH ROW +BEGIN + DELETE sc FROM sharingCartDaily sc + WHERE sc.dated BETWEEN OLD.started AND OLD.ended AND + sc.ownerFk = OLD.workerFk AND + sc.substituteFk = OLD.workerSubstitute; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `sharingCartDaily` +-- + +DROP TABLE IF EXISTS `sharingCartDaily`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sharingCartDaily` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ownerFk` int(10) unsigned NOT NULL, + `substituteFk` int(10) unsigned NOT NULL, + `dated` date NOT NULL, + `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + UNIQUE KEY `sharingCartDailyWorker_idx` (`ownerFk`,`dated`), + KEY `sharingCartDailySubstitute_idx` (`substituteFk`), + CONSTRAINT `sharingCartDailySubstitute` FOREIGN KEY (`substituteFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `sharingCartDailyWorker` FOREIGN KEY (`ownerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='para calcular las comisiones de las sustituciones de los comerciales'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sharingClient` +-- + +DROP TABLE IF EXISTS `sharingClient`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sharingClient` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `started` date NOT NULL, + `ended` date NOT NULL, + `clientFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `Worker` (`workerFk`), + KEY `Client` (`clientFk`), + CONSTRAINT `Clients_key` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `Trabajadores_key` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingClient_beforeInsert` + BEFORE INSERT ON `sharingClient` + FOR EACH ROW +BEGIN + SET NEW.ended = GREATEST(CURDATE(),NEW.ended); + SET NEW.started = GREATEST(CURDATE(),NEW.started); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`sharingClient_beforeUpdate` + BEFORE UPDATE ON `sharingClient` + FOR EACH ROW +BEGIN + SET NEW.ended = GREATEST(CURDATE(),NEW.ended); + SET NEW.started = GREATEST(CURDATE(),NEW.started); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `shelving` +-- + +DROP TABLE IF EXISTS `shelving`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `shelving` ( + `code` varchar(10) CHARACTER SET utf8 NOT NULL, + `parkingFk` int(11) DEFAULT NULL, + `isPrinted` tinyint(4) NOT NULL DEFAULT '0', + `priority` int(11) NOT NULL DEFAULT '0', + `parked` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `userFk` int(10) unsigned DEFAULT NULL, + `isSpam` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'señala las matrículas con producto que se puede llevar a la reserva', + `isRecyclable` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'las matrículas marcadas como reciclables se liberan cada noche desde vn.shelving_clean para poder volver a utilizarlas', + PRIMARY KEY (`code`), + KEY `shelving_fk1_idx` (`parkingFk`), + KEY `shelving_fk2_idx` (`userFk`), + CONSTRAINT `shelving_fk1` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `shelving_fk2` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tabla usada para localizar el carro en el parking del altillo'; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_beforeInsert` + BEFORE INSERT ON `shelving` + FOR EACH ROW +BEGIN + + IF NEW.code = "" THEN + + CALL util.throw('NOT_EMPTY_CODE_ALLOWED'); + + END IF; + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`shelving_BEFORE_UPDATE` + BEFORE UPDATE ON `shelving` + FOR EACH ROW +BEGIN + + IF OLD.parkingFk != NEW.parkingFk THEN + + UPDATE item i + JOIN itemShelving ish ON ish.itemFk = i.id + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON p.id = sh.parkingFk + SET i.sectorFk = p.sectorFk + WHERE sh.`code` = OLD.`code`; + + END IF; + + IF NEW.code = "" THEN + + CALL util.throw('NOT_EMPTY_CODE_ALLOWED'); + + 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 `shelvingLog` +-- + +DROP TABLE IF EXISTS `shelvingLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `shelvingLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` varchar(10) CHARACTER SET utf8 NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text CHARACTER SET utf8, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `userFk` (`userFk`), + KEY `originFk` (`originFk`), + CONSTRAINT `shelvingLog_FK_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `shelving` (`code`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `shelvingLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `silexACL` +-- + +DROP TABLE IF EXISTS `silexACL`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `silexACL` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `module` varchar(50) NOT NULL, + `method` varchar(50) NOT NULL, + `role` varchar(20) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `module_UNIQUE` (`module`,`method`,`role`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sinister` +-- + +DROP TABLE IF EXISTS `sinister`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sinister` ( + `id` int(11) NOT NULL, + `supplierFk` int(11) NOT NULL, + `clientFk` int(11) NOT NULL, + `amount` decimal(10,2) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `insureRate` decimal(3,2) NOT NULL DEFAULT '0.75', + `isBooked` tinyint(4) NOT NULL DEFAULT '0', + `workerFk` int(10) unsigned NOT NULL, + `companyFk` smallint(5) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `sinister_fk1_idx` (`supplierFk`), + KEY `sinister_fk2_idx` (`clientFk`), + KEY `sinister_fk3_idx` (`workerFk`), + KEY `sinister_fk4_idx` (`companyFk`), + CONSTRAINT `sinister_fk1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE, + CONSTRAINT `sinister_fk2` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `sinister_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `sinister_fk4` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Impago de cliente asegurado'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `sinisterDetail` +-- + +DROP TABLE IF EXISTS `sinisterDetail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sinisterDetail` ( + `id` int(11) NOT NULL, + `sinisterFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `amountIn` decimal(10,2) DEFAULT NULL, + `amountOut` decimal(10,2) DEFAULT NULL, + `isConciliated` tinyint(1) NOT NULL DEFAULT '0', + `workerFk` int(10) unsigned NOT NULL, + `bankFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `sinisterDetail_fk1_idx` (`sinisterFk`), + KEY `sinisterDetail_fk2_idx` (`workerFk`), + KEY `sinisterDetail_fk3_idx` (`bankFk`), + CONSTRAINT `sinisterDetail_fk1` FOREIGN KEY (`sinisterFk`) REFERENCES `sinister` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `sinisterDetail_fk2` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `sinisterDetail_fk3` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`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 `smartTag` +-- + +DROP TABLE IF EXISTS `smartTag`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `smartTag` ( + `code` varchar(12) CHARACTER SET utf8 NOT NULL, + `shelvingFk` varchar(10) CHARACTER SET utf8 DEFAULT NULL, + `level` int(11) DEFAULT NULL, + PRIMARY KEY (`code`), + KEY `smartTag_shelving_fk` (`shelvingFk`), + CONSTRAINT `smartTag_shelving_fk` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) 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` +-- + +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) DEFAULT '0', + `status` varchar(255) COLLATE utf8_unicode_ci DEFAULT 'OK', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT 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, + `apiKey` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='SMS configuration parameters'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `solunionCAP` +-- + +DROP TABLE IF EXISTS `solunionCAP`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `solunionCAP` ( + `creditInsurance` int(11) NOT NULL, + `dateStart` date NOT NULL, + `dateEnd` date NOT NULL, + `dateLeaving` date DEFAULT NULL, + PRIMARY KEY (`creditInsurance`,`dateStart`), + KEY `solunionCAPdateLeavingIdx` (`dateLeaving`), + CONSTRAINT `solunionCAP` FOREIGN KEY (`creditInsurance`) REFERENCES `creditInsurance` (`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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_INSERT` + AFTER INSERT ON `solunionCAP` + FOR EACH ROW +BEGIN + UPDATE vn2008.Clientes c + JOIN creditClassification cc ON c.Id_Cliente = cc.client + JOIN creditInsurance ci ON ci.creditClassification = cc.id + SET creditInsurance = ci.credit * 2 WHERE ci.id = NEW.creditInsurance; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_AFTER_UPDATE` + AFTER UPDATE ON `solunionCAP` + FOR EACH ROW +BEGIN + IF NEW.dateLeaving IS NOT NULL THEN + UPDATE vn2008.Clientes c + JOIN creditClassification cc ON c.Id_Cliente = cc.client + JOIN creditInsurance ci ON ci.creditClassification = cc.id + SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; + ELSE + UPDATE vn2008.Clientes c + JOIN creditClassification cc ON c.Id_Cliente = cc.client + JOIN creditInsurance ci ON ci.creditClassification = cc.id + SET creditInsurance = ci.credit * 2 WHERE ci.id = OLD.creditInsurance; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`solunionCAP_BEFORE_DELETE` + BEFORE DELETE ON `solunionCAP` + FOR EACH ROW +BEGIN + UPDATE vn2008.Clientes c + JOIN creditClassification cc ON c.Id_Cliente = cc.client + JOIN creditInsurance ci ON ci.creditClassification = cc.id + SET creditInsurance = ci.credit WHERE ci.id = OLD.creditInsurance; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `sorter` +-- + +DROP TABLE IF EXISTS `sorter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `sorter` ( + `id` int(11) NOT NULL DEFAULT '0', + `created` datetime NOT NULL, + `routeFk` int(10) unsigned NOT NULL, + `ticketFk` int(10) NOT NULL, + `isBox` int(11) DEFAULT '1', + `itemFk` int(11) DEFAULT NULL, + `width` decimal(10,2) DEFAULT '0.00', + `depth` decimal(10,2) DEFAULT '0.00', + `height` decimal(10,2) DEFAULT '0.00', + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', + `weight` decimal(5,2) NOT NULL DEFAULT '0.00', + `buildingOrder` int(5) NOT NULL DEFAULT '0', + `ETD` time NOT NULL DEFAULT '23:59:00', + `palletOrder` int(5) DEFAULT NULL, + `lungGrow` int(11) DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `specialPrice` +-- + +DROP TABLE IF EXISTS `specialPrice`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `specialPrice` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `clientFk` int(11) NOT NULL DEFAULT '0', + `itemFk` int(11) NOT NULL DEFAULT '0', + `value` double NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `Id_Cliente_2` (`clientFk`,`itemFk`), + KEY `Id_Article` (`itemFk`), + KEY `Id_Cliente` (`clientFk`), + CONSTRAINT `sp_article_id` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE, + CONSTRAINT `sp_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `{01A99AF1-3D3F-4B15-AC0C-C7A834F319A3}` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `{EE4ADEF6-0AC6-401F-B7C4-D797972FC065}` FOREIGN KEY (`itemFk`) REFERENCES `item` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `specie_UN` (`name`) +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_INSERT` + BEFORE INSERT ON `specie` + FOR EACH ROW +BEGIN + SET NEW.name = LCASE(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 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`specie_BEFORE_UPDATE` + BEFORE UPDATE ON `specie` + FOR EACH ROW +BEGIN + SET NEW.name = LCASE(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 */ ; + +-- +-- Table structure for table `specieGeoInvasive` +-- + +DROP TABLE IF EXISTS `specieGeoInvasive`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `specieGeoInvasive` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `genusFk` int(11) NOT NULL, + `specieFk` int(11) NOT NULL, + `zoneGeofk` int(11) NOT NULL, + `isForbidden` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + KEY `specieGeoInvasive_FK` (`genusFk`), + KEY `specieGeoInvasive_FK_1` (`specieFk`), + KEY `specieGeoInvasive_FK_2` (`zoneGeofk`), + CONSTRAINT `specieGeoInvasive_FK` FOREIGN KEY (`genusFk`) REFERENCES `genus` (`id`) ON UPDATE CASCADE, + CONSTRAINT `specieGeoInvasive_FK_1` FOREIGN KEY (`specieFk`) REFERENCES `specie` (`id`) ON UPDATE CASCADE, + CONSTRAINT `specieGeoInvasive_FK_2` FOREIGN KEY (`zoneGeofk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Esta tabla recoge las prohibiciones de comerciar con especies invasoras de acuerdo con el Catálogo de Especies Exóticas Invasoras publicado por el Estado Español'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `starredModule` +-- + +DROP TABLE IF EXISTS `starredModule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `starredModule` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `moduleFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `position` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `starred_workerFk` (`workerFk`), + KEY `starred_moduleFk` (`moduleFk`), + CONSTRAINT `starred_moduleFk` FOREIGN KEY (`moduleFk`) REFERENCES `salix`.`module` (`code`) ON UPDATE CASCADE, + CONSTRAINT `starred_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `state` +-- + +DROP TABLE IF EXISTS `state`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `state` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + `order` tinyint(3) unsigned DEFAULT NULL, + `alertLevel` int(11) NOT NULL DEFAULT '0', + `code` varchar(45) CHARACTER SET utf8 NOT NULL, + `sectorProdPriority` tinyint(3) DEFAULT NULL, + `nextStateFk` tinyint(4) NOT NULL COMMENT 'Estado al que tiene que cambiar el ticket despues de preparacion previa', + `isPreviousPreparable` tinyint(1) NOT NULL DEFAULT '0', + `isPicked` tinyint(1) NOT NULL DEFAULT '0', + `isPreparable` tinyint(1) NOT NULL DEFAULT '0', + `semaphore` int(11) NOT NULL DEFAULT '0', + `isPrintable` tinyint(4) NOT NULL DEFAULT '0', + `isOK` tinyint(4) NOT NULL DEFAULT '0', + `graphCategory` int(11) NOT NULL DEFAULT '0', + `isNotValidated` tinyint(1) DEFAULT '0' COMMENT 'Los tienen que ser validados por un comercial para prepararse', + `classColor` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `code_UNIQUE` (`code`), + KEY `state_id3` (`semaphore`), + KEY `alertLevel` (`alertLevel`), + CONSTRAINT `state_ibfk_1` FOREIGN KEY (`alertLevel`) REFERENCES `alertLevel` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `stockBuyed` +-- + +DROP TABLE IF EXISTS `stockBuyed`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `stockBuyed` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `user` int(10) unsigned DEFAULT NULL, + `buyed` decimal(10,2) DEFAULT NULL, + `date` date DEFAULT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `reserved` decimal(10,2) DEFAULT NULL, + `requested` decimal(10,2) DEFAULT NULL, + `description` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `stockBuyed_user_idx` (`user`), + CONSTRAINT `stockBuyedUserFk` FOREIGN KEY (`user`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `stowaway` +-- + +DROP TABLE IF EXISTS `stowaway`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `stowaway` ( + `id` int(11) NOT NULL COMMENT 'ticket pequeño', + `shipFk` int(11) NOT NULL COMMENT 'ticket grande', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Tickets polizones y sus naves de embarque'; +/*!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` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `account` varchar(10) DEFAULT NULL, + `street` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `city` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `provinceFk` smallint(5) unsigned DEFAULT NULL, + `countryFk` mediumint(8) unsigned DEFAULT NULL, + `nif` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `isOfficial` tinyint(1) NOT NULL DEFAULT '1', + `isFarmer` tinyint(1) NOT NULL DEFAULT '0', + `retAccount` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `phone` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `Fax__` varchar(16) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `commission` float NOT NULL DEFAULT '0', + `nickname` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `payMethodFk` tinyint(3) unsigned NOT NULL, + `payDay` tinyint(4) unsigned DEFAULT NULL, + `payDemFk` tinyint(3) unsigned NOT NULL DEFAULT '7', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `isSerious` tinyint(1) unsigned NOT NULL DEFAULT '1', + `note` text CHARACTER SET utf8 COLLATE utf8_unicode_ci, + `postcodeFk` int(11) unsigned DEFAULT NULL, + `postCode` char(5) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, + `isActive` tinyint(4) DEFAULT '1', + `taxTypeSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipo de IVA SAGE', + `withholdingSageFk` smallint(6) DEFAULT NULL COMMENT 'Tipos de retención SAGE', + `transactionTypeSageFk` tinyint(4) DEFAULT NULL COMMENT 'Ti po de transacción SAGE', + `isTrucker` tinyint(1) NOT NULL DEFAULT '0', + `workerFk` int(10) unsigned DEFAULT NULL COMMENT 'Responsible for approving invoices', + `supplierActivityFk` varchar(45) NOT NULL DEFAULT 'flowersPlants', + `healthRegister` varchar(45) DEFAULT NULL, + `isPayMethodChecked` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Se ha validado la forma de pago', + PRIMARY KEY (`id`), + UNIQUE KEY `cuenta` (`account`), + UNIQUE KEY `NIF` (`nif`), + KEY `pais_id` (`countryFk`), + KEY `pay_met_id` (`payMethodFk`), + KEY `province_id` (`provinceFk`), + KEY `pay_dem_id` (`payDemFk`), + KEY `codpos` (`postCode`), + KEY `supplier_taxTypeFk_idx` (`taxTypeSageFk`), + KEY `supplier_withholdingFk_idx` (`withholdingSageFk`), + KEY `supplier_transactionFk_idx` (`transactionTypeSageFk`), + KEY `suppplier_supplierActivityFk` (`supplierActivityFk`), + KEY `supplier_workerFk` (`workerFk`), + CONSTRAINT `Id_Pais` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pay_dem_id` FOREIGN KEY (`payDemFk`) REFERENCES `payDem` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pay_met_id` FOREIGN KEY (`payMethodFk`) REFERENCES `payMethod` (`id`) ON UPDATE CASCADE, + CONSTRAINT `province_id` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON UPDATE CASCADE, + CONSTRAINT `supplier_taxTypeFk` FOREIGN KEY (`taxTypeSageFk`) REFERENCES `sage`.`TiposIva` (`CodigoIva`) ON UPDATE CASCADE, + CONSTRAINT `supplier_transactionFk` FOREIGN KEY (`transactionTypeSageFk`) REFERENCES `sage`.`TiposTransacciones` (`CodigoTransaccion`) ON UPDATE CASCADE, + CONSTRAINT `supplier_withholdingFk` FOREIGN KEY (`withholdingSageFk`) REFERENCES `sage`.`TiposRetencion` (`CodigoRetencion`) ON UPDATE CASCADE, + CONSTRAINT `supplier_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `suppplier_supplierActivityFk` FOREIGN KEY (`supplierActivityFk`) REFERENCES `supplierActivity` (`code`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`supplier_beforeUpdate` + BEFORE UPDATE ON `supplier` + FOR EACH ROW +BEGIN + DECLARE vHasChange BOOL DEFAULT FALSE; + DECLARE vPayMethodHasVerified BOOL; + + SELECT hasVerified INTO vPayMethodHasVerified + FROM payMethod + WHERE id = NEW.payMethodFk; + + SET vHasChange = (NEW.payDemFk <> OLD.payDemFk) OR (NEW.payDay <> OLD.payDay); + + IF vPayMethodHasVerified AND !vHasChange THEN + SET vHasChange = (NEW.payMethodFk <> OLD.payMethodFk); + END IF; + + IF vHasChange THEN + SET NEW.isPayMethodChecked = 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 */ ; + +-- +-- Table structure for table `supplierAccount` +-- + +DROP TABLE IF EXISTS `supplierAccount`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierAccount` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `supplierFk` int(11) NOT NULL, + `iban` varchar(30) CHARACTER SET utf8 DEFAULT NULL, + `office` varchar(4) CHARACTER SET utf8 DEFAULT NULL, + `DC` varchar(2) CHARACTER SET utf8 DEFAULT NULL, + `number` varchar(10) CHARACTER SET utf8 DEFAULT NULL, + `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'obsoleta(comprobar)', + `bicSufix` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT '', + `bankEntityFk` int(10) DEFAULT NULL, + `bankFk` int(11) DEFAULT NULL COMMENT 'obsoleta(comprobar)', + `beneficiary` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `fk_proveedores_proveedores_account_idx` (`supplierFk`), + KEY `fk_Proveedores_account_entity1_idx` (`bankEntityFk`), + KEY `fk_banco_prov_account_idx` (`bankFk`) +) ENGINE=InnoDBDEFAULT 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 = 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 ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER supplierAccount_afterUpdate + AFTER UPDATE ON supplierAccount + FOR EACH ROW +BEGIN + DECLARE vPayMethodHasVerified BOOL; + + SELECT pm.hasVerified INTO vPayMethodHasVerified + FROM vn.supplier s + JOIN vn.payMethod pm ON pm.id = s.payMethodFk + WHERE s.id = OLD.supplierFk; + + IF OLD.iban <> NEW.iban OR OLD.bankEntityFk <> NEW.bankEntityFk AND vPayMethodHasVerified THEN + UPDATE vn.supplier + SET isPayMethodChecked = FALSE + WHERE id = OLD.supplierFk; + 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 `supplierActivity` +-- + +DROP TABLE IF EXISTS `supplierActivity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierActivity` ( + `code` varchar(45) CHARACTER SET utf8 NOT NULL, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supplierAddress` +-- + +DROP TABLE IF EXISTS `supplierAddress`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierAddress` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `supplierFk` int(11) DEFAULT NULL, + `nickname` varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL, + `street` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `provinceFk` smallint(6) unsigned DEFAULT NULL, + `postalCode` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `city` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `phone` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `mobile` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `supplierAddress_province_fk` (`provinceFk`), + CONSTRAINT `supplierAddress_province_fk` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`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 `supplierAgencyTerm` +-- + +DROP TABLE IF EXISTS `supplierAgencyTerm`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierAgencyTerm` ( + `agencyFk` smallint(5) unsigned NOT NULL, + `supplierFk` int(11) DEFAULT NULL, + `minimumPackages` int(11) NOT NULL DEFAULT '0' COMMENT 'numero minimo de bultos', + `kmPrice` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'precio extra por km', + `packagePrice` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT 'precio extra por bulto', + `routePrice` decimal(10,2) DEFAULT NULL COMMENT 'precio fijo por ruta', + `minimumKm` int(11) NOT NULL DEFAULT '0', + `minimumM3` decimal(10,2) NOT NULL DEFAULT '0.00', + `m3Price` decimal(10,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`agencyFk`), + KEY `agencyTerm_FK_1` (`supplierFk`), + CONSTRAINT `agencyTerm_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `agencyTerm_FK_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`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 `supplierContact` +-- + +DROP TABLE IF EXISTS `supplierContact`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierContact` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `supplierFk` int(11) DEFAULT NULL, + `phone` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL, + `mobile` varchar(16) COLLATE utf8_unicode_ci DEFAULT NULL, + `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `observation` text COLLATE utf8_unicode_ci, + `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `supplier_id` (`supplierFk`), + CONSTRAINT `supplier_id` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supplierExpense` +-- + +DROP TABLE IF EXISTS `supplierExpense`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierExpense` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `supplierFk` int(11) NOT NULL, + `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT '2', + `amount` decimal(10,2) NOT NULL DEFAULT '0.00', + `description` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `dmsFk` int(11) DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `isConciliated` tinyint(1) unsigned zerofill NOT NULL DEFAULT '0', + `dueDated` date NOT NULL, + PRIMARY KEY (`id`), + KEY `empresa_id` (`companyFk`), + KEY `supplierExDated` (`dated`), + KEY `id_moneda` (`currencyFk`), + KEY `proveedor_pago` (`supplierFk`), + KEY `gestdoc_id` (`dmsFk`), + KEY `dueDatedIdx` (`dueDated`), + CONSTRAINT `gestdoc_fk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pago_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `pago_moneda` FOREIGN KEY (`currencyFk`) REFERENCES `currency` (`id`) ON UPDATE CASCADE, + CONSTRAINT `proveedor_pago` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `supplierLog` +-- + +DROP TABLE IF EXISTS `supplierLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `supplierLog` ( + `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 CHARACTER SET utf8, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `logSupplier_ibfk_1` (`originFk`), + KEY `supplierLog_ibfk_2` (`userFk`), + CONSTRAINT `supplierLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `supplier` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `supplierLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `supplierPackaging` +-- + +DROP TABLE IF EXISTS `supplierPackaging`; +/*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `supplierPackaging` ( + `supplierFk` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `longName` tinyint NOT NULL, + `supplier` tinyint NOT NULL, + `entryFk` tinyint NOT NULL, + `landed` tinyint NOT NULL, + `out` tinyint NOT NULL, + `in` tinyint NOT NULL, + `warehouse` tinyint NOT NULL, + `buyingValue` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `tablet` +-- + +DROP TABLE IF EXISTS `tablet`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tablet` ( + `uuid` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `place` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `macwifi` varchar(45) COLLATE utf8_unicode_ci DEFAULT '0', + PRIMARY KEY (`uuid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tabletDepartment` +-- + +DROP TABLE IF EXISTS `tabletDepartment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tabletDepartment` ( + `tabletFk` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `departmentFk` int(11) NOT NULL, + PRIMARY KEY (`tabletFk`,`departmentFk`), + KEY `departmentFk_idx` (`departmentFk`), + CONSTRAINT `departmentFk` FOREIGN KEY (`departmentFk`) REFERENCES `department` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `tablet_uuid` FOREIGN KEY (`tabletFk`) REFERENCES `tablet` (`uuid`) 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 `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, + `code` varchar(45) CHARACTER SET utf8 DEFAULT NULL, + `name` varchar(25) COLLATE utf8_unicode_ci NOT NULL, + `isFree` tinyint(1) NOT NULL DEFAULT '1', + `isQuantitatif` tinyint(4) NOT NULL DEFAULT '0', + `sourceTable` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `unit` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `ediTypeFk` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `overwrite` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'nombre del campo de item a sobreescribir con el valor del tag, hay que añadir el código correspondiente en item_refreshTags', + PRIMARY KEY (`id`), + UNIQUE KEY `tagNameIdx` (`name`,`ediTypeFk`), + UNIQUE KEY `tagEdiTypeFkIdx` (`ediTypeFk`), + CONSTRAINT `fgnTag` FOREIGN KEY (`ediTypeFk`) REFERENCES `edi`.`type` (`type_id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Categorias para etiquetar los productos'; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`tag_BEFORE_INSERT` + BEFORE INSERT ON `tag` + FOR EACH ROW +BEGIN + IF NEW.ediTypeFk IS NULL AND (SELECT COUNT(*) FROM tag WHERE `name` = NEW.`name`) THEN + CALL util.throw('name duplicated'); + 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 `tagAbbreviation` +-- + +DROP TABLE IF EXISTS `tagAbbreviation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tagAbbreviation` ( + `value` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `abbreviation` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`value`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!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 TABLE `tagL10n` ( + `id` tinyint NOT NULL, + `name` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `taxArea` +-- + +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) 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 */; + +-- +-- Table structure for table `taxClass` +-- + +DROP TABLE IF EXISTS `taxClass`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `taxClass` ( + `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, + `description` varchar(30) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'R', + PRIMARY KEY (`id`), + UNIQUE KEY `code_UNIQUE` (`code`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `taxClassCode` +-- + +DROP TABLE IF EXISTS `taxClassCode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `taxClassCode` ( + `taxClassFk` tinyint(3) unsigned NOT NULL, + `effectived` date NOT NULL, + `taxCodeFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`taxClassFk`,`effectived`,`taxCodeFk`), + KEY `iva_codigo_id` (`taxCodeFk`), + CONSTRAINT `taxClassCode_ibfk_1` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, + CONSTRAINT `taxClassCode_ibfk_2` FOREIGN KEY (`taxCodeFk`) REFERENCES `taxCode` (`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 `taxCode` +-- + +DROP TABLE IF EXISTS `taxCode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `taxCode` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `code` varchar(10) CHARACTER SET utf8 NOT NULL, + `taxTypeFk` tinyint(2) NOT NULL, + `rate` decimal(4,1) NOT NULL DEFAULT '0.0', + `equalizationTax` decimal(4,1) NOT NULL DEFAULT '0.0', + `type` char(1) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Solo rellenar si en el asiento ira en el DEBE', + `link` tinyint(4) unsigned 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 COMMENT 'Código de Transacción de SAGE', + `operationCode` varchar(1) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Código de operaciones de SAGE', + `taxCode` int(4) DEFAULT NULL COMMENT 'Código de IVA SAGE', + `isIntracommunity` tinyint(2) DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `taxCode_dated_IDX` (`dated`,`taxTypeFk`,`type`,`link`) USING BTREE, + KEY `iva_tipo_id` (`taxTypeFk`), + KEY `codigo` (`code`), + KEY `tipo_index` (`type`), + CONSTRAINT `taxCode_ibfk_1` FOREIGN KEY (`taxTypeFk`) REFERENCES `taxType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `taxType` +-- + +DROP TABLE IF EXISTS `taxType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `taxType` ( + `id` tinyint(2) NOT NULL AUTO_INCREMENT, + `nickname` varchar(6) COLLATE utf8_unicode_ci NOT NULL, + `isAccrued` tinyint(4) NOT NULL DEFAULT '0', + `serial` char(1) COLLATE utf8_unicode_ci DEFAULT NULL, + `TIPOOPE` varchar(1) COLLATE utf8_unicode_ci NOT NULL DEFAULT ' ' COMMENT 'respetar el nombre de la columna, se utiliza en contaplus', + `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `countryFk` mediumint(8) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `serie_id` (`serial`), + KEY `Id_Pais` (`countryFk`), + CONSTRAINT `taxType_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `temperature` +-- + +DROP TABLE IF EXISTS `temperature`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `temperature` ( + `code` varchar(10) CHARACTER SET utf8 NOT NULL, + `description` text COLLATE utf8_unicode_ci, + `name` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `thermograph` +-- + +DROP TABLE IF EXISTS `thermograph`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `thermograph` ( + `id` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `model` enum('TL30','SENSITECH','TREKVIEW1','TREKVIEW2','DISPOSABLE','TEMPMATE') 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 `ticket` +-- + +DROP TABLE IF EXISTS `ticket`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticket` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `clientFk` int(11) NOT NULL DEFAULT '0', + `warehouseFk` smallint(6) unsigned NOT NULL DEFAULT '1', + `shipped` datetime NOT NULL, + `nickname` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `notes` longtext COLLATE utf8_unicode_ci, + `refFk` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `invoiceOutFk` int(10) unsigned DEFAULT NULL COMMENT 'eliminar', + `isBooked` tinyint(1) NOT NULL DEFAULT '0', + `addressFk` int(11) NOT NULL DEFAULT '0', + `workerFk` int(11) DEFAULT NULL, + `observations` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'eliminar', + `isSigned` tinyint(1) NOT NULL DEFAULT '0', + `isLabeled` tinyint(1) NOT NULL DEFAULT '0', + `isPrinted` tinyint(1) NOT NULL DEFAULT '0', + `packages` smallint(10) unsigned DEFAULT '0', + `location` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + `hour` int(11) DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `isBlocked` tinyint(1) NOT NULL DEFAULT '1', + `solution` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL, + `routeFk` int(10) unsigned DEFAULT NULL, + `priority` tinyint(3) unsigned DEFAULT NULL, + `hasPriority` tinyint(1) unsigned NOT NULL DEFAULT '1', + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `agencyModeFk` int(11) DEFAULT NULL, + `landed` date DEFAULT NULL, + `isBoxed` tinyint(2) NOT NULL DEFAULT '0', + `isDeleted` tinyint(2) NOT NULL DEFAULT '0', + `zoneFk` int(11) DEFAULT NULL, + `collectionFk__` int(11) DEFAULT NULL, + `zonePrice` decimal(10,2) DEFAULT NULL, + `zoneBonus` decimal(10,2) DEFAULT NULL, + `totalWithVat` decimal(10,2) DEFAULT NULL COMMENT 'cache calculada del total con iva', + `totalWithoutVat` decimal(10,2) DEFAULT NULL COMMENT 'cache calculada del total sin iva', + PRIMARY KEY (`id`), + KEY `Id_Cliente` (`clientFk`), + KEY `Id_Consigna` (`addressFk`), + KEY `Id_Trabajador` (`workerFk`), + KEY `warehouse_id` (`warehouseFk`), + KEY `empresa_id` (`companyFk`), + KEY `Id_Agencia` (`agencyModeFk`), + KEY `Factura` (`refFk`), + KEY `Id_Ruta` (`routeFk`), + KEY `warehouse_date` (`warehouseFk`,`shipped`), + KEY `Fecha` (`shipped`,`clientFk`), + KEY `tickets_zone_fk_idx` (`zoneFk`), + KEY `tickets_fk11_idx` (`collectionFk__`), + CONSTRAINT `ticket_FK` FOREIGN KEY (`refFk`) REFERENCES `invoiceOut` (`ref`) ON UPDATE CASCADE, + CONSTRAINT `ticket_customer_id` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticket_ibfk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticket_ibfk_5` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticket_ibfk_6` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticket_ibfk_8` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`), + CONSTRAINT `ticket_ibfk_9` FOREIGN KEY (`routeFk`) REFERENCES `route` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `tickets_fk11` FOREIGN KEY (`collectionFk__`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `tickets_zone_fk` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterInsert` + AFTER INSERT ON `ticket` + FOR EACH ROW +BEGIN + + DECLARE vClientType VARCHAR(255); + DECLARE vStateCode VARCHAR(255); + DECLARE vTransferorFirstShipped DATE; + + -- Borrar cuando se cambie el insert ticket en la APP móvil + + SELECT typeFk INTO vClientType + FROM vn.`client` WHERE id = NEW.clientFk; + + IF vClientType = 'loses' THEN + SET vStateCode = 'DELIVERED'; + ELSE + SET vStateCode = 'FREE'; + END IF; + + INSERT INTO vncontrol.inter(Id_Ticket, state_id, Id_Trabajador) + SELECT NEW.id, id, account.myUser_getId() + FROM state + WHERE `code` = vStateCode COLLATE utf8_general_ci; + + IF YEAR(NEW.shipped) > 2000 THEN + + SELECT cnb.firstShipped INTO vTransferorFirstShipped + FROM bs.clientNewBorn cnb + JOIN `client` c ON c.transferorFk = cnb.clientFk + WHERE c.id = NEW.clientFk; + + INSERT INTO bs.clientNewBorn(clientFk, firstShipped, lastShipped) + VALUES(NEW.clientFk, IFNULL(vTransferorFirstShipped, CURDATE()), CURDATE()) + ON DUPLICATE KEY UPDATE lastShipped = 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 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeUpdate` + BEFORE UPDATE ON `ticket` + FOR EACH ROW +BEGIN + DECLARE vNewTime TIME; + + IF !(NEW.routeFk <=> OLD.routeFk) THEN + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id + FROM vn.route r + WHERE r.isOk = FALSE + AND r.id IN (OLD.routeFk,NEW.routeFk) + AND r.created >= CURDATE() + GROUP BY r.id; + call util.debugAdd(NEW.id,CONCAT(OLD.routeFk,' ',NEW.routeFk)); + END IF; + + IF !(DATE(NEW.shipped) <=> DATE(OLD.shipped)) THEN + IF YEAR(NEW.shipped) < 2000 THEN + SIGNAL SQLSTATE '46000' + SET MESSAGE_TEXT = 'Year cannot be lesser than 2000'; + END IF; + + IF YEAR(NEW.shipped) = 2000 THEN + SET NEW.isDeleted = TRUE; + END IF; + + END IF; + + IF !(NEW.isDeleted <=> OLD.isDeleted) AND NEW.isDeleted THEN + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id + FROM vn.ticket t + JOIN vn.route r ON r.id = t.routeFk + WHERE r.isOk = FALSE + AND t.id = NEW.id + AND r.created >= CURDATE() + GROUP BY r.id; + SET NEW.shipped = DATE_FORMAT(NEW.shipped, '2000-%m-%d %T'); + SET NEW.landed = DATE_FORMAT(NEW.landed, '2000-%m-%d %T'); + SET NEW.routeFk = NULL; + SET NEW.zoneFk = NULL; + END IF; + + IF NEW.routeFk AND NEW.isDeleted THEN + CALL util.throw ('This ticket is deleted'); + END IF; + + IF !(NEW.routeFk <=> OLD.routeFk) AND NEW.routeFk IS NOT NULL THEN + SELECT MAX(TIME(shipped)) INTO vNewTime + FROM vn.ticket + WHERE routeFk = NEW.routeFk + HAVING MAX(TIME(shipped)) > TIME(NEW.shipped); + + IF vNewTime THEN + SET NEW.shipped = TIMESTAMP(DATE(NEW.shipped), vNewTime); + INSERT INTO vn.ticketLog + SET originFk = NEW.id, + userFk = account.myUser_getId(), + `action` = 'update', + description = CONCAT('Cambia la hora por cambio de ruta de ', + TIME(OLD.shipped), + ' a ', + TIME(NEW.shipped)); + END IF; + INSERT IGNORE INTO zoneAgencyMode (agencyModeFk,zoneFk) + SELECT r.agencyModeFk, NEW.zoneFk FROM route r + WHERE r.id = NEW.routeFk; + + CALL vn.routeUpdateM3(NEW.routeFk); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_afterUpdate` + AFTER UPDATE ON `ticket` + FOR EACH ROW +BEGIN + + IF !(NEW.id <=> OLD.id) + OR !(NEW.warehouseFk <=> OLD.warehouseFk) + OR !(NEW.shipped <=> OLD.shipped) THEN + CALL stock.log_add('ticket', NEW.id, OLD.id); + END IF; + + IF !(NEW.clientFk <=> OLD.clientFk) + OR !(NEW.addressFk <=> OLD.addressFk) + OR !(NEW.companyFk <=> OLD.companyFk) THEN + CALL ticket_requestRecalc(NEW.id); + END IF; + + IF NEW.clientFk = 2067 AND !(NEW.clientFk <=> OLD.clientFk) THEN + -- Fallo que se insertan no se sabe como tickets en este cliente + CALL mail_insert( + 'jgallego@verdnatura.es', + 'jgallego@verdnatura.es', + 'Modificado ticket al cliente 2067', + CONCAT(account.myUserGetName(), ' ha modificado el ticket ',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 */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticket_beforeDelete` + BEFORE DELETE ON `ticket` + FOR EACH ROW +BEGIN + INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`) + SELECT r.id + FROM vn.route r + WHERE r.isOk = FALSE + AND r.id = OLD.routeFk + AND r.created >= CURDATE() + GROUP BY r.id; + + DELETE FROM sale WHERE ticketFk = OLD.id; + + DELETE FROM ticketDms WHERE ticketFk = 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 `ticketCollection` +-- + +DROP TABLE IF EXISTS `ticketCollection`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketCollection` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ticketFk` int(11) NOT NULL, + `collectionFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `level` int(11) DEFAULT NULL, + `wagon` int(11) NOT NULL DEFAULT '0', + `smartTagFk` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, + `usedShelves` int(11) DEFAULT NULL COMMENT 'número de bandejas que ocupa un ticket en el carro', + `itemCount` int(11) DEFAULT NULL COMMENT 'número de productos distintos en el pedido', + `liters` int(11) DEFAULT NULL COMMENT 'volumen del pedido en litros', + PRIMARY KEY (`id`), + UNIQUE KEY `ticketCollection_UN` (`ticketFk`,`collectionFk`), + KEY `ticketCollection_fk1_idx` (`collectionFk`), + KEY `ticketCollection_fk2_idx` (`ticketFk`), + KEY `ticketCollection_smartTagFk_IDX` (`smartTagFk`) USING BTREE, + KEY `ticketCollection_created_IDX` (`created`) USING BTREE, + CONSTRAINT `ticketCollection_fk1` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketCollection_fk2` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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`@`localhost`*/ /*!50003 TRIGGER ticketCollection_afterDelete +AFTER DELETE +ON ticketCollection FOR EACH ROW +BEGIN + + DECLARE vSalesRemaining INT; + + SELECT count(*) INTO vSalesRemaining + FROM vn.ticketCollection tc + JOIN sale s ON s.ticketFk = tc.ticketFk + WHERE collectionFk = OLD.collectionFk + AND tc.id != OLD.id; + + IF NOT vSalesRemaining THEN + + DELETE FROM vn.collection WHERE id = OLD.collectionFk; + + ELSE + + UPDATE vn.collection + SET saleTotalCount = vSalesRemaining + WHERE id = OLD.collectionFk; + + 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 `ticketConfig` +-- + +DROP TABLE IF EXISTS `ticketConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `scopeDays` tinyint(3) DEFAULT NULL, + `pickingDelay` int(11) NOT NULL DEFAULT '10' COMMENT 'minutos de cortesia desde que se crea un ticket hasta que se puede preparar', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ticketDms` +-- + +DROP TABLE IF EXISTS `ticketDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketDms` ( + `ticketFk` int(11) NOT NULL, + `dmsFk` int(11) NOT NULL, + PRIMARY KEY (`ticketFk`,`dmsFk`), + KEY `gestdoc_id` (`dmsFk`), + CONSTRAINT `ticketDms_dmsFk` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketDms_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketDms_beforeDelete` + BEFORE DELETE ON `ticketDms` + FOR EACH ROW +BEGIN + UPDATE dms + SET dmsTypeFk = (SELECT id + FROM dmsType + WHERE `code` = 'trash' + ) + WHERE id = OLD.dmsFk AND ( SELECT IF(COUNT(*) > 0, FALSE, TRUE) + FROM ticketDms + WHERE dmsFk = OLD.dmsFk + ) ; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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 `ticketDocumentation` +-- + +DROP TABLE IF EXISTS `ticketDocumentation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketDocumentation` ( + `ticketFk` int(11) NOT NULL, + PRIMARY KEY (`ticketFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Marca si se ha revisado el ticket para aportar la documentación CRM/DUA (relativa al trasporte internacional de mercancias)'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ticketDown` +-- + +DROP TABLE IF EXISTS `ticketDown`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketDown` ( + `ticketFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `selected` int(11) NOT NULL DEFAULT '0', + `collectionFk` int(11) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + KEY `created_idx` (`created`), + KEY `selected_idx` (`selected`), + KEY `ticketDown_FK` (`collectionFk`), + CONSTRAINT `ticketDown_FK` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketDown_fk1` FOREIGN KEY (`selected`) REFERENCES `ticketDown_SelectionType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Cola de impresion para los tickets que se van a solicitar al altillo'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ticketDown_SelectionType` +-- + +DROP TABLE IF EXISTS `ticketDown_SelectionType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketDown_SelectionType` ( + `id` int(11) NOT NULL, + `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `description_UNIQUE` (`description`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `ticketLabel_Source` +-- + +DROP TABLE IF EXISTS `ticketLabel_Source`; +/*!50001 DROP VIEW IF EXISTS `ticketLabel_Source`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ticketLabel_Source` ( + `level` tinyint NOT NULL, + `Id_Ticket` tinyint NOT NULL, + `Agencia` tinyint NOT NULL, + `Id_Cliente` tinyint NOT NULL, + `Notas` tinyint NOT NULL, + `Sacador` tinyint NOT NULL, + `ncarro` tinyint NOT NULL, + `horaagencia` tinyint NOT NULL, + `fecha` tinyint NOT NULL, + `urgente` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `ticketLastState` +-- + +DROP TABLE IF EXISTS `ticketLastState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketLastState` ( + `ticketFk` int(11) NOT NULL DEFAULT '0', + `ticketTrackingFk` int(11) NOT NULL, + `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`ticketFk`), + KEY `double_foreign` (`ticketFk`,`ticketTrackingFk`), + CONSTRAINT `Id_Ticket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `double_foreign` FOREIGN KEY (`ticketFk`, `ticketTrackingFk`) REFERENCES `vncontrol`.`inter` (`Id_Ticket`, `inter_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 `ticketLastUpdated` +-- + +DROP TABLE IF EXISTS `ticketLastUpdated`; +/*!50001 DROP VIEW IF EXISTS `ticketLastUpdated`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ticketLastUpdated` ( + `ticketFk` tinyint NOT NULL, + `lastUpdated` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ticketLastUpdatedList` +-- + +DROP TABLE IF EXISTS `ticketLastUpdatedList`; +/*!50001 DROP VIEW IF EXISTS `ticketLastUpdatedList`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ticketLastUpdatedList` ( + `ticketFk` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ticketLocation` +-- + +DROP TABLE IF EXISTS `ticketLocation`; +/*!50001 DROP VIEW IF EXISTS `ticketLocation`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ticketLocation` ( + `ticketFk` tinyint NOT NULL, + `longitude` tinyint NOT NULL, + `latitude` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- 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 DEFAULT NULL, + `action` set('insert','update','delete','select') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text CHARACTER SET utf8, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `logTicketoriginFk` (`originFk`), + KEY `logTicketuserFk` (`userFk`), + CONSTRAINT `ticketLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketLog_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `ticketMRW` +-- + +DROP TABLE IF EXISTS `ticketMRW`; +/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ticketMRW` ( + `id_Agencia` tinyint NOT NULL, + `empresa_id` tinyint NOT NULL, + `Consignatario` tinyint NOT NULL, + `DOMICILIO` tinyint NOT NULL, + `POBLACION` tinyint NOT NULL, + `CODPOSTAL` tinyint NOT NULL, + `telefono` tinyint NOT NULL, + `movil` tinyint NOT NULL, + `IF` tinyint NOT NULL, + `Id_Ticket` tinyint NOT NULL, + `warehouse_id` tinyint NOT NULL, + `Id_Consigna` tinyint NOT NULL, + `CodigoPais` tinyint NOT NULL, + `Fecha` tinyint NOT NULL, + `province_id` tinyint NOT NULL, + `landing` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `ticketNotInvoiced` +-- + +DROP TABLE IF EXISTS `ticketNotInvoiced`; +/*!50001 DROP VIEW IF EXISTS `ticketNotInvoiced`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ticketNotInvoiced` ( + `companyFk` tinyint NOT NULL, + `companyCode` tinyint NOT NULL, + `clientFk` tinyint NOT NULL, + `clientName` tinyint NOT NULL, + `shipped` tinyint NOT NULL, + `value` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `ticketObservation` +-- + +DROP TABLE IF EXISTS `ticketObservation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketObservation` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `ticketFk` int(11) NOT NULL, + `observationTypeFk` tinyint(3) unsigned NOT NULL, + `description` text COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `Id_Ticket` (`ticketFk`,`observationTypeFk`), + KEY `observation_type_id` (`observationTypeFk`), + CONSTRAINT `ticketObservation_ibfk_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketObservation_ibfk_2` FOREIGN KEY (`observationTypeFk`) REFERENCES `observationType` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 `ticketPackage` +-- + +DROP TABLE IF EXISTS `ticketPackage`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketPackage` ( + `ticket` int(11) NOT NULL, + `counter` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`ticket`), + CONSTRAINT `ticketPackage_ticketFk` FOREIGN KEY (`ticket`) REFERENCES `ticket` (`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 `ticketPackaging` +-- + +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 AUTO_INCREMENT, + `ticketFk` int(11) NOT NULL, + `packagingFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `quantity` int(10) DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `pvp` double DEFAULT NULL, + `workerFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `ticketPackaging_fk1_idx` (`ticketFk`), + KEY `ticketPackaging_fk2_idx` (`packagingFk`), + KEY `ticketPackaging_fk3_idx` (`workerFk`), + CONSTRAINT `ticketPackaging_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketPackaging_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticketPackaging_fk3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketPackaging_BEFORE_INSERT` + BEFORE INSERT ON `ticketPackaging` + FOR EACH ROW +BEGIN + + SET NEW.workerFk = account.myUser_getId(); + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- 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, + `isForgetable` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`clientFk`,`packagingFk`), + KEY `ticketPackagingStartingStock_fk2_idx` (`packagingFk`), + KEY `ticketPackagingStartingStock_fk3_idx` (`itemFk`), + CONSTRAINT `ticketPackagingStartingStock_fk1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketPackagingStartingStock_fk2` FOREIGN KEY (`packagingFk`) REFERENCES `packaging` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketPackagingStartingStock_fk3` FOREIGN KEY (`itemFk`) REFERENCES `item` (`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 `ticketPackingList` +-- + +DROP TABLE IF EXISTS `ticketPackingList`; +/*!50001 DROP VIEW IF EXISTS `ticketPackingList`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ticketPackingList` ( + `nickname` tinyint NOT NULL, + `ticketFk` tinyint NOT NULL, + `agencyMode` tinyint NOT NULL, + `flag` tinyint NOT NULL, + `province` tinyint NOT NULL, + `itemFk` tinyint NOT NULL, + `concept` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `litros` tinyint NOT NULL, + `observaciones` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `ticketParking` +-- + +DROP TABLE IF EXISTS `ticketParking`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketParking` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ticketFk` int(11) NOT NULL, + `parkingFk` int(11) NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `workerFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `ticketParking_idx1` (`ticketFk`,`parkingFk`), + UNIQUE KEY `ticketFk_UNIQUE` (`ticketFk`), + KEY `ticketParking_fk1_idx` (`parkingFk`), + CONSTRAINT `ticketParking_fk1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketParking_fk2` FOREIGN KEY (`parkingFk`) REFERENCES `parking` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena los distintos lugares donde puede estar aparcado cada uno de los prepedidos'; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketParking_BEFORE_INSERT` + BEFORE INSERT ON `ticketParking` + FOR EACH ROW +BEGIN + + SET NEW.workerFk = vn.getUser(); + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Temporary table structure for view `ticketPreviousPreparingList` +-- + +DROP TABLE IF EXISTS `ticketPreviousPreparingList`; +/*!50001 DROP VIEW IF EXISTS `ticketPreviousPreparingList`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `ticketPreviousPreparingList` ( + `ticketFk` tinyint NOT NULL, + `code` tinyint NOT NULL, + `saleLines` tinyint NOT NULL, + `alreadyMadeSaleLines` tinyint NOT NULL, + `madeRate` tinyint NOT NULL, + `created` tinyint NOT NULL, + `parking` tinyint NOT NULL, + `sectorFk` tinyint NOT NULL, + `alertCode` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `ticketRecalc` +-- + +DROP TABLE IF EXISTS `ticketRecalc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketRecalc` ( + `ticketFk` int(11) NOT NULL, + PRIMARY KEY (`ticketFk`), + CONSTRAINT `ticketRecalc_ibfk_1` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Queue of changed tickets to recalc its total'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ticketRefund` +-- + +DROP TABLE IF EXISTS `ticketRefund`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketRefund` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `refundTicketFk` int(11) NOT NULL, + `originalTicketFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `ticketRefund_FK` (`refundTicketFk`), + KEY `ticketRefund_FK_1` (`originalTicketFk`), + CONSTRAINT `ticketRefund_FK` FOREIGN KEY (`refundTicketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticketRefund_FK_1` FOREIGN KEY (`originalTicketFk`) REFERENCES `ticket` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRefund_beforeInsert` + BEFORE INSERT ON `ticketRefund` + FOR EACH ROW +BEGIN + DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; + + IF NEW.refundTicketFk = NEW.originalTicketFk THEN + CALL util.throw('Original ticket and refund ticket has same id'); + END IF; + + SELECT COUNT(*) INTO vAlreadyExists + FROM ticketRefund + WHERE refundTicketFk = NEW.originalTicketFk; + + IF vAlreadyExists > 0 THEN + CALL util.throw('This ticket is already a refund'); + 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`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRefund_beforeUpdate` + BEFORE UPDATE ON `ticketRefund` + FOR EACH ROW +BEGIN + DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; + + IF NEW.refundTicketFk = NEW.originalTicketFk THEN + CALL util.throw('Original ticket and refund ticket has same id'); + END IF; + + SELECT COUNT(*) INTO vAlreadyExists + FROM ticketRefund + WHERE refundTicketFk = NEW.originalTicketFk; + + IF vAlreadyExists > 0 THEN + CALL util.throw('This ticket is already a refund'); + 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 `ticketRequest` +-- + +DROP TABLE IF EXISTS `ticketRequest`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketRequest` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ordered` datetime DEFAULT NULL, + `shipped` datetime DEFAULT NULL, + `salesPersonCode` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `buyerCode` varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'NOE', + `quantity` int(11) DEFAULT NULL, + `price` double DEFAULT NULL, + `price__` double DEFAULT NULL, + `itemFk` double DEFAULT NULL, + `clientFk` int(11) DEFAULT NULL, + `response` longtext COLLATE utf8_unicode_ci, + `ok__` tinyint(1) NOT NULL DEFAULT '0', + `total` int(11) DEFAULT NULL, + `buyed` datetime DEFAULT NULL, + `ko__` tinyint(1) NOT NULL DEFAULT '0', + `saleFk` int(11) DEFAULT NULL, + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `isOk` tinyint(1) DEFAULT NULL, + `requesterFk` int(10) unsigned DEFAULT NULL, + `attenderFk` int(10) unsigned DEFAULT NULL, + `ticketFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `Id_Movimiento_UNIQUE` (`saleFk`), + KEY `Id_ARTICLE` (`itemFk`), + KEY `Id_CLIENTE` (`clientFk`), + KEY `Id_Comprador` (`buyerCode`), + KEY `Id_Movimiento` (`saleFk`), + KEY `Id_Vendedor` (`salesPersonCode`), + KEY `fgnRequester_idx` (`requesterFk`), + KEY `fgnAtender_idx` (`attenderFk`), + KEY `fgnTicket_idx` (`ticketFk`), + CONSTRAINT `fgbMovimiento` FOREIGN KEY (`saleFk`) REFERENCES `sale` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `fgnAtender` FOREIGN KEY (`attenderFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fgnRequester` FOREIGN KEY (`requesterFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE, + CONSTRAINT `fgnTicket` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_beforeInsert` + BEFORE INSERT ON `ticketRequest` + FOR EACH ROW +BEGIN + IF NEW.ticketFk IS NULL THEN + SET NEW.ticketFk = (SELECT s.ticketFk FROM sale s WHERE s.id = NEW.saleFk); + END IF; + + IF NEW.requesterFk IS NULL THEN + SET NEW.requesterFk = (SELECT w.id FROM worker w WHERE w.code = NEW.salesPersonCode); + END IF; + + IF NEW.attenderFk IS NULL THEN + SET NEW.attenderFk = (SELECT w.id FROM worker w WHERE w.code = NEW.buyerCode); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketRequest_beforeUpdate` + BEFORE UPDATE ON `ticketRequest` + FOR EACH ROW +BEGIN + IF NEW.saleFk <> OLD.saleFk THEN + SET NEW.ticketFk = (SELECT s.ticketFk FROM sale s WHERE s.id = NEW.saleFk); + END IF; + + IF NEW.salesPersonCode <> OLD.salesPersonCode THEN + SET NEW.requesterFk = (SELECT w.id FROM worker w WHERE w.code = NEW.salesPersonCode); + END IF; + + IF NEW.buyerCode <> OLD.buyerCode THEN + SET NEW.attenderFk = (SELECT w.id FROM worker w WHERE w.code = NEW.buyerCode); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketService` +-- + +DROP TABLE IF EXISTS `ticketService`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketService` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `quantity` int(11) NOT NULL DEFAULT '0', + `price` decimal(10,2) NOT NULL DEFAULT '0.00', + `taxClassFk` tinyint(3) unsigned NOT NULL DEFAULT '2', + `ticketFk` int(11) NOT NULL, + `ticketServiceTypeFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `ticketServiceIvaGroup_idx` (`taxClassFk`), + KEY `fgn_ticketFk_idx` (`ticketFk`), + KEY `ticketService_ticketServiceType_idx` (`ticketServiceTypeFk`), + CONSTRAINT `fgn_ticketFk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ticketServiceIvaGroup` FOREIGN KEY (`taxClassFk`) REFERENCES `taxClass` (`id`) ON UPDATE CASCADE, + CONSTRAINT `ticketService_ticketServiceType` FOREIGN KEY (`ticketServiceTypeFk`) REFERENCES `ticketServiceType` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Servicios asociadas a un ticket'; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ai` + AFTER INSERT ON `ticketService` + FOR EACH ROW +BEGIN + + CALL ticket_requestRecalc(NEW.ticketFk); + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_au` + AFTER UPDATE ON `ticketService` + FOR EACH ROW +BEGIN + IF !(NEW.price <=> OLD.price) + OR !(NEW.ticketFk <=> OLD.ticketFk) + OR !(NEW.quantity <=> OLD.quantity) THEN + CALL ticket_requestRecalc(NEW.ticketFk); + CALL ticket_requestRecalc(OLD.ticketFk); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`ticketService_ad` + AFTER DELETE ON `ticketService` + FOR EACH ROW +BEGIN + + CALL ticket_requestRecalc(OLD.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 */ ; + +-- +-- Table structure for table `ticketServiceType` +-- + +DROP TABLE IF EXISTS `ticketServiceType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketServiceType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `expenceFk` varchar(10) NOT NULL DEFAULT '7050000000', + PRIMARY KEY (`id`), + KEY `ticketServiceType_expenceFk` (`expenceFk`), + CONSTRAINT `ticketServiceType_expenceFk` FOREIGN KEY (`expenceFk`) REFERENCES `expence` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COMMENT='Lista de los posibles servicios a elegir'; +/*!40101 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` ( + `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, + `isPreviousPreparable` tinyint NOT NULL, + `isPicked` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- 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 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, + `updated` tinyint NOT NULL, + `isPicked` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- 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 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; + +-- +-- Table structure for table `ticketTrolley` +-- + +DROP TABLE IF EXISTS `ticketTrolley`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketTrolley` ( + `ticket` int(11) NOT NULL, + `labelCount` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`ticket`), + CONSTRAINT `fk_ticketTrolley_vs_ticket` FOREIGN KEY (`ticket`) REFERENCES `ticket` (`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 `ticketUpdateAction` +-- + +DROP TABLE IF EXISTS `ticketUpdateAction`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketUpdateAction` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT 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 */; + +-- +-- Table structure for table `ticketWeekly` +-- + +DROP TABLE IF EXISTS `ticketWeekly`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ticketWeekly` ( + `ticketFk` int(11) NOT NULL AUTO_INCREMENT, + `weekDay` tinyint(1) NOT NULL COMMENT 'funcion de mysql Lunes = 0, Domingo = 6\nShipped, dia de preparacion del pedido', + `agencyModeFk` int(11) DEFAULT NULL, + PRIMARY KEY (`ticketFk`), + KEY `agencyModeFk_idx` (`agencyModeFk`), + CONSTRAINT `Id_Ticket_fk` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `agencyModeFk` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `till` +-- + +DROP TABLE IF EXISTS `till`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `till` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `isAccountable` tinyint(1) NOT NULL DEFAULT '0', + `serie` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL, + `number` int(11) DEFAULT NULL, + `concept` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `in` decimal(10,2) DEFAULT NULL, + `out` decimal(10,2) DEFAULT NULL, + `bankFk` int(11) DEFAULT '1', + `workerFk` int(10) unsigned DEFAULT NULL, + `companyFk` smallint(5) unsigned DEFAULT '442' COMMENT 'kakear', + `isLinked` tinyint(4) DEFAULT '0', + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `isOk` tinyint(4) NOT NULL DEFAULT '0', + `warehouseFk` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'to kak\\n', + `isConciliate` tinyint(4) NOT NULL DEFAULT '0', + `supplierAccountFk` mediumint(8) unsigned NOT NULL, + `calculatedCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `InForeignValue` decimal(10,2) DEFAULT NULL, + `OutForeignValue` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `id_calculated_UNIQUE` (`calculatedCode`), + KEY `CajasCajafecha` (`dated`), + KEY `Id_Banco` (`bankFk`), + KEY `Id_Trabajador` (`workerFk`), + KEY `empresa_id` (`companyFk`), + KEY `warehouse_id` (`warehouseFk`), + KEY `fk_Cajas_Proveedores_account1_idx` (`supplierAccountFk`), + CONSTRAINT `till_ibfk_2` FOREIGN KEY (`bankFk`) REFERENCES `accounting` (`id`) ON UPDATE CASCADE, + CONSTRAINT `till_ibfk_3` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`till_beforeInsert` + BEFORE INSERT ON `till` + FOR EACH ROW +BEGIN + IF IFNULL(NEW.concept,"") = "" THEN + CALL util.throw ('Error. El concepto esta vacío'); + 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 `tillConfig` +-- + +DROP TABLE IF EXISTS `tillConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tillConfig` ( + `id` int(11) NOT NULL, + `openingBalance` decimal(10,2) NOT NULL, + `updated` timestamp NOT NULL 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 `time` +-- + +DROP TABLE IF EXISTS `time`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `time` ( + `dated` date NOT NULL, + `period` int(6) NOT NULL, + `month` int(2) NOT NULL, + `year` int(4) NOT NULL, + `day` int(2) NOT NULL, + `week` int(2) NOT NULL, + `yearMonth` int(6) NOT NULL, + `salesYear` int(4) NOT NULL COMMENT 'año para los calculos de las comisiones ventas', + PRIMARY KEY (`dated`), + 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 `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 */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`time_AFTER_UPDATE` + AFTER UPDATE ON `time` + FOR EACH ROW +BEGIN + /*INSERT INTO vn.mail SET + `sender` = 'jgallego@verdnatura.es', + `replyTo` = 'jgallego@verdnatura.es', + `subject` = 'tabla time modificada', + `body` = CONCAT(account.myUserGetName(), ' ha modificado la tabla time ', + NEW.`dated`);*/ +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- 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 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, + `yearMonth` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- 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 AUTO_INCREMENT, + `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + `provinceFk` smallint(6) unsigned NOT NULL, + `geoFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `name_idx` (`name`), + KEY `townProvinceFk` (`provinceFk`), + CONSTRAINT `townProvinceFk` FOREIGN KEY (`provinceFk`) REFERENCES `province` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_beforeInsert` + BEFORE INSERT ON `town` + FOR EACH ROW +BEGIN + SET NEW.geoFk = zoneGeo_new('town', NEW.`name`, + (SELECT geoFk FROM province WHERE id = NEW.provinceFk)); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_beforeUpdate` + BEFORE UPDATE ON `town` + FOR EACH ROW +BEGIN + -- IF !(OLD.geoFk <=> NEW.geoFk) THEN + -- CALL zoneGeo_throwNotEditable; + -- END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_afterUpdate` + AFTER UPDATE ON `town` + FOR EACH ROW +BEGIN + IF !(OLD.provinceFk <=> NEW.provinceFk) THEN + CALL zoneGeo_setParent(NEW.geoFk, + (SELECT geoFk FROM province WHERE id = NEW.provinceFk)); + END IF; + + IF !(OLD.`name` <=> NEW.`name`) THEN + UPDATE zoneGeo SET `name` = NEW.`name` + WHERE id = NEW.geoFk; + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`town_afterDelete` + AFTER DELETE ON `town` + FOR EACH ROW +BEGIN + CALL zoneGeo_delete(OLD.geoFk); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Temporary table structure for view `tr2` +-- + +DROP TABLE IF EXISTS `tr2`; +/*!50001 DROP VIEW IF EXISTS `tr2`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `tr2` ( + `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, + `kg` tinyint NOT NULL, + `cargoSupplierFk` tinyint NOT NULL, + `totalEntries` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `traceabilityBuy` +-- + +DROP TABLE IF EXISTS `traceabilityBuy`; +/*!50001 DROP VIEW IF EXISTS `traceabilityBuy`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `traceabilityBuy` ( + `buyFk` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `landed` tinyint NOT NULL, + `warehouseName` tinyint NOT NULL, + `entryFk` tinyint NOT NULL, + `supplierName` tinyint NOT NULL, + `itemFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `traceabilitySale` +-- + +DROP TABLE IF EXISTS `traceabilitySale`; +/*!50001 DROP VIEW IF EXISTS `traceabilitySale`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `traceabilitySale` ( + `ticketFk` tinyint NOT NULL, + `buyFk` tinyint NOT NULL, + `shipped` tinyint NOT NULL, + `nickname` tinyint NOT NULL, + `quantity` tinyint NOT NULL, + `worker` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `train` +-- + +DROP TABLE IF EXISTS `train`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `train` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Define la configuración de los carros que se utilizan para sacar pedidos'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `trainingCenter` +-- + +DROP TABLE IF EXISTS `trainingCenter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `trainingCenter` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `trainingCourse` +-- + +DROP TABLE IF EXISTS `trainingCourse`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `trainingCourse` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `trainingCourseTypeFk` int(11) NOT NULL, + `centerFk` int(11) DEFAULT NULL, + `started` datetime NOT NULL, + `ended` datetime NOT NULL, + `invoice` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `amount` double DEFAULT NULL, + `remark` longtext COLLATE utf8_unicode_ci, + `hasDiscount` tinyint(1) NOT NULL DEFAULT '0', + `hasDiploma` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `frgnWorker_idx` (`workerFk`), + KEY `frgnCenter_idx` (`centerFk`), + KEY `frgnTrainingCourseType_idx` (`trainingCourseTypeFk`), + CONSTRAINT `frgnCenter` FOREIGN KEY (`centerFk`) REFERENCES `trainingCenter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `frgnTrainingCourseType` FOREIGN KEY (`trainingCourseTypeFk`) REFERENCES `trainingCourseType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `frgnWorker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de trabajadores que han realizado una formación'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `trainingCourseType` +-- + +DROP TABLE IF EXISTS `trainingCourseType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `trainingCourseType` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de las formaciones'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `travel` +-- + +DROP TABLE IF EXISTS `travel`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `travel` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `shipped` date DEFAULT NULL, + `shipmentHour` time DEFAULT NULL, + `landed` date NOT NULL, + `landingHour` time DEFAULT NULL, + `warehouseInFk` smallint(6) unsigned DEFAULT NULL, + `warehouseOutFk` smallint(6) unsigned DEFAULT NULL, + `agencyFk` int(11) DEFAULT NULL, + `ref` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `isDelivered` tinyint(1) NOT NULL DEFAULT '0', + `isReceived` 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, + `totalEntries` tinyint(4) unsigned DEFAULT '0', + `appointment` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `shipment_2` (`shipped`,`landed`,`warehouseInFk`,`warehouseOutFk`,`agencyFk`,`ref`), + KEY `agency_id` (`agencyFk`), + KEY `shipment` (`shipped`), + KEY `landing` (`landed`), + KEY `warehouse_landing` (`warehouseInFk`,`landed`), + KEY `warehouse_out_shipment` (`warehouseOutFk`,`shipped`), + KEY `travel_ibfk_4_idx` (`cargoSupplierFk`), + CONSTRAINT `travel_ibfk_1` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_beforeInsert` + BEFORE INSERT ON `travel` + FOR EACH ROW +BEGIN + CALL travel_checkDates(NEW.shipped, NEW.landed); +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_beforeUpdate` + BEFORE UPDATE ON `travel` + FOR EACH ROW +BEGIN + IF !(NEW.landed <=> OLD.landed) + OR !(NEW.shipped <=> OLD.shipped) THEN + CALL travel_checkDates(NEW.shipped, NEW.landed); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`travel_afterUpdate` + AFTER UPDATE ON `travel` + FOR EACH ROW +BEGIN + CALL stock.log_add('travel', NEW.id, OLD.id); + + IF !(NEW.shipped <=> OLD.shipped) THEN + UPDATE entry + SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) + WHERE travelFk = NEW.id; + END IF; +/* + IF !(ABS(NEW.isDelivered) <=> ABS(OLD.isDelivered)) + THEN + INSERT INTO vn2008.travel_dits SET + idaccion_dits = 89, + Id_Trabajador = account.myUser_getId(), + Id_Ticket = NEW.id, + value_old = OLD.isDelivered, + value_new = NEW.isDelivered; + 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 `travelClonedWeekly` +-- + +DROP TABLE IF EXISTS `travelClonedWeekly`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `travelClonedWeekly` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `weekStart` tinyint(3) unsigned NOT NULL, + `weekEnd` tinyint(3) unsigned NOT NULL, + `warehouseOutFk` smallint(6) unsigned NOT NULL, + `warehouseInFk` smallint(6) unsigned NOT NULL, + `agencyModeFk` int(11) NOT NULL, + `weekDay` tinyint(3) unsigned NOT NULL, + `duration` tinyint(3) unsigned NOT NULL, + `ref` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `supplierFk` int(11) DEFAULT NULL, + `kg` decimal(10,0) unsigned DEFAULT NULL, + `travelFk` int(11) unsigned DEFAULT NULL COMMENT 'Travel origen para clonar ademas sus entradas', + PRIMARY KEY (`id`), + KEY `travelClonedWeekly_FK` (`warehouseOutFk`), + KEY `travelClonedWeekly_FK_1` (`warehouseInFk`), + KEY `travelClonedWeekly_FK_2` (`agencyModeFk`), + KEY `travelClonedWeekly_FK_3` (`supplierFk`), + KEY `travelClonedWeekly_FK_4` (`travelFk`), + CONSTRAINT `travelClonedWeekly_FK` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `travelClonedWeekly_FK_1` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `travelClonedWeekly_FK_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE, + CONSTRAINT `travelClonedWeekly_FK_3` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `travelClonedWeekly_FK_4` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `travelLog` +-- + +DROP TABLE IF EXISTS `travelLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `travelLog` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `originFk` int(10) unsigned NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text CHARACTER SET utf8, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `originFk` (`originFk`), + KEY `userFk` (`userFk`), + CONSTRAINT `travelLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `travel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `travelLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `travelObservation` +-- + +DROP TABLE IF EXISTS `travelObservation`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `travelObservation` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `originFk` int(11) NOT NULL, + `userFk` int(11) NOT NULL, + `description` text COLLATE utf8_unicode_ci NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Observaciones de travel'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `travelRecalc` +-- + +DROP TABLE IF EXISTS `travelRecalc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `travelRecalc` ( + `travelFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`travelFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Travels to recalc it''s entry count'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `travelThermograph` +-- + +DROP TABLE IF EXISTS `travelThermograph`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `travelThermograph` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `thermographFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `created` date NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + `travelFk` int(10) unsigned DEFAULT NULL, + `temperature__` enum('COOL','WARM','DRY') COLLATE utf8_unicode_ci DEFAULT NULL, + `result` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `dmsFk` int(11) DEFAULT NULL, + `temperatureFk` varchar(10) CHARACTER SET utf8 DEFAULT 'cool' COMMENT 'En la versión de Agosto de Salix se empezará a usar este campo y se actualizaran los anteriores mirando temperature.', + PRIMARY KEY (`id`), + KEY `thermograph_fk_idx` (`thermographFk`), + KEY `gestdoc_fk_idx` (`dmsFk`), + KEY `travel_id` (`travelFk`), + KEY `warehouse_id` (`warehouseFk`), + KEY `travelThermographTemperatureFgn` (`temperatureFk`), + CONSTRAINT `travelThermographDmsFgn` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON UPDATE CASCADE, + CONSTRAINT `travelThermographTemperatureFgn` FOREIGN KEY (`temperatureFk`) REFERENCES `temperature` (`code`), + CONSTRAINT `travelThermographThermographFgn` FOREIGN KEY (`thermographFk`) REFERENCES `thermograph` (`id`) ON UPDATE CASCADE, + CONSTRAINT `travelThermographTravelFgn` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`), + CONSTRAINT `travelThermographWarehouseFgn` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON DELETE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Registra cada termografo que se ha introducido en cada travel'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `trolley` +-- + +DROP TABLE IF EXISTS `trolley`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `trolley` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned DEFAULT NULL, + `coupled` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `trolley_FK` (`workerFk`), + CONSTRAINT `trolley_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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 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; + +-- +-- 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` ( + `userFk` int(10) unsigned NOT NULL, + `warehouseFk` smallint(6) DEFAULT NULL, + `companyFk` smallint(5) unsigned DEFAULT NULL, + `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`userFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuración de usuario en Salix'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `userLog` +-- + +DROP TABLE IF EXISTS `userLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `userLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `originFk` int(10) unsigned NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text CHARACTER SET utf8, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `originFk` (`originFk`), + KEY `userFk` (`userFk`), + CONSTRAINT `userLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `userLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `userPhone` +-- + +DROP TABLE IF EXISTS `userPhone`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `userPhone` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `userFk` int(10) unsigned NOT NULL, + `typeFk` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `phone` varchar(25) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UserFk_Phone` (`userFk`,`typeFk`,`phone`), + KEY `fgnTypeFk` (`typeFk`), + CONSTRAINT `fgnTypeFk` FOREIGN KEY (`typeFk`) REFERENCES `userPhoneType` (`code`) ON UPDATE CASCADE, + CONSTRAINT `fgnUserFk` 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 `userPhoneType` +-- + +DROP TABLE IF EXISTS `userPhoneType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `userPhoneType` ( + `code` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vehicle` +-- + +DROP TABLE IF EXISTS `vehicle`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicle` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `numberPlate` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `model` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `tradeMark` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `companyFk` smallint(5) unsigned NOT NULL DEFAULT '442', + `m3` double DEFAULT NULL, + `isActive` tinyint(4) NOT NULL DEFAULT '1', + `warehouseFk` smallint(6) unsigned DEFAULT NULL, + `description` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `deliveryPointFk` int(11) DEFAULT '6' COMMENT 'Direccion para Buscaman', + `isKmTruckRate` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Computar km como camión en el cálculo de salario de reparto', + `photo` blob, + `chassis` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'numero de bastidor', + `fuelTypeFk` int(11) DEFAULT NULL, + `ppeFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `empresa_id` (`companyFk`), + KEY `provinceFk_idx` (`warehouseFk`), + KEY `vehicle_deliveryPointFk_idx` (`deliveryPointFk`), + KEY `vehicle_FK` (`fuelTypeFk`), + KEY `vehicle_FK_1` (`ppeFk`), + CONSTRAINT `provinceFk` FOREIGN KEY (`warehouseFk`) REFERENCES `province` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `vehicle_FK` FOREIGN KEY (`fuelTypeFk`) REFERENCES `fuelType` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `vehicle_FK_1` FOREIGN KEY (`ppeFk`) REFERENCES `ppe` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `vehicle_deliveryPointFk` FOREIGN KEY (`deliveryPointFk`) REFERENCES `deliveryPoint` (`id`) ON UPDATE CASCADE, + CONSTRAINT `vehicle_ibfk_1` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vehicleDms` +-- + +DROP TABLE IF EXISTS `vehicleDms`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicleDms` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `vehicleFk` int(10) unsigned NOT NULL, + `dmsFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `vehicleDms_FK` (`vehicleFk`), + KEY `vehicleDms_FK_1` (`dmsFk`), + CONSTRAINT `vehicleDms_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `vehicleDms_FK_1` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Gestion documental de vehicle'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vehicleEvent` +-- + +DROP TABLE IF EXISTS `vehicleEvent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicleEvent` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `started` date DEFAULT NULL, + `finished` date DEFAULT NULL, + `vehicleStateFk` int(11) DEFAULT NULL, + `description` varchar(250) COLLATE utf8_unicode_ci NOT NULL, + `vehicleFk` int(11) NOT NULL, + `userFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `vehicleEvent_FK` (`vehicleStateFk`), + KEY `vehicleEvent_FK_1` (`userFk`), + CONSTRAINT `vehicleEvent_FK` FOREIGN KEY (`vehicleStateFk`) REFERENCES `vehicleState` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `vehicleEvent_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vehicleInvoiceIn` +-- + +DROP TABLE IF EXISTS `vehicleInvoiceIn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicleInvoiceIn` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `vehicleFk` int(10) unsigned NOT NULL, + `invoiceInFk` mediumint(8) unsigned NOT NULL, + `amount` decimal(10,2) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `vehicleInvoiceIn_FK` (`vehicleFk`), + KEY `vehicleInvoiceIn_FK_1` (`invoiceInFk`), + CONSTRAINT `vehicleInvoiceIn_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`), + CONSTRAINT `vehicleInvoiceIn_FK_1` FOREIGN KEY (`invoiceInFk`) REFERENCES `invoiceIn` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vehicleNotes` +-- + +DROP TABLE IF EXISTS `vehicleNotes`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicleNotes` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `vehicleFk` int(10) unsigned NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `note` text COLLATE utf8_unicode_ci NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `vehicleNotes_FK_1` (`userFk`), + KEY `vehicleNotes_FK` (`vehicleFk`), + CONSTRAINT `vehicleNotes_FK` FOREIGN KEY (`vehicleFk`) REFERENCES `vehicle` (`id`), + CONSTRAINT `vehicleNotes_FK_1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vehicleState` +-- + +DROP TABLE IF EXISTS `vehicleState`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vehicleState` ( + `id` int(11) NOT NULL, + `state` varchar(100) 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 `volumeConfig` +-- + +DROP TABLE IF EXISTS `volumeConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `volumeConfig` ( + `palletM3` decimal(10,2) DEFAULT NULL COMMENT 'metros cúbicos', + `trolleyM3` decimal(10,2) DEFAULT NULL COMMENT 'metros cúbicos', + `dutchCompressionRate` double NOT NULL DEFAULT '1', + `standardFlowerBox` int(11) NOT NULL COMMENT 'en litros', + `minCompressionRate` decimal(10,2) DEFAULT '0.30' COMMENT 'minimo permitido por la empresa', + `ccLength` int(11) NOT NULL DEFAULT '130' COMMENT 'longitud útil para la carga de un CC, en cm', + `ccWidth` int(11) NOT NULL DEFAULT '60' COMMENT 'ancho útil para la carga en un CC, en cm', + `sorterPallet_m3` decimal(5,1) NOT NULL DEFAULT '2.0' COMMENT 'volumen minimo para extraer pallet del sorter', + `minTicketVolume` int(11) NOT NULL DEFAULT '75' COMMENT 'volumen mínimo, en litros, para que un pedido sea preparable', + `shelveVolume` int(11) DEFAULT '200' COMMENT 'volumen en litros de una bandeja standard, a efectos de los sacadores', + `minTicketValue` int(11) NOT NULL DEFAULT '50' +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='almacena el valor standard para volumenes convencionales de Verdnatura, en metros cúbicos'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `wagon` +-- + +DROP TABLE IF EXISTS `wagon`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `wagon` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `volume` int(11) NOT NULL DEFAULT '150' COMMENT 'Volumen en litros', + `plate` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Matrícula', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `wagonVolumetry` +-- + +DROP TABLE IF EXISTS `wagonVolumetry`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `wagonVolumetry` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `level` int(10) unsigned NOT NULL DEFAULT '0', + `lines` int(10) unsigned NOT NULL DEFAULT '1', + `liters` int(10) unsigned NOT NULL DEFAULT '0', + `height` int(10) unsigned NOT NULL DEFAULT '20', + `wagonFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `wagonVolumetry_FK` (`wagonFk`), + CONSTRAINT `wagonVolumetry_FK` FOREIGN KEY (`wagonFk`) REFERENCES `wagon` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `warehouse` +-- + +DROP TABLE IF EXISTS `warehouse`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `warehouse` ( + `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL, + `isFeedStock` tinyint(1) unsigned NOT NULL DEFAULT '0', + `addressName` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `delay` double NOT NULL DEFAULT '0.004', + `hasAvailable` tinyint(4) NOT NULL DEFAULT '0', + `isForTicket` tinyint(2) unsigned zerofill NOT NULL DEFAULT '00', + `countryFk` mediumint(8) unsigned NOT NULL DEFAULT '1', + `labelZone` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'almacenes donde hay produccion', + `hasComission` tinyint(4) NOT NULL DEFAULT '0', + `isInventory` tinyint(2) NOT NULL DEFAULT '0', + `isComparative` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Si esta a true,en la comparativa muestra el stock de este almacen, cuando no se especifica almacen.', + `valuatedInventory` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Determina si se incluye en el informe de inventario valorado', + `isManaged` tinyint(2) NOT NULL DEFAULT '0' COMMENT 'Se añaden los cubos de expedition a la tabla ticketPackaging', + `hasConfectionTeam` tinyint(1) unsigned NOT NULL DEFAULT '0', + `hasStowaway` tinyint(1) NOT NULL DEFAULT '0', + `hasDms` tinyint(1) NOT NULL DEFAULT '0', + `pickUpAgencyModeFk` int(11) DEFAULT NULL, + `isBuyerToBeEmailed` tinyint(2) NOT NULL DEFAULT '0', + `aliasFk` smallint(5) unsigned DEFAULT NULL, + `labelReport` int(11) DEFAULT NULL, + `hasUbications` tinyint(1) NOT NULL DEFAULT '1', + `hasProduction` tinyint(1) NOT NULL DEFAULT '0', + `addressFk` int(11) DEFAULT NULL, + `hasMachine` tinyint(1) NOT NULL DEFAULT '0', + `isLogiflora` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Este almacén acepta productos de Logiflora', + `isBionic` tinyint(1) NOT NULL DEFAULT '1', + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`), + KEY `Id_Paises` (`countryFk`), + KEY `isComparativeIdx` (`isComparative`), + KEY `warehouse_ibfk_1_idx` (`aliasFk`), + KEY `warehouse_FK` (`addressFk`), + CONSTRAINT `warehouse_FK` FOREIGN KEY (`addressFk`) REFERENCES `address` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `warehouse_ibfk_1` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`), + CONSTRAINT `warehouse_ibfk_2` FOREIGN KEY (`aliasFk`) REFERENCES `warehouseAlias` (`id`) ON DELETE SET NULL ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterInsert` + AFTER INSERT ON `warehouse` + FOR EACH ROW +BEGIN + IF NEW.isFeedStock THEN + INSERT INTO warehouseAlias(`name`) VALUES(NEW.`name`); + INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) + VALUES(NEW.id,LAST_INSERT_ID()); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`warehouse_afterUpdate` + AFTER UPDATE ON `warehouse` + FOR EACH ROW +BEGIN + IF NEW.isFeedStock IS TRUE and OLD.isFeedStock IS FALSE then + INSERT INTO warehouseAlias(`name`) VALUES(NEW.`name`); + INSERT INTO warehouseJoined(warehouseFk, warehouseAliasFk) + VALUES(NEW.id,LAST_INSERT_ID()); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `warehouseAlias` +-- + +DROP TABLE IF EXISTS `warehouseAlias`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `warehouseAlias` ( + `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(15) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `name_UNIQUE` (`name`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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, + `warehouseFk` smallint(6) DEFAULT NULL, + `street` varchar(255) DEFAULT NULL, + `geoFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `workCenter_geoFk_idx` (`geoFk`), + CONSTRAINT `workCenter_geoFk` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workCenterHoliday` +-- + +DROP TABLE IF EXISTS `workCenterHoliday`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workCenterHoliday` ( + `workCenterFk` int(11) NOT NULL, + `days` double NOT NULL, + `year` smallint(6) NOT NULL, + PRIMARY KEY (`workCenterFk`,`year`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `worker` +-- + +DROP TABLE IF EXISTS `worker`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `worker` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `code` varchar(3) COLLATE utf8_unicode_ci NOT NULL, + `firstName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `lastName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `password__` varchar(50) CHARACTER SET utf8 DEFAULT NULL, + `email__` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `extension__` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL, + `sub` int(11) unsigned DEFAULT NULL, + `user__` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `typeBussines__` varchar(30) CHARACTER SET utf8 DEFAULT 'no dejar vacio' COMMENT 'campo obsoleto, actualmente se rellena en laboral', + `laborCategory__` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `started__` datetime DEFAULT NULL, + `ended__` datetime DEFAULT NULL, + `notes__` varchar(254) COLLATE utf8_unicode_ci DEFAULT NULL, + `photo` blob, + `fi__` varchar(9) COLLATE utf8_unicode_ci DEFAULT NULL, + `address__` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `birthed__` date NOT NULL, + `phone` varchar(9) COLLATE utf8_unicode_ci NOT NULL, + `clientFk__` int(11) DEFAULT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `bossFk` int(11) NOT NULL DEFAULT '103', + `fiDueDate` datetime DEFAULT NULL, + `hasMachineryAuthorized` tinyint(2) DEFAULT '0', + `seniority` date DEFAULT NULL, + `isTodayRelative` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Para el F11. Calcula los problemas de visiblidad en funcion del dia actual', + `isF11Allowed` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Usuario autorizado para abrir el F11', + `sectorFk` int(11) DEFAULT NULL COMMENT 'Sector que tiene asociado el trabajador.', + `maritalStatus` enum('S','M') COLLATE utf8_unicode_ci NOT NULL, + `labelerFk` tinyint(3) unsigned DEFAULT NULL, + `originCountryFk` mediumint(8) unsigned DEFAULT NULL COMMENT 'País de origen', + `educationLevelFk` smallint(6) DEFAULT NULL, + `SSN` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `CodigoTrabajador_UNIQUE` (`code`), + UNIQUE KEY `user` (`user__`), + UNIQUE KEY `user_id_UNIQUE` (`userFk`), + UNIQUE KEY `Id_Cliente_Interno` (`clientFk__`), + KEY `sub` (`sub`), + KEY `boss_idx` (`bossFk`), + KEY `worker_FK` (`labelerFk`), + KEY `worker_FK_2` (`educationLevelFk`), + KEY `worker_FK_1` (`originCountryFk`), + CONSTRAINT `Clientes` FOREIGN KEY (`clientFk__`) REFERENCES `client` (`id`) ON UPDATE CASCADE, + CONSTRAINT `worker_FK` FOREIGN KEY (`labelerFk`) REFERENCES `printer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE, + CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `educationLevel` (`id`) ON UPDATE CASCADE, + CONSTRAINT `worker_ibfk_1` FOREIGN KEY (`id`) REFERENCES `account`.`user` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerBosses` +-- + +DROP TABLE IF EXISTS `workerBosses`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerBosses` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `bossFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`bossFk`), + KEY `fg_worker_worker_idx` (`workerFk`), + KEY `fg_bossFk_worker_idx` (`bossFk`), + CONSTRAINT `fg_bossFk_worker` FOREIGN KEY (`bossFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fg_workerFk_worker` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `workerBusinessDated` +-- + +DROP TABLE IF EXISTS `workerBusinessDated`; +/*!50001 DROP VIEW IF EXISTS `workerBusinessDated`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerBusinessDated` ( + `dated` tinyint NOT NULL, + `business_id` tinyint NOT NULL, + `workerFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `workerBusinessType` +-- + +DROP TABLE IF EXISTS `workerBusinessType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerBusinessType` ( + `id` int(11) NOT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `isFullTime` tinyint(1) NOT NULL DEFAULT '1', + `isPermanent` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Contrato fijo', + `hasHolidayEntitlement` tinyint(1) DEFAULT '1' COMMENT 'Tiene derecho a vacaciones', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `workerCalendar` +-- + +DROP TABLE IF EXISTS `workerCalendar`; +/*!50001 DROP VIEW IF EXISTS `workerCalendar`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerCalendar` ( + `businessFk` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `absenceTypeFk` tinyint NOT NULL, + `dated` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `workerClockLog` +-- + +DROP TABLE IF EXISTS `workerClockLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerClockLog` ( + `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 `logWorkerClockoriginFk` (`originFk`), + KEY `logWorkerClockuserFk` (`userFk`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerConfig__` +-- + +DROP TABLE IF EXISTS `workerConfig__`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerConfig__` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `defaultWorkerFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `defaultWorkerFk` (`defaultWorkerFk`), + CONSTRAINT `workerConfig___ibfk_1` FOREIGN KEY (`defaultWorkerFk`) REFERENCES `worker` (`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 `workerDepartment` +-- + +DROP TABLE IF EXISTS `workerDepartment`; +/*!50001 DROP VIEW IF EXISTS `workerDepartment`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerDepartment` ( + `workerFk` tinyint NOT NULL, + `departmentFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `workerDepartmentTest` +-- + +DROP TABLE IF EXISTS `workerDepartmentTest`; +/*!50001 DROP VIEW IF EXISTS `workerDepartmentTest`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerDepartmentTest` ( + `workerFk` tinyint NOT NULL, + `departmentFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `workerDisableExcluded` +-- + +DROP TABLE IF EXISTS `workerDisableExcluded`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerDisableExcluded` ( + `workerFk` int(10) unsigned NOT NULL, + `dated` date DEFAULT NULL, + PRIMARY KEY (`workerFk`), + CONSTRAINT `workerDisableExcludedFk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No se deshabilitan hasta la fecha especificada'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerDistributionCategory` +-- + +DROP TABLE IF EXISTS `workerDistributionCategory`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerDistributionCategory` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `category` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `workerDistributionCategory_workerFk_idx` (`workerFk`), + CONSTRAINT `workerDistributionCategory_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerDocument` +-- + +DROP TABLE IF EXISTS `workerDocument`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerDocument` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `worker` int(10) unsigned DEFAULT NULL, + `document` int(11) DEFAULT NULL, + `isReadableByWorker` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Indica si el empleado tiene permiso para acceder al documento', + PRIMARY KEY (`id`), + KEY `workerDocument_ibfk_1` (`worker`), + KEY `workerDocument_ibfk_2` (`document`), + CONSTRAINT `workerDocument_ibfk_1` FOREIGN KEY (`worker`) REFERENCES `worker` (`userFk`) ON UPDATE CASCADE, + CONSTRAINT `workerDocument_ibfk_2` FOREIGN KEY (`document`) REFERENCES `dms` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerEmergencyBoss` +-- + +DROP TABLE IF EXISTS `workerEmergencyBoss`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerEmergencyBoss` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `value` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Table to save all responsible people phones', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerHourPrice` +-- + +DROP TABLE IF EXISTS `workerHourPrice`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerHourPrice` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dated` date NOT NULL, + `holidayInc` decimal(4,2) DEFAULT NULL, + `nightInc` decimal(4,2) DEFAULT NULL, + `extraInc` decimal(4,2) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Recoge los acuerdos de los distintos convenios'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerIrpf` +-- + +DROP TABLE IF EXISTS `workerIrpf`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerIrpf` ( + `workerFk` int(10) unsigned NOT NULL, + `spouseNif` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `geographicMobilityDate` date DEFAULT NULL, + `disabilityGradeFk` int(11) DEFAULT NULL, + `isDependend` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Acredita la necesidad de ayuda de terceras personas o movilidad reducida', + `familySituation` enum('1','2','3') COLLATE utf8_unicode_ci DEFAULT '1', + `spousePension` decimal(10,2) DEFAULT NULL COMMENT 'Apartado 4 - Pensión compensatoria en favor del conyuge ', + `childPension` decimal(10,2) DEFAULT NULL COMMENT 'Apartado 4 - Anualidades por alimentos en favor de los hijos', + `hasHousingPaymentBefore` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Apartado 5 - Pagos por adquisición o rehabilitación de la vivienda habitual utilizando financiación ajena, con derecho a deducción del IRPF', + `hasHousingPaymentAfter` tinyint(1) NOT NULL DEFAULT '0', + `hasExtendedWorking` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Aprtado 1 - prolongar la actividad laboral', + `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`workerFk`), + KEY `workerIrpf_disabilityGradeFk` (`disabilityGradeFk`), + CONSTRAINT `workerIrpf_disabilityGradeFk` FOREIGN KEY (`disabilityGradeFk`) REFERENCES `disabilityGrade` (`id`) ON UPDATE CASCADE, + CONSTRAINT `workerIrpf_wokerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 1 - 4 y 5 '; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerJourney` +-- + +DROP TABLE IF EXISTS `workerJourney`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerJourney` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `userFk` int(10) unsigned NOT NULL, + `dated` date NOT NULL, + `total` decimal(5,2) NOT NULL DEFAULT '0.00', + `priceOrdinaryHour` decimal(5,2) NOT NULL DEFAULT '0.00', + `nocturn` decimal(5,2) NOT NULL DEFAULT '0.00', + `priceNocturnHour` decimal(5,2) NOT NULL DEFAULT '0.00', + `holiday` decimal(5,2) NOT NULL DEFAULT '0.00', + `priceHolidayHour` decimal(5,2) NOT NULL DEFAULT '0.00', + `lunch` decimal(5,2) NOT NULL DEFAULT '0.00', + `priceExtraHour` decimal(5,2) NOT NULL DEFAULT '0.00', + `extra` decimal(5,2) NOT NULL DEFAULT '0.00', + `contractJourney` decimal(5,2) NOT NULL DEFAULT '0.00', + `priceExtraHoliday` decimal(5,2) NOT NULL DEFAULT '0.00', + `businessFk` int(11) DEFAULT NULL, + `isPaid` tinyint(1) NOT NULL DEFAULT '0', + `isUpdated` tinyint(1) NOT NULL DEFAULT '0', + `permission` decimal(5,2) NOT NULL DEFAULT '0.00', + PRIMARY KEY (`id`), + UNIQUE KEY `userFk_UNIQUE` (`userFk`,`dated`), + KEY `fk_workerJourney_user_idx` (`userFk`), + KEY `workerJourney_businessFk_idx` (`businessFk`), + KEY `workerJourney_dated_idx` (`dated`), + CONSTRAINT `fk_workerJourney_user` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE, + CONSTRAINT `workerJourney_businessFk` FOREIGN KEY (`businessFk`) REFERENCES `postgresql`.`business` (`business_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `workerLabour` +-- + +DROP TABLE IF EXISTS `workerLabour`; +/*!50001 DROP VIEW IF EXISTS `workerLabour`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerLabour` ( + `businessFk` tinyint NOT NULL, + `workerFk` tinyint NOT NULL, + `workCenterFk` tinyint NOT NULL, + `started` tinyint NOT NULL, + `ended` tinyint NOT NULL, + `departmentFk` tinyint NOT NULL, + `payedHolidays` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- 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(10) unsigned 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, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT 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 `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerMana` +-- + +DROP TABLE IF EXISTS `workerMana`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerMana` ( + `workerFk` int(10) unsigned NOT NULL, + `size` int(11) NOT NULL DEFAULT '300', + `amount` int(11) NOT NULL DEFAULT '0', + `pricesModifierRate` double NOT NULL DEFAULT '0', + `isPricesModifierActivated` tinyint(1) NOT NULL DEFAULT '1', + `minRate` decimal(3,2) NOT NULL DEFAULT '-0.05', + `maxRate` decimal(3,2) NOT NULL DEFAULT '0.05', + PRIMARY KEY (`workerFk`), + KEY `fk_mana_spellers_Trabajadores_idx` (`workerFk`), + CONSTRAINT `fk_mana_spellers_Trabajadores` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`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 `workerManaExcluded` +-- + +DROP TABLE IF EXISTS `workerManaExcluded`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerManaExcluded` ( + `workerFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`workerFk`), + CONSTRAINT `mana_spellers_excluded_fk1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Usuarios que tienen que estar excluidos del cálculo del maná'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `workerMana__` +-- + +DROP TABLE IF EXISTS `workerMana__`; +/*!50001 DROP VIEW IF EXISTS `workerMana__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerMana__` ( + `workerFk` tinyint NOT NULL, + `size` tinyint NOT NULL, + `amount` tinyint NOT NULL, + `pricesModifierRate` tinyint NOT NULL, + `isPricesModifierActivated` tinyint NOT NULL, + `minRate` tinyint NOT NULL, + `maxRate` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `workerMedia` +-- + +DROP TABLE IF EXISTS `workerMedia`; +/*!50001 DROP VIEW IF EXISTS `workerMedia`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerMedia` ( + `workerFk` tinyint NOT NULL, + `mediaValue` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `workerMistake` +-- + +DROP TABLE IF EXISTS `workerMistake`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerMistake` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `userFk` int(10) unsigned NOT NULL, + `workerMistakeTypeFk` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `workerMistake_fk1_idx` (`userFk`), + KEY `workerMistake_fk2_idx` (`workerMistakeTypeFk`), + CONSTRAINT `workerMistake_fk1` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `workerMistake_fk2` FOREIGN KEY (`workerMistakeTypeFk`) REFERENCES `workerMistakeType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerMistakeType` +-- + +DROP TABLE IF EXISTS `workerMistakeType`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerMistakeType` ( + `code` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerRelatives` +-- + +DROP TABLE IF EXISTS `workerRelatives`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerRelatives` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `isDescendant` tinyint(1) DEFAULT '1' COMMENT 'Descendientes - Ascendientes', + `disabilityGradeFk` int(11) DEFAULT NULL, + `birthed` int(4) NOT NULL, + `adoptionYear` int(4) DEFAULT NULL COMMENT 'Solo en el caso de descendientes', + `isDependend` tinyint(1) DEFAULT '0', + `isJointCustody` tinyint(1) DEFAULT '0' COMMENT 'Solo en el caso de descendientes', + `updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `workerRelatives_disabilityGradeFk` (`disabilityGradeFk`), + KEY `workerRelatives_workerFk` (`workerFk`), + CONSTRAINT `workerRelatives_disabilityGradeFk` FOREIGN KEY (`disabilityGradeFk`) REFERENCES `disabilityGrade` (`id`) ON UPDATE CASCADE, + CONSTRAINT `workerRelatives_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `workerIrpf` (`workerFk`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Modelo 145 IRPF apartado 2 y 3'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerShelving` +-- + +DROP TABLE IF EXISTS `workerShelving`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerShelving` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `shelvingFk` varchar(10) CHARACTER SET utf8 NOT NULL, + `collectionFk` int(11) DEFAULT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `workerShelving_shelving_fk` (`shelvingFk`), + KEY `workerShelving_FK` (`workerFk`), + KEY `workerShelving_FK_1` (`collectionFk`), + CONSTRAINT `workerShelving_FK` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + CONSTRAINT `workerShelving_shelving_fk` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON UPDATE CASCADE, + CONSTRAINT `workerShelving_worker_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='utilizaremos el id para establecer la prioridad de los carros a asignar'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `workerSpeedExpedition` +-- + +DROP TABLE IF EXISTS `workerSpeedExpedition`; +/*!50001 DROP VIEW IF EXISTS `workerSpeedExpedition`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerSpeedExpedition` ( + `ticketFk` tinyint NOT NULL, + `litros` tinyint NOT NULL, + `literLastHour` tinyint NOT NULL, + `litersByMinute` tinyint NOT NULL, + `workerCode` tinyint NOT NULL, + `cajas` tinyint NOT NULL, + `warehouseFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `workerSpeedSaleTracking` +-- + +DROP TABLE IF EXISTS `workerSpeedSaleTracking`; +/*!50001 DROP VIEW IF EXISTS `workerSpeedSaleTracking`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerSpeedSaleTracking` ( + `warehouseFk` tinyint NOT NULL, + `accion` tinyint NOT NULL, + `workerCode` tinyint NOT NULL, + `sumaLitros` tinyint NOT NULL, + `started` tinyint NOT NULL, + `finished` tinyint NOT NULL, + `sumaLitrosLastHour` tinyint NOT NULL, + `litersByMinute` tinyint NOT NULL, + `departmentName` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `workerTeam` +-- + +DROP TABLE IF EXISTS `workerTeam`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTeam` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `team` int(11) NOT NULL, + `workerFk` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `user_idx` (`workerFk`), + KEY `team_idx` (`team`), + CONSTRAINT `user_team` FOREIGN KEY (`workerFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- 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 TABLE `workerTeamCollegues` ( + `workerFk` tinyint NOT NULL, + `collegueFk` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `workerTimeControl` +-- + +DROP TABLE IF EXISTS `workerTimeControl`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControl` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `userFk` int(10) unsigned NOT NULL, + `timed` datetime NOT NULL, + `manual` tinyint(4) NOT NULL DEFAULT '0', + `order` int(11) DEFAULT NULL, + `warehouseFk` smallint(6) unsigned DEFAULT NULL, + `direction` enum('in','out','middle') COLLATE utf8_unicode_ci DEFAULT 'middle', + `isSendMail` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Fichadas generadas autómaticamente con el procedimiento vn.workerTimeControl_sendMail', + PRIMARY KEY (`id`), + UNIQUE KEY `userFk_Timed_uniq` (`userFk`,`timed`), + KEY `warehouseFkfk1_idx` (`warehouseFk`), + CONSTRAINT `warehouseFk_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `workerTimeControl_fk1` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Fichadas'; +/*!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`@`localhost`*/ /*!50003 TRIGGER `vn`.`workerTimeControl_AI` + AFTER INSERT ON `workerTimeControl` + FOR EACH ROW +BEGIN + IF NEW.timed > DATE_ADD(NOW(), INTERVAL 1 DAY) THEN + CALL util.throw('date in the future'); + END IF; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `workerTimeControlConfig` +-- + +DROP TABLE IF EXISTS `workerTimeControlConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControlConfig` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dayBreak` int(11) NOT NULL, + `dayBreakDriver` int(11) NOT NULL, + `shortWeekBreak` int(11) NOT NULL, + `longWeekBreak` int(11) NOT NULL, + `weekScope` int(11) NOT NULL, + `mailPass` varchar(45) COLLATE utf8_bin NOT NULL, + `mailHost` varchar(45) COLLATE utf8_bin NOT NULL, + `mailSuccessFolder` varchar(45) COLLATE utf8_bin NOT NULL, + `mailErrorFolder` varchar(45) COLLATE utf8_bin NOT NULL, + `mailUser` varchar(45) COLLATE utf8_bin NOT NULL, + `minHoursToBreak` decimal(5,2) unsigned NOT NULL COMMENT 'Horas mínimas que se deben trabajar para añadir descanso remunerado', + `breakHours` decimal(5,2) unsigned NOT NULL COMMENT 'Descanso remunerado', + `hoursCompleteWeek` int(10) unsigned NOT NULL COMMENT 'Horas a realizar por semana para que se considere jornada completa', + `startNightlyHours` time NOT NULL, + `endNightlyHours` time NOT NULL, + `maxTimePerDay` int(11) unsigned NOT NULL COMMENT 'Maximo tiempo transcurrido en segundos desde que se inicia la jornada hasta que se termina', + `breakTime` int(11) DEFAULT NULL COMMENT 'Tiempo de descanso expresado en segundos', + `timeToBreakTime` int(11) DEFAULT NULL COMMENT 'Tiempo mínimo que se debe trabajar para añadir descanso, expresado en segundos', + `dayMaxTime` int(11) DEFAULT NULL COMMENT 'Tiempo máximo desde la entrada hasta la salida, expresado en segundos', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerTimeControlConfig_` +-- + +DROP TABLE IF EXISTS `workerTimeControlConfig_`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControlConfig_` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `warehouseFk` smallint(6) unsigned NOT NULL, + `host` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `warehouseFk_1_idx` (`warehouseFk`), + CONSTRAINT `warehouseFk_2` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerTimeControlLog` +-- + +DROP TABLE IF EXISTS `workerTimeControlLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControlLog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `userFk` int(10) NOT NULL, + `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `description` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Log de fichadas, se rellena cuando el fichador(tablet) no autoriza el fichaje (PROC:vn.workerTimeControl_check)'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerTimeControlMail` +-- + +DROP TABLE IF EXISTS `workerTimeControlMail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControlMail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `workerFk` int(10) unsigned NOT NULL, + `year` int(4) NOT NULL, + `week` int(2) NOT NULL, + `state` enum('SENDED','CONFIRMED','REVISE') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'SENDED', + `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Fecha/hora último cambio de estado', + `sendedCounter` int(3) NOT NULL DEFAULT '1' COMMENT 'Número de veces que se ha enviado el correo', + `emailResponse` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`id`), + UNIQUE KEY `workerFk_UNIQUE` (`workerFk`,`year`,`week`), + KEY `workerFk_idx` (`workerFk`), + CONSTRAINT `workerTimeControlMail_workerFk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Guarda las respuestas de mail de los correos generados automáticamente por la procedimiento workerTimeControl_sendMail'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerTimeControlParams` +-- + +DROP TABLE IF EXISTS `workerTimeControlParams`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControlParams` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `dayBreak` int(11) NOT NULL, + `weekBreak` int(11) NOT NULL, + `weekScope` int(11) NOT NULL, + `dayWorkMax` int(11) NOT NULL, + `dayStayMax` int(11) NOT NULL, + `weekMaxBreak` int(11) NOT NULL, + `weekMaxScope` int(11) NOT NULL, + `askInOut` int(11) NOT NULL COMMENT 'Tiempo desde la última fichada que determinará si se pregunta al usuario por la dirección de la fichada', + `mailPass` varchar(45) COLLATE utf8_bin NOT NULL, + `mailHost` varchar(45) COLLATE utf8_bin NOT NULL, + `mailSuccessFolder` varchar(45) COLLATE utf8_bin NOT NULL, + `mailErrorFolder` varchar(45) COLLATE utf8_bin NOT NULL, + `mailUser` varchar(45) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='All values in seconds'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workerTimeControlPin` +-- + +DROP TABLE IF EXISTS `workerTimeControlPin`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControlPin` ( + `workerFk` int(10) unsigned NOT NULL, + `pin` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`workerFk`), + CONSTRAINT `workerFk_.1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`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 `workerTimeControlSchedule` +-- + +DROP TABLE IF EXISTS `workerTimeControlSchedule`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workerTimeControlSchedule` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `time` time DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `punique_trhf` (`time`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `workerTimeControlUserInfo` +-- + +DROP TABLE IF EXISTS `workerTimeControlUserInfo`; +/*!50001 DROP VIEW IF EXISTS `workerTimeControlUserInfo`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerTimeControlUserInfo` ( + `userFk` tinyint NOT NULL, + `name` tinyint NOT NULL, + `surname` tinyint NOT NULL, + `user` tinyint NOT NULL, + `password` tinyint NOT NULL, + `bcryptPassword` tinyint NOT NULL, + `departmentFk` tinyint NOT NULL, + `dni` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `workerTimeControlWorking` +-- + +DROP TABLE IF EXISTS `workerTimeControlWorking`; +/*!50001 DROP VIEW IF EXISTS `workerTimeControlWorking`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerTimeControlWorking` ( + `userFk` tinyint NOT NULL, + `timed` tinyint NOT NULL, + `name` tinyint NOT NULL, + `surname` tinyint NOT NULL, + `phone` tinyint NOT NULL, + `workerPhone` tinyint NOT NULL, + `department` tinyint NOT NULL, + `workerCenter` tinyint NOT NULL, + `maxOrder` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `workerTimeControl_Journey__` +-- + +DROP TABLE IF EXISTS `workerTimeControl_Journey__`; +/*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerTimeControl_Journey__` ( + `userFk` tinyint NOT NULL, + `dated` tinyint NOT NULL, + `Journey` tinyint NOT NULL, + `dayName` tinyint NOT NULL, + `name` tinyint NOT NULL, + `firstname` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `workerTimeJourneyNG` +-- + +DROP TABLE IF EXISTS `workerTimeJourneyNG`; +/*!50001 DROP VIEW IF EXISTS `workerTimeJourneyNG`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerTimeJourneyNG` ( + `userFk` tinyint NOT NULL, + `dated` tinyint NOT NULL, + `Journey` tinyint NOT NULL, + `dayName` tinyint NOT NULL, + `name` tinyint NOT NULL, + `firstname` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `workerWithoutDevice__` +-- + +DROP TABLE IF EXISTS `workerWithoutDevice__`; +/*!50001 DROP VIEW IF EXISTS `workerWithoutDevice__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerWithoutDevice__` ( + `workerFk` tinyint NOT NULL, + `Trabajador` tinyint NOT NULL, + `Colecciones` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Temporary table structure for view `workerWithoutTractor` +-- + +DROP TABLE IF EXISTS `workerWithoutTractor`; +/*!50001 DROP VIEW IF EXISTS `workerWithoutTractor`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `workerWithoutTractor` ( + `workerFk` tinyint NOT NULL, + `Trabajador` tinyint NOT NULL, + `Colecciones` tinyint NOT NULL, + `created` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `workers20190711` +-- + +DROP TABLE IF EXISTS `workers20190711`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workers20190711` ( + `person_id` int(11) NOT NULL DEFAULT '0', + `business_id` int(11) NOT NULL DEFAULT '0', + `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `Fecha_Inicio` date DEFAULT NULL, + `Fecha_Fin` date DEFAULT NULL, + `departamento` varchar(45) COLLATE utf8_unicode_ci NOT NULL, + `Jornada_Semanal` smallint(6) DEFAULT NULL, + `Codigo_Contrato` int(11) DEFAULT NULL, + `userFk` int(11) NOT NULL, + PRIMARY KEY (`person_id`), + UNIQUE KEY `userFk_UNIQUE` (`userFk`), + UNIQUE KEY `nif_UNIQUE` (`nif`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workers20190711_FichadasAbril` +-- + +DROP TABLE IF EXISTS `workers20190711_FichadasAbril`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workers20190711_FichadasAbril` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `person_id` int(11) NOT NULL DEFAULT '0', + `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `Fecha` date DEFAULT NULL, + `Hora` int(2) DEFAULT NULL, + `Minuto` int(2) DEFAULT NULL, + `sumable` double DEFAULT NULL, + `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workers20190711_FichadasJulio11` +-- + +DROP TABLE IF EXISTS `workers20190711_FichadasJulio11`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workers20190711_FichadasJulio11` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `person_id` int(11) NOT NULL DEFAULT '0', + `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `Fecha` date DEFAULT NULL, + `Hora` int(2) DEFAULT NULL, + `Minuto` int(2) DEFAULT NULL, + `sumable` double DEFAULT NULL, + `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workers20190711_FichadasJunio` +-- + +DROP TABLE IF EXISTS `workers20190711_FichadasJunio`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workers20190711_FichadasJunio` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `person_id` int(11) NOT NULL DEFAULT '0', + `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `Fecha` date DEFAULT NULL, + `Hora` int(2) DEFAULT NULL, + `Minuto` int(2) DEFAULT NULL, + `sumable` double DEFAULT NULL, + `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workers20190711_FichadasMayo` +-- + +DROP TABLE IF EXISTS `workers20190711_FichadasMayo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workers20190711_FichadasMayo` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `person_id` int(11) NOT NULL DEFAULT '0', + `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `Fecha` date DEFAULT NULL, + `Hora` int(2) DEFAULT NULL, + `Minuto` int(2) DEFAULT NULL, + `sumable` double DEFAULT NULL, + `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workers20190711_FichadasOctubre` +-- + +DROP TABLE IF EXISTS `workers20190711_FichadasOctubre`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workers20190711_FichadasOctubre` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `person_id` int(11) NOT NULL DEFAULT '0', + `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `Fecha` date DEFAULT NULL, + `Hora` int(2) DEFAULT NULL, + `Minuto` int(2) DEFAULT NULL, + `sumable` double DEFAULT NULL, + `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workers20190711_Garrote` +-- + +DROP TABLE IF EXISTS `workers20190711_Garrote`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workers20190711_Garrote` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `person_id` int(11) NOT NULL DEFAULT '0', + `nif` varchar(15) CHARACTER SET utf8 DEFAULT NULL, + `Apellidos` varchar(60) CHARACTER SET utf8 NOT NULL, + `Nombre` varchar(20) CHARACTER SET utf8 DEFAULT NULL, + `Fecha` date DEFAULT NULL, + `Hora` int(2) DEFAULT NULL, + `Minuto` int(2) DEFAULT NULL, + `sumable` double DEFAULT NULL, + `jornada` decimal(5,2) NOT NULL DEFAULT '8.00', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `workingHours` +-- + +DROP TABLE IF EXISTS `workingHours`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `workingHours` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `timeIn` datetime NOT NULL, + `timeOut` datetime DEFAULT NULL, + `userId` int(10) unsigned NOT NULL, + 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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena horas de Entrada y de Salida del personal'; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`workingHoursBeforeInsert` + BEFORE INSERT ON `workingHours` + FOR EACH ROW +BEGIN + IF (SELECT COUNT(*) FROM workingHours WHERE userId = NEW.userId AND DATE(timeIn) = CURDATE()) > 0 THEN + CALL util.throw ('ALREADY_LOGGED'); + 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 `zone` +-- + +DROP TABLE IF EXISTS `zone`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zone` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(45) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, + `hour` datetime NOT NULL, + `warehouseFk__` smallint(6) unsigned DEFAULT NULL, + `agencyModeFk` int(11) NOT NULL, + `travelingDays` int(11) NOT NULL DEFAULT '1', + `price` double NOT NULL DEFAULT '0', + `bonus` double NOT NULL DEFAULT '0', + `isVolumetric` tinyint(1) NOT NULL DEFAULT '0', + `inflation` decimal(5,2) NOT NULL DEFAULT '1.00', + `m3Max` decimal(10,2) unsigned DEFAULT NULL, + `itemMaxSize` int(11) DEFAULT NULL COMMENT 'tamaño maximo de los articulos que esa ruta puede transportar', + `code` varchar(45) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `fk_zone_1_idx` (`warehouseFk__`), + KEY `fk_zone_2_idx` (`agencyModeFk`), + KEY `zone_name_idx` (`name`), + CONSTRAINT `fk_zone_1` FOREIGN KEY (`warehouseFk__`) REFERENCES `warehouse` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `fk_zone_2` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDBDEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneAgencyMode` +-- + +DROP TABLE IF EXISTS `zoneAgencyMode`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneAgencyMode` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `agencyModeFk` int(11) NOT NULL, + `zoneFk` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `zoneAgencyMode_UN` (`agencyModeFk`,`zoneFk`), + KEY `zoneAgencyMode_FK_1` (`zoneFk`), + CONSTRAINT `zoneAgencyMode_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `zoneAgencyMode_FK_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='junta agencias con zonas para que al enrutar se puedan proponer tickets.'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneClosure` +-- + +DROP TABLE IF EXISTS `zoneClosure`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneClosure` ( + `zoneFk` int(11) NOT NULL, + `dated` date NOT NULL, + `hour` time NOT NULL, + PRIMARY KEY (`zoneFk`,`dated`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneConfig` +-- + +DROP TABLE IF EXISTS `zoneConfig`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneConfig` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `scope` int(10) unsigned NOT NULL, + `forwardDays` int(10) NOT NULL DEFAULT '7' COMMENT 'days forward to show zone_upcomingDeliveries', + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `zoneEstimatedDelivery` +-- + +DROP TABLE IF EXISTS `zoneEstimatedDelivery`; +/*!50001 DROP VIEW IF EXISTS `zoneEstimatedDelivery`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `zoneEstimatedDelivery` ( + `zoneFk` tinyint NOT NULL, + `hourTheoretical` tinyint NOT NULL, + `totalVolume` tinyint NOT NULL, + `remainingVolume` tinyint NOT NULL, + `speed` tinyint NOT NULL, + `hourEffective` tinyint NOT NULL, + `minutesLess` tinyint NOT NULL, + `etc` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Table structure for table `zoneEvent` +-- + +DROP TABLE IF EXISTS `zoneEvent`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneEvent` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `zoneFk` int(11) NOT NULL, + `type` enum('day','indefinitely','range') NOT NULL, + `dated` date DEFAULT NULL, + `started` date DEFAULT NULL, + `ended` date DEFAULT NULL, + `weekDays` set('mon','tue','wed','thu','fri','sat','sun') NOT NULL, + `hour` datetime DEFAULT NULL, + `travelingDays` int(11) DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, + `bonus` decimal(10,2) DEFAULT NULL, + `m3Max` decimal(10,2) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `zoneFk` (`zoneFk`,`type`,`dated`), + CONSTRAINT `zoneEvent_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneExclusion` +-- + +DROP TABLE IF EXISTS `zoneExclusion`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneExclusion` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `zoneFk` int(11) NOT NULL, + `dated` date NOT NULL, + `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `userFk` int(11) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `zoneFk_2` (`zoneFk`,`dated`), + KEY `zoneFk` (`zoneFk`), + CONSTRAINT `zoneExclusion_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BI` + BEFORE INSERT ON `zoneExclusion` + FOR EACH ROW +BEGIN + + SET NEW.userFk = account.myUser_getId(); + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneExclusion_BU` + BEFORE UPDATE ON `zoneExclusion` + FOR EACH ROW +BEGIN + + SET NEW.userFk = account.myUser_getId(); + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; + +-- +-- Table structure for table `zoneFilter` +-- + +DROP TABLE IF EXISTS `zoneFilter`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneFilter` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `zoneFk` int(11) NOT NULL, + `sizeMax` int(11) DEFAULT NULL COMMENT 'altura máxima en cm', + `itemTypeFk` smallint(5) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `zoneFilter_FK` (`zoneFk`), + KEY `zoneFilter_FK_1` (`itemTypeFk`), + CONSTRAINT `zoneFilter_FK` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `zoneFilter_FK_1` FOREIGN KEY (`itemTypeFk`) REFERENCES `itemType` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='recoge los parámetros para filtrar determinados productos según la zona'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneGeo` +-- + +DROP TABLE IF EXISTS `zoneGeo`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneGeo` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `type` set('country','province','town','postCode','autonomy') CHARACTER SET utf8 NOT NULL, + `name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, + `parentFk` int(10) unsigned DEFAULT NULL, + `path` varchar(255) 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, + PRIMARY KEY (`id`), + KEY `lft_rgt_depth_idx` (`lft`,`rgt`,`depth`), + KEY `name_idx` (`name`), + KEY `parentFk` (`parentFk`), + KEY `path` (`path`) +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneGeo_beforeInsert` + BEFORE INSERT ON `zoneGeo` + FOR EACH ROW +BEGIN + CALL zoneGeo_checkName(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 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`zoneGeo_beforeUpdate` + BEFORE UPDATE ON `zoneGeo` + FOR EACH ROW +BEGIN + IF !(OLD.`name` <=> NEW.`name`) THEN + CALL zoneGeo_checkName(NEW.`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 */ ; + +-- +-- Table structure for table `zoneGeoRecalc` +-- + +DROP TABLE IF EXISTS `zoneGeoRecalc`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneGeoRecalc` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `isChanged` tinyint(4) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDBDEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneIncluded` +-- + +DROP TABLE IF EXISTS `zoneIncluded`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneIncluded` ( + `zoneFk` int(11) NOT NULL, + `geoFk` int(11) NOT NULL, + `isIncluded` tinyint(1) DEFAULT NULL, + PRIMARY KEY (`zoneFk`,`geoFk`), + KEY `geoFk_idx` (`geoFk`), + CONSTRAINT `zoneFk2` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `zoneGeoFk2` FOREIGN KEY (`geoFk`) REFERENCES `zoneGeo` (`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 `zoneLog` +-- + +DROP TABLE IF EXISTS `zoneLog`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneLog` ( + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `originFk` int(10) NOT NULL, + `userFk` int(10) unsigned DEFAULT NULL, + `action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL, + `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `description` text CHARACTER SET utf8, + `changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + `oldInstance` text COLLATE utf8_unicode_ci, + `newInstance` text COLLATE utf8_unicode_ci, + `changedModelId` int(11) DEFAULT NULL, + `changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `originFk` (`originFk`), + KEY `userFk` (`userFk`), + CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zonePromo__` +-- + +DROP TABLE IF EXISTS `zonePromo__`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zonePromo__` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `zoneFk` int(11) NOT NULL, + `dated` date NOT NULL, + `amount` decimal(10,2) NOT NULL, + `isDone` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `zonePromo_fk1_idx` (`zoneFk`), + CONSTRAINT `zonePromo_fk1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `zoneWarehouse` +-- + +DROP TABLE IF EXISTS `zoneWarehouse`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `zoneWarehouse` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `zoneFk` int(11) NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `zoneFk` (`zoneFk`,`warehouseFk`), + KEY `warehouseFk` (`warehouseFk`), + CONSTRAINT `zoneWarehouse_fk_warehouse` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE, + CONSTRAINT `zoneWarehouse_ibfk_1` FOREIGN KEY (`zoneFk`) REFERENCES `zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Temporary table structure for view `zone_ETD__` +-- + +DROP TABLE IF EXISTS `zone_ETD__`; +/*!50001 DROP VIEW IF EXISTS `zone_ETD__`*/; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8; +/*!50001 CREATE TABLE `zone_ETD__` ( + `zoneFk` tinyint NOT NULL, + `HoraTeórica` tinyint NOT NULL, + `volumenTotal` tinyint NOT NULL, + `volumenPendiente` tinyint NOT NULL, + `velocidad` tinyint NOT NULL, + `HoraPráctica` tinyint NOT NULL, + `minutesLess` tinyint NOT NULL, + `etc` tinyint NOT NULL +) ENGINE=MyISAM */; +SET character_set_client = @saved_cs_client; + +-- +-- Dumping events for database 'vn' +-- +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +/*!50106 DROP EVENT IF EXISTS `department_doCalc` */; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `department_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-11-15 00:00:00' ON COMPLETION PRESERVE ENABLE DO CALL vn.department_doCalc */ ;; +/*!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 `envialiaThreHoldChecker` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `envialiaThreHoldChecker` ON SCHEDULE EVERY 1 DAY STARTS '2022-01-28 09:52:46' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN + DECLARE vActualNumber BIGINT; + DECLARE vEndRange BIGINT; + DECLARE vIsAlreadyNotified BOOLEAN; + DECLARE vNotificationThrehold INT; + + SELECT actualNumber, endRange, isAlreadyNotified, notificationThrehold + INTO vActualNumber, vEndRange, vIsAlreadyNotified, vNotificationThrehold + FROM envialiaConfig; + + IF (vActualNumber+vNotificationThrehold) >= vEndRange AND + vIsAlreadyNotified = FALSE + THEN + CALL mail_insert( + 'cau@verdnatura.es', + NULL, + 'Hablar con envialia, acercandonos al numero final del rango permitido para las etiquetas', + CONCAT('Numero actual: ', vActualNumber, ' , numero final: ',vEndRange) + ); + UPDATE envialiaConfig SET isAlreadyNotified = TRUE; + END IF; + + IF (vActualNumber+vNotificationThrehold) < vEndRange AND + vIsAlreadyNotified = TRUE + THEN + UPDATE envialiaConfig SET isAlreadyNotified = FALSE; + END IF; + +END */ ;; +/*!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 `mysqlConnectionsSorter_kill` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `mysqlConnectionsSorter_kill` ON SCHEDULE EVERY 1 MINUTE STARTS '2021-10-28 09:56:27' ON COMPLETION NOT PRESERVE ENABLE DO CALL mysqlConnectionsSorter_kill() */ ;; +/*!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 `printQueue_check` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2022-01-28 09:52:46' ON COMPLETION PRESERVE ENABLE DO BEGIN + + DECLARE vCurrentCount INT; + DECLARE vCheckSum INT; + DECLARE vIsAlreadyNotified BOOLEAN; + DECLARE vTableQueue TEXT; + DECLARE vLineQueue TEXT; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vCur CURSOR FOR + SELECT CONCAT(' + ', IFNULL(pq.id, ''), ' + ', IFNULL(p.path, ''),' + ', IFNULL(lr.name, ''),' + ', IFNULL(e.Estado, ''),' + ', IFNULL(w.firstname, ''), " ", IFNULL(w.lastName, ''),' + ', IFNULL(pq.`error`, ''),' + ') + FROM vn.printingQueue pq + LEFT JOIN vn.worker w ON w.id = pq.worker + LEFT JOIN vn.printer p ON p.id = pq.printer + LEFT JOIN vn.labelReport lr ON lr.id = pq.report + JOIN vn2008.Estados e ON e.Id_Estado = pq.state + LIMIT 30; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum + FROM vn.printingQueue WHERE state = 1; + + SELECT isAlreadyNotified INTO vIsAlreadyNotified + FROM printingQueueCheck; + + IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND + (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND + vIsAlreadyNotified = FALSE AND vCurrentCount > 0 + THEN + + SELECT ' + + + + + + + + ' INTO vTableQueue; + + OPEN vCur; + + l: LOOP + + SET vDone = FALSE; + + FETCH vCur INTO vLineQueue; + + IF vDone THEN + LEAVE l; + END IF; + + SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue; + + END LOOP; + + CLOSE vCur; + + CALL mail_insert( + 'cau@verdnatura.es', + NULL, + 'Servidor de impresion parado', + CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '
Id ColaRuta ImpresoraInformeEstadoTrabajadorError
') + ); + + UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; + END IF; + + IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND + vIsAlreadyNotified = TRUE + THEN + UPDATE printingQueueCheck SET isAlreadyNotified = FALSE; + END IF; + + UPDATE printingQueueCheck + SET lastCount = vCurrentCount, + lastCheckSum = vCheckSum; + +END */ ;; +/*!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 `route_doRecalc` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `route_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2021-07-08 07:32:23' ON COMPLETION PRESERVE ENABLE DO CALL route_doRecalc */ ;; +/*!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 `sale_checkWithoutComponents` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `sale_checkWithoutComponents` ON SCHEDULE EVERY 10 MINUTE STARTS '2020-05-04 11:56:23' ON COMPLETION PRESERVE DISABLE DO call sale_checkNoComponents(DATE_ADD(NOW(), INTERVAL -10 MINUTE),DATE_ADD(NOW(), INTERVAL -1 MINUTE)) */ ;; +/*!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 `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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticketClosure` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-18 00:30:00' ON COMPLETION NOT PRESERVE DISABLE 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 */ ;; +/*!50106 DROP EVENT IF EXISTS `ticket_doRecalc` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ticket_doRecalc` ON SCHEDULE EVERY 10 SECOND STARTS '2022-01-28 09:29:18' ON COMPLETION PRESERVE ENABLE DO CALL ticket_doRecalc */ ;; +/*!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 `travel_doRecalc` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `travel_doRecalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-05-17 10:52:29' ON COMPLETION PRESERVE ENABLE DO CALL travel_doRecalc */ ;; +/*!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 `workerTimeControl_sendMail` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `workerTimeControl_sendMail` ON SCHEDULE EVERY 1 WEEK STARTS '2020-11-25 08:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN + DECLARE vWeek,vYear INT; + + SELECT week,year INTO vWeek,vYear + FROM vn.time + WHERE dated IN (DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY)) + GROUP BY year,week + LIMIT 1; + + CALL vn.workerTimeControl_sendMail(vWeek, vYear, NULL); +END */ ;; +/*!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 `zoneGeo_doCalc` */;; +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_unicode_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; +/*!50003 SET @saved_time_zone = @@time_zone */ ;; +/*!50003 SET time_zone = 'SYSTEM' */ ;; +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `zoneGeo_doCalc` ON SCHEDULE EVERY 15 SECOND STARTS '2019-09-13 15:30:47' ON COMPLETION PRESERVE ENABLE DO CALL vn.zoneGeo_doCalc */ ;; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 `address_getGeo` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `address_getGeo`(vSelf INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Returns the geo for the passed address. + * + * @param vSelf The address id + * @return The geo id + */ + DECLARE vGeoFk INT; + + SELECT p.geoFk INTO vGeoFk + FROM address a + JOIN town t ON t.provinceFk = a.provinceFk + JOIN postCode p ON p.townFk = t.id AND p.`code` = a.postalCode + WHERE a.id = vSelf + ORDER BY (a.city SOUNDS LIKE t.`name`) DESC + LIMIT 1; + + RETURN vGeoFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `barcodeToItem` */; +/*!50003 SET @saved_cs_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`@`localhost` FUNCTION `barcodeToItem`(vBarcode VARCHAR(22)) RETURNS int(11) + DETERMINISTIC +BEGIN + +/** + * Obtiene el id del artículo + * + * @param vBarcode código de barras + * + * return id del item + */ + + DECLARE vItemFk INT; + + SELECT id INTO vItemFk + FROM vn.item + WHERE id = vBarcode OR comment = vBarcode + LIMIT 1; + + IF vItemFk THEN + RETURN vItemFk; + END IF; + + SELECT itemFk INTO vItemFk + FROM buy + WHERE id = vBarcode; + + IF vItemFk THEN + RETURN vItemFk; + END IF; + + SELECT itemFk INTO vItemFk + FROM itemBarcode + WHERE code = vBarcode; + + IF vItemFk THEN + RETURN vItemFk; + END IF; + + SELECT i.id INTO vItemFk + FROM vn.item i + WHERE i.name LIKE CONCAT('%',vBarcode,'%') + ORDER BY i.id ASC + LIMIT 1; + + RETURN vItemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `bionicCalcReverse__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `bionicCalcReverse__`(vWarehouse INT, + vMargin DECIMAL(10,3), + vRetailedPrice DECIMAL(10,3), + vM3 DECIMAL(10,3), + vAddress INT, + vAgencyMode INT) RETURNS decimal(10,3) + DETERMINISTIC +BEGIN + + -- OBSOLETO usar catalog_componentReverse JGF 2020-02-26 + DECLARE vGeneralInflationCoeficient INT; + DECLARE vVerdnaturaVolumeBox BIGINT; + DECLARE vClientFk INT; + DECLARE vComponentRecovery VARCHAR(50) DEFAULT 'debtCollection'; + DECLARE vComponentMana VARCHAR(50) DEFAULT 'autoMana'; + DECLARE vComponentPort VARCHAR(50) DEFAULT 'delivery'; + DECLARE vComponentMargin VARCHAR(50) DEFAULT 'margin'; + DECLARE vComponentCost VARCHAR(50) DEFAULT 'purchaseValue'; + DECLARE vComponentCostValue DECIMAL(10,2); + DECLARE vItem INT DEFAULT 98; + DECLARE vItemCarryBox INT; + + CALL util.throw('Obsoleto hablar con Informática'); + + SELECT generalInflationCoeFicient, verdnaturaVolumeBox, itemCarryBox + INTO vGeneralInflationCoeficient, vVerdnaturaVolumeBox, vItemCarryBox + FROM bionicConfig; + + SELECT clientFk INTO vClientFk FROM address WHERE id = vAddress; + + -- Creamos la tabla tmp.bionicComponent + DROP TEMPORARY TABLE IF EXISTS tmp.bionicComponent; + CREATE TEMPORARY TABLE tmp.bionicComponent( + `warehouseFk` smallint(5) unsigned NOT NULL, + `itemFk` int(11) NOT NULL, + `componentFk` int(10) unsigned NOT NULL, + `value` decimal(10,4) NOT NULL, + UNIQUE KEY `itemWarehouseComponent` (`itemFk`,`warehouseFk`,`componentFk`) USING HASH, + KEY `itemWarehouse` (`itemFk`,`warehouseFk`) USING BTREE + ) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + -- Margin + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, id, vMargin + FROM component + WHERE code = vComponentMargin; + + -- Recobro + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, c.id, ROUND(LEAST(cr.recobro,0.25), 3) + FROM bi.claims_ratio cr + JOIN component c ON c.code = vComponentRecovery + WHERE cr.Id_Cliente = vClientFk AND cr.recobro > 0.009; + + -- Componente de maná automático, en función del maná acumulado por el comercial. + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, co.id, ROUND(ms.prices_modifier_rate, 3) + FROM client c + JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador + JOIN component co ON co.code = vComponentMana + WHERE ms.prices_modifier_activated AND c.id = vClientFk LIMIT 1; + + -- Reparto + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, co.id, vGeneralInflationCoeficient + * ROUND( + vM3 + * az.price + * az.inflation + / vVerdnaturaVolumeBox, 4 + ) + FROM agencyMode ag + JOIN address a ON a.id = vAddress AND ag.id = vAgencyMode + JOIN agencyProvince ap ON ap.agencyFk = ag.agencyFk + AND ap.warehouseFk = vWarehouse AND ap.provinceFk = a.provinceFk + JOIN agencyModeZone az ON az.agencyModeFk = vAgencyMode + AND az.zone = ap.zone AND az.itemFk = 71 AND az.warehouseFk = vWarehouse + JOIN component co ON co.code = vComponentPort; + + -- Coste + SELECT vRetailedPrice - SUM(`value`) INTO vComponentCostValue + FROM tmp.bionicComponent; + + INSERT INTO tmp.bionicComponent (warehouseFk, itemFk, componentFk, `value`) + SELECT vWarehouse, vItem, id,vComponentCostValue + FROM component + WHERE code = vComponentCost; + + RETURN vComponentCostValue; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `botanicExport_isUpdatable` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `botanicExport_isUpdatable`(vEdiGenusFk MEDIUMINT,vEdiSpecieFk MEDIUMINT, + vCountryFk MEDIUMINT,vRestriction MEDIUMINT) RETURNS int(11) + DETERMINISTIC +BEGIN + DECLARE vIsUpdatable INTEGER; + SELECT COUNT(*) INTO vIsUpdatable + FROM botanicExport + WHERE ediGenusFk = vEdiGenusFk + AND (vEdiSpecieFk = ediSpecieFk OR IFNULL(vEdiSpecieFk,ediSpecieFk) IS NULL) + AND (vCountryFk = countryFk OR IFNULL(vCountryFk,countryFk) IS NULL) + AND vRestriction = restriction; +RETURN vIsUpdatable; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `buy_getUnitVolume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getUnitVolume`(vSelf INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Calculates the unit volume occupied by a buy. + * + * @param vSelf The buy id + * @return The unit volume in cubic centimeters + */ + DECLARE vItem INT; + DECLARE vPackaging VARCHAR(10); + DECLARE vPacking INT; + + SELECT itemFk, packageFk, packing + INTO vItem, vPackaging, vPacking + FROM buy + WHERE id = vSelf; + + RETURN IFNULL(ROUND(item_getVolume(vItem, vPackaging) / vPacking), 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 FUNCTION IF EXISTS `buy_getVolume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `buy_getVolume`(vSelf INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Calculates the volume occupied by a buy. + * + * @param vSelf The buy id + * @return The volume in cubic centimeters + */ + DECLARE vItem INT; + DECLARE vPackaging VARCHAR(10); + + SELECT itemFk, packageFk INTO vItem, vPackaging + FROM buy + WHERE id = vSelf; + + RETURN item_getVolume(vItem, vPackaging); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `buy_hasNotifyPassport__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `buy_hasNotifyPassport__`(vBuyFk INT, vItemFk INT) RETURNS tinyint(1) + READS SQL DATA +BEGIN + DECLARE vHasPassport BOOL; + DECLARE vIsAlreadySent BOOL; + DECLARE vItemCategoryFk INT; + SELECT id INTO vItemCategoryFk FROM itemCategory WHERE code = 'plant'; + + SELECT COUNT(*) INTO vHasPassport + FROM botanicExport be + JOIN itemBotanical ib + ON be.ediGenusFk = ib.genusFk + AND IFNULL(be.ediSpecieFk, ib.specieFk) = ib.specieFk + AND be.`code` = 'phytosanitaryPassport' + JOIN item i ON i.id = ib.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE ib.itemFk = vItemFk + AND it.categoryFk = vItemCategoryFk; + + IF vHasPassport THEN + SELECT COUNT(*) INTO vIsAlreadySent + FROM mail m + JOIN buy b ON b.id = vBuyFk + WHERE m.`body` LIKE CONCAT('%', b.ektFk, '%') + LIMIT 1; + END IF; + + RETURN vHasPassport AND NOT vIsAlreadySent; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `catalog_componentReverse` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `catalog_componentReverse`(vWarehouse INT, + vCost DECIMAL(10,3), + vM3 DECIMAL(10,3), + vAddressFk INT, + vZoneFk INT) RETURNS decimal(10,3) + DETERMINISTIC +BEGIN + /* Calcula los componentes para un cliente a partir de un coste y volumen + * @param vWarehouse + * @param vCost Valor de coste del articulo + * @param vM3 m3 del articulo + * @param vAddressFk + * @param vZoneFk + * @return vRetailedPrice precio de venta sin iva + * @return tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) + */ + + DECLARE vBoxVolume BIGINT; + DECLARE vCustomer INT; + DECLARE vComponentRecovery INT DEFAULT 17; + DECLARE vComponentMana INT DEFAULT 39; + DECLARE vDeliveryComponent INT DEFAULT 15; + DECLARE vComponentMargin INT DEFAULT 29; + DECLARE vComponentCost INT DEFAULT 28; + DECLARE vRetailedPrice DECIMAL(10,2); + DECLARE vItem INT DEFAULT 98; + + SELECT volume INTO vBoxVolume + FROM vn.packaging + WHERE id = '94'; + + SELECT clientFk INTO vCustomer FROM address WHERE id = vAddressFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.catalog_component; + CREATE TEMPORARY TABLE tmp.catalog_component ( + `warehouseFk` INT UNSIGNED NOT NULL, + `itemFk` INT NOT NULL, + `componentFk` INT UNSIGNED NOT NULL, + `cost` DECIMAL(10,4) NOT NULL, + INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), + UNIQUE INDEX `itemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC)); + + -- Cost + INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) + SELECT vWarehouse, vItem, vComponentCost, vCost + FROM vn.rate + WHERE dated <= CURDATE() + AND warehouseFk = vWarehouse + ORDER BY dated DESC + LIMIT 1; + + -- Margen + -- No se aplica margen, cau 12589 +/* INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) + SELECT vWarehouse, vItem, vComponentMargin, (vCost / ((100 - rate2) / 100)) - vCost + FROM vn.rate + WHERE dated <= CURDATE() + AND warehouseFk = vWarehouse + ORDER BY dated DESC + LIMIT 1; + */ + -- Recobro + INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) + SELECT vWarehouse, vItem, vComponentRecovery, ROUND(LEAST(recobro,0.25), 3) + FROM bi.claims_ratio + WHERE Id_Cliente = vCustomer AND recobro > 0.009; + + -- Componente de maná automático, en función del maná acumulado por el comercial. + INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) + SELECT vWarehouse, vItem, vComponentMana, ROUND(prices_modifier_rate, 3) + FROM client c + JOIN bs.mana_spellers ms ON c.salesPersonFk = ms.Id_Trabajador + WHERE ms.prices_modifier_activated AND c.id = vCustomer LIMIT 1; + + -- Reparto + INSERT INTO tmp.catalog_component (warehouseFk, itemFk, componentFk, cost) + SELECT vWarehouse, vItem, vDeliveryComponent, + ROUND( + vM3 + * (z.price - z.bonus) + * z.inflation + / vBoxVolume, 4 + ) + FROM zone z + WHERE z.id = vZoneFk; + + -- Precio de venta + SELECT SUM(cost) INTO vRetailedPrice + FROM tmp.catalog_component; + + RETURN vRetailedPrice; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientGetDebt` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetDebt`(`vClient` INT, `vDate` DATE) RETURNS decimal(10,2) + READS SQL DATA +BEGIN +/** + * Devuelve el saldo de un cliente. + * + * @param vClient Identificador 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); + DECLARE vHasDebt BOOLEAN; + + SELECT COUNT(*) INTO vHasDebt + FROM `client` c + WHERE c.id = vClient AND c.typeFk = 'normal'; + + IF NOT vHasDebt THEN + RETURN 0; + END IF; + + SET vDate = IFNULL(vDate, CURDATE()); + + SET vDateIni = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET vDateEnd = TIMESTAMP(vDate, '23:59:59'); + + SELECT IFNULL(SUM(t.amount), 0) INTO vDebt + FROM ( + SELECT SUM(IFNULL(totalWithVat,0)) amount + FROM ticket + WHERE clientFk = vClient + AND refFk IS NULL + AND shipped BETWEEN vDateIni AND vDateEnd + UNION ALL + SELECT SUM(amountPaid) amount + FROM receipt + WHERE clientFk = vClient + AND payed > vDateEnd + UNION ALL + SELECT SUM(amount) + FROM clientRisk + WHERE clientFk = vClient + UNION ALL + SELECT CAST(-SUM(amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction + WHERE clientFk = vClient + AND receiptFk IS NULL + AND `status` = 'ok' + ) t; + + 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 `clientGetMana` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetMana`(vClient INT) RETURNS decimal(10,2) + DETERMINISTIC +BEGIN +/** + * Devuelve el mana del cliente. + * + * @param vClient Id del cliente + * @return Mana del cliente + */ + DECLARE vMana DECIMAL(10,2); + DECLARE vFromDated DATE; + DECLARE vHasMana BOOLEAN; + DECLARE vManaComponent INT; + DECLARE vAutoManaComponent INT; + DECLARE vManaBank INT; + DECLARE vManaGreugeType INT; + + SELECT id INTO vManaGreugeType FROM greugeType WHERE code = 'mana'; + SELECT id INTO vManaBank FROM bank WHERE code = 'mana'; + SELECT id INTO vManaComponent FROM component WHERE code = 'mana'; + SELECT id INTO vAutoManaComponent FROM component WHERE code = 'autoMana'; + + SELECT COUNT(*) INTO vHasMana + FROM `client` c + WHERE c.id = vClient AND c.typeFk = 'normal'; + + IF NOT vHasMana THEN + RETURN 0; + END IF; + + SELECT max(dated) INTO vFromDated + FROM clientManaCache; + + SELECT sum(mana) INTO vMana + FROM + ( + SELECT mana + FROM clientManaCache + WHERE clientFk = vClient + AND dated = vFromDated + UNION ALL + SELECT s.quantity * value + FROM ticket t + JOIN address a ON a.id = t.addressFk + JOIN sale s on s.ticketFk = t.id + JOIN saleComponent sc on sc.saleFk = s.id + WHERE sc.componentFk IN (vManaComponent, vAutoManaComponent) + AND t.shipped > vFromDated + AND t.shipped < TIMESTAMPADD(DAY,1,CURDATE()) + AND a.clientFk = vClient + UNION ALL + SELECT - amountPaid + FROM receipt r + JOIN `client` c ON c.id = r.clientFk + WHERE r.bankFk = vManaBank + AND r.payed > vFromDated + AND r.payed <= CURDATE() + AND c.id = vClient + UNION ALL + SELECT g.amount + FROM greuge g + JOIN `client` c ON c.id = g.clientFk + WHERE g.greugeTypeFk = vManaGreugeType + AND g.shipped > vFromDated + AND g.shipped <= CURDATE() + AND c.id = vClient + ) sub; + RETURN IFNULL(vMana,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 FUNCTION IF EXISTS `clientGetSalesPerson` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * DEPRECATED: use client_getSalesPerson + **/ + RETURN client_getSalesPerson(vClientFk, vDated); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientTaxArea` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `clientTaxArea`(vClientId INT, vCompanyId INT) RETURNS varchar(25) CHARSET utf8 + READS SQL DATA +BEGIN +/** + * Devuelve el area de un cliente, + * intracomunitario, extracomunitario o nacional. + * + * @param vClient Id del cliente + * @param vCompanyFk Compañia desde la que se factura + * @return Código de area + */ + 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 = 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'; + END IF; + + 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 `client_getFromPhone` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `client_getFromPhone`(vPhone VARCHAR(255)) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Searchs a customer associated to the phone number. + * + * @param vPhone The phone number + * @return The client id or %NULL if not found + */ + DECLARE vClient INT DEFAULT NULL; + + -- SET vPhone = vPhone COLLATE 'utf8_unicode_ci'; + + DROP TEMPORARY TABLE IF EXISTS tClient; + CREATE TEMPORARY TABLE tClient + ENGINE = MEMORY + SELECT id clientFk + FROM `client` + WHERE phone = vPhone + OR mobile = vPhone + UNION + SELECT clientFk + FROM address + WHERE phone = vPhone + OR mobile = 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.clientFk INTO vClient + FROM tClient t + JOIN `client` c ON c.id = t.clientFk + WHERE c.isActive + LIMIT 1; + + DROP TEMPORARY TABLE tClient; + + 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 `client_getSalesPerson` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Dado un id cliente y una fecha, devuelve su comercial para ese dia, teniendo + * en cuenta la jerarquía de las tablas: 1º la de sharingclient, 2º la de + * sharingcart y tercero la de clientes. + * + * @param vClientFk El id del cliente + * @param vDated Fecha a comprobar + * @return El id del comercial para la fecha dada + **/ + DECLARE vSalesPersonFk INT DEFAULT NULL; + DECLARE vWorkerSubstituteFk INT DEFAULT NULL; + DECLARE vLoop BOOLEAN; + + -- Obtiene el comercial original y el de sharingclient + + SELECT c.salesPersonFk, s.workerFk + INTO vSalesPersonFk, vWorkerSubstituteFk + FROM client c + LEFT JOIN sharingClient s + ON c.id = s.clientFk + AND vDated BETWEEN s.started AND s.ended + WHERE c.id = vClientFk + ORDER BY s.id + LIMIT 1; + + -- Si no hay ninguno en sharingclient busca en sharingcart + + IF vWorkerSubstituteFk IS NOT NULL + THEN + SET vSalesPersonFk = vWorkerSubstituteFk; + ELSEIF vSalesPersonFk IS NOT NULL + THEN + DROP TEMPORARY TABLE IF EXISTS tmp.stack; + CREATE TEMPORARY TABLE tmp.stack + (INDEX (substitute)) + ENGINE = MEMORY + SELECT vSalesPersonFk substitute; + + l: LOOP + SELECT workerSubstitute INTO vWorkerSubstituteFk + FROM sharingCart + WHERE curdate() BETWEEN started AND ended + AND workerFk = vSalesPersonFk + ORDER BY id + LIMIT 1; + + IF vWorkerSubstituteFk IS NULL THEN + LEAVE l; + END IF; + + SELECT COUNT(*) > 0 INTO vLoop + FROM tmp.stack WHERE substitute = vWorkerSubstituteFk; + + IF vLoop THEN + LEAVE l; + END IF; + + INSERT INTO tmp.stack SET + substitute = vWorkerSubstituteFk; + + SET vSalesPersonFk = vWorkerSubstituteFk; + END LOOP; + + DROP TEMPORARY TABLE tmp.stack; + END IF; + + RETURN vSalesPersonFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `client_getSalesPersonByTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonByTicket`(vTicketFk INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Dado un id ticket, devuelve su comercial. + * Para más información ir a client_getSalesPerson() + * + * @param vClientFk El id del cliente + * @param vDated Fecha a comprobar + * @return El id del comercial para la fecha dada + **/ + DECLARE vClientFk INT; + DECLARE vDated DATE; + + SELECT clientFk, shipped + INTO vClientFk, vDated + FROM ticket WHERE id = vTicketFk; + + RETURN client_getSalesPerson(vClientFk, vDated); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `client_getSalesPersonCode` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonCode`(vClientFk INT, vDated DATE) RETURNS varchar(3) CHARSET utf8 + DETERMINISTIC +BEGIN +/** + * Dado un id cliente y una fecha, devuelve su comercial. + * Para más información ir a client_getSalesPerson() + * + * @param vClientFk El id del cliente + * @param vDated Fecha a comprobar + * @return El código del comercial para la fecha dada + **/ + DECLARE vWorkerCode CHAR(3); + DECLARE vSalesPersonFk INT; + + SET vSalesPersonFk = client_getSalesPerson(vClientFk, vDated); + + SELECT code + INTO vWorkerCode + FROM worker + WHERE id = vSalesPersonFk; + + RETURN vWorkerCode; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `client_getSalesPersonCodeByTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `client_getSalesPersonCodeByTicket`(vTicketFk INT) RETURNS varchar(3) CHARSET utf8 + DETERMINISTIC +BEGIN +/** + * Dado un id ticket, devuelve su comercial. + * Para más información ir a client_getSalesPerson() + * + * @param vClientFk El id del cliente + * @param vDated Fecha a comprobar + * @return El código del comercial para la fecha dada + **/ + DECLARE vClientFk INT; + DECLARE vDated DATE; + + SELECT clientFk, shipped + INTO vClientFk, vDated + FROM ticket WHERE id = vTicketFk; + + RETURN client_getSalesPersonCode(vClientFk, vDated); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collectionExpeditionLacks` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `collectionExpeditionLacks`(vCollectionFk INT) RETURNS varchar(100) CHARSET utf8 COLLATE utf8_unicode_ci + DETERMINISTIC +BEGIN + + DECLARE vExpeditionLacks BOOL; + DECLARE vAnswer VARCHAR(100) DEFAULT ''; + + SELECT (COUNT(*) > 0) INTO vExpeditionLacks + FROM vn.ticketCollection tc + LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND ISNULL(e.id); + + IF vExpeditionLacks THEN + + SELECT CONCAT('Colección: ',tc.collectionFk,' Tickets: ' , GROUP_CONCAT(tc.ticketFk) ) INTO vAnswer + FROM vn.ticketCollection tc + LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND ISNULL(e.id); + + END IF; + + RETURN vAnswer; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `currentRate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `currentRate`(vCurrencyFk INT, vDated DATE) RETURNS decimal(10,4) + READS SQL DATA +BEGIN + + DECLARE curRate DECIMAL(10,4); + + SELECT value INTO curRate + FROM referenceRate + WHERE dated <= vDated + AND currencyFk = vCurrencyFk + ORDER BY dated DESC + LIMIT 1; + +RETURN curRate; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `deviceProductionUser_accessGranted` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `deviceProductionUser_accessGranted`(vUserFK INT(10) , android_id VARCHAR(50)) RETURNS tinyint(1) + DETERMINISTIC +BEGIN + /* + * Comprueba si el usuario puede entrar en la aplicacion de almacen con ese movil + * + * */ + + /*DECLARE vIsGranted BOOLEAN; + DECLARE vDeviceProductionFk INT(11) DEFAULT NULL; + + SELECT dp.id INTO vDeviceProductionFk + FROM vn.deviceProduction dp + WHERE dp.android_id = android_id; + + IF vDeviceProductionFk THEN + + SELECT COUNT(*) INTO vIsGranted + FROM vn.deviceProductionUser dpu + WHERE dpu.userFk = vUserFK + AND dpu.deviceProductionFk = vDeviceProductionFk; + + RETURN vIsGranted; + END IF;*/ + RETURN 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 FUNCTION IF EXISTS `duaTax_getRate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `duaTax_getRate`(vDua INT, vTaxClass INT) RETURNS decimal(5,2) + DETERMINISTIC +BEGIN + DECLARE vCountryFk INTEGER; + + SELECT s.countryFk INTO vCountryFk + FROM dua d + JOIN supplier s ON s.id = d.companyFk + WHERE d.id = vDua; + + RETURN (SELECT rate + FROM + (SELECT taxClassFk, rate + FROM invoiceInTaxBookingAccount + WHERE effectived <= CURDATE() + AND countryFk = vCountryFk + AND taxClassFk = vTaxClass + ORDER BY effectived DESC + ) ba1 + GROUP BY taxClassFk); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ekt_getEntry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getEntry`(vEktFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + /** + * Devuelve el numero de entrada para el ekt + * + * @param vEktFk Identificador de edi.ekt + */ + + DECLARE vTravelFk INT; + DECLARE vEntryFk INT DEFAULT 0; + DECLARE vEntryAssignFk INT; + + SET vTravelFk = vn.ekt_getTravel(vEktFk); + + IF vTravelFk THEN + + SELECT ea.id INTO vEntryAssignFk + FROM edi.ekt e + JOIN vn.travel tr ON tr.id = vTravelFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + AND IFNULL(ea.sub, e.sub) <=> e.sub + AND IFNULL(ea.kop, e.kop) <=> e.kop + AND IFNULL(ea.pro, e.pro) <=> e.pro + WHERE e.id = vEktFk + ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC + LIMIT 1; + + SELECT MAX(e.id) INTO vEntryFk + FROM vn.entry e + JOIN vn.ektEntryAssign ea ON ea.id = vEntryAssignFk + WHERE e.travelFk = vTravelFk + AND e.sub <=> ea.sub + AND e.kop <=> ea.kop + AND e.pro <=> ea.pro; + + + IF IFNULL(vEntryFk,0) = 0 THEN + + INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk, kop, sub, ref, pro) + SELECT vTravelFk, ea.supplierFk, c.id, cu.id, ea.kop, ea.sub, ea.ref, ea.pro + FROM vn.ektEntryAssign ea + JOIN vn.company c ON c.code = 'VNL' + JOIN vn.currency cu ON cu.code = 'EUR' + WHERE ea.id = vEntryAssignFk; + + SELECT MAX(id) INTO vEntryFk + FROM vn.entry + WHERE travelFk = vTravelFk; + + END IF; + + UPDATE vn.ektEntryAssign + SET entryFk = vEntryFk + WHERE id = vEntryAssignFk; + + ELSE + + SELECT ec.defaultEntry INTO vEntryFk + FROM vn.entryConfig ec; + + INSERT IGNORE INTO vn.entry(id) VALUES(vEntryFk); + + END IF; + + RETURN vEntryFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ekt_getTravel` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getTravel`(vEktFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + DECLARE vTravelFk INT; + DECLARE vEntryAssignFk INT; + + SELECT ea.id INTO vEntryAssignFk + FROM edi.ekt e + JOIN vn.ektEntryAssign ea ON IFNULL(ea.sub, e.sub) <=> e.sub + AND IFNULL(ea.kop, e.kop) <=> e.kop + AND IFNULL(ea.pro, e.pro) <=> e.pro + WHERE e.id = vEktFk + ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC + LIMIT 1; + + SELECT MAX(tr.id) INTO vTravelFk + FROM vn.travel tr + JOIN vn.ektEntryAssign ea ON ea.id = vEntryAssignFk + JOIN edi.ekt e ON e.id = vEktFk + WHERE ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + AND tr.landed = e.fec; + + /* + SELECT tr.id INTO vTravelFk + FROM vn.travel tr + JOIN edi.ekt e ON e.id = vEktFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + AND (ea.sub = e.sub OR ea.kop = e.kop OR ea.pro = e.pro) + AND tr.landed = e.fec + ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC + LIMIT 1; + */ + + + + IF NOT vTravelFk THEN + + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) + SELECT e.fec, e.fec, ea.warehouseInFk, ea.warehouseOutFk, ea.agencyModeFk + FROM edi.ekt e + JOIN vn.ektEntryAssign ea ON ea.kop = e.kop + WHERE e.id = vEktFk + ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC + LIMIT 1; + + SELECT MAX(id) INTO vTravelFk + FROM vn.travel tr + JOIN edi.ekt e ON e.id = vEktFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + AND IFNULL(ea.sub, e.sub) <=> e.sub + AND IFNULL(ea.kop, e.kop) <=> e.kop + AND IFNULL(ea.pro, e.pro) <=> e.pro + AND tr.landed = e.fec; + + END IF; + + RETURN vTravelFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entry_calcCommission__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_calcCommission__`( + vCurrentCommission INT, + vTravelFk INT, + vCurrencyFk INT +) RETURNS int(11) + READS SQL DATA +BEGIN + -- DEPRECATED: use entry_getComission + DECLARE vCommission INT; + + IF vCurrencyFk != 2 /* Dollar */ THEN + RETURN vCurrentCommission; + END IF; + + SELECT ROUND(-100 * (1 - (1 / r.rate))) INTO vCommission + FROM travel t + LEFT JOIN vn2008.reference_min r + ON r.moneda_id = vCurrencyFk AND r.`date` <= t.shipped + WHERE t.id = vTravelFk + ORDER BY r.`date` DESC + LIMIT 1; + + SET vCommission = IFNULL(vCommission, 0); + + RETURN vCommission; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entry_getCommission` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission`( + vTravelFk INT, + vCurrencyFk INT, + vSupplierFk INT +) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE vCommission INT; + DECLARE vCurrentCommission INT; + DECLARE vIsCurrencyUsd INT; + DECLARE vLastEntryFk INT; + + SELECT count(*) INTO vIsCurrencyUsd + FROM currency c + WHERE c.code = 'USD' AND id = vCurrencyFk; + + IF NOT vIsCurrencyUsd THEN + + SELECT e.id INTO vLastEntryFk + FROM vn.entry e + JOIN vn.travel tr ON tr.id = e.travelFk + WHERE e.supplierFk = vSupplierFk + ORDER BY tr.landed DESC + LIMIT 1; + + IF vLastEntryFk THEN + + SELECT commission INTO vCurrentCommission + FROM vn.entry + WHERE id = vLastEntryFk; + + ELSE + + SELECT commission INTO vCurrentCommission + FROM supplier s + WHERE s.id = vSupplierFk; + + END IF; + + RETURN vCurrentCommission; + + ELSE + + SELECT ROUND(-100 * (1 - (1 / r.value))) INTO vCommission + FROM travel t + LEFT JOIN referenceCurrent r ON r.currencyFk = vCurrencyFk AND r.`dated` <= t.shipped + WHERE t.id = vTravelFk + ORDER BY r.`dated` DESC + LIMIT 1; + + RETURN IFNULL(vCommission, 0); + + 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 FUNCTION IF EXISTS `entry_getCommission__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCommission__`( + vTravelFk INT, + vCurrencyFk INT, + vSupplierFk INT +) RETURNS int(11) + READS SQL DATA +BEGIN + -- bernat: working in this file + DECLARE vCommission INT; + DECLARE vCurrentCommission INT; + DECLARE vIsCurrencyUsd INT; + + SELECT count(*) INTO vIsCurrencyUsd + FROM currency c + WHERE c.code = 'USD' AND id = vCurrencyFk; + + IF NOT vIsCurrencyUsd THEN + SELECT commission INTO vCurrentCommission + FROM supplier s + WHERE s.id = vSupplierFk; + RETURN vCurrentCommission; + END IF; + + SELECT ROUND(-100 * (1 - (1 / r.rate))) INTO vCommission + FROM travel t + LEFT JOIN vn2008.reference_min r ON r.moneda_id = vCurrencyFk AND r.`date` <= t.shipped + WHERE t.id = vTravelFk + ORDER BY r.`date` DESC + LIMIT 1; + + RETURN IFNULL(vCommission, 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 FUNCTION IF EXISTS `entry_getCurrency` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getCurrency`( + vCurrency INT, + vSupplierFk INT +) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE vIsDollarAccount BOOL; + + SELECT account LIKE '___4______' INTO vIsDollarAccount + FROM vn.supplier WHERE id = vSupplierFk; + + IF vIsDollarAccount THEN + RETURN 2; + ELSE + RETURN vCurrency; + 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 FUNCTION IF EXISTS `entry_getForLogiflora` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `entry_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + /** + * Devuelve una entrada para Logiflora. Si no existe la crea. + * + * @param vLanded Fecha de llegada al almacén + * @param vWarehouseFk Identificador de vn.warehouse + */ + + DECLARE vTravelFk INT; + DECLARE vEntryFk INT; + DECLARE previousEntryFk INT; + + SET vTravelFk = vn.travel_getForLogiflora(vLanded, vWarehouseFk); + + IF vLanded THEN + + SELECT IFNULL(MAX(id),0) INTO vEntryFk + FROM vn.entry + WHERE travelFk = vTravelFk + AND isRaid; + + IF NOT vEntryFk THEN + + INSERT INTO vn.entry(travelFk, supplierFk, commission, companyFk, currencyFk, isRaid) + SELECT vTravelFk, s.id, 4, c.id, cu.id, TRUE + FROM vn.supplier s + JOIN vn.company c ON c.code = 'VNL' + JOIN vn.currency cu ON cu.code = 'EUR' + WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN'; + + SELECT MAX(id) INTO vEntryFk + FROM vn.entry + WHERE travelFk = vTravelFk; + + END IF; + + END IF; + + SELECT entryFk INTO previousEntryFk + FROM edi.warehouseFloramondo wf + WHERE wf.warehouseFk = vWarehouseFk; + + IF IFNULL(previousEntryFk,0) != vEntryFk THEN + + DELETE FROM buy WHERE entryFk = previousEntryFk; + + DELETE FROM entry WHERE id = previousEntryFk; + + END IF; + + RETURN vEntryFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expedition_checkRoute` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `expedition_checkRoute`(vPalletFk INT,vExpeditionFk INT) RETURNS tinyint(1) + DETERMINISTIC +BEGIN +/** +* Comprueba si las expediciones del pallet son todas +* de la misma ruta. +* +* @param vExpeditionFk numero de expedition a comprobar +* @param vPalletFk numero de pallet +* @return vHasDistinctRoutes +*/ + DECLARE vRouteFk INT; + DECLARE vHasDistinctRoutes BOOL; + + SELECT t.routeFk INTO vRouteFk + FROM vn.expedition e + JOIN vn.ticket t ON e.ticketFk = t.id + WHERE e.id = vExpeditionFk; + + SELECT COUNT(*) > 0 INTO vHasDistinctRoutes + FROM vn.expeditionScan es + JOIN vn.expedition e ON es.expeditionFk = e.id + JOIN vn.ticket t ON e.ticketFk = t.id + WHERE es.palletFk = vPalletFk + AND t.routeFk <> vRouteFk; + + RETURN vHasDistinctRoutes; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `firstDayOfWeek` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `firstDayOfWeek`(vYear INT, vWeek INT) RETURNS date + DETERMINISTIC +BEGIN +/** + * Returns the date of the first day of the week + * + * @param vYear The year + * @param vWeek The week number + * @return Date of the first day of the week + */ + DECLARE vDate DATE; + + SELECT dated INTO vDate + FROM `time` + WHERE `year` = vYear + AND `week` = vWeek + ORDER BY dated + LIMIT 1; + + RETURN 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 `getAlert3State` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3State`(vTicket INT) RETURNS varchar(45) CHARSET utf8 COLLATE utf8_unicode_ci + READS SQL DATA +BEGIN + DECLARE vDeliveryType INTEGER DEFAULT 0; + DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; + DECLARE vCode VARCHAR(45); + + SELECT am.deliveryMethodFk + INTO vDeliveryType + FROM ticket t + JOIN agencyMode am ON am.id = t.agencyModeFk + WHERE t.id = vTicket; + + CASE vDeliveryType + WHEN 1 THEN -- AGENCIAS + SET vCode = 'DELIVERED'; + + WHEN 2 THEN -- REPARTO + SET vCode = 'ON_DELIVERY'; + + ELSE -- MERCADO, OTROS + SELECT MIN(t.warehouseFk <> w.id) INTO isWaitingForPickUp + FROM ticket t + LEFT JOIN warehouse w + ON w.pickUpagencyModeFk = t.agencyModeFk + WHERE t.id = vTicket; + + IF isWaitingForPickUp THEN + SET vCode = 'WAITING_FOR_PICKUP'; + ELSE + SET vCode = 'DELIVERED'; + END IF; + END CASE; + RETURN 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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `getAlert3StateTest` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3StateTest`(vTicket INT) RETURNS varchar(45) CHARSET latin1 + READS SQL DATA +BEGIN + DECLARE vDeliveryType INTEGER DEFAULT 0; + DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; + DECLARE vCode VARCHAR(45); + + SELECT + a.Vista + INTO vDeliveryType + FROM vn2008.Tickets t + JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia + WHERE Id_Ticket = vTicket; + + CASE vDeliveryType + WHEN 1 THEN -- AGENCIAS + SET vCode = 'DELIVERED'; + + WHEN 2 THEN -- REPARTO + SET vCode = 'ON_DELIVERY'; + + ELSE -- MERCADO, OTROS + SELECT t.warehouse_id <> w.warehouse_id INTO isWaitingForPickUp + FROM vn2008.Tickets t + LEFT JOIN vn2008.warehouse_pickup w + ON w.agency_id = t.Id_Agencia AND w.warehouse_id = t.warehouse_id + WHERE t.Id_Ticket = vTicket; + + IF isWaitingForPickUp THEN + SET vCode = 'WAITING_FOR_PICKUP'; + ELSE + SET vCode = 'DELIVERED'; + END IF; + END CASE; + RETURN 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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `getAlert3State__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getAlert3State__`(vTicket INT) RETURNS varchar(45) CHARSET utf8 COLLATE utf8_unicode_ci + READS SQL DATA +BEGIN + DECLARE vDeliveryType INTEGER DEFAULT 0; + DECLARE isWaitingForPickUp BOOLEAN DEFAULT FALSE; + DECLARE vCode VARCHAR(45); + + SELECT a.Vista + INTO vDeliveryType + FROM vn2008.Tickets t + JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia + WHERE Id_Ticket = vTicket; + + CASE vDeliveryType + WHEN 1 THEN -- AGENCIAS + SET vCode = 'DELIVERED'; + + WHEN 2 THEN -- REPARTO + SET vCode = 'ON_DELIVERY'; + + ELSE -- MERCADO, OTROS + SELECT MIN(t.warehouse_id <> w.warehouse_id) INTO isWaitingForPickUp + FROM vn2008.Tickets t + LEFT JOIN vn2008.warehouse_pickup w + ON w.agency_id = t.Id_Agencia + WHERE t.Id_Ticket = vTicket; + + IF isWaitingForPickUp THEN + SET vCode = 'WAITING_FOR_PICKUP'; + ELSE + SET vCode = 'DELIVERED'; + END IF; + END CASE; + RETURN 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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `getDueDate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getDueDate`(vDated DATE, vDayToPay INT) RETURNS date + NO SQL +BEGIN + DECLARE vDued DATE; + + IF vDayToPay = 0 THEN + RETURN vDated; + END IF; + + SET vDued = TIMESTAMPADD(DAY,vDayToPay MOD 30, LAST_DAY(TIMESTAMPADD(MONTH, vDayToPay DIV 30, vDated))); + + RETURN vDued; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getInventoryDate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getInventoryDate`() RETURNS date + DETERMINISTIC +BEGIN + RETURN vn2008.date_inv(); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getNewItemId` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getNewItemId`() RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE newItemId INT; + + SELECT i1.id + 1 INTO newItemId + FROM item i1 + LEFT JOIN item i2 ON i1.id + 1 = i2.id + WHERE i2.id IS NULL + ORDER BY i1.id + LIMIT 1; + + RETURN newItemId; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getNextDueDate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getNextDueDate`(vDated DATE, vGapDays INT, vPayDay INT) RETURNS date + NO SQL +BEGIN + + DECLARE vReturn DATE; + DECLARE vDuaDate DATE; + DECLARE vDuaDateDay INT; + + SELECT TIMESTAMPADD(DAY, vGapDays, vDated) INTO vDuaDate; + + IF vDuaDate = CONCAT(YEAR(vDuaDate), '-03-01') THEN + SET vDuaDate = TIMESTAMPADD (DAY , -1, vDuaDate); + ELSEIF vDuaDate = CONCAT(YEAR(vDuaDate), '-02-29') THEN + SET vDuaDate = TIMESTAMPADD (DAY , -2, vDuaDate); + END IF; + + IF MONTH(vDuaDate) = 2 AND vPayDay = 30 THEN + IF util.isLeapYear(YEAR(vDuaDate)) THEN + SET vPayDay = 29; + ELSE + SET vPayDay = 28; + END IF; + END IF; + + SELECT DAY(vDuaDate) INTO vDuaDateDay; + RETURN TIMESTAMPADD(MONTH, (vDuaDateDay > vPayDay), DATE_FORMAT(vDuaDate, CONCAT('%y/%m/', vPayDay))); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getPlacementReserve` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getPlacementReserve`(vItemFk INT, vWarehouseFk INT) RETURNS varchar(25) CHARSET utf8 + READS SQL DATA +BEGIN + DECLARE vPlacementReserve VARCHAR(25); + + SELECT CONCAT(IFNULL(`code`,'--'), ' / ', IFNULL(reserve,'--')) INTO vPlacementReserve + FROM itemPlacement + WHERE itemFk = vItemFk + AND warehouseFk = vWarehouseFk; + + RETURN vPlacementReserve; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getShipmentHour` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getShipmentHour`(vTicket INT) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE vShipmentHour INT; + + SELECT HOUR(shipped) INTO vShipmentHour + FROM ticket + WHERE id = vTicket; + + IF vShipmentHour = 0 + THEN + DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; + CREATE TEMPORARY TABLE tmp.production_buffer + ENGINE = MEMORY + SELECT am.agencyFk as agency_id + , t.warehouseFk as warehouse_id + , a.provinceFk as province_id + , 0 as Hora + , 0 as Departure + FROM ticket t + JOIN agencyMode am on am.id = t.agencyModeFk + JOIN address a on a.id = t.addressFk + WHERE t.id = vTicket; + + SELECT Hora INTO vShipmentHour + FROM tmp.production_buffer; + END IF; + + RETURN vShipmentHour; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getSpecialPrice` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getSpecialPrice`(vItemFk int(11),vClientFk int(11)) RETURNS decimal(10,2) + READS SQL DATA +BEGIN + DECLARE price DECIMAL(10,2); + + SELECT rate3 INTO price + FROM vn.priceFixed + WHERE itemFk = vItemFk + AND CURDATE() BETWEEN started AND ended ORDER BY created DESC LIMIT 1; + + SELECT `value` INTO price + FROM vn.specialPrice + WHERE itemFk = vItemFk + AND clientFk = vClientFk ; +RETURN price; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getTicketToPrepare` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getTicketToPrepare`(`vWorker` INT, `vWarehouse` INT) RETURNS int(11) + READS SQL DATA +BEGIN +/** + * Devuelve el ticket que debe de preparar el trabajador + * + * @param vWorker Id del trabajador + * @param vWarehouse Id del almacén + * @return Id del ticket + * + * #UPDATED PAK 2019/08/16 + * #PENDING REVIEW + **/ + + DECLARE vToday DATETIME DEFAULT CURDATE(); + DECLARE vYesterday DATETIME; + DECLARE vTodayvMidniight DATETIME DEFAULT midnight(vToday); + DECLARE vTicket INT DEFAULT NULL; + DECLARE PREVIOUS_PREPARATION INT; + DECLARE vHasBeenPreviouslyPrepared INT DEFAULT 0; + + -- Si hay algun ticket previamente seleccionado, y se ha quedado sin empezar, lo recupera en primer lugar. + /* + SELECT i.Id_Ticket INTO vTicket + FROM vncontrol.inter i + JOIN vn.state s ON s.id = i.state_id + LEFT JOIN + (SELECT DISTINCT s.ticketFk + FROM vn.sale s + JOIN vn.saleTracking st ON st.saleFk = s.id + JOIN vn.ticketStateToday tst ON tst.ticket = s.ticketFk + WHERE st.created > CURDATE() + -- AND tst.`code` = 'ON_PREPARATION' + ) sub ON sub.ticketFk = i.Id_Ticket + WHERE odbc_date > CURDATE() + AND s.`code` = 'ON_PREPARATION' + AND i.Id_Trabajador = vWorker + AND sub.ticketFk IS NULL + LIMIT 1; + + IF vTicket IS NULL THEN + */ + SELECT id INTO PREVIOUS_PREPARATION + FROM vn.state + WHERE code LIKE 'PREVIOUS_PREPARATION'; + + SET vYesterday = TIMESTAMPADD(DAY,-1,vToday); + + DROP TEMPORARY TABLE IF EXISTS tmp.workerComercial; + CREATE TEMPORARY TABLE tmp.workerComercial + ENGINE = MEMORY + SELECT workerFk as worker FROM `grant` g + JOIN grantGroup gg ON g.`groupFk` = gg.id + WHERE gg.description = 'Comerciales'; + + DELETE wc.* + FROM tmp.workerComercial wc + JOIN `grant` g ON g.workerFk = wc.worker + JOIN grantGroup gg ON g.`groupFk` = gg.id + WHERE gg.description = 'Gerencia'; + + DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer; + CREATE TEMPORARY TABLE tmp.production_buffer + ENGINE = MEMORY + SELECT t.id as ticket + , am.agencyFk as agency_id + , t.warehouseFk as warehouse_id + , a.provinceFk as province_id + , IF (HOUR(t.shipped),HOUR(t.shipped),HOUR(z.`hour`)) as Hora + , HOUR(t.shipped) as Departure + , IF (MINUTE(t.shipped),MINUTE(t.shipped),MINUTE(z.`hour`)) as Minuto + , tls.code + , IFNULL(t.priority,0) loadingOrder + FROM ticket t + JOIN ticketState tls on t.id = tls.ticket + 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 + LEFT JOIN vn.zone z ON z.id = t.zoneFk + WHERE t.shipped BETWEEN vYesterday AND vTodayvMidniight + AND t.warehouseFk = vWarehouse + AND + ( + (tls.code = 'PRINTED' AND wc.worker IS NULL) + OR + (tls.code ='PICKER_DESIGNED' AND tls.worker = vWorker) + OR + (tls.code = 'PRINTED_BACK') + OR + (tls.code = 'PRINTED PREVIOUS') + ); + + + SELECT ticket INTO vTicket + FROM tmp.production_buffer + ORDER BY (code = 'PICKER_DESIGNED') DESC, (code = 'PRINTED PREVIOUS') DESC ,Hora, Minuto, loadingOrder + LIMIT 1; + + -- Aviso de ticket para bajar + SELECT COUNT(*) INTO vHasBeenPreviouslyPrepared + FROM vncontrol.inter + WHERE Id_Ticket = vTicket + AND state_id = PREVIOUS_PREPARATION; + + IF vHasBeenPreviouslyPrepared AND ticketWarehouseGet(vTicket) = 1 THEN + + INSERT IGNORE INTO vn.ticketDown(ticketFk) VALUES(vTicket); + + END IF; + + -- END IF; + + 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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `getTicketTrolleyLabelCount` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getTicketTrolleyLabelCount`(vTicket INT) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE vLabelCount INT DEFAULT 0; + + SELECT labelCount INTO vLabelCount + FROM ticketTrolley + WHERE ticket = vTicket; + + SET vLabelCount = vLabelCount +1 ; + + REPLACE ticketTrolley(ticket,labelCount) + SELECT vTicket, vLabelCount; + + RETURN vlabelCount; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getUser` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getUser`() RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * @deprecated Use account.userGetId() + */ + RETURN account.userGetId(); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getUserId` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getUserId`(userName varchar(30)) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE vUser INT; + + SELECT id INTO vUser + FROM account.user + WHERE `name` = userName; + + 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 `getWorkerCode` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getWorkerCode`() RETURNS varchar(3) CHARSET utf8 + READS SQL DATA +BEGIN + DECLARE vUserCode VARCHAR(3) CHARSET utf8 COLLATE utf8_unicode_ci; + + SELECT code INTO vUserCode + FROM worker + WHERE userFk = account.userGetId(); + + RETURN vUserCode; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getWorker__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `getWorker__`() RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * @deprecated Use myWorker_getId() + */ + DECLARE vUser INT; + + SELECT id INTO vUser + FROM worker + WHERE userFk = account.userGetId(); + + 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 `hasAnyNegativeBase` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `hasAnyNegativeBase`() RETURNS tinyint(1) + DETERMINISTIC +BEGIN + +/* Calcula si existe alguna base imponible negativa +* Requiere la tabla temporal vn.ticketToInvoice(id) +* +* returns BOOLEAN +*/ + DECLARE hasAnyNegativeBase BOOLEAN; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk + FROM ticketToInvoice; + + CALL ticket_getTax(NULL); + + SELECT COUNT(*) INTO hasAnyNegativeBase + FROM( + SELECT SUM(taxableBase) as taxableBase + FROM tmp.ticketTax + GROUP BY pgcFk + HAVING taxableBase < 0 + ) t; + + DROP TEMPORARY TABLE tmp.ticketTax; + DROP TEMPORARY TABLE tmp.ticket; + + RETURN hasAnyNegativeBase; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `hasAnyNegativeBase__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `hasAnyNegativeBase__`() RETURNS tinyint(1) + DETERMINISTIC +BEGIN + +/* Calcula si existe alguna base imponible negativa +* Requiere la tabla temporal vn.ticketToInvoice(id) +* +* returns BOOLEAN +*/ + + DECLARE vCountry INT; + DECLARE hasAnyNegativeBase BOOLEAN; + + SELECT s.countryFk + INTO vCountry + FROM supplier s + JOIN ticket t ON t.companyFk = s.id + JOIN vn.ticketToInvoice tl ON tl.id = t.id + LIMIT 1; + + SELECT COUNT(*) INTO hasAnyNegativeBase + FROM ( + SELECT SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2)) taxableBase + FROM sale s + JOIN item i ON i.id = s.itemFk + JOIN itemTaxCountry itc + ON itc.itemFk = i.id AND itc.countryFk = vCountry + JOIN vn.ticketToInvoice tl ON tl.id = s.ticketFk + GROUP BY itc.taxClassFk + HAVING taxableBase < 0 + ) t1 ; + + RETURN hasAnyNegativeBase; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `hasItemsInSector` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `hasItemsInSector`(vTicketFk INT, vSectorFk INT) RETURNS tinyint(1) + DETERMINISTIC +BEGIN + + DECLARE vItemCount INT; + + SELECT count(*) INTO vItemCount + FROM vn.sale s + JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + WHERE s.ticketFk = vTicketFk + AND p.sectorFk = vSectorFk; + + RETURN vItemCount; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `hasSomeNegativeBase` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `hasSomeNegativeBase`(vTicket INT) RETURNS tinyint(1) + READS SQL DATA +BEGIN + DECLARE vCountry INT; + DECLARE hasSomeNegativeBase BOOLEAN; + + SELECT s.countryFk + INTO vCountry + FROM supplier s + JOIN ticket t ON t.companyFk = s.id + WHERE t.id = vTicket; + + SELECT COUNT(*) INTO hasSomeNegativeBase + FROM ( + SELECT SUM(ROUND(s.quantity * s.price * (100 - s.discount)/100,2)) taxableBase + FROM sale s + JOIN item i ON i.id = s.itemFk + JOIN itemTaxCountry itc + ON itc.itemFk = i.id AND itc.countryFk = vCountry + WHERE s.ticketFk = vTicket + GROUP BY itc.taxClassFk + HAVING taxableBase < 0 + ) t1 ; + + RETURN hasSomeNegativeBase; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceOutAmount` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOutAmount`(vInvoiceRef VARCHAR(15)) RETURNS decimal(10,2) + READS SQL DATA +BEGIN + DECLARE totalAmount DECIMAL(10,2); + + SELECT SUM(vat) INTO totalAmount + FROM ( + SELECT iot.vat + FROM invoiceOutTax iot + JOIN invoiceOut io ON io.id = iot.invoiceOutFk + WHERE io.ref = vInvoiceRef + UNION ALL + SELECT ioe.amount + FROM invoiceOutExpence ioe + JOIN invoiceOut io ON io.id = ioe.invoiceOutFk + WHERE io.ref = vInvoiceRef + ) t1; + + RETURN totalAmount; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceOut_getPath` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceOut_getPath`(vSelf INT) RETURNS varchar(255) CHARSET utf8 + DETERMINISTIC +BEGIN + DECLARE vIssued DATE; + DECLARE vSerial VARCHAR(15); + + SELECT issued, ref + INTO vIssued, vSerial + FROM invoiceOut WHERE id = vSelf; + + 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 `invoiceSerial` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerial`(vClientFk INT, vCompanyFk INT, vType CHAR(1)) RETURNS char(1) CHARSET utf8 + DETERMINISTIC +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 + */ + DECLARE vTaxArea VARCHAR(25); + DECLARE vSerie CHAR(1); + + IF (SELECT hasInvoiceSimplified FROM client WHERE id = vClientFk) THEN + RETURN 'S'; + END IF; + + SELECT clientTaxArea(vClientFk, vCompanyFk) INTO vTaxArea; + SELECT invoiceSerialArea(vType,vTaxArea) INTO vSerie; + 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 `invoiceSerialArea` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `invoiceSerialArea`(vType CHAR(1), vTaxArea VARCHAR(25)) RETURNS char(1) CHARSET utf8 COLLATE utf8_unicode_ci + DETERMINISTIC +BEGIN + + DECLARE vSerie CHAR(1); + + IF vType = 'R' THEN + SELECT + CASE vTaxArea + WHEN 'CEE' + THEN 'H' + WHEN 'WORLD' + THEN 'E' + WHEN 'NATIONAL' + THEN 'T' + END + INTO vSerie; + -- Factura multiple + ELSEIF vType = 'M' THEN + SELECT + CASE vTaxArea + WHEN 'CEE' + THEN 'H' + WHEN 'WORLD' + THEN 'E' + WHEN 'NATIONAL' + THEN 'M' + END + INTO vSerie; + -- Factura global + ELSEIF vType = 'G' THEN + SELECT + CASE vTaxArea + WHEN 'CEE' + THEN 'V' + WHEN 'WORLD' + THEN 'X' + WHEN 'NATIONAL' + THEN 'A' + END + INTO 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 `isIntrastatEntry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `isIntrastatEntry`(vEntryFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE isIntrastatOperation BOOL DEFAULT FALSE; + DECLARE vSupplierCountry INT DEFAULT -1; + DECLARE vClientCountry INT DEFAULT -1; + + SELECT c.id INTO vSupplierCountry + FROM vn.country c + JOIN vn.supplier s ON s.countryFk = c.id + JOIN vn.entry e ON e.supplierFk = s.id + WHERE e.id = vEntryFk + AND c.isUeeMember = TRUE; + + SELECT c.id INTO vClientCountry + FROM vn.country c + JOIN vn.supplier s ON s.countryFk = c.id + JOIN vn.company co ON co.id = s.id + JOIN vn.entry e ON e.companyFk = co.id + WHERE e.id = vEntryFk + AND c.isUeeMember = TRUE; + + IF vSupplierCountry != vClientCountry AND vSupplierCountry * vClientCountry > 0 THEN + SET isIntrastatOperation = TRUE; + END IF; + + RETURN isIntrastatOperation; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `isLogifloraDay` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `isLogifloraDay`(vShipped DATE, vWarehouse INT) RETURNS tinyint(1) + DETERMINISTIC +BEGIN + + DECLARE vIsLogifloraDay BOOLEAN; + + SELECT COUNT(*) INTO vIsLogifloraDay + FROM edi.warehouseFloramondo wf + JOIN vn.floramondoConfig fc + WHERE wf.warehouseFk = vWarehouse + AND vShipped BETWEEN DATE(TIMESTAMPADD(DAY, wf.travellingDays , fc.nextLanded)) + AND DATE(TIMESTAMPADD(DAY, wf.travellingDays + wf.dayRange , fc.nextLanded)); + + RETURN vIsLogifloraDay; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `isPalletHomogeneus`(vExpedition INT) RETURNS tinyint(1) + READS SQL DATA +BEGIN + DECLARE vScanId INT; + DECLARE vDistinctRoutesInThePallet INT; + + SELECT scan_id INTO vScanId + FROM vn2008.scan_line + WHERE code = vExpedition + LIMIT 1; + + SELECT COUNT(*) INTO vDistinctRoutesInThePallet + FROM ( + SELECT DISTINCT t.Id_Ruta + FROM vn2008.scan_line sl + JOIN 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 */ ; +/*!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 `itemPacking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `itemPacking`(vBarcode VARCHAR(22), vWarehouseFk INT) RETURNS int(11) + DETERMINISTIC +BEGIN + + DECLARE vPacking INTEGER DEFAULT 0; + DECLARE vItemFk INTEGER; + + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + + SELECT IFNULL(packing,0) INTO vPacking + FROM vn.buy + WHERE id = CAST(vBarcode AS DECIMAL(18,0)); + + + + + IF NOT vPacking THEN + CALL cache.last_buy_refresh(FALSE); + SELECT IFNULL(packing,1) INTO vPacking + FROM + (SELECT packing , created + FROM vn.itemShelving + WHERE itemFk = vItemFk + UNION ALL + SELECT b.packing, landing + FROM vn.buy b + JOIN cache.last_buy lb ON lb.buy_id = b.id + WHERE lb.warehouse_id = vWarehouseFk + AND b.itemFk = vItemFk + ) packings + ORDER BY created desc + LIMIT 1; + + END IF; + + RETURN vPacking; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemPlacementGet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `itemPlacementGet`(vItemFk INT, vWarehouseFk INT) RETURNS varchar(25) CHARSET utf8 + READS SQL DATA +BEGIN + DECLARE vPlacementReserve VARCHAR(25); + + SELECT CONCAT(IFNULL(`code`,'--'), ' / ', IFNULL(reserve,'--')) + INTO vPlacementReserve + FROM itemPlacement + WHERE itemFk = vItemFk + AND warehouseFk = vWarehouseFk; + + RETURN vPlacementReserve; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingPlacementSupply_ClosestGet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `itemShelvingPlacementSupply_ClosestGet`(vParkingFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + /* Devuelve el parking más cercano.*/ + DECLARE vColumn INT; + DECLARE vClosestParkingFk INT; + DECLARE vSectorFk INT; + + SELECT p.column, sectorFk INTO vColumn, vSectorFk + FROM vn.parking p + WHERE p.id = vParkingFk; + + SELECT itemShelvingFk INTO vClosestParkingFk + FROM + ( + SELECT ABS(p.column - vColumn) as distance, itemShelvingFk + FROM vn.itemShelvingPlacementSupplyStock ispss + JOIN vn.parking p ON p.id = ispss.parkingFk + JOIN vn.itemPlacementSupplyList ipsl ON ipsl.sectorFk = ispss.sectorFk AND ipsl.itemFk = ispss.itemFk + WHERE p.sectorFk = vSectorFk + AND ipsl.saldo > 0 + ) sub + ORDER BY distance + LIMIT 1; + + RETURN vClosestParkingFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemsInSector_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `itemsInSector_get`(vTicketFk INT, vSectorFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + DECLARE vItemCount INT; + + SELECT count(*) INTO vItemCount + FROM vn.sale s + JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + WHERE s.ticketFk = vTicketFk + AND p.sectorFk = vSectorFk; + + RETURN vItemCount; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemTag_getIntValue` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `itemTag_getIntValue`(vValue VARCHAR(255)) RETURNS int(11) + DETERMINISTIC +BEGIN + IF vValue NOT REGEXP '^-?[0-9]+' THEN + RETURN NULL; + END IF; + + RETURN CAST(vValue AS SIGNED); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `item_getFhImage` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `item_getFhImage`(itemFk INT) RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci + DETERMINISTIC +BEGIN + DECLARE vImageUrl VARCHAR(255); + SELECT sr.PictureReference INTO vImageUrl + FROM vn.buy b + JOIN edi.ekt e ON b.ektFk = e.id + JOIN edi.supplyResponse sr ON sr.Item_ArticleCode =e.`ref` + JOIN vn.item i ON i.id = b.itemFk + WHERE b.itemFk = itemFk + ORDER BY (sr.EmbalageCode = e.package) DESC + LIMIT 1; + RETURN vImageUrl; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `item_getPackage` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `item_getPackage`(vItemFk INT) RETURNS varchar(50) CHARSET utf8 COLLATE utf8_unicode_ci + DETERMINISTIC +BEGIN + + DECLARE vDiameter INT; + DECLARE vPackageFk VARCHAR(50); + DECLARE vCoeficient DOUBLE DEFAULT 1.08; + + SELECT MAX(LEFT(value,3)) INTO vDiameter + FROM vn.itemTag it + JOIN vn.tag t ON t.id = it.tagFk + WHERE it.itemFk = vItemFk + AND t.overwrite = 'diameter'; + + SELECT 8000 + FLOOR(vc.ccLength * vc.ccWidth / (vCoeficient * PI() * (vDiameter / 2) * (vDiameter / 2))) + INTO vPackageFk + FROM vn.volumeConfig vc; + + INSERT IGNORE INTO vn.packaging(id, width, `depth`) + SELECT vPackageFk, + FLOOR(vc.ccWidth / FLOOR(vc.ccWidth / vDiameter)), + FLOOR(vc.ccLength / FLOOR(vc.ccLength / vDiameter)) + FROM vn.volumeConfig vc; + + RETURN vPackageFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `item_getVolume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `item_getVolume`(vSelf INT, vPackaging VARCHAR(10)) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Calculates the volume occupied by an item together + * with its packaging. + * + * @param vSelf The item id + * @param vPackaging The packaging id + * @return The volume in cubic centimeters + */ + DECLARE vVolume INT; + + SELECT SUM(IF(p.volume > 0, + p.volume, + p.width * p.depth * IF(IFNULL(p.height,0), p.height, IFNULL(i.size,60) + 10) + )) INTO vVolume + FROM packaging p + JOIN item i ON i.id = vSelf + WHERE p.id = vPackaging; + + RETURN vVolume; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `lastDayOfWeek` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `lastDayOfWeek`(vYear INT, vWeek INT) RETURNS date + DETERMINISTIC +BEGIN +/** + * Returns the date of the last day of the week + * + * @param vYear The year + * @param vWeek The week number + * @return Date of the first day of the week + */ + DECLARE vDate DATE; + + SELECT dated INTO vDate + FROM `time` + WHERE `year` = vYear + AND `week` = vWeek + ORDER BY dated DESC + LIMIT 1; + + RETURN 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 `machineWorker_Worker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `machineWorker_Worker`(vWorkerFk VARCHAR(10)) RETURNS varchar(20) CHARSET utf8 COLLATE utf8_unicode_ci + READS SQL DATA +BEGIN +/** + * Comprueba si existen registros en las últimas 12 horas del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo) + * + * @param vWorkerFk id del trabajador + * @return Devuelve REGISTERED/UNREGISTERED en caso de que haya registros + */ + + IF (SELECT COUNT(*) + FROM machineWorker m + WHERE m.workerFk = vWorkerFk + AND m.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) AND ISNULL(m.outTimed)) + THEN + RETURN "REGISTERED"; + ELSE + RETURN "UNREGISTERED"; + 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 FUNCTION IF EXISTS `machine_checkPlate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `machine_checkPlate`(vPlate VARCHAR(10)) RETURNS tinyint(1) + READS SQL DATA +BEGIN +/** + * Comprueba si existe matrícula + * + * @param vPlate matrícula del vehículo + * @return Devuelve TRUE en caso de que exista + * + */ + + IF (SELECT COUNT(*) + FROM machine m + WHERE m.plate = vPlate + ) THEN + RETURN TRUE; + ELSE + RETURN 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 FUNCTION IF EXISTS `messageSend` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `messageSend`(vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE result INT; + DECLARE vSenderFk INT; + + SELECT id INTO vSenderFk + FROM account.user WHERE `name` = account.userGetName(); + + RETURN (SELECT messageSendWithUser(vSenderFk, vRecipient, 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 FUNCTION IF EXISTS `messageSendWithUser` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `messageSendWithUser`(vSenderFK INT, vRecipient VARCHAR(255) CHARSET utf8, vMessage TEXT CHARSET utf8) RETURNS int(11) + DETERMINISTIC +BEGIN + + DECLARE vCount INT; + DECLARE vUuid VARCHAR(255); + DECLARE vSendDate DATETIME DEFAULT NOW(); + DECLARE vSender VARCHAR(255) CHARSET utf8; + + SELECT `name` INTO vSender + FROM account.user WHERE id = vSenderFK; + + SET vRecipient = LOWER(vRecipient); + + DROP TEMPORARY TABLE IF EXISTS tRecipients; + CREATE TEMPORARY TABLE tRecipients + SELECT u.name finalRecipient + FROM account.mailAlias a + JOIN account.mailAliasAccount aa ON aa.mailAlias = a.id + JOIN account.user u ON u.id = aa.account + WHERE a.alias = vRecipient COLLATE utf8_unicode_ci + AND u.name != vSender + AND u.active + UNION + SELECT u.name FROM account.user u + WHERE u.name = vRecipient + AND u.active; + + SELECT COUNT(*) INTO vCount FROM tRecipients; + + IF vCount = 0 THEN + RETURN vCount; + END IF; + + SET vUuid = UUID(); + + INSERT INTO message + SET uuid = vUuid, + sender = vSender, + recipient = vRecipient, + message = vMessage, + sendDate = vSendDate; + + INSERT INTO messageInbox (uuid, sender, recipient, finalRecipient, message, sendDate) + SELECT vUuid, vSender, vRecipient, finalRecipient, vMessage, vSendDate + FROM tRecipients; + + DROP TEMPORARY TABLE tRecipients; + RETURN vCount; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `MIDNIGHT` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `MIDNIGHT`(vDate DATE) RETURNS datetime + DETERMINISTIC +BEGIN + RETURN TIMESTAMP(vDate,'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 `myWorker_getId__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `myWorker_getId__`() RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Returns the current worker id or the default worker id + * if current user cannot be retrieved. + * + * @return The worker id + */ + DECLARE vWorker INT; + + SELECT w.id INTO vWorker + FROM worker w, workerConfig__ c + WHERE w.userFk = account.userGetId(); + + RETURN vWorker; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `nz` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `nz`(vQuantity DOUBLE) RETURNS double + DETERMINISTIC +BEGIN + + DECLARE vResult DOUBLE; + + SET vResult = IFNULL(vQuantity,0); + + RETURN vResult; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `orderTotalVolume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `orderTotalVolume`(vOrderId INT) RETURNS decimal(10,3) + READS SQL DATA +BEGIN + -- Devuelte el volumen total de la orden sumada + DECLARE vWarehouseId INTEGER; + DECLARE vVolume DECIMAL(10,3); + + SELECT IFNULL(SUM(o.amount * ic.cm3delivery)/1000000,0) INTO vVolume + FROM hedera.orderRow o + JOIN item i ON i.id = o.itemFk + JOIN itemCost ic on ic.itemFk = o.itemFk AND ic.warehouseFk = o.warehouseFk + WHERE o.orderFk = vOrderId; + + RETURN vVolume; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `orderTotalVolumeBoxes` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `orderTotalVolumeBoxes`(vOrderId INT) RETURNS decimal(10,3) + READS SQL DATA +BEGIN +/** + * Devuelve el volumen estimado del ticket sumado, en cajas + * + * @param vOrder Id del pedido + */ + DECLARE vVolumeBoxM3 DOUBLE; + DECLARE vOrderTotalVolumeBoxes DECIMAL(10,1); + DECLARE vVnBoxId VARCHAR(10) DEFAULT '94'; + + SELECT volume / 1000000 + INTO vVolumeBoxM3 + FROM packaging + WHERE id = vVnBoxId; + + SET vOrderTotalVolumeBoxes = orderTotalVolume(vOrderId) / vVolumeBoxM3; + + RETURN vOrderTotalVolumeBoxes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `phytoPassport` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `phytoPassport`(vRef VARCHAR(15)) RETURNS text CHARSET utf8 + DETERMINISTIC +BEGIN +DECLARE vPhyto TEXT CHARSET utf8 COLLATE utf8_unicode_ci; +SELECT + GROUP_CONCAT(i.id, + ':', + ppa.denomination, + ' ', + pp.number, + CHAR(13,10) + SEPARATOR '') fitosanitario + INTO vPhyto +FROM + sale s + JOIN + ticket t ON t.id = s.ticketFk + JOIN + item i ON i.id = s.itemFk + JOIN + plantpassport pp ON pp.producerFk = i.producerFk + JOIN + plantpassportAuthority ppa ON ppa.id = pp.plantpassportAuthorityFk + JOIN + itemBotanicalWithGenus ib ON ib.itemFk = i.id + JOIN + botanicExport be ON be.`code` = 'phytosanitaryPassport' + LEFT JOIN + ediGenus eg ON eg.id = be.ediGenusFk + LEFT JOIN + ediSpecie es ON es.id = be.ediSpecieFk +WHERE + t.refFk = vRef + AND ib.ediBotanic LIKE CONCAT(IFNULL(eg.latinGenusName, ''), + IF(latinSpeciesName > '', + CONCAT(' ', latinSpeciesName), + ''), + '%'); +RETURN vPhyto; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `routeProposal` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal`(vTicketFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + DECLARE vRouteFk INT; + DECLARE vAddressFk INT; + + DECLARE vLanded DATE; + DECLARE vZoneFk INT; + DECLARE vSignificativeFriendship INT DEFAULT 6; + DECLARE vVolumeMax DECIMAL(5,1) DEFAULT 10; + + SELECT addressFk, zoneFk, landed INTO vAddressFk, vZoneFk, vLanded + FROM vn.ticket + WHERE id = vTicketFk; + + -- Se inicia la selección de rutas posibles con aquellas cuyas agencias alguna vez han estado asociadas con nuestra zona + DROP TEMPORARY TABLE IF EXISTS tmp.route; + CREATE TEMPORARY TABLE tmp.route + SELECT r.id routeFk, + zf.friendship zoneFriendship + FROM vn.route r + JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk + WHERE friendship >= vSignificativeFriendship + AND zf.zoneFk = vZoneFk + AND r.created = vLanded + ORDER BY friendship; + + -- Se eliminan aquellas que superan el volumen máximo + DELETE r.* + FROM tmp.route r + JOIN (SELECT routeFk, sum(volume) volume + FROM vn.saleVolume + WHERE landed = vLanded + GROUP BY routeFk) sub ON sub.routeFk = r.routeFk + WHERE sub.volume > vVolumeMax; + + -- Se ordenan las que quedan en función con la afinidad del resto de consignatarios de cada ruta + SELECT routeFk INTO vRouteFk + FROM + (SELECT r.routeFk, r.zoneFriendship, sum(af.friendship) friendshipSum + FROM tmp.route r + LEFT JOIN vn.ticket t ON t.routeFk = r.routeFk + LEFT JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk + GROUP BY routeFk + ORDER BY zoneFriendship DESC, friendshipSum DESC + ) sub + LIMIT 1; + + RETURN vRouteFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `routeProposal_` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal_`(vTicketFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + DECLARE vRouteFk INT; + DECLARE vAddressFk INT; + DECLARE vShipped DATETIME; + + SELECT addressFk, date(shipped) INTO vAddressFk, vShipped + FROM vn.ticket + WHERE id = vTicketFk; + + SELECT routeFk INTO vRouteFk + FROM + (SELECT t.routeFk, sum(af.friendship) friendshipSum + FROM vn.ticket t + JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk + WHERE t.shipped BETWEEN vShipped and MIDNIGHT(vShipped) + AND t.routeFk + GROUP BY routeFk + ORDER BY friendshipSum DESC + ) sub + LIMIT 1; + + RETURN vRouteFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `routeProposal_beta` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `routeProposal_beta`(vTicketFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + DECLARE vRouteFk INT; + DECLARE vAddressFk INT; + + DECLARE vLanded DATE; + DECLARE vZoneFk INT; + DECLARE vSignificativeFriendship INT DEFAULT 6; + DECLARE vVolumeMax DECIMAL(5,1) DEFAULT 10; + + SELECT addressFk, zoneFk, landed INTO vAddressFk, vZoneFk, vLanded + FROM vn.ticket + WHERE id = vTicketFk; + + -- Se inicia la selección de rutas posibles con aquellas cuyas agencias alguna vez han estado asociadas con nuestra zona + DROP TEMPORARY TABLE IF EXISTS tmp.route; + CREATE TEMPORARY TABLE tmp.route + SELECT r.id routeFk, + zf.friendship zoneFriendship + FROM vn.route r + JOIN cache.zoneAgencyFriendship zf ON zf.agencyModeFk = r.agencyModeFk + WHERE friendship >= vSignificativeFriendship + AND zf.zoneFk = vZoneFk + AND r.created = vLanded + ORDER BY friendship; + + -- Se eliminan aquellas que superan el volumen máximo + DELETE r.* + FROM tmp.route r + JOIN (SELECT routeFk, sum(volume) volume + FROM vn.saleVolume + WHERE landed = vLanded + GROUP BY routeFk) sub ON sub.routeFk = r.routeFk + WHERE sub.volume > vVolumeMax; + + -- Se ordenan las que quedan en función con la afinidad del resto de consignatarios de cada ruta + SELECT routeFk INTO vRouteFk + FROM + (SELECT r.routeFk, r.zoneFriendship, sum(af.friendship) friendshipSum + FROM tmp.route r + LEFT JOIN vn.ticket t ON t.routeFk = r.routeFk + LEFT JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk + GROUP BY routeFk + ORDER BY zoneFriendship DESC, friendshipSum DESC + ) sub + LIMIT 1; + + RETURN vRouteFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `specie_IsForbidden` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `specie_IsForbidden`(vItemFk INT, vAddressFk INT) RETURNS tinyint(1) + READS SQL DATA +BEGIN + + DECLARE vIsForbbiden BOOL; + DECLARE vLeft INT; + + SELECT zg.lft INTO vLeft + FROM vn.address a + JOIN vn.zoneGeo zg ON zg.name = a.postalCode + WHERE a.id = vAddressFk; + + SELECT sgi.isForbidden INTO vIsForbbiden + FROM vn.specieGeoInvasive sgi + JOIN vn.zoneGeo zg ON zg.id = sgi.zoneGeofk + JOIN vn.itemBotanical ib ON ib.genusFk = sgi.genusFk AND sgi.specieFk IN ('sp.',ib.specieFk) + WHERE vLeft BETWEEN zg.lft AND zg.rgt + AND ib.itemFk = vItemFk + ORDER BY zg.`depth` DESC + LIMIT 1; + + RETURN IFNULL(vIsForbbiden, 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 `testCIF` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `testCIF`(vCIF VARCHAR(9)) RETURNS varchar(10) CHARSET utf8 COLLATE utf8_unicode_ci + DETERMINISTIC +BEGIN + + DECLARE vLetraInicial VARCHAR(1); + DECLARE vLetraFinal VARCHAR(1); + DECLARE vParteNumerica VARCHAR(7); + DECLARE vSuma INT DEFAULT 0; + DECLARE vNumero INT DEFAULT 0; + DECLARE i INT DEFAULT 0; + DECLARE vResult BOOL DEFAULT FALSE; + + SET vLetraInicial = SUBSTR(vCIF, 1, 1); + SET vLetraFinal = SUBSTR(vCIF, 9, 1); + SET vParteNumerica = SUBSTR(vCIF, 2, 7); + + WHILE i < 7 DO + + SET i = i + 1; + + SET vNumero = CAST(SUBSTR(vParteNumerica, i, 1) AS DECIMAL(1,0)); + + IF i MOD 2 THEN + + SET vNumero = vNumero * 2; + SET vNumero = vNumero MOD 10 + FLOOR(vNumero/10); + + END IF; + + SET vSuma = vSuma + vNumero; + + END WHILE; + + SET vSuma = vSuma MOD 10; + + IF vSuma > 0 THEN + + SET vSuma = 10 - vSuma; + + END IF; + + -- Comprobación de dígito de control + IF CAST(vLetraFinal AS DECIMAL(1,0)) = vSuma THEN + + SET vResult = TRUE; + + END IF; + + IF vSuma = 0 THEN + + SET vSuma = 10; + + END IF; + + IF CHAR(64 + vSuma) = vLetraFinal THEN + + SET vResult = TRUE; + + END IF; + + -- Sólo se aceptan letras como caracter inicial + IF ASCII(vLetraInicial) < 65 OR ASCII(vLetraInicial) > 87 THEN -- Ha de ser entre la A y la W + + SET vResult = FALSE; + + END IF; + + RETURN vResult; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `testNIE` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `testNIE`(vNIE VARCHAR(9)) RETURNS tinyint(1) + DETERMINISTIC +BEGIN + + DECLARE vIndice INT; + DECLARE vNumero VARCHAR(7); + DECLARE vOperador VARCHAR(9); + DECLARE vParteNumerica DECIMAL(8,0); + DECLARE vLetraInicial VARCHAR(1); + DECLARE vLetraFinal VARCHAR(1); + DECLARE vLetrasFinalesPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; + DECLARE vLetraInicialEsIncorrecta BOOL DEFAULT FALSE; + + SET vLetraInicial = SUBSTR(vNIE, 1, 1); + SET vLetraFinal = SUBSTR(vNIE, 9, 1); + SET vNumero = SUBSTR(vNIE, 2, 7); + + CASE vLetraInicial + + WHEN 'X' THEN + + SET vOperador = "0"; + + WHEN 'Y' THEN + + SET vOperador = "1"; + + WHEN 'Z' THEN + + SET vOperador = "2"; + + ELSE + + SET vLetraInicialEsIncorrecta = TRUE; + + END CASE; + + SET vOperador = CONCAT(vOperador, vNumero); + SET vParteNumerica = CAST(vOperador AS DECIMAL(8,0)); + SET vIndice = Round(vParteNumerica Mod 23, 0) + 1; + + IF SUBSTR(vLetrasFinalesPosibles, vIndice, 1) = vLetraFinal AND vLetraInicialEsIncorrecta = FALSE THEN + + RETURN TRUE; + + ELSE + + RETURN 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 FUNCTION IF EXISTS `testNIF` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `testNIF`(vNIF VARCHAR(9)) RETURNS tinyint(1) + DETERMINISTIC +BEGIN + + DECLARE vIndice INT; + DECLARE vParteNumerica DECIMAL(8,0); + DECLARE vLetra VARCHAR(1); + DECLARE vLetrasPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; + + SET vLetra = SUBSTRING(vNIF, 9, 1); + + SET vParteNumerica = CAST(SUBSTRING(vNIF, 1, 8) AS DECIMAL(8,0)); + + SET vIndice = Round(vParteNumerica MOD 23, 0) + 1; + + If SUBSTRING(vLetrasPosibles, vIndice, 1) = vLetra Then + + RETURN TRUE; + + ELSE + + RETURN 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 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 `ticketPositionInPath` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticketPositionInPath`(vTicketId INT) RETURNS varchar(10) CHARSET utf8 + DETERMINISTIC +BEGIN + + DECLARE vRestTicketsMaxOrder INT; + DECLARE vRestTicketsMinOrder INT; + DECLARE vRestTicketsPacking INT; + DECLARE vMyProductionOrder INT; + DECLARE vPosition VARCHAR(10) DEFAULT 'MID'; + DECLARE vMyPath INT; + DECLARE vMyWarehouse INT; + DECLARE PACKING_ORDER INT; + DECLARE vExpeditionsCount INT; + DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE; + +SELECT `order` + INTO PACKING_ORDER + FROM state + WHERE code = 'PACKING'; + +SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0) + INTO vMyPath, vMyWarehouse, vMyProductionOrder + FROM ticket t + LEFT JOIN ticketState ts on ts.ticket = t.id + WHERE t.id = vTicketId; + +SELECT (ag.`name` = 'VN_VALENCIA') + INTO vIsValenciaPath + FROM vn2008.Rutas r + JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia + JOIN vn2008.agency ag on ag.agency_id = a.agency_id + WHERE r.Id_Ruta = vMyPath; + +IF vIsValenciaPath THEN -- Rutas Valencia + + SELECT COUNT(*) + INTO vExpeditionsCount + FROM expedition e + JOIN ticket t ON t.id = e.ticketFk + WHERE t.routeFk = vMyPath; + + SELECT MAX(ts.productionOrder), MIN(ts.productionOrder) + INTO vRestTicketsMaxOrder, vRestTicketsMinOrder + FROM ticket t + LEFT JOIN ticketState ts on t.id = ts.ticket + WHERE t.routeFk = vMyPath + AND t.warehouseFk = vMyWarehouse + AND t.id != vTicketid; + + SELECT COUNT(*) + INTO vRestTicketsPacking + FROM ticket t + LEFT JOIN ticketState ts on t.id = ts.ticket + WHERE ts.productionOrder = PACKING_ORDER + AND t.routeFk = vMyPath + AND t.warehouseFk = vMyWarehouse + AND t.id != vTicketid; + + IF vExpeditionsCount = 1 THEN + SET vPosition = 'FIRST'; + ELSEIF vRestTicketsMinOrder > PACKING_ORDER THEN + SET vPosition = 'LAST'; + ELSEIF vRestTicketsPacking THEN + SET vPosition = 'SHARED'; + ELSE + SET vPosition = 'MID'; + END IF; + +ELSE + SET vPosition = 'MID'; + +END IF; + +RETURN vPosition; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketSplitCounter` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticketSplitCounter`(vTicketFk INT) RETURNS varchar(15) CHARSET utf8 + READS SQL DATA +BEGIN + DECLARE vSplitCounter VARCHAR(15); + + SELECT CONCAT(OK,'/',Total, IF(OK = Total ,' LS','')) INTO vSplitCounter + FROM + ( + SELECT count(l.Id_Movimiento) as OK, COUNT(*) as Total + FROM vn.sale s + LEFT JOIN vn2008.movement_label l ON l.Id_Movimiento = s.id + WHERE ticketFk = vTicketFk + ) sub; + + RETURN IFNULL(vSplitCounter,'--'); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketTotalVolume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolume`(vTicketId INT) RETURNS decimal(10,3) + READS SQL DATA +BEGIN + -- Devuelte el volumen total del ticket sumado + + DECLARE vVolume DECIMAL(10,3); + + SELECT SUM(volume) INTO vVolume + FROM saleVolume + WHERE ticketFk = vTicketId; + RETURN vVolume; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketTotalVolumeBoxes` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticketTotalVolumeBoxes`(vTicketId INT) RETURNS decimal(10,1) + DETERMINISTIC +BEGIN + +/* + * Devuelve el volumen estimado del ticket sumado, en cajas + * + * vTicketId Numero de ticket + * + */ + + DECLARE vVolumeBoxM3 DOUBLE; + DECLARE vTicketTotalVolumeBoxes DECIMAL(10,1); + DECLARE vVnBoxId VARCHAR(10) DEFAULT '94'; + + SELECT volume / 1000000 INTO vVolumeBoxM3 FROM packaging WHERE id = vVnBoxId; + + SET vTicketTotalVolumeBoxes = ticketTotalVolume(vTicketId) / vVolumeBoxM3; + + RETURN vTicketTotalVolumeBoxes; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketWarehouseGet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticketWarehouseGet`(vTicketFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + DECLARE vWarehouseFk INT; + + SELECT warehouseFk INTO vWarehouseFk + FROM ticket + WHERE id = vTicketFk; + + RETURN vWarehouseFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticket_CC_volume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_CC_volume`(vTicketFk INT) RETURNS decimal(10,1) + READS SQL DATA +BEGIN + + DECLARE vCC DECIMAL(10,1); + + SELECT sum(sv.volume * IF(i.itemPackingTypeFk = 'H', vc.dutchCompressionRate, 1)) / (p.volume / 1000000) + INTO vCC + FROM vn.saleVolume sv + JOIN vn.sale s ON s.id = sv.saleFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.packaging p ON p.id = 'CC' + JOIN vn.volumeConfig vc + WHERE sv.ticketFk = vTicketFk; + + RETURN vCC; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticket_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_get`(vParamFk INT) RETURNS int(11) + READS SQL DATA +proc:BEGIN + + /* Devuelve el número de ticket o collection consultando en varias tablas posibles + * + * @param vParamFk Número a validar + * @return vValidFk Identificador validado + */ + + DECLARE vValidFk INT; + + -- Tabla vn.saleGroup + SELECT s.ticketFk INTO vValidFk + FROM vn.sale s + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk + WHERE sg.id = vParamFk + AND sg.created > TIMESTAMPADD(WEEK,-1, CURDATE()) + LIMIT 1; + + IF vValidFk THEN + + RETURN vValidFk; + + LEAVE proc; + + END IF; + + -- Tabla vn.collection + SELECT c.id INTO vValidFk + FROM vn.collection c + WHERE c.id = vParamFk + AND c.created > TIMESTAMPADD(WEEK,-1, CURDATE()); + + IF vValidFk THEN + + RETURN vValidFk; + + LEAVE proc; + + END IF; + + -- Tabla vn.ticket + SELECT t.id INTO vValidFk + FROM vn.ticket t + WHERE t.id = vParamFk + AND t.shipped > TIMESTAMPADD(WEEK,-1, CURDATE()); + + IF vValidFk THEN + + RETURN vValidFk; + + LEAVE proc; + + END IF; + + RETURN 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 FUNCTION IF EXISTS `ticket_getFreightCost` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getFreightCost`(vTicketFk INT) RETURNS decimal(10,2) + DETERMINISTIC +BEGIN +/** + * Devuelve el coste de transportar un ticket. + * + * @vTicketFk Id del ticket a calcular + */ + DECLARE deliveryPrice DECIMAL (10,2); + + IF (SELECT isVolumetric FROM ticket t JOIN zone z ON t.zoneFk = z.id + WHERE t.id = vTicketFk) THEN + SELECT SUM(sv.freight) INTO deliveryPrice + FROM vn.saleVolume sv + WHERE sv.ticketFk = vTicketFk; + ELSE + SELECT SUM((t.zonePrice - t.zoneBonus) * ebv.ratio) INTO deliveryPrice + FROM vn.ticket t + LEFT JOIN expedition e ON e.ticketFk = t.id + JOIN expeditionBoxVol ebv ON ebv.boxFk = e.isBox + WHERE t.id = vTicketFk; + + END IF; + RETURN deliveryPrice; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticket_getWeight` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getWeight`(vTicketFk INT) RETURNS decimal(10,3) + READS SQL DATA +BEGIN +/** + * Devuelve el peso total del ticket + * + * @return Total peso + */ + + DECLARE vWeight DECIMAL(10,3); + + SELECT sum(weight) INTO vWeight + FROM saleVolume + WHERE ticketFk = vTicketFk; + + RETURN vWeight; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticket_getWithParameters` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getWithParameters`(vClientFk INT, vWarehouseFk INT, vShipped DATE, vAddressFk INT, vCompanyFk INT, vAgencyModeFk INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Devuelve un ticket con los parametros, en caso de no existir lo crea + * + * @param vClientFk Cliente + * @param vWarehouseFk almacen + * @param vShipped Fecha de preparacion + * @param vAddressFk Consignatario + * @param vCompanyFk Empresa + * @param vAgencyModeFk agencia + */ + + DECLARE vTicket INT; + + SELECT t.id INTO vTicket + FROM vn.ticket t + WHERE (t.clientFk <=> vClientFk OR vClientFk IS NULL) + AND (t.warehouseFk <=> vWarehouseFk OR vWarehouseFk IS NULL) + AND (t.shipped <=> vShipped OR vShipped IS NULL) + AND (t.addressFk <=> vAddressFk OR vAddressFk IS NULL) + AND (t.companyFk <=> vCompanyFk OR vCompanyFk IS NULL) + AND (t.agencyModeFk <=> vAgencyModeFk OR vAgencyModeFk IS NULL) + LIMIT 1; + + IF vTicket IS NULL THEN + CALL vn.ticket_add( + vClientFk, + IFNULL(vShipped, CURDATE()), + vWarehouseFk, + vCompanyFk, + vAddressFk, + vAgencyModeFk, + NULL, + vShipped, + `account`.`myUser_getId`(), + TRUE, + vTicket + ); + END IF; + + 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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `ticket_HasUbication` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_HasUbication`(vTicketFk INT) RETURNS tinyint(1) + READS SQL DATA +BEGIN + + DECLARE hasUbication BOOL; + + SELECT COUNT(*) INTO hasUbication + FROM vn.ticket t + JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk + WHERE rm.beachFk + AND t.id = vTicketFk; + + RETURN hasUbication; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `till_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `till_new`( + vClient INT + ,vBank INT + ,vAmount DOUBLE + ,vConcept VARCHAR(25) + ,vDated DATE + ,vSerie CHAR(1) + ,vBatch TINYINT + ,vNumber INT + ,vCompany SMALLINT + ,vWorker INT +) RETURNS int(11) + DETERMINISTIC +BEGIN + DECLARE vAccount VARCHAR(12); + DECLARE vSubaccount VARCHAR(12); + DECLARE vAsiento INT DEFAULT NULL; + + -- Inserta el registro en cajas + + INSERT INTO till + SET + workerFk = vWorker + ,bankFk = vBank + ,`in` = vAmount + ,concept = vConcept + ,dated = vDated + ,serie = vSerie + ,isAccountable = vBatch + ,`number` = vNumber + ,companyFk = vCompany; + + -- Inserta los asientos contables + + SELECT account INTO vAccount + FROM bank WHERE id = vBank; + + SELECT accountingAccount INTO vSubaccount + FROM `client` WHERE id = vClient; + + SET vAsiento = xdiario_new + ( + vAsiento + ,vDated + ,vAccount + ,vSubaccount + ,vConcept + ,vAmount + ,0 + ,0 + ,NULL -- Serie + ,NULL -- Factura + ,NULL -- IVA + ,NULL -- Recargo + ,FALSE -- Auxiliar + ,vCompany + ); + DO xdiario_new + ( + vAsiento + ,vDated + ,vSubaccount + ,vAccount + ,vConcept + ,0 + ,vAmount + ,0 + ,NULL -- Serie + ,NULL -- Factura + ,NULL -- IVA + ,NULL -- Recargo + ,FALSE -- Auxiliar + ,vCompany + ); + + RETURN 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 FUNCTION IF EXISTS `timeWorkerControl_getDirection` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `timeWorkerControl_getDirection`(vUserFk INT, vTimed DATETIME) RETURNS varchar(6) CHARSET utf8 COLLATE utf8_unicode_ci + READS SQL DATA +BEGIN +/** + * Verifica la dirección de la fichada + * @param vUserFk Identificador del trabajador + * @param vTimed Hora de la fichada + * @return Retorna sentido de la fichada 'in, out, middle' + */ + + DECLARE vPrevious DATETIME ; + DECLARE vNext DATETIME ; + DECLARE vPreviousDirection VARCHAR(3) ; + DECLARE vNextDirection VARCHAR(3) ; + DECLARE vDayStayMax INT; + DECLARE vTimedSeconds INT; + DECLARE vLastTimeIn INT; + + SELECT UNIX_TIMESTAMP(vTimed) INTO vTimedSeconds; + + SELECT dayStayMax INTO vDayStayMax + FROM vn.workerTimeControlParams; + + SELECT timed, direction INTO vNext,vNextDirection + FROM vn.workerTimeControl + WHERE userFk = vUserFk + AND direction IN ('in','out') + AND timed > vTimed + ORDER BY timed ASC + LIMIT 1; + + SELECT timed, direction INTO vPrevious, vPreviousDirection + FROM vn.workerTimeControl + WHERE userFk = vUserFk + AND direction IN ('in','out') + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + IF (vTimedSeconds - UNIX_TIMESTAMP(vPrevious) + UNIX_TIMESTAMP(vNext) - vTimedSeconds)<= vDayStayMax AND vPreviousDirection = 'in' AND vNextDirection = 'out' THEN + RETURN 'middle'; + END IF; + + + IF (vTimedSeconds> UNIX_TIMESTAMP(vPrevious)) THEN + IF vPreviousDirection = 'in' THEN + RETURN 'out'; + ELSE + SELECT UNIX_TIMESTAMP(MAX(timed)) INTO vLastTimeIn + FROM vn.workerTimeControl + WHERE userFk = vUserFk + AND direction ='in' + AND timed < vPrevious; + IF vTimedSeconds - vLastTimeIn <= vDayStayMax THEN + RETURN 'out'; + END IF; + END IF; + END IF; + + RETURN 'in'; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `time_getSalesYear` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `time_getSalesYear`(vMonth INT, vYear INT) RETURNS int(11) + DETERMINISTIC +BEGIN +DECLARE vSalesYear INT; +SELECT salesYear INTO vSalesYear +FROM `time` +WHERE `month` = vMonth AND `year` = vYear +LIMIT 1; +RETURN vSalesYear; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `travel_getForLogiflora` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `travel_getForLogiflora`(vLanded DATE, vWarehouseFk INT) RETURNS int(11) + READS SQL DATA +BEGIN + + /** + * Devuelve un número de travel para compras de Logiflora a partir de la fecha de llegada y del almacén. + * Si no existe lo genera. + * + * @param vLanded Fecha de llegada al almacén + * @param vWarehouseFk Identificador de vn.warehouse + */ + + DECLARE vTravelFk INT; + + IF vLanded THEN + + SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk + FROM vn.travel tr + JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk + JOIN vn.agencyMode am ON am.id = tr.agencyFk + WHERE wIn.id = vWarehouseFk + AND wOut.name = 'Holanda' + AND am.name = 'LOGIFLORA' + AND landed = vLanded; + + IF NOT vTravelFk THEN + + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) + SELECT vLanded, curdate(), vWarehouseFk, wOut.id, am.id + FROM vn.warehouse wOut + JOIN vn.agencyMode am ON am.name = 'LOGIFLORA' + WHERE wOut.name = 'Holanda'; + + SELECT MAX(tr.id) INTO vTravelFk + FROM vn.travel tr + JOIN vn.warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN vn.warehouse wOut ON wOut.id = tr.warehouseOutFk + WHERE wIn.id = vWarehouseFk + AND wOut.name = 'Holanda' + AND landed = vLanded; + END IF; + + END IF; + + RETURN vTravelFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `validationCode` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `validationCode`(vString VARCHAR(255)) RETURNS int(11) + DETERMINISTIC +BEGIN + + DECLARE vSeed DOUBLE DEFAULT 0; + DECLARE vCode INT; + DECLARE vLength INT; + DECLARE vChar INT; + + SET vLength = length(vString); + + WHILE vLength > 0 DO + + SET vChar = MID(vString,vLength,1); + + SET vSeed = vSeed + ASCII(vChar); + + SET vLength = vLength - 1; + + END WHILE; + + SET vCode = FLOOR(SQRT(vSeed)*1000000) mod 1000; + + RETURN 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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `validationCode_beta` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `validationCode_beta`(vString VARCHAR(255)) RETURNS int(11) + DETERMINISTIC +BEGIN + + DECLARE vSeed DOUBLE DEFAULT 0; + DECLARE vCode INT; + DECLARE vLength INT; + DECLARE vChar INT; + + SET vLength = length(vString); + + WHILE vLength > 0 DO + + SET vChar = MID(vString,vLength,1); + + SET vSeed = vSeed + ASCII(vChar); + + SET vLength = vLength - 1; + + END WHILE; + + SET vCode = FLOOR(SQRT(vSeed)*1000000) mod 1000; + + RETURN 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 */ ; +/*!50003 DROP FUNCTION IF EXISTS `workerIsBoss` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `workerIsBoss`(vUserId INT) RETURNS int(11) + DETERMINISTIC +BEGIN +/** + * Comprueba por jerarquía si el trabajador actual es jefe + * de un trabajador en concreto. + * + * @param vUserId Id del trabajador que se desea comprobar. + * @return Revuelve verdadero si es jefe del empleado por escala jerárquica. + */ + DECLARE vWorkerId INT; + DECLARE vBossId INT; + + SELECT id INTO vWorkerId + FROM vn.worker + WHERE userFk = vUserId; + IF vWorkerId IS NULL THEN + CALL util.throw('USER_NOT_FOUND'); + END IF; + + DROP TEMPORARY TABLE IF EXISTS tCheckedWorker; + CREATE TEMPORARY TABLE tCheckedWorker + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT id workerFk FROM worker LIMIT 0; + LOOP + SELECT bossFk INTO vBossId + FROM vn.worker + WHERE id = vWorkerId; + IF (SELECT COUNT(*) FROM tCheckedWorker WHERE workerFk = vBossId) THEN + CALL util.throw('INFINITE_LOOP'); + END IF; + IF vBossId = vWorkerId THEN + RETURN FALSE; + ELSEIF vBossId = account.myUser_getId() THEN + RETURN TRUE; + ELSE + INSERT INTO tCheckedWorker VALUES (vWorkerId); + SET vWorkerId = vBossId; + END IF; + END LOOP; + DROP TEMPORARY TABLE tCheckedWorker; + 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 `workerMachinery_isRegistered` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `workerMachinery_isRegistered`(vWorkerFk VARCHAR(10)) RETURNS tinyint(1) + READS SQL DATA +BEGIN +/** + * Comprueba si existen registros en las últimas horas (maxHours de machineWorkerConfig) del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo) + * + * @param vWorkerFk id del trabajador + * @return Devuelve TRUE/FALSE en caso de que haya o no registros + */ + + IF (SELECT COUNT(*) + FROM machineWorker m + WHERE m.workerFk = vWorkerFk + AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), NOW()) AND ISNULL(m.outTimed)) + THEN + RETURN TRUE; + ELSE + RETURN 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 FUNCTION IF EXISTS `workerNigthlyHours_calculate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `workerNigthlyHours_calculate`(vTimeIn DATETIME, vTimeOut DATETIME) RETURNS decimal(5,2) + READS SQL DATA +BEGIN +/** + * Calcula el número decimal de horas nocturnas comprendidas entre 2 horas dadas + * + * @param vTimeIn + * @param vTimeOut + * @return vNigthlyHours + */ + DECLARE vNigthlyHours DECIMAL(5,2); + DECLARE vSecondsPerHour INT(4) DEFAULT 3600; + + SELECT GREATEST(0, TIMESTAMPDIFF(SECOND, + IF(TIME(vTimeIn) BETWEEN endNightlyHours AND startNightlyHours, + CONCAT(DATE(vTimeIn), ' ', startNightlyHours), + vTimeIn), + IF(TIME(vTimeOut) BETWEEN endNightlyHours AND startNightlyHours, + CONCAT(DATE(vTimeOut), ' ', endNightlyHours), + vTimeOut))) / vSecondsPerHour INTO vNigthlyHours + FROM vn.workerTimeControlConfig; + + RETURN vNigthlyHours; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControl_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_add`( vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) + DETERMINISTIC +BEGIN + DECLARE vDirection VARCHAR(6); + DECLARE vLastIn DATETIME; + DECLARE vDayStayMax INT; + DECLARE vHasDirectionOut INT; + DECLARE vLastInsertedId INT; + + SELECT dayStayMax INTO vDayStayMax + FROM workerTimeControlParams; + + SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; + + IF vDirection = 'out' THEN + + SELECT MAX(timed) INTO vLastIn + FROM workerTimeControl + WHERE userFk = vUserFk + AND direction = 'in' + AND timed < vTimed; + + UPDATE workerTimeControl wtc + SET wtc.direction = 'middle' + WHERE userFk = vUserFk + AND direction = 'out' + AND timed BETWEEN vLastIn AND vTimed; + + ELSE IF vDirection = 'in' THEN + + SELECT COUNT(*) INTO vHasDirectionOut + FROM workerTimeControl wtc + WHERE userFk = vUserFk + AND direction = 'out' + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + + UPDATE workerTimeControl wtc + SET wtc.direction = IF (vHasDirectionOut,'middle','out') + WHERE userFk = vUserFk + AND direction = 'in' + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + + END IF; + END IF; + + INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) + VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); + + SET vLastInsertedId = LAST_INSERT_ID(); + + CALL workerTimeControlSOWP(vUserFk, vTimed); + + RETURN vLastInsertedId; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `workerTimeControl_addDirection` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `workerTimeControl_addDirection`( vUserFk INT, vWarehouseFk INT, vTimed DATETIME, vIsManual BOOL) RETURNS int(11) + DETERMINISTIC +BEGIN + DECLARE vDirection VARCHAR(6); + DECLARE vLastIn DATETIME; + DECLARE vDayStayMax INT; + DECLARE vHasDirectionOut INT; + DECLARE vLastInsertedId INT; + + SELECT dayStayMax INTO vDayStayMax + FROM workerTimeControlParams; + + SELECT timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; + + IF vDirection = 'out' THEN + + SELECT MAX(timed) INTO vLastIn + FROM workerTimeControl + WHERE userFk = vUserFk + AND direction = 'in' + AND timed < vTimed; + + UPDATE workerTimeControl wtc + SET wtc.direction = 'middle' + WHERE userFk = vUserFk + AND direction = 'out' + AND timed BETWEEN vLastIn AND vTimed; + + ELSE IF vDirection = 'in' THEN + + SELECT COUNT(*) INTO vHasDirectionOut + FROM workerTimeControl wtc + WHERE userFk = vUserFk + AND direction = 'out' + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + + UPDATE workerTimeControl wtc + SET wtc.direction = IF (vHasDirectionOut,'middle','out') + WHERE userFk = vUserFk + AND direction = 'in' + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + + END IF; + END IF; + + INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) + VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); + + SET vLastInsertedId = LAST_INSERT_ID(); + + CALL workerTimeControlSOWP(vUserFk, vTimed); + + RETURN vLastInsertedId; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `worker_isWorking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `worker_isWorking`(vWorkerFk INT) RETURNS tinyint(1) + READS SQL DATA +BEGIN +/** + * Comprueba si el trabajador está trabajando en el momento de la consulta + * @return Devuelve TRUE en caso de que este trabajando. Si se encuentra en un descanso devolverá FALSE + */ + DECLARE vLastIn DATETIME ; + + SELECT MAX(timed) INTO vLastIn + FROM vn.workerTimeControl + WHERE userFk = vWorkerFk AND + direction = 'in'; + + IF (SELECT MOD(COUNT(*),2) + FROM vn.workerTimeControl + WHERE userFk = vWorkerFk AND + timed >= vLastIn + ) THEN + RETURN TRUE; + ELSE + RETURN 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 FUNCTION IF EXISTS `xdiario_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `xdiario_new`( + vAsiento INT, + vDated DATE, + vSubaccount VARCHAR(12), + vAccount VARCHAR(12), + vConcept VARCHAR(25), + vDebit DOUBLE, + vCredit DOUBLE, + vEuro DOUBLE, + vSerie CHAR(1), + vInvoice VARCHAR(8), + vVat DOUBLE, + vRe DOUBLE, + vAux TINYINT, + vCompany INT +) RETURNS int(11) + NO SQL +BEGIN + IF vAsiento IS NULL THEN + CALL vn.ledger_next(vAsiento); + END IF; + + INSERT INTO XDiario + SET ASIEN = vAsiento, + FECHA = vDated, + SUBCTA = vSubaccount, + CONTRA = vAccount, + CONCEPTO = vConcept, + EURODEBE = vDebit, + EUROHABER = vCredit, + BASEEURO = vEuro, + SERIE = vSerie, + FACTURA = vInvoice, + IVA = vVat, + RECEQUIV = vRe, + AUXILIAR = IF(vAux = FALSE, NULL, '*'), + MONEDAUSO = 2, + empresa_id = vCompany; + + RETURN vAsiento; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zoneGeo_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` FUNCTION `zoneGeo_new`(vType VARCHAR(255), vName VARCHAR(255), vParentFk INT) RETURNS int(11) + NO SQL +BEGIN +/** + * Creates a new node a node from the #zoneGeo table. + * Also sets a mark to force the tree recalculation. + * + * @param vType The node type + * @param vName The node name + * @param vParentFk The parent node identifier + * @return The new node identifier + */ + DECLARE vSelf INT; + + INSERT INTO zoneGeo + SET `type` = vType, + `name` = vName, + parentFk = vParentFk; + + SET vSelf = LAST_INSERT_ID(); + + UPDATE zoneGeoRecalc SET isChanged = TRUE; + + RETURN vSelf; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `addNoteFromDelivery` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `addNoteFromDelivery`(idTicket INT,nota TEXT) +BEGIN + + DECLARE observationTypeFk INT DEFAULT 3; /*3 = REPARTIDOR*/ + + INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) + VALUES (idTicket,observationTypeFk,nota) + ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `addressTaxArea`() + READS SQL DATA +BEGIN +/** + * Devuelve el taxArea para un conjunto de Consignatarios y empresas, + * + * @table tmp.addressCompany(addressFk, companyFk) valores a calcular + * @return tmp.addressTaxArea(addressFk,companyFk) + */ + + DECLARE vSpainCountryCode INT DEFAULT 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; + CREATE TEMPORARY TABLE tmp.addressTaxArea + (PRIMARY KEY (addressFk, companyFk)) + ENGINE = MEMORY + SELECT CASE + WHEN (NOT cClient.isUeeMember OR NOT cSupplier.isUeeMember) AND s.countryFk != c.countryFk THEN + 'WORLD' + WHEN cClient.isUeeMember AND cSupplier.isUeeMember AND c.countryFk != s.countryFk AND c.isVies THEN + 'CEE' + WHEN a.isEqualizated AND c.countryFk = vSpainCountryCode THEN + 'EQU' + ELSE + 'NATIONAL' + END AS areaFk, ac.addressFk, ac.companyFk + FROM tmp.addressCompany ac + JOIN address a ON a.id = ac.addressFk + JOIN `client` c ON c.id = a.clientFk + JOIN country cClient ON cClient.id = c.countryFk + JOIN supplier s ON s.id = ac.companyFk + JOIN country cSupplier ON cSupplier.id = s.countryFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `agencyHourGetFirstShipped` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetFirstShipped`(vAgencyMode INT, vAddress INT, vWarehouse INT) +BEGIN +/** + * DEPRECATED usar zoneGetFirstShipped +* Devuelve la primera fecha de envio disponible para una agencia en una direccion y un warehouse +* +* @param vAgencyMode id de la agencia en vn.agencyMode +* @param vAddress id de la direccion +* @param vWarehouse id del warehouse +* @return vShipped la primera fecha disponible y vLanded la fecha de llegada/recojida +*/ +DECLARE vAgency INT; +DECLARE vShipped DATE; +DECLARE vLanded DATE DEFAULT CURDATE(); + SELECT agencyFk INTO vAgency FROM agencyMode WHERE id= vAgencyMode; + + l: LOOP + + CALL agencyHourGetShipped(vLanded,vAddress,vAgency); + SELECT shipped INTO vShipped + FROM tmp.agencyHourGetShipped + WHERE warehouseFk = vWarehouse LIMIT 1; + + IF vShipped THEN + LEAVE l; + END IF; + + SET vLanded = DATE_ADD(vLanded, INTERVAL +1 DAY); + + END LOOP; + + SELECT vShipped,vLanded; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `agencyHourGetLanded` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetLanded`(vDated DATE, vAddress INT, vAgency INT, vWarehouse INT) +BEGIN +/** + * DEPRECATED usar zoneGetLanded + * Devuelve una tabla temporal con el dia de recepcion para vDated. + * + * @param vDated Fecha de preparacion de mercancia + * @param vAddress Id de consignatario, %NULL para recogida + * @param vAgency Id agencia + * @table tmp.agencyHourGetLanded Datos de recepción + */ + DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetLanded; + CREATE TEMPORARY TABLE tmp.agencyHourGetLanded + ENGINE = MEMORY + SELECT vWarehouse warehouseFk, landed FROM ( + SELECT * FROM ( + SELECT vWarehouse, TIMESTAMPADD(DAY, ah.substractDay, vDated) landed, ah.substractDay, ah.maxHour + FROM agencyHour ah + LEFT JOIN address a ON a.id = vAddress + WHERE (ah.weekDay = WEEKDAY(TIMESTAMPADD(DAY, ah.substractDay, vDated)) OR ah.weekDay IS NULL) + AND (ah.agencyFk = vAgency OR ah.agencyFk IS NULL) + AND ah.warehouseFk = vWarehouse + AND (ah.provinceFk = a.provinceFk OR ah.provinceFk IS NULL OR vAddress IS NULL) + ORDER BY ( + (ah.weekDay IS NOT NULL) + + (ah.agencyFk IS NOT NULL) + + (- ah.substractDay) + + ((ah.provinceFk IS NOT NULL)*3) + ) DESC + ) t + LIMIT 1 + ) t + WHERE IF(vDated = CURDATE(), t.maxHour > HOUR(NOW()), TRUE) AND t.substractDay < 225; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `agencyHourGetWarehouse` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourGetWarehouse`(vAddress INT, vDate DATE, vWarehouse INT) +BEGIN +/** + * DEPRECATED usar zoneGetWarehouse + * Devuelve el listado de agencias disponibles para la fecha, + * dirección y warehouuse pasadas + * + * @param vAddress no puede ser NULL + * @param vWarehouse warehouse donde comprobaremos las agencias y fecha + * @param vDate Fecha de recogida + * @table agencyModeWarehouseList Listado de agencias disponibles + */ + DECLARE vAgency INT; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vCur CURSOR FOR + SELECT DISTINCT a.id + FROM agency a + JOIN agencyHour ah ON ah.agencyFk = a.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + IF vAddress IS NULL + THEN + CALL util.throw ('Address cannot be null'); + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.agencyModeWarehouseList; + CREATE TEMPORARY TABLE tmp.agencyModeWarehouseList ( + id INT NOT NULL, + agency VARCHAR(20), + description VARCHAR(45), + deliveryMethodFk VARCHAR(45), + shipped DATE, + warehouse VARCHAR(45), + PRIMARY KEY(id) + ) + ENGINE = MEMORY; + + OPEN vCur; + FETCH vCur INTO vAgency; + + WHILE NOT vDone + DO + + INSERT INTO tmp.agencyModeWarehouseList + SELECT am.id, am.name, am.description,am.deliveryMethodFk, TIMESTAMPADD(DAY, -ah.substractDay, vDate), w.name + FROM agencyHour ah + LEFT JOIN address a ON a.id = vAddress + JOIN agencyMode am ON am.agencyFk = vAgency + JOIN warehouse w on w.id = ah.warehouseFk + WHERE ah.warehouseFk = vWarehouse + AND (weekDay = WEEKDAY(vDate) + OR weekDay IS NULL) + AND (ah.agencyFk = vAgency + OR ah.agencyFk IS NULL) + AND (ah.provinceFk = a.provinceFk + OR ah.provinceFk IS NULL + OR vAddress IS NULL) + AND TIMESTAMPADD(DAY, -ah.substractDay, vDate) >= CURDATE() + AND IF(TIMESTAMPADD(DAY, -ah.substractDay, vDate) = CURDATE(), ah.maxHour > HOUR(NOW()), TRUE) + ORDER BY ( + (ah.weekDay IS NOT NULL) + + (ah.agencyFk IS NOT NULL) + + ((ah.provinceFk IS NOT NULL) * 3) + ) DESC + LIMIT 1; + + + FETCH vCur INTO vAgency; + END WHILE; + + CLOSE vCur; + + SELECT * FROM tmp.agencyModeWarehouseList; + DROP TEMPORARY TABLE tmp.agencyModeWarehouseList; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `agencyHourListGetShipped` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyHourListGetShipped`(vDate DATE, vAddress INT, vAgency INT) +BEGIN + /* * DEPRECATED usar zoneGetShipped +*/ + CALL vn.agencyHourGetShipped(vDate, vAddress, vAgency); + + SELECT * FROM tmp.agencyHourGetShipped; + + DROP TEMPORARY TABLE IF EXISTS tmp.agencyHourGetShipped; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `agencyVolume__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyVolume__`(vDated DATE, vAgency INT) +BEGIN + + SELECT ELT(it.temperature + 1,'Calientes','Frios','Secos') AS Temp, + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.carro / 1000000 ,1) AS DECIMAL(10,2)) AS carros , + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.espai / 1000000,1) AS DECIMAL(10,2)) AS espais + FROM vn.buy b + INNER JOIN vn.entry e ON e.id = b.entryFk + INNER JOIN vn.travel tr ON tr.id = e.travelFk + INNER JOIN vn.volumeConfig vc + INNER JOIN vn.item i ON i.id = b.itemFk + INNER JOIN vn.itemType it ON it.id = i.typeFk + WHERE tr.landed = vDated + AND tr.agencyFk IN (0, vAgency) + GROUP BY Temp; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `available_calc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `available_calc`( + vDate DATE, + vAddress INT, + vAgencyMode INT) +BEGIN +/** + * Calculates the available for all available stores + * according to the given parameters. + * + * @param vDate The delivery date + * @param vAddress The delivery address id + * @param vAgencyMode The shipping agency + * @return tmp.availableCalc(calcFk) The available cache ids + */ + DECLARE vCalcFk INT; + DECLARE vShipment DATE; + DECLARE vWarehouse INT; + DECLARE vDone BOOL; + + DECLARE cWarehouses CURSOR FOR + SELECT warehouseFk, shipped FROM tmp.zoneGetShipped; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + -- Establecemos los almacenes y las fechas que van a entrar al disponible + + CALL vn.zone_getShipped (vDate, vAddress, vAgencyMode, FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.availableCalc; + CREATE TEMPORARY TABLE tmp.availableCalc( + calcFk INT UNSIGNED, + PRIMARY KEY (calcFk) + ) + ENGINE = MEMORY; + + OPEN cWarehouses; + + l: LOOP + SET vDone = FALSE; + FETCH cWarehouses INTO vWarehouse, vShipment; + + IF vDone THEN + LEAVE l; + END IF; + + CALL `cache`.available_refresh(vCalcFk, FALSE, vWarehouse, vShipment); + + INSERT IGNORE INTO tmp.availableCalc + SET calcFk = vCalcFk; + END LOOP; + + CLOSE cWarehouses; + DROP TEMPORARY TABLE tmp.zoneGetShipped; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `available_calc__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `available_calc__`( + vDate DATE, + vAddress INT, + vAgencyMode INT) +BEGIN +/** + * Calculates the available for all available stores + * according to the given parameters. + * + * @param vDate The delivery date + * @param vAddress The delivery address id + * @param vAgencyMode The shipping agency + * @return tmp.availableCalc(calcFk) The available cache ids + */ + DECLARE vCalcFk INT; + DECLARE vShipment DATE; + DECLARE vWarehouse INT; + DECLARE vDone BOOL; + + DECLARE cWarehouses CURSOR FOR + SELECT warehouseFk, shipped FROM tmp.zoneGetShipped; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + -- Establecemos los almacenes y las fechas que van a entrar al disponible + + CALL vn.zone_getShippedWarehouse(vDate, vAddress, vAgencyMode); + + DROP TEMPORARY TABLE IF EXISTS tmp.availableCalc; + CREATE TEMPORARY TABLE tmp.availableCalc( + calcFk INT UNSIGNED, + PRIMARY KEY (calcFk) + ) + ENGINE = MEMORY; + + OPEN cWarehouses; + + l: LOOP + SET vDone = FALSE; + FETCH cWarehouses INTO vWarehouse, vShipment; + + IF vDone THEN + LEAVE l; + END IF; + + CALL `cache`.available_refresh(vCalcFk, FALSE, vWarehouse, vShipment); + + INSERT IGNORE INTO tmp.availableCalc + SET calcFk = vCalcFk; + END LOOP; + + CLOSE cWarehouses; + DROP TEMPORARY TABLE tmp.zoneGetShipped; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `bankPolicy_notifyExpired` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `bankPolicy_notifyExpired`() +BEGIN +/** +* +* Manda correo cuando caduca un seguro +* de los leasing +* +*/ + INSERT INTO mail (receiver,replyTo,subject,body) + SELECT 'administracion@verdnatura.es' receiver, + 'noreply@verdnatura.es' replyTo, + CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') subject, + CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') body + FROM vn.bankPolicy bp + LEFT JOIN vn.supplier s + ON s.id = bp.supplierFk + LEFT JOIN vn.bank b + ON b.id = bp.bankFk + WHERE bp.insuranceExpired = 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 `buyUltimate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimate`(vWarehouseFk SMALLINT, vDated DATE) +BEGIN +/** + * Calcula las últimas compras realizadas hasta una fecha + * + * @param vWarehouseFk Id del almacén + * @param vDated Compras hasta fecha + * @return tmp.buyUltimate + */ + CALL cache.last_buy_refresh (FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; + CREATE TEMPORARY TABLE tmp.buyUltimate + (PRIMARY KEY (itemFk, warehouseFk), + INDEX(itemFk)) + ENGINE = MEMORY + SELECT item_id itemFk, buy_id buyFk, warehouse_id warehouseFk, landing + FROM cache.last_buy + WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL; + + CALL buyUltimateFromInterval(vWarehouseFk, CURDATE(), vDated); + + REPLACE INTO tmp.buyUltimate + SELECT itemFk, buyFk, warehouseFk, landed landing + FROM tmp.buyUltimateFromInterval + WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) + AND landed <= vDated; + + INSERT IGNORE INTO tmp.buyUltimate + SELECT itemFk, buyFk, warehouseFk, landed landing + FROM tmp.buyUltimateFromInterval + WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) + AND landed > vDated; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `buyUltimateFromInterval` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimateFromInterval`(vWarehouseFk SMALLINT, vStarted DATE, vEnded DATE) +BEGIN +/** + * Calcula las últimas compras realizadas + * desde un rango de fechas. + * + * @param vWarehouseFk Id del almacén si es NULL se actualizan todos + * @param vStarted Fecha inicial + * @param vEnded Fecha fin + * @return tmp.buyUltimateFromInterval + */ + IF vEnded IS NULL THEN + SET vEnded = vStarted; + END IF; + + IF vEnded < vStarted THEN + SET vStarted = TIMESTAMPADD(MONTH, -1, vEnded); + END IF; + + -- Item + + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval; + CREATE TEMPORARY TABLE tmp.buyUltimateFromInterval + (PRIMARY KEY (itemFk, warehouseFk), INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk)) + ENGINE = MEMORY + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + MULTIMAX(t.landed, b.id) buyFk, + MAX(t.landed) landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vStarted AND vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.price2 > 0 + AND NOT b.isIgnored + AND b.quantity > 0 + GROUP BY itemFk, warehouseInFk; + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed > vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.price2 > 0 + AND NOT b.isIgnored + GROUP BY itemFk, warehouseInFk; + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vStarted AND vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.quantity = 0 + GROUP BY itemFk, warehouseInFk; + + + + -- ItemOriginal + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + MULTIMAX(t.landed, b.id) buyFk, + MAX(t.landed) landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vStarted AND vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.price2 > 0 + AND NOT b.isIgnored + AND b.quantity > 0 + AND itemOriginalFk + GROUP BY itemOriginalFk, warehouseInFk; + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed > vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.price2 > 0 + AND NOT b.isIgnored + AND itemOriginalFk + GROUP BY itemOriginalFk, warehouseInFk; + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vStarted AND vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.quantity = 0 + AND itemOriginalFk + GROUP BY itemOriginalFk, warehouseInFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `buyUltimate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimate__`(vWarehouseFk SMALLINT, vDated DATE) +BEGIN +/** + * Calcula las �ltimas compras realizadas hasta una fecha + * + * @param vWarehouseFk Id del almacén + * @param vDated Compras hasta fecha + * @return tmp.buyUltimate + */ + CALL cache.last_buy_refresh (FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; + CREATE TEMPORARY TABLE tmp.buyUltimate + (PRIMARY KEY (itemFk, warehouseFk), + INDEX(itemFk)) + ENGINE = MEMORY + SELECT item_id itemFk, buy_id buyFk, warehouse_id warehouseFk + FROM cache.last_buy + WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL; + + CALL buyUltimateFromInterval(vWarehouseFk, CURDATE(), vDated); + + REPLACE INTO tmp.buyUltimate + SELECT itemFk, buyFk, warehouseFk + FROM tmp.buyUltimateFromInterval + WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) + AND landed <= vDated; + + INSERT IGNORE INTO tmp.buyUltimate + SELECT itemFk, buyFk, warehouseFk + FROM tmp.buyUltimateFromInterval + WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) + AND landed > vDated; + + DROP TEMPORARY TABLE tmp.buyUltimateFromInterval; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_afterUpsert` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_afterUpsert`(vSelf INT) +BEGIN +/** + * Triggered actions when a buy is updated or inserted. + * + * @param vSelf The buy reference + */ + DECLARE vEntryFk INT; + DECLARE vItemFk INT; + DECLARE vPackingOut DECIMAL(10,2); + DECLARE vWarehouse INT; + DECLARE vStandardFlowerBox INT; + DECLARE vWarehouseOut INT; + DECLARE vIsMerchandise BOOL; + DECLARE vIsFeedStock BOOL; + + SELECT b.entryFk, b.itemFk, i.packingOut, ic.merchandise, vc.standardFlowerBox + INTO vEntryFk, vItemFk, vPackingOut, vIsMerchandise, vStandardFlowerBox + FROM buy b + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN itemType it ON it.id = i.typeFk + LEFT JOIN itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox + JOIN volumeConfig vc ON TRUE + WHERE b.id = vSelf; + + SELECT t.warehouseInFk, t.warehouseOutFk + INTO vWarehouse, vWarehouseOut + FROM entry e + JOIN travel t ON t.id = e.travelFk + WHERE e.id = vEntryFk; + + IF vIsMerchandise THEN + + REPLACE itemCost SET + itemFk = vItemFk, + warehouseFk = vWarehouse, + cm3 = buy_getUnitVolume(vSelf), + cm3Delivery = IFNULL((vStandardFlowerBox * 1000) / vPackingOut, buy_getUnitVolume(vSelf)); + + UPDATE vn.itemCost ic + JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk + JOIN vn.buy b ON b.id = lb.buy_id + SET ic.grams = b.weight * 1000 / b.packing + WHERE ic.itemFk = vItemFk AND + ic.warehouseFk = vWarehouse; + + END IF; + + SELECT isFeedStock INTO vIsFeedStock + FROM warehouse WHERE id = vWarehouseOut AND id <> 13; + + IF vIsFeedStock THEN + INSERT IGNORE INTO producer(`name`) + SELECT es.company_name + FROM buy b + JOIN edi.ekt be ON be.id = b.ektFk + JOIN edi.supplier es ON es.supplier_id = be.pro + WHERE b.id = vSelf; + + 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 `buy_checkGrouping` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_checkGrouping`(vGrouping INT) +BEGIN +/** + * Checks the buy grouping, throws an error if it's invalid. + * + * @param vGrouping The grouping + */ + IF vGrouping = 0 THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Grouping cannot be zero'; + 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 `buy_getVolume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolume`() +BEGIN +/** + * Cálculo de volumen en líneas de compra + * @table tmp.buy(buyFk) + */ + SELECT t.name Temp, + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + item_getVolume(b.itemFk, b.packageFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) carros , + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + item_getVolume(b.itemFk, b.packageFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) espais + FROM buy b + JOIN tmp.buy tb ON tb.buyFk = b.id + JOIN volumeConfig vc + JOIN item i ON i.id = b.itemFk + JOIN itemType it ON it.id = i.typeFk + LEFT JOIN temperature t ON t.code = it.temperatureFk + GROUP BY Temp; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getVolumeByAgency` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolumeByAgency`(vDated DATE, vAgencyFk INT) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.buy; + CREATE TEMPORARY TABLE tmp.buy (buyFk INT NOT NULL, PRIMARY KEY (buyFk)) ENGINE = MEMORY; + + INSERT INTO tmp.buy + SELECT b.id + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed = vDated + AND t.agencyFk IN (0, vAgencyFk); + + CALL buy_getVolume(); + DROP TEMPORARY TABLE tmp.buy; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getVolumeByEntry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_getVolumeByEntry`(vEntryFk INT) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.buy; + CREATE TEMPORARY TABLE tmp.buy (buyFk INT NOT NULL, PRIMARY KEY (buyFk)) ENGINE = MEMORY; + + INSERT INTO tmp.buy + SELECT b.id + FROM buy b + JOIN entry e ON e.id = b.entryFk + WHERE e.id = vEntryFk; + + CALL buy_getVolume(); + DROP TEMPORARY TABLE tmp.buy; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_notifyPassport__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_notifyPassport__`( + IN vBuyFk INT, + IN vItemFk INT, + IN vStickers SMALLINT, + IN vPacking SMALLINT +) +BEGIN + /*INSERT INTO vn.mail(`subject`,`body`,`sender`) + SELECT 'Solicitar pasaporte', + CONCAT( + 'Etiquetas: ', IFNULL(vStickers, 0), + ', Packing: ', IFNULL(vPacking, 0), + ', Nombre: ', IFNULL(i.`name`, 0), + ', buy_edi: ', IFNULL(e.id, 0), + ', Nombre botánico: ', IFNULL(g.latin_genus_name, ''), ' ', IFNULL(s.latin_species_name, ''), + ', Productor: ',IFNULL(es.company_name, IFNULL(p.`name`, '')) + ) + ,'ekt@verdnatura.es' + FROM item i + LEFT JOIN itemBotanical ib ON ib.itemFk = i.id + LEFT JOIN edi.genus g ON g.genus_id = ib.genusFk + LEFT JOIN edi.specie s ON IFNULL(s.specie_id, ib.specieFk) = ib.specieFk + LEFT JOIN producer p ON p.id = i.producerFk + LEFT JOIN buy b ON b.id = vBuyFk + LEFT JOIN edi.ekt e ON b.ektFk = e.id + LEFT JOIN edi.supplier es ON es.supplier_id = e.pro + WHERE i.id = vItemFk; */ +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_recalcPrices` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_recalcPrices`() +BEGIN +-- Preparar para que proveedores como el 4 no puedan ser recalculadas sus entradas +/** + * Recalcula los precios para las compras insertadas en tmp.buyRecalc + * + * @param tmp.buyRecalc (id) + */ + DECLARE vLanded DATE; + DECLARE vWarehouseFk INT; + DECLARE vFallo BOOL; + DECLARE vBuyingValue DECIMAL(10,3); + DECLARE vPackageFk VARCHAR(10); + + SELECT t.landed, t.warehouseInFk INTO vLanded, vWarehouseFk + FROM tmp.buyRecalc br + JOIN buy b ON b.id = br.id + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + LIMIT 1; + + CALL vn.rate_getPrices(vLanded, vWarehouseFk); + + -- quitado los cubos a floramondo revisar en buy_tarifas_entry + UPDATE buy b + JOIN tmp.buyRecalc br ON br.id = b.id AND (@buyId := b.id) + LEFT JOIN packaging p ON p.id = b.packageFk + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN itemType it ON it.id = i.typeFk + JOIN travel tr ON tr.id = e.travelFk + JOIN agencyMode am ON am.id = tr.agencyFk + JOIN tmp.rate r + SET b.freightValue = @PF:= + ROUND(IFNULL(((am.m3 * @cm3:= item_getVolume(b.itemFk, b.packageFk)) / 1000000) / b.packing,0),3), + b.comissionValue = @CF:= ROUND(IFNULL(e.commission * b.buyingValue / 100, 0), 3), + b.packageValue = @EF:= IF(p.isPackageReturnable != 0, 0, ROUND(IFNULL(p.`value` / b.packing ,0),3)), + b.price3 = @t3:= IF(r.rate3 = 0, b.buyingValue,ROUND((b.buyingValue + @CF + @EF + @PF) / ((100 - r.rate3 - it.promo ) /100) ,2)), -- He añadido que el coste sea igual a tarifa3 si t3 = 0 + b.price2 = @t2:= round(@t3 * (1 + ((r.rate2 - r.rate3)/100)),2), + b.price2 = @t2:= IF(@t2 <= @t3,@t3 , @t2); + + SELECT (b.buyingValue = b.price2), b.buyingValue, b.packageFk + INTO vFallo, vBuyingValue, vPackageFk + FROM vn.buy b + WHERE b.id = @buyId AND b.buyingValue <> 0.01; + + IF vFallo THEN + + CALL `vn`.`mail_insert`('cau@verdnatura.es', + NULL, + CONCAT('Fallo en buy_recalcPrices buy.id = ', @buyId), + CONCAT( ' @t3 = ', @t3, + ' @t2 = ', @t2, + ' @PF = ', @PF, + ' @EF = ', @EF, + ' @CF = ', @CF, + ' buyingValue = ', vBuyingValue, + ' packageFk = ', vPackageFk + ) + ); + + END IF; + + DROP TEMPORARY TABLE tmp.rate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `buy_updateGrouping` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updateGrouping`(vWarehouseFk INT, vItemFk INT, vGrouping INT) +BEGIN +/** + * Actualiza el grouping de las últimas compras de un artículo + * + * @param vWarehouseFk Id del almacén + * @param vItemFk Id del Artículo + * @param vGrouping Cantidad de grouping + */ + + CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + + UPDATE vn.buy b + JOIN tmp.buyUltimate bu ON b.id = bu.buyFk + SET b.`grouping` = vGrouping + WHERE bu.warehouseFk = vWarehouseFk + AND bu.itemFk = vItemFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_updatePacking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updatePacking`(vWarehouseFk INT, vItemFk INT, vPacking INT) +BEGIN +/** + * Actualiza packing + * + * @param vWarehouseFk warehouse del item + * @param vItemFk id del item + * @param vPacking packing a actualizar + */ + CALL buyUltimate(vWarehouseFk, CURDATE()); + + UPDATE buy b + JOIN tmp.buyUltimate bu ON b.id = bu.buyFk + SET b.packing = vPacking + WHERE bu.warehouseFk = vWarehouseFk + AND bu.itemFk = vItemFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `camaraFutureVolume__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `camaraFutureVolume__`(vWarehouseFk INT, vDateStart DATE, vDateEnd DATE) +BEGIN + + DECLARE vDated DATE; + DECLARE vSectorVolume INT; + DECLARE vLastDayVolume INT; + DECLARE vMinCamara INT; + + SET vDated = vDateStart; + + DROP TEMPORARY TABLE IF EXISTS tmp.camara; + + IF vDateStart = CURDATE() THEN + + CREATE TEMPORARY TABLE tmp.camara + SELECT vDated as dated, + CONCAT('sector ', sectorFk) as place, + FLOOR(SUM(ish.visible * r.cm3)/1000000) as m3 + FROM vn.itemShelving ish + JOIN bi.rotacion r ON r.Id_Article = ish.itemFk AND r.warehouse_id = vWarehouseFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + WHERE s.warehouseFk = vWarehouseFk + GROUP BY p.sectorFk; + + SELECT m3 + INTO vSectorVolume + FROM tmp.camara + WHERE place LIKE 'sector%'; + + CALL cache.visible_refresh(@calc_id, FALSE, 1); + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'nicho', + FLOOR((SUM(v.visible * r.cm3) / 1000000) - vSectorVolume ) as m3 + FROM cache.visible v + JOIN bi.rotacion r ON r.Id_Article = v.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = v.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE calc_id = @calc_id + AND ic.display; + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'entradas', FLOOR(SUM(iei.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_entry_in iei + JOIN bi.rotacion r ON r.Id_Article = iei.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = iei.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.display + AND dat = vDated + AND NOT received + AND NOT isVirtualStock + AND iei.warehouse_id = vWarehouseFk; + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'salidas', FLOOR(SUM(ieo.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_entry_out ieo + JOIN bi.rotacion r ON r.Id_Article = ieo.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = ieo.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.display + AND dat = vDated + AND NOT delivered + AND NOT isVirtualStock + AND ieo.warehouse_id = vWarehouseFk; + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'ventas', FLOOR(SUM(io.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_out io + JOIN bi.rotacion r ON r.Id_Article = io.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = io.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.ticketStateToday tst ON tst.ticket = io.ticketFk + JOIN vn.ticket t ON t.id = io.ticketFk + WHERE ic.display + AND ic.id != 7 + AND t.clientFk NOT IN (200,400,50,450) + AND dat BETWEEN vDated AND util.dayend(vDated) + AND NOT tst.isPicked + AND io.warehouse_id = vWarehouseFk; + + ELSE + + CREATE TEMPORARY TABLE tmp.camara + SELECT vDated as dated, + 'entradas' as place, + FLOOR(SUM(iei.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_entry_in iei + JOIN bi.rotacion r ON r.Id_Article = iei.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = iei.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.display + AND dat = vDated + AND NOT isVirtualStock + AND iei.warehouse_id = vWarehouseFk; + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'salidas', FLOOR(SUM(ieo.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_entry_out ieo + JOIN bi.rotacion r ON r.Id_Article = ieo.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = ieo.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.display + AND dat = vDated + AND ieo.warehouse_id = vWarehouseFk; + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'ventas', FLOOR(SUM(io.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_out io + JOIN bi.rotacion r ON r.Id_Article = io.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = io.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.ticket t ON t.id = io.ticketFk + WHERE ic.display + AND dat BETWEEN vDated AND util.dayend(vDated) + AND ic.id != 7 + AND t.clientFk NOT IN (200,400,50,450) + AND io.warehouse_id = vWarehouseFk; + + END IF; + + -- Resto de dias + WHILE vDated < vDateEnd DO + + SELECT SUM(IFNULL(m3,0)) INTO vLastDayVolume + FROM tmp.camara + WHERE dated = vDated; + + SET vDated = TIMESTAMPADD(DAY, 1, vDated); + + INSERT INTO tmp.camara(dated, place, m3) + VALUES( vDated, 'camara', vLastDayVolume); + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'entradas', FLOOR(SUM(iei.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_entry_in iei + JOIN bi.rotacion r ON r.Id_Article = iei.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = iei.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.display + AND dat = vDated + AND NOT isVirtualStock + AND iei.warehouse_id = vWarehouseFk; + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'salidas', FLOOR(SUM(ieo.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_entry_out ieo + JOIN bi.rotacion r ON r.Id_Article = ieo.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = ieo.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE ic.display + AND dat = vDated + AND ieo.warehouse_id = vWarehouseFk; + + INSERT INTO tmp.camara(dated, place, m3) + SELECT vDated, 'ventas', FLOOR(SUM(io.amount * r.cm3) / 1000000) as m3 + FROM vn2008.item_out io + JOIN bi.rotacion r ON r.Id_Article = io.item_id AND r.warehouse_id = vWarehouseFk + JOIN vn.item i ON i.id = io.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.ticket t ON t.id = io.ticketFk + WHERE ic.display + AND dat BETWEEN vDated AND util.dayend(vDated) + AND ic.id != 7 + AND t.clientFk NOT IN (200,400,50,450) + AND io.warehouse_id = vWarehouseFk; + + END WHILE; + + SELECT min(m3) INTO vMinCamara + FROM + (SELECT dated, sum(m3) m3 + FROM tmp.camara + GROUP BY dated) sub; + + UPDATE tmp.camara + SET m3 = m3 - vMinCamara + WHERE place = 'camara'; + + SELECT camara.* FROM tmp.camara; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `carrosOficialesANoOficiales__` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `carrosOficialesANoOficiales__`() +BEGIN + +DECLARE done BOOL DEFAULT FALSE; +DECLARE vClientFk INT; +DECLARE vQuantity INT; +DECLARE vTicketFk INT; +DECLARE vAgencyTypeFk INT DEFAULT 628; + + +DECLARE rs CURSOR FOR + SELECT clientFk, sum(quantity) as carros + FROM `ticketPackaging` tp + JOIN ticket t ON t.id = tp.ticketFk + WHERE packagingFk = 'cc' + and t.shipped between '2017-10-30' AND '2019-01-06 23:59:59' + group by clientFk + having carros != 0; + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + +OPEN rs; + +FETCH rs INTO vClientFk, vQuantity; + +-- WHILE NOT done DO + + CALL vn.ticketCreate(vClientFk, '2019-01-06', 13, 442, NULL, vAgencyTypeFk, NULL, '2019-01-01', vTicketFk); + + INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) + VALUES (vTicketFk, 'cc', - VQuantity); + + INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) + VALUES (vTicketFk, 'dc', VQuantity); + + INSERT INTO vn.sale(ticketFk, itemFk, concept) + VALUES (vTicketFk, 90, 'Regularización CCs 2019'); + + CALL vn.`ticketStateUpdate`(vTicketFk, 'DELIVERED'); -- entregado + +-- FETCH rs INTO vClientFk, vQuantity; + +-- END WHILE; + + +CLOSE rs; + +SELECT vTicketFk; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `catalog_calcFromItem` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calcFromItem`( + vLanded DATE, + vAddressFk INT, + vAgencyModeFk INT, + vItemFk INT) +BEGIN +/** + * Calculates available and price for a single item. + * + * @param vItemFk The item id + * @return tmp.ticketCalculateItem + * @return tmp.ticketComponentPrice + * @return tmp.ticketComponent + * @return tmp.ticketLot + * @return tmp.zoneGetShipped + */ + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + ENGINE = MEMORY + SELECT vItemFk itemFk; + + CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); + DROP TEMPORARY TABLE 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 `catalog_calculate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_calculate`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT) +BEGIN +/** + * Calcula los articulos disponibles y sus precios + * + * @table tmp.item(itemFk) Listado de artículos a calcular + * @param vLanded Fecha de recepcion de mercancia + * @param vAddressFk Id del consignatario + * @param vAgencyModeFk Id de la agencia + * @return tmp.ticketCalculateItem(itemFk, available, producer, + * item, size, stems, category, inkFk, image, origin, price) + * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) + * @return tmp.ticketComponent + * @return tmp.ticketComponentPrice + */ + + DECLARE vAvailableCalc INT; + DECLARE vAvailableNoRaidsCalc INT; + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vZoneFk INT; + DECLARE vDone BOOL; + DECLARE cTravelTree CURSOR FOR + SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot( + `warehouseFk` smallint(5) unsigned NOT NULL, + `itemFk` int(11) NOT NULL, + `available` double DEFAULT NULL, + `buyFk` int(11) DEFAULT NULL, + `fix` tinyint(3) unsigned DEFAULT '0', -- este campo parece obsoleto + `zoneFk` int(11) NOT NULL, + KEY `itemFk` (`itemFk`), + KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH + ) ENGINE=MEMORY DEFAULT CHARSET=utf8; + + CALL catalog_componentPrepare(); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; + CREATE TEMPORARY TABLE tmp.ticketCalculateItem( + itemFk INT(11) NOT NULL, + available INT(11), + producer VARCHAR(50), + item VARCHAR(50), + size INT(10) UNSIGNED, + stems INT(11), + category VARCHAR(3), + inkFk VARCHAR(3), + image VARCHAR(50), + origin VARCHAR(3), + price DECIMAL(10,2), + priceKg DECIMAL(10,2), + `grouping` INT(10) UNSIGNED, + PRIMARY KEY `itemFk` (`itemFk`) + ) ENGINE = MEMORY DEFAULT CHARSET=utf8; + + OPEN cTravelTree; + + l: LOOP + SET vDone = FALSE; + FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped; + + IF vDone THEN + LEAVE l; + END IF; + + CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped); + CALL `cache`.availableNoRaids_refresh (vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped); + CALL vn.buyUltimate(vWarehouseFk, vShipped); + + INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk) + SELECT vWarehouseFk, + a.item_id, + IFNULL(a.available, 0), + bu.buyFk, + vZoneFk + FROM `cache`.available a + LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id + AND anr.calc_id = vAvailableNoRaidsCalc + JOIN tmp.item i ON i.itemFk = a.item_id + JOIN vn.item it ON it.id = i.itemFk + JOIN vn.`zone` z ON z.id = vZoneFk + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id + LEFT JOIN edi.supplyResponse sr ON sr.ID = it.supplyResponseFk + LEFT JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID + LEFT JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID + LEFT JOIN (SELECT isVNHSupplier, isEarlyBird, TRUE AS itemAllowed + FROM vn.addressFilter af + JOIN (SELECT ad.provinceFk, p.countryFk, ad.isLogifloraAllowed + FROM vn.address ad + JOIN vn.province p ON p.id = ad.provinceFk + WHERE ad.id = vAddressFk + ) sub2 ON sub2.provinceFk <=> IFNULL(af.provinceFk, sub2.provinceFk) + AND sub2.countryFk <=> IFNULL(af.countryFk, sub2.countryFk) + AND sub2.isLogifloraAllowed <=> IFNULL(af.isLogifloraAllowed, sub2.isLogifloraAllowed) + WHERE vWarehouseFk = af.warehouseFk + AND (vShipped < af.beforeDated + OR ISNULL(af.beforeDated) + OR vShipped > af.afterDated + OR ISNULL(af.afterDated)) + ) sub ON sub.isVNHSupplier = v.isVNHSupplier + AND (sub.isEarlyBird = mp.isEarlyBird OR ISNULL(sub.isEarlyBird)) + JOIN vn.agencyMode am ON am.id = vAgencyModeFk + JOIN vn.agency ag ON ag.id = am.agencyFk + JOIN vn.itemType itt ON itt.id = it.typeFk + JOIN vn.itemCategory itc on itc.id = itt.categoryFk + JOIN vn.address ad ON ad.id = vAddressFk + LEFT JOIN vn.clientItemType cit + ON cit.clientFk = ad.clientFk + AND cit.itemTypeFk = itt.id + LEFT JOIN vn.clientItemCategory cic + ON cic.clientFk = ad.clientFk + AND cic.itemCategoryFk = itc.id + WHERE a.calc_id = vAvailableCalc + AND a.available > 0 + AND (sub.itemAllowed OR NOT it.isFloramondo OR anr.available > 0) + AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize) + AND (itc.isReclining OR ISNULL(it.`size`) OR it.`size` < z.itemMaxSize OR ISNULL(z.itemMaxSize)) + AND NOT (cit.isAllowed <=> FALSE) + AND (ISNULL(cic.itemCategoryFk) OR cit.isAllowed); + + DROP TEMPORARY TABLE tmp.buyUltimate; + + CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); + + INSERT INTO tmp.ticketCalculateItem ( + itemFk, + available, + producer, + item, + size, + stems, + category, + inkFk, + image, + origin, + price, + priceKg, + `grouping`) + SELECT + tl.itemFk, + SUM(tl.available) available, + p.name producer, + i.name item, + i.size size, + i.stems, + i.category, + i.inkFk, + i.image, + o.code origin, + bl.price, + bl.priceKg, + bl.`grouping` + FROM tmp.ticketLot tl + JOIN item i ON tl.itemFk = i.id + LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible + JOIN origin o ON o.id = i.originFk + JOIN ( + SELECT price, itemFk, priceKg, MIN(`grouping`) `grouping` + FROM ( + SELECT price, itemFk, priceKg, `grouping` + FROM tmp.ticketComponentPrice + WHERE warehouseFk = vWarehouseFk + ORDER BY (rate = 2) DESC + ) sub + GROUP BY itemFk + ) bl ON bl.itemFk = tl.itemFk + WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk + GROUP BY tl.itemFk + ON DUPLICATE KEY UPDATE available = available + VALUES(available); + + END LOOP; + + CLOSE cTravelTree; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `catalog_componentCalculate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentCalculate`( vZoneFk INT, + vAddressFk INT, + vShipped DATE, + vWarehouseFk INT) +BEGIN + /** + * Calcula los componentes de los articulos de tmp.ticketLot + * + * @param vZoneFk para calcular el transporte + * @param vAddressFk Consignatario + * @param vShipped dia de salida del pedido + * @param vWarehouseFk warehouse de salida del pedido + * @table tmp.ticketLot (warehouseFk, available, itemFk, buyFk, zoneFk) + * @table tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) + * + * @return tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) + */ + + DECLARE vClientFk INT; + DECLARE vIsFrenchVNHBuyer BOOLEAN DEFAULT FALSE; + DECLARE vVNHWarehouseFk INT DEFAULT 7; + DECLARE vFrenchDiscount DECIMAL(3,2) DEFAULT 0.12; + DECLARE visAnyVolumeAllowed BOOL; + + SELECT clientFk INTO vClientFK + FROM address + WHERE id = vAddressFk; + + SELECT (c.country = 'FRANCIA' AND vWarehouseFk = vVNHWarehouseFk) + INTO vIsFrenchVNHBuyer + FROM vn.country c + JOIN vn.province p ON p.countryFk = c.id + JOIN vn.address a ON a.provinceFk = p.id + WHERE a.id = vAddressFk; + + + -- Se eliminan los productos de tamaños no convencionales, salvo agencias que lo permitan + SELECT a.isAnyVolumeAllowed INTO visAnyVolumeAllowed + FROM vn.agency a + JOIN vn.agencyMode am ON am.agencyFk = a.id + JOIN vn.`zone`z ON z.agencyModeFk = am.id + WHERE z.id = vZoneFk; + + IF NOT vIsAnyVolumeAllowed THEN + + DELETE tl.* + FROM tmp.ticketLot tl + JOIN vn.item i ON i.id = tl.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + WHERE it.isUnconventionalSize; + + END IF; + + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCalculate; + + CREATE TEMPORARY TABLE tmp.ticketComponentCalculate + (PRIMARY KEY (itemFk, warehouseFk)) + ENGINE = MEMORY + SELECT + tl.itemFk, + tl.warehouseFk, + tl.available, + -- IF((@rate2 := IFNULL(pf.rate2, b.price2)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate2) rate2, + IF(i.hasMinPrice, GREATEST(i.minPrice,IFNULL(pf.rate2, b.price2)),IFNULL(pf.rate2, b.price2)) rate2, + IF(i.hasMinPrice, GREATEST(i.minPrice,IFNULL(pf.rate3, b.price3)),IFNULL(pf.rate3, b.price3)) rate3, + -- @minPrice := IF((@rate3 := IFNULL(pf.rate3, b.price3)) < i.minPrice AND i.hasMinPrice, i.minPrice, @rate3) rate3, + -- TRUE AS minPrice, + IFNULL(pf.packing, GREATEST(b.grouping, b.packing)) packing, + IFNULL(pf.`grouping`, b.`grouping`) `grouping`, + ABS(IFNULL(pf.box, b.groupingMode)) groupingMode, + tl.buyFk, + i.typeFk, + IF(i.hasKgPrice, b.weight / b.packing, NULL) weightGrouping + FROM tmp.ticketLot tl + JOIN buy b ON b.id = tl.buyFk + JOIN item i ON i.id = tl.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN specialPrice sp ON sp.itemFk = i.id + AND sp.clientFk = vClientFk + LEFT JOIN ( + SELECT * FROM ( + SELECT pf.itemFk, + pf.`grouping`, + pf.packing, + pf.box, + pf.rate2, + pf.rate3, + zw.warehouseFk + FROM priceFixed pf + JOIN zoneWarehouse zw ON zw.zoneFk = vZoneFk + AND zw.warehouseFk IN (pf.warehouseFk,0) + WHERE vShipped BETWEEN pf.started AND pf.ended + ORDER BY pf.itemFk, pf.warehouseFk DESC + ) tpf + GROUP BY tpf.itemFk, tpf.warehouseFk + ) pf ON pf.itemFk = tl.itemFk + AND pf.warehouseFk = tl.warehouseFk + WHERE b.buyingValue + b.freightValue + b.packageValue + b.comissionValue > 0.01 + AND ic.merchandise + AND tl.zoneFk = vZoneFk + AND tl.warehouseFk = vWarehouseFk; + + -- Coste + INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) + SELECT + tcc.warehouseFk, + tcc.itemFk, + c2.id, + b.buyingValue + b.freightValue + b.packageValue + b.comissionValue + FROM tmp.ticketComponentCalculate tcc + JOIN vn.component c2 ON c2.code = 'purchaseValue' + JOIN buy b ON b.id = tcc.buyFk; + + -- Margen + INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) + SELECT + tcc.warehouseFk, + tcc.itemFk, + c2.id, + tcc.rate3 - b.buyingValue - b.freightValue - b.packageValue - b.comissionValue + FROM tmp.ticketComponentCalculate tcc + JOIN vn.component c2 ON c2.code = 'margin' + JOIN buy b ON b.id = tcc.buyFk; + + -- Promo Francia + IF vIsFrenchVNHBuyer THEN + + INSERT INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) + SELECT + tcc.warehouseFk, + tcc.itemFk, + c2.id, + - vFrenchDiscount * (b.buyingValue + b.freightValue + b.packageValue + b.comissionValue) / ( 1 - vFrenchDiscount) + FROM tmp.ticketComponentCalculate tcc + JOIN vn.component c2 ON c2.code = 'frenchOffer' + JOIN buy b ON b.id = tcc.buyFk; + + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentBase; + CREATE TEMPORARY TABLE tmp.ticketComponentBase ENGINE = MEMORY + SELECT tc.itemFk, ROUND(SUM(tc.cost), 4) AS base, tc.warehouseFk + FROM tmp.ticketComponent tc + JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tc.itemFk AND tcc.warehouseFk = tc.warehouseFk + GROUP BY tc.itemFk, warehouseFk; + + -- RECOBRO + INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) + SELECT tcb.warehouseFk, tcb.itemFk, c2.id, + ROUND(tcb.base * + LEAST( + MAX(GREATEST(IFNULL(cr.priceIncreasing,0), + IFNULL(cr1.priceIncreasing,0), + IFNULL(cr2.priceIncreasing,0)) + ), + 0.25), + 3) + FROM tmp.ticketComponentBase tcb + JOIN vn.component c2 ON c2.code = 'debtCollection' + JOIN claimRatio cr ON cr.clientFk = vClientFk + LEFT JOIN clientYoke cy1 ON cy1.leftOx = cr.clientFk + LEFT JOIN claimRatio cr1 ON cr1.clientFk = cy1.rightOx + LEFT JOIN clientYoke cy2 ON cy2.rightOx = cr.clientFk + LEFT JOIN claimRatio cr2 ON cr2.clientFk = cy2.leftOx + WHERE GREATEST(IFNULL(cr.priceIncreasing,0), IFNULL(cr1.priceIncreasing,0), IFNULL(cr2.priceIncreasing,0)) > 0.009 + GROUP BY tcb.itemFk; + + -- Mana auto + INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) + SELECT tcb.warehouseFk, tcb.itemFk, c2.id, ROUND(base * (0.01 + wm.pricesModifierRate), 3) as manaAuto + FROM tmp.ticketComponentBase tcb + JOIN `client` c on c.id = vClientFk + JOIN workerMana wm ON c.salesPersonFk = wm.workerFk + JOIN vn.component c2 ON c2.code = 'autoMana' + WHERE wm.isPricesModifierActivated + HAVING manaAuto <> 0; + + -- Precios especiales + INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) + SELECT tcb.warehouseFk, + tcb.itemFk, + c2.id, + GREATEST( + IFNULL(ROUND(tcb.base * c2.tax, 4), 0), + IF(i.hasMinPrice, i.minPrice,0) - tcc.rate3 + ) cost + FROM tmp.ticketComponentBase tcb + JOIN vn.component c2 ON c2.code = 'lastUnitsDiscount' + JOIN tmp.ticketComponentCalculate tcc ON tcc.itemFk = tcb.itemFk AND tcc.warehouseFk = tcb.warehouseFk + LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk + JOIN vn.item i ON i.id = tcb.itemFk + WHERE sp.value IS NULL + AND i.supplyResponseFk IS NULL; + + -- Venta por paquetes + INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) + SELECT tcc.warehouseFk, tcc.itemFk, c2.id, tcc.rate2 - tcc.rate3 + FROM tmp.ticketComponentCalculate tcc + JOIN vn.component c2 ON c2.code = 'salePerPackage' + JOIN buy b ON b.id = tcc.buyFk + LEFT JOIN specialPrice sp ON sp.clientFk = vClientFk AND sp.itemFk = tcc.itemFk + WHERE sp.value IS NULL; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.zone (INDEX (id)) + ENGINE = MEMORY + SELECT vZoneFk id; + + CALL zone_getOptionsForShipment(vShipped, TRUE); + + -- Reparto + INSERT INTO tmp.ticketComponent + SELECT tcc.warehouseFK, + tcc.itemFk, + c2.id, + z.inflation * ROUND(ic.cm3delivery * (IFNULL(zo.price,5000) - IFNULL(zo.bonus,0)) / (1000 * vc.standardFlowerBox) , 4) cost + FROM tmp.ticketComponentCalculate tcc + JOIN item i ON i.id = tcc.itemFk + JOIN tmp.zoneOption zo ON zo.zoneFk = vZoneFk + JOIN zone z ON z.id = vZoneFk + JOIN agencyMode am ON am.id = z.agencyModeFk + JOIN vn.volumeConfig vc + JOIN vn.component c2 ON c2.code = 'delivery' + LEFT JOIN itemCost ic ON ic.warehouseFk = tcc.warehouseFk + AND ic.itemFk = tcc.itemFk + HAVING cost <> 0; + + DROP TEMPORARY TABLE tmp.zoneOption; + /* + -- Extra reparto + INSERT INTO tmp.ticketComponent(warehouseFk, itemFk, componentFk, cost) + SELECT tcc.warehouseFk, tcc.itemFk, c2.id, ap.packagingValue cost + FROM tmp.ticketComponentCalculate tcc + JOIN vn.addressForPackaging ap + JOIN vn.component c2 ON c2.code = 'bagged' + WHERE ap.addressFk = vAddressFk; + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentCopy; + CREATE TEMPORARY TABLE tmp.ticketComponentCopy ENGINE = MEMORY + SELECT * FROM tmp.ticketComponent; + + -- Precio especial + INSERT INTO tmp.ticketComponent + SELECT tcc.warehouseFk, + tcc.itemFk, + c2.id, + sp.value - SUM(tcc.cost) sumCost + FROM tmp.ticketComponentCopy tcc + JOIN component c ON c.id = tcc.componentFk + JOIN specialPrice sp ON sp.clientFk = vClientFK AND sp.itemFk = tcc.itemFk + JOIN vn.component c2 ON c2.code = 'specialPrices' + WHERE c.classRate IS NULL + AND tcc.warehouseFk = vWarehouseFk + GROUP BY tcc.itemFk, tcc.warehouseFk + HAVING ABS(sumCost) > 0.001; + + -- Rappel + INSERT INTO tmp.ticketComponent + SELECT tcc.warehouseFk, + tcc.itemFk, + IFNULL(c.componentFk ,c2.id), + SUM(tcc.cost) * ((1/(1-c.rappel/100)) -1) sumCost + FROM tmp.ticketComponentCopy tcc + JOIN vn.clientChain cc ON cc.clientFk = vClientFk + JOIN vn.`chain` c ON c.id = cc.chainFk + JOIN vn.component c2 ON c2.code = 'rappel' + WHERE tcc.warehouseFk = vWarehouseFk + GROUP BY tcc.itemFk, tcc.warehouseFk; + + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentSum; + CREATE TEMPORARY TABLE tmp.ticketComponentSum + (INDEX (itemFk, warehouseFk)) + ENGINE = MEMORY + SELECT SUM(cost) sumCost, tc.itemFk, tc.warehouseFk, c.classRate + FROM tmp.ticketComponent tc + JOIN component c ON c.id = tc.componentFk + GROUP BY tc.itemFk, tc.warehouseFk, c.classRate; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentRate; + CREATE TEMPORARY TABLE tmp.ticketComponentRate ENGINE = MEMORY + SELECT tcc.warehouseFk, + tcc.itemFk, + 1 rate, + IF(tcc.groupingMode = 1, tcc.`grouping`, 1) `grouping`, + CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) price, + CAST(SUM(tcs.sumCost) AS DECIMAL(10,2)) / weightGrouping priceKg + FROM tmp.ticketComponentCalculate tcc + JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk + AND tcs.warehouseFk = tcc.warehouseFk + WHERE IFNULL(tcs.classRate, 1) = 1 + AND tcc.groupingMode < 2 AND (tcc.packing > tcc.`grouping` or tcc.groupingMode = 0) + GROUP BY tcs.warehouseFk, tcs.itemFk; + + INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) + SELECT + tcc.warehouseFk, + tcc.itemFk, + 2 rate, + tcc.packing `grouping`, + SUM(tcs.sumCost) price, + SUM(tcs.sumCost) / weightGrouping priceKg + FROM tmp.ticketComponentCalculate tcc + JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk + AND tcs.warehouseFk = tcc.warehouseFk + WHERE tcc.available IS NULL OR (IFNULL(tcs.classRate, 2) = 2 + AND tcc.packing > 0 AND tcc.available >= tcc.packing) + GROUP BY tcs.warehouseFk, tcs.itemFk; + + INSERT INTO tmp.ticketComponentRate (warehouseFk, itemFk, rate, `grouping`, price, priceKg) + SELECT + tcc.warehouseFk, + tcc.itemFk, + 3 rate, + tcc.available `grouping`, + SUM(tcs.sumCost) price, + SUM(tcs.sumCost) / weightGrouping priceKg + FROM tmp.ticketComponentCalculate tcc + JOIN tmp.ticketComponentSum tcs ON tcs.itemFk = tcc.itemFk + AND tcs.warehouseFk = tcc.warehouseFk + WHERE IFNULL(tcs.classRate, 3) = 3 + GROUP BY tcs.warehouseFk, tcs.itemFk; + + INSERT INTO tmp.ticketComponentPrice (warehouseFk, itemFk, rate, `grouping`, price, priceKg) + SELECT * FROM ( + SELECT * FROM tmp.ticketComponentRate ORDER BY price + ) t + GROUP BY itemFk, warehouseFk, `grouping`; + + DROP TEMPORARY TABLE + tmp.ticketComponentCalculate, + tmp.ticketComponentSum, + tmp.ticketComponentBase, + tmp.ticketComponentRate, + tmp.ticketComponentCopy; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `catalog_componentPrepare` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPrepare`() +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent; + CREATE TEMPORARY TABLE tmp.ticketComponent ( + `warehouseFk` INT UNSIGNED NOT NULL, + `itemFk` INT NOT NULL, + `componentFk` INT UNSIGNED NOT NULL, + `cost` DECIMAL(10,4) NOT NULL, + INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), + UNIQUE `fkItemWarehouseComponent` (`itemFk` ASC, `warehouseFk` ASC, `componentFk` ASC) + )ENGINE=MEMORY DEFAULT CHARSET=utf8; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPrice; + CREATE TEMPORARY TABLE tmp.ticketComponentPrice ( + `warehouseFk` INT UNSIGNED NOT NULL, + `itemFk` INT NOT NULL, + `rate` INT NOT NULL, + `grouping` INT UNSIGNED NOT NULL, + `price` DECIMAL(10,4) NOT NULL, + `priceKg` DECIMAL(10,4), + INDEX `itemWarehouse` USING BTREE (`itemFk` ASC, `warehouseFk` ASC), + UNIQUE `fkItemWarehouseRate` (`itemFk` ASC, `warehouseFk` ASC, `rate` ASC) + )ENGINE=MEMORY DEFAULT CHARSET=utf8; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `catalog_componentPurge` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_componentPurge`() +BEGIN + DROP TEMPORARY TABLE + tmp.ticketComponentPrice, + tmp.ticketComponent, + tmp.ticketLot; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `catalog_test` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `catalog_test`() +proc: BEGIN +/** + * Calcula los articulos disponibles y sus precios + * + * @table tmp.item(itemFk) Listado de artículos a calcular + * @param vLanded Fecha de recepcion de mercancia + * @param vAddressFk Id del consignatario + * @param vAgencyModeFk Id de la agencia + * @return tmp.ticketCalculateItem(itemFk, available, producer, + * item, size, stems, category, inkFk, image, origin, price) + * @return tmp.ticketLot(warehouseFk, itemFk, available, buyFk) + * @return tmp.ticketComponent + * @return tmp.ticketComponentPrice + * @return tmp.zoneGetShipped + */ + DECLARE vLanded DATE DEFAULT DATE_ADD(CURDATE(),INTERVAL 2 DAY); + DECLARE vAddressFk INT DEFAULT 24526; + DECLARE vAgencyModeFk INT DEFAULT 639; + DECLARE vAvailableCalc INT; + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vZoneFk INT; + DECLARE vDone BOOL; + DECLARE cTravelTree CURSOR FOR + SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + ENGINE = MEMORY + SELECT 10 itemFk; + -- Establece los almacenes y las fechas que van a entrar al disponible +SELECT 1; + CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, FALSE); +SELECT 2; + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot( + `warehouseFk` smallint(5) unsigned NOT NULL, + `itemFk` int(11) NOT NULL, + `available` double DEFAULT NULL, + `buyFk` int(11) DEFAULT NULL, + `fix` tinyint(3) unsigned DEFAULT '0', + `zoneFk` int(11) NOT NULL, + KEY `itemFk` (`itemFk`), + KEY `item_warehouse` (`itemFk`,`warehouseFk`) USING HASH + ) ENGINE=MEMORY DEFAULT CHARSET=utf8; + CALL catalog_componentPrepare(); + +SELECT 3; + DROP TEMPORARY TABLE IF EXISTS tmp.ticketCalculateItem; + CREATE TEMPORARY TABLE tmp.ticketCalculateItem( + itemFk INT(11) NOT NULL, + available INT(11), + producer VARCHAR(50), + item VARCHAR(50), + size INT(10) UNSIGNED, + stems INT(11), + category VARCHAR(3), + inkFk VARCHAR(3), + image VARCHAR(50), + origin VARCHAR(3), + price DECIMAL(10,2), + priceKg DECIMAL(10,2), + PRIMARY KEY `itemFk` (`itemFk`) + ) ENGINE = MEMORY DEFAULT CHARSET=utf8; + + OPEN cTravelTree; + + l: LOOP + SET vDone = FALSE; + FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped; + + IF vDone THEN + LEAVE l; + END IF; + + CALL `cache`.available_refresh (vAvailableCalc, FALSE, vWarehouseFk, vShipped); +SELECT '4', vWarehouseFk, vShipped ; + CALL buyUltimate (vWarehouseFk, vShipped); +SELECT 5; + INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk) + SELECT vWarehouseFk, + i.item_id, + IFNULL(i.available, 0), + bu.buyFk, + vZoneFk + FROM `cache`.available i + JOIN tmp.item br ON br.itemFk = i.item_id + LEFT JOIN item it ON it.id = i.item_id + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.item_id + WHERE i.calc_id = vAvailableCalc + AND i.available > 0; + + DROP TEMPORARY TABLE tmp.buyUltimate; + + CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); +SELECT 6; + INSERT INTO tmp.ticketCalculateItem ( + itemFk, + available, + producer, + item, + size, + stems, + category, + inkFk, + image, + origin, + price, + priceKg) + SELECT + tl.itemFk, + SUM(tl.available) available, + p.name producer, + i.name item, + i.size size, + i.stems, + i.category, + i.inkFk, + i.image, + o.code origin, + bl.price, + bl.priceKg + FROM tmp.ticketLot tl + JOIN item i ON tl.itemFk = i.id + LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible + JOIN origin o ON o.id = i.originFk + JOIN ( + SELECT * + FROM (SELECT price, itemFk, priceKg + FROM tmp.ticketComponentPrice + WHERE warehouseFk = vWarehouseFk + ORDER BY (rate = 2) DESC) sub + GROUP BY itemFk + ) bl ON bl.itemFk = tl.itemFk + WHERE tl.zoneFk = vZoneFk AND tl.warehouseFk = vWarehouseFk + GROUP BY tl.itemFk + ON DUPLICATE KEY UPDATE available = available + VALUES(available); + + END LOOP; + + CLOSE cTravelTree; + DROP TEMPORARY TABLE tmp.item; +SELECT 7; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() +BEGIN + DECLARE vDateShort DATETIME; + DECLARE vOneYearAgo DATE; + DECLARE vFourYearsAgo DATE; + DECLARE v18Month DATE; + DECLARE v26Month DATE; + DECLARE v3Month DATE; + DECLARE vTrashId varchar(15); + + SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET vOneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE()); + SET vFourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE()); + SET v18Month = TIMESTAMPADD(MONTH, -18,CURDATE()); + SET v26Month = TIMESTAMPADD(MONTH, -26,CURDATE()); + SET v3Month = TIMESTAMPADD(MONTH, -3, CURDATE()); + + DELETE FROM ticketParking WHERE created < vDateShort; + DELETE FROM routesMonitor WHERE dated < vDateShort; + DELETE FROM workerTimeControlLog WHERE created < vDateShort; + DELETE FROM `message` WHERE sendDate < vDateShort; + DELETE FROM messageInbox WHERE sendDate < vDateShort; + DELETE FROM messageInbox WHERE sendDate < vDateShort; + DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo; + DELETE FROM itemShelving WHERE created < CURDATE() AND visible = 0; + DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE()); + DELETE FROM entryLog WHERE creationDate < vDateShort; + DELETE IGNORE FROM expedition WHERE created < v26Month; + DELETE FROM sms WHERE created < v18Month; + DELETE FROM saleTracking WHERE created < vOneYearAgo; + DELETE tobs FROM ticketObservation tobs + JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,CURDATE()); + DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo; + DELETE FROM sharingCart where ended < vDateShort; + DELETE FROM sharingClient where ended < vDateShort; + DELETE tw.* FROM ticketWeekly tw + LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL; + DELETE FROM claim WHERE ticketCreated < vFourYearsAgo; + DELETE FROM message WHERE sendDate < vDateShort; + -- Robert ubicacion anterior de trevelLog comentario para debug + DELETE sc FROM saleChecked sc + JOIN sale s ON sc.saleFk = s.id WHERE s.created < vDateShort; + DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month; + DELETE bm + FROM buyMark bm + JOIN buy b ON b.id = bm.id + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed <= vDateShort; + DELETE FROM stowaway WHERE created < v3Month; + DELETE FROM vn.buy WHERE created < vDateShort AND entryFk = 9200; + DELETE FROM vn.itemShelvingLog WHERE created < vDateShort; + DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort; + + -- Equipos duplicados + DELETE w.* + FROM workerTeam w + JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated + FROM workerTeam + GROUP BY team,workerFk + HAVING duplicated + ) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id; + + DELETE sc + FROM saleComponent sc + JOIN sale s ON s.id= sc.saleFk + JOIN ticket t ON t.id= s.ticketFk + WHERE t.shipped < v18Month; + + DELETE c + FROM vn.claim c + JOIN vn.claimState cs ON cs.id = c.claimStateFk + WHERE cs.description = "Anulado" AND + c.created < vDateShort; + DELETE + FROM vn.expeditionTruck + WHERE ETD < v3Month; + + -- borrar travels sin entradas + DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; + CREATE TEMPORARY TABLE tmp.thermographToDelete + SELECT th.id,th.dmsFk + FROM vn.travel t + LEFT JOIN vn.entry e ON e.travelFk = t.id + JOIN vn.travelThermograph th ON th.travelFk = t.id + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL; + + SELECT dt.id into vTrashId + FROM vn.dmsType dt + WHERE dt.code = 'trash'; + + UPDATE tmp.thermographToDelete th + JOIN vn.dms d ON d.id = th.dmsFk + SET d.dmsTypeFk = vTrashId; + + DELETE th + FROM tmp.thermographToDelete tmp + JOIN vn.travelThermograph th ON th.id = tmp.id; + + DELETE t + FROM vn.travel t + LEFT JOIN vn.entry e ON e.travelFk = t.id + WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL; + + -- borrar entradas sin compras + DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; + CREATE TEMPORARY TABLE tmp.entryToDelete + SELECT e.* + FROM vn.entry e + LEFT JOIN vn.buy b ON b.entryFk = e.id + JOIN vn.entryConfig ec ON e.id != ec.defaultEntry + WHERE e.dated < TIMESTAMPADD(MONTH, -3, CURDATE()) AND b.entryFK IS NULL; + + DELETE e + FROM vn.entry e + JOIN tmp.entryToDelete tmp ON tmp.id = e.id; + + -- borrar de route registros menores a 4 años + DROP TEMPORARY TABLE IF EXISTS tmp.routeToDelete; + CREATE TEMPORARY TABLE tmp.routeToDelete + SELECT * + FROM vn.route r + WHERE created < TIMESTAMPADD(YEAR,-4,CURDATE()); + + UPDATE tmp.routeToDelete tmp + JOIN vn.dms d ON d.id = tmp.gestdocFk + SET d.dmsTypeFk = vTrashId; + + DELETE r + FROM tmp.routeToDelete tmp + JOIN vn.route r ON r.id = tmp.id; + + -- borrar registros de dua y awb menores a 2 años + DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete; + CREATE TEMPORARY TABLE tmp.duaToDelete + SELECT * + FROM vn.dua + WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE()); + + UPDATE tmp.duaToDelete tm + JOIN vn.dms d ON d.id = tm.gestdocFk + SET d.dmsTypeFk = vTrashId; + + DELETE d + FROM tmp.duaToDelete tmp + JOIN vn.dua d ON d.id = tmp.id; + + DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,CURDATE()); + + -- Borra los ficheros gestDoc + INSERT INTO vn.printServerQueue(priorityFk, labelReportFk)VALUES(1,11); + + -- Borra los registros de collection y ticketcollection + DELETE FROM vn.collection WHERE created < vDateShort; + + DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; + DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; + DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete; + + DELETE FROM travelLog WHERE creationDate < v3Month; + + CALL shelving_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 `clean_logiflora` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clean_logiflora`() +BEGIN + /* partir en 2 procedimientos, uno que borre compras y otro articulos + * item_clean, buy_clean + * */ + + DECLARE vMaxDated DATE DEFAULT TIMESTAMPADD(DAY, - 7, CURDATE()); + DECLARE vDone INT DEFAULT FALSE; + DECLARE vBuyFk INT; + DECLARE cur1 CURSOR FOR SELECT id FROM tmp.buy; + DECLARE cur2 CURSOR FOR SELECT id FROM tmp.item; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.buy; + + CREATE TEMPORARY TABLE tmp.buy + ENGINE = MEMORY + SELECT b.id + FROM vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.agencyMode am ON am.id = tr.agencyFk + WHERE b.quantity = 0 + AND am.name = 'LOGIFLORA' + AND e.isRaid; + + OPEN cur1; + + read_loop: LOOP + + SET vDone = FALSE; + + FETCH cur1 INTO vBuyFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + DELETE FROM vn.buy WHERE id = vBuyFk; + + END LOOP; + + CLOSE cur1; + + DROP TEMPORARY TABLE tmp.buy; + + DROP TEMPORARY TABLE IF EXISTS tmp.item; + + CREATE TEMPORARY TABLE tmp.item + ENGINE = MEMORY + SELECT DISTINCT i.id + FROM vn.item i + LEFT JOIN hedera.orderRow o ON o.itemFk = i.id + LEFT JOIN vn.sale s ON s.itemFk = i.id + LEFT JOIN vn.buy b ON b.itemFk = i.id + WHERE i.supplyResponseFk + AND o.id IS NULL + AND b.id IS NULL + AND s.id IS NULL + AND i.created < vMaxDated; + + OPEN cur2; + + read_loop: LOOP + + SET vDone = FALSE; + + FETCH cur2 INTO vBuyFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + DELETE FROM vn.item WHERE id = vBuyFk; + + END LOOP; + + CLOSE cur2; + + DROP TEMPORARY TABLE 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 `clearShelvingList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clearShelvingList`(vShelvingFk VARCHAR(8)) +BEGIN + + UPDATE vn.itemShelving + SET visible = 0, available = 0 + WHERE shelvingFk COLLATE utf8_unicode_ci =vShelvingFk 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 `clientCreate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientCreate`( + vFirstname VARCHAR(50), + vSurnames VARCHAR(50), + vFi VARCHAR(9), + vAddress TEXT, + vPostcode CHAR(5), + vCity VARCHAR(25), + vProvinceFk SMALLINT(5), + vCompanyFk SMALLINT(5), + vPhone VARCHAR(11), + vEmail VARCHAR(255), + vUserFk INT) +BEGIN +/** + * Create new client + * + */ + DECLARE vPayMethodFk INT DEFAULT 4; + DECLARE vDueDay INT DEFAULT 5; + DECLARE vDefaultCredit DECIMAL(10, 2) DEFAULT 300.00; + DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1; + DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE; + DECLARE vMandateTypeFk INT DEFAULT 2; + + INSERT INTO `client` ( + id, + name, + street, + fi, + phone, + email, + provinceFk, + city, + postcode, + socialName, + payMethodFk, + dueDay, + credit, + isTaxDataChecked, + hasCoreVnl, + isEqualizated) + VALUES ( + vUserFk, + CONCAT('TR ', vFirstname, ' ', vSurnames), + vAddress, + TRIM(vFi), + vPhone, + vEmail, + vProvinceFk, + vCity, + vPostcode, + CONCAT(vSurnames, ' ', vFirstname), + vPayMethodFk, + vDueDay, + vDefaultCredit, + vIsTaxDataChecked, + vHasCoreVnl, + FALSE + ) ON duplicate key update + payMethodFk = vPayMethodFk, + dueDay = vDueDay, + credit = vDefaultCredit, + isTaxDataChecked = vIsTaxDataChecked, + hasCoreVnl = vHasCoreVnl, + isActive = TRUE; + + IF (SELECT COUNT(*) FROM mandate WHERE clientFk = vUserFk AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk) = 0 THEN + INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) + VALUES (vUserFk, vCompanyFk, vMandateTypeFk); + 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 `clientDebtSpray` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientDebtSpray`(vClientFk INT) +BEGIN + + /* Reparte el saldo de un cliente en greuge en la cartera que corresponde, y desasigna el comercial + * + * + */ + + DECLARE vClientDebt DOUBLE; + + SELECT vn.clientGetDebt(vClientFk, CURDATE()) INTO vClientDebt; + + INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) + VALUES (vClientFk, 'Saldo pendiente', vClientDebt, CURDATE(), 5); + + CALL vn.clientGreugeSpray(vClientFk, TRUE, '', TRUE); + + INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) + SELECT vClientFk, 'Liquidación cliente', sum(amount), CURDATE(), 5 + FROM vn.greuge + WHERE clientFk = vClientFk; + + UPDATE vn.client + SET salesPersonFk = NULL + WHERE id = vClientFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientFreeze` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `clientFreeze`() +BEGIN +/** + * Congela diariamente aquellos clientes que son morosos sin recobro, + * pero que no sean trabajadores, + * y que el riesgo no sea menor que cero + * hasta que no se gire la remesa no se congelan a los clientes de giro + */ + + DECLARE vIsRemittanced BOOLEAN; + + SELECT id into vIsRemittanced + FROM receipt + WHERE invoiceFk LIKE 'REMESA%' + AND payed > util.firstDayOfMonth(CURDATE()) + limit 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + SELECT clientFk + FROM bs.defaulter + WHERE created = CURDATE() + AND amount; + + CALL clientGetDebt(CURDATE()); + + UPDATE client c + JOIN bi.defaulters d ON d.client = c.id AND d.date = CURDATE() + JOIN config ON TRUE + LEFT JOIN account.`user` u ON u.id = c.id AND u.active + LEFT JOIN worker w ON w.id = u.id + LEFT JOIN recovery r ON r.clientFk = c.id AND r.finished IS NULL + LEFT JOIN payMethod pm ON pm.id = c.payMethodFk + LEFT JOIN tmp.risk rk ON rk.clientFk = c.id + SET c.isFreezed = TRUE, + d.frozened = CURDATE(), + u.active = FALSE + WHERE (d.amount > config.defaultersMaxAmount + AND rk.risk > 0) + AND c.typeFk = 'normal' + AND r.id IS NULL + AND w.id IS NULL + AND (vIsRemittanced OR pm.code <> 'bankDraft'); + + DROP TEMPORARY TABLE tmp.clientGetDebt; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientGetDebt` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `clientGetDebt`(vDate DATE) +BEGIN +/** + * Calcula el riesgo para los clientes activos + * + * @table tmp.clientGetDebt(clientFk) + * @param vDate Fecha maxima de los registros + * @return tmp.risk + */ + DECLARE vStarted DATETIME DEFAULT TIMESTAMPADD(DAY, -35, CURDATE()); + DECLARE vEnded DATETIME; + + SET vEnded = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); + + DROP TEMPORARY TABLE IF EXISTS tClientRisk; + CREATE TEMPORARY TABLE tClientRisk + ENGINE = MEMORY + SELECT cr.clientFk, SUM(cr.amount) amount + FROM clientRisk cr + JOIN tmp.clientGetDebt c ON c.clientFk = cr.clientFk + GROUP BY cr.clientFk; + + INSERT INTO tClientRisk + SELECT c.clientFk, SUM(r.amountPaid) + FROM receipt r + JOIN tmp.clientGetDebt c ON c.clientFk = r.clientFk + WHERE r.payed > vEnded + GROUP BY c.clientFk; + + INSERT INTO tClientRisk + SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk + WHERE t.receiptFk IS NULL + AND t.status = 'ok' + GROUP BY t.clientFk; + + INSERT INTO tClientRisk + SELECT t.clientFk, totalWithVat + FROM ticket t + JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk + WHERE refFk IS NULL + AND shipped BETWEEN vStarted AND vEnded; + + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + CREATE TEMPORARY TABLE tmp.risk + (PRIMARY KEY (clientFk)) + ENGINE = MEMORY + SELECT clientFk, SUM(amount) risk + FROM client c + JOIN tClientRisk cr ON cr.clientFk = c.id + GROUP BY c.id; + + DROP TEMPORARY TABLE tClientRisk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientGetDebtDiary` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGetDebtDiary`(vClientFK INT, vCompanyFk INT) +BEGIN +/** + * Devuelve el registro de deuda + * + * @param vClientFK Id del cliente + * @param vCompanyFk Id de la empresa + */ + DECLARE vDone BOOL; + DECLARE vDate DATETIME; + DECLARE vTotalBalance DOUBLE DEFAULT 0.00; + DECLARE vCreated DATETIME; + DECLARE vIssued DATETIME; + DECLARE vBalance DOUBLE DEFAULT 0.00; + DECLARE cur CURSOR FOR + SELECT + created, + issued, + ROUND(amount, 2) AS balance + FROM invoiceOut + WHERE clientFk = vClientFk AND companyFk = vCompanyFk + UNION ALL + SELECT + created, + payed, + ROUND(-1 * amountPaid, 2) AS balance + FROM receipt + WHERE clientFk = vClientFk AND companyFk = vCompanyFk + ORDER BY issued, created; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + OPEN cur; + + proc: LOOP + SET vDone = FALSE; + + FETCH cur INTO vCreated, vIssued, vBalance; + + IF vDate IS NULL THEN + SET vDate=vIssued; + END IF; + + IF vDone THEN + LEAVE proc; + END IF; + + SET vTotalBalance = vTotalBalance + vBalance; + + IF CAST(ABS(vTotalBalance) AS UNSIGNED) = 0 THEN + SET vDate = vIssued; + SET vDone = TRUE; + END IF; + END LOOP; + + CLOSE cur; + + SELECT + issued, + CAST(debtOut AS DECIMAL(10,2)) debtOut, + CAST(debtIn AS DECIMAL(10,2)) debtIn, + ref, + companyFk, + priority + FROM + (SELECT + NULL AS issued, + SUM(amountUnpaid) AS debtOut, + NULL AS debtIn, + 'Saldo Anterior' AS ref, + companyFk, + 0 as priority + FROM + (SELECT SUM(amount) AS amountUnpaid, companyFk, 0 + FROM invoiceOut + WHERE clientFk = vClientFK + AND issued < vDate + GROUP BY companyFk + + UNION ALL + + SELECT SUM(-1 * amountPaid), companyFk, 0 + FROM receipt + WHERE clientFk = vClientFK + AND payed < vDate + GROUP BY companyFk) AS transactions + GROUP BY companyFk + + UNION ALL + + SELECT + issued, + amount as debtOut, + NULL AS debtIn, + ref, + companyFk, + 1 + FROM invoiceOut + WHERE clientFk = vClientFK + AND issued >= vDate + UNION ALL + + SELECT + r.payed, + NULL as debtOut, + r.amountPaid, + r.invoiceFk, + r.companyFk, + 0 + FROM receipt r + WHERE r.clientFk = vClientFK + AND r.payed >= vDate) t + INNER JOIN `client` c ON c.id = vClientFK + HAVING debtOut <> 0 OR debtIn <> 0 + ORDER BY issued, priority DESC, debtIn; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientGreugeSpray` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGreugeSpray`(IN vClientFk INT, IN onlyForHisOwner BOOL, IN vWorkerCode VARCHAR(3), IN vWithMana BOOLEAN) +BEGIN + + DECLARE vGreuge DECIMAL(10,2); + DECLARE vOwner INT; + DECLARE vTotalSale INT; + DECLARE vGreugeTypeFk INT DEFAULT 5; -- HERENCIA + DECLARE vGreugeTypeMana INT DEFAULT 3;-- Maná + DECLARE vMana DECIMAL(10,2); + + SELECT vn.clientGetMana(vClientFk) INTO vMana; + + IF vWithMana AND vMana THEN + + INSERT INTO vn.greuge( clientFk, + description, + amount, + shipped, + greugeTypeFk) + VALUES( vClientFk, + 'Desasignación', + -1 * vMana, + CURDATE(), + vGreugeTypeMana); + + END IF; + + SELECT sum(amount) INTO vGreuge + FROM vn.greuge + WHERE clientFk = vClientFk; + + IF vGreuge != 0 THEN + + IF LENGTH(vWorkerCode) = 0 THEN + + SELECT salesPersonFk INTO vOwner + FROM vn.client + WHERE id = vClientFk; + + ELSE + + SELECT id INTO vOwner + FROM vn.worker + WHERE code = vWorkerCode COLLATE utf8_general_ci; + + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientList; + CREATE TEMPORARY TABLE tmp.clientList + SELECT DISTINCT t.clientFk, floor(cr.yearSale / 12) AS monthSale + FROM vn.ticket t + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.manaSpellers ms ON ms.worker = c.salesPersonFk + JOIN vn.claimRatio cr ON cr.clientFk = c.id + WHERE ms.worker = IF(onlyForHisOwner, vOwner, ms.worker) + AND t.shipped >= TIMESTAMPADD(MONTH,-1,CURDATE()) + AND c.id != vClientFk + HAVING monthSale > 100; + + SELECT SUM(monthSale) INTO vTotalSale + FROM tmp.clientList; + + INSERT INTO vn.greuge(clientFk, description, amount, shipped, greugeTypeFk) + SELECT clientFk, CONCAT('Cliente: ',vClientFk), vGreuge * monthSale / vTotalSale, CURDATE(), vGreugeTypeFk + FROM tmp.clientList + UNION ALL + SELECT vClientFk, 'Reparto greuge', -vGreuge, CURDATE(), vGreugeTypeFk; + + 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 `clientPackagingOverstock` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstock`(vClientFk INT, vGraceDays INT ) +BEGIN + DROP TEMPORARY TABLE IF EXISTS tmp.clientPackagingOverstock; + CREATE TEMPORARY TABLE tmp.clientPackagingOverstock + ENGINE = MEMORY + SELECT itemFk, + sum(GotfromClient) - sum(SenttoClient) as devueltos, + sum(InvoicedtoClient) - sum(InvoicedfromClient) as facturados, + LEAST( + sum(GotfromClient) - sum(SenttoClient), + sum(InvoicedtoClient) - sum(InvoicedfromClient) + ) as abonables + FROM + ( + SELECT t.*, + IF(@month = month, 0, 1) monthEnd, + @month := month + FROM + ( + SELECT x.id as ticketFk, + date(x.shipped) as shipped, + x.itemFk, + IFNULL(cast(sum(x.InvoicedtoClient) as DECIMAL(10,0)),0) InvoicedtoClient, + IFNULL(cast(sum(x.InvoicedfromClient) as DECIMAL(10,0)),0) InvoicedfromClient, + IFNULL(cast(sum(x.SenttoClient) as DECIMAL(10,0)),0) SenttoClient, + IFNULL(cast(sum(x.GotfromClient) as DECIMAL(10,0)),0) GotfromClient, + i.name as concept, + x.refFk as invoice, + month(shipped) month, + x.companyFk + FROM + ( + SELECT t.id, + t.shipped, + IFNULL(pe.equivalentFk, s.itemFk) itemFk, + IF(s.quantity > 0, s.quantity, NULL) InvoicedtoClient, + IF(s.quantity < 0, -s.quantity, NULL) InvoicedfromClient, + NULL SenttoClient, + NULL GotfromClient, + t.refFk, + @month := 0 month, + t.companyFk + FROM sale s + JOIN ticket t on t.id = s.ticketFk + JOIN packaging p ON p.itemFk = s.itemFk + LEFT JOIN packageEquivalentItem pe ON pe.itemFk = s.itemFk + WHERE t.clientFk = vClientFk + AND t.shipped > '2017-11-30' + AND p.isPackageReturnable + UNION ALL + SELECT NULL, + '2017-11-30', + IFNULL(pe.equivalentFk, tps.itemFk) itemFk, + tps.sent InvoicedtoClient, + tps.returned InvoicedfromClient, + NULL SenttoClient, + NULL GotfromClient, + 'Histórico', + NULL, + NULL + + FROM ticketPackagingStartingStock tps + LEFT JOIN packageEquivalentItem pe ON pe.itemFk = tps.itemFk + WHERE tps.clientFk = vClientFk + AND tps.isForgetable = FALSE + UNION ALL + SELECT t.id, + t.shipped, + IFNULL(pe.equivalentFk, p.itemFk) itemFk, + NULL, + NULL, + IF(tp.quantity > 0 AND t.shipped <= TIMESTAMPADD(DAY, - vGraceDays, CURDATE()), tp.quantity, NULL) SenttoClient, + IF(tp.quantity < 0, -tp.quantity, NULL) GotfromClient, + NULL AS refFk, + NULL, + t.companyFk + FROM ticketPackaging tp + JOIN ticket t on t.id = tp.ticketFk + JOIN packaging p ON p.id = tp.packagingFk + LEFT JOIN packageEquivalentItem pe ON pe.itemFk = p.itemFk + WHERE t.clientFk = vClientFk + AND t.shipped > '2017-11-21' ) x + + JOIN item i ON x.itemFk = i.id + GROUP BY x.id, x.itemFk + ) t + ORDER BY itemFk, shipped DESC + ) t2 + GROUP BY itemFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientPackagingOverstockReturn` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientPackagingOverstockReturn`(vClientFk INT, vGraceDays INT ) +BEGIN + + DECLARE vNewTicket INT DEFAULT 0; + DECLARE vWarehouseFk INT; + -- SET vGraceDays = GREATEST(vGraceDays, 90); + + CALL vn.clientPackagingOverstock(vClientFk,vGraceDays); + + SELECT id INTO vWarehouseFk + FROM vn.warehouse + WHERE hasConfectionTeam; + + CALL vn.ticket_add( + vClientFk + ,CURDATE() + ,vWarehouseFk -- Algemesi + ,442 -- Verdnatura + ,NULL -- address + ,NULL -- agencia + ,NULL -- route + ,CURDATE() + ,account.myUser_getId() + ,TRUE + ,vNewTicket); + + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) + SELECT vNewTicket, cpo.itemFk, - cpo.abonables, i.longName, p.price + FROM tmp.clientPackagingOverstock cpo + JOIN vn.item i ON i.id = cpo.itemFk + JOIN vn.packaging p ON p.itemFk = cpo.itemFk + WHERE cpo.abonables > 0; + + INSERT INTO vn.ticketPackaging(ticketFk, packagingFk, quantity) + SELECT vNewTicket, p.id, cpo.abonables + FROM tmp.clientPackagingOverstock cpo + JOIN vn.packaging p ON p.itemFk = cpo.itemFk + WHERE cpo.abonables > 0; + + 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 `clientRandomSelection__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRandomSelection__`(vNumero INT) +BEGIN + + DECLARE vClient INT; + + SET @vIndex := 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.client; + + CREATE TEMPORARY TABLE tmp.client + SELECT io.clientFk, + FALSE as isSelected, + @vIndex := @vIndex + 1 id + FROM vn.client c + JOIN vn.invoiceOut io ON io.clientFk = c.id + JOIN vn.address a ON a.clientFk = c.id + JOIN vn.province p ON p.id = a.provinceFk + WHERE p.name = 'MADRID' + AND io.issued = '2019-01-31' + AND a.isDefaultAddress + AND c.name NOT LIKE 'TR %'; + + WHILE vNumero DO + + SET vClient = FLOOR(RAND() * @vIndex + 1); + + IF (SELECT isSelected FROM tmp.client WHERE id = vClient) = FALSE THEN + + UPDATE tmp.client + SET isSelected = TRUE + WHERE id = vClient; + + SET vNumero = vNumero - 1; + + END IF; + + END WHILE; + + SELECT * FROM tmp.client JOIN vn.client c ON c.id = clientFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientRemoveWorker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRemoveWorker`() +BEGIN + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vClientFk INT; + DECLARE rs CURSOR FOR + SELECT c.clientFk + FROM tmp.clientGetDebt c + LEFT JOIN clientRisk r ON r.clientFk = c.clientFk + GROUP BY c.clientFk + HAVING SUM(IFNULL(r.amount,0)) = 0; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + SELECT cd.id as clientFk + FROM bs.clientDied cd + LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id + JOIN vn.client c ON c.id = cd.id + JOIN vn.province p ON p.id = c.provinceFk + JOIN vn.country co ON co.id = p.countryFk + WHERE cd.Aviso = 'TERCER AVISO' AND + cp.clientFk IS NULL AND + co.country NOT IN ('Portugal','Francia','España exento') AND + c.salesPersonFk IS NOT NULL; + + OPEN rs; + FETCH rs INTO vClientFk; + WHILE NOT vDone DO + CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE); + UPDATE vn.client SET salesPersonFk = NULL WHERE id = vClientFk; + INSERT INTO vn.clientLog (originFk, userFk, `action`, description) + VALUES (vClientFk, account.userGetId(), 'update', CONCAT('Se ha desasignado el cliente por que no ha comprado en 3 meses')); + FETCH rs INTO vClientFk; + END WHILE; + CLOSE rs; + DROP TEMPORARY TABLE tmp.clientGetDebt; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clientRisk_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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientRisk_update`(vClientId INT, vCompanyId INT, vAmount DECIMAL(10,2)) +BEGIN + IF vAmount IS NOT NULL + THEN + INSERT INTO clientRisk + SET + clientFk = vClientId, + companyFk = vCompanyId, + amount = vAmount + ON DUPLICATE KEY UPDATE + amount = amount + VALUES(amount); + 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 `client_checkBalance` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `client_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL) +BEGIN + + DECLARE vDateFrom DATE; + SET vDateTo = TIMESTAMP(vDateTo,'23:59:59'); + SELECT util.firstDayOfYear(vDateTo) INTO vDateFrom; + + SELECT s.nickname, c.id , c.accountingAccount , sub1.mysql , sub1.sage, sub1.mysql - sub1.sage diference, sub1.companyFk , c.name + FROM client c + JOIN payMethod pm ON pm.id = c.payMethodFk + JOIN( SELECT sub.companyFk, sub.clientFk, ROUND(SUM(sub.mysql),2) mysql, ROUND(SUM(sub.sage),2) sage + FROM( SELECT io.companyFk, io.clientFk, -io.amount mysql, 0 sage + FROM invoiceOut io + WHERE issued BETWEEN vDateFrom AND vDateTo + UNION ALL + SELECT r.companyFk, r.clientFk, r.amountPaid, 0 sage + FROM receipt r + WHERE payed BETWEEN vDateFrom AND vDateTo + AND IF(vIsConciliated,r.isConciliate, TRUE) = TRUE + UNION ALL + SELECT empresa_id, c.id, 0, ROUND(NZ(Eurohaber) - NZ(Eurodebe),2) sage + FROM bi.XDiario_ALL xd + JOIN client c ON c.accountingAccount = xd.SUBCTA + WHERE xd.Fecha BETWEEN vDateFrom AND vDateTo + )sub + GROUP BY companyFk, clientFk + ) sub1 ON sub1.clientFk = c.id + JOIN supplier s ON s.id = sub1.companyFk + JOIN company co ON co.id = sub1.companyFk + WHERE pm.outstandingDebt + AND co.code <> 'BLK' + HAVING ABS(diference) > 0.05 + ORDER BY c.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 `client_RandomList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `client_RandomList`(vNumber INT) +BEGIN + + DECLARE i INT DEFAULT 0; + DECLARE c INT DEFAULT 0; + DECLARE maxClientFk INT; + + DROP TEMPORARY TABLE IF EXISTS tmp.client; + + CREATE TEMPORARY TABLE tmp.`client` + (id INT AUTO_INCREMENT, + clientFk INT, + isSelected TINYINT(1) NOT NULL DEFAULT 0, + PRIMARY KEY(id), + UNIQUE KEY clientFk (clientFk)) + ENGINE = MEMORY; + + INSERT INTO tmp.client(clientFk) + SELECT DISTINCT clientFk + FROM vn.invoiceOut + WHERE issued > TIMESTAMPADD(MONTH, -2, CURDATE()); + + SELECT max(id) INTO maxClientFk + FROM tmp.client; + + + WHILE i < vNumber DO + + SET i = i + 1; + + WHILE c = 0 DO + + SELECT id INTO c + FROM tmp.client + WHERE id = floor(RAND() * maxClientFk) + 1 + AND isSelected = FALSE + LIMIT 1; + + END WHILE; + + -- SELECT i, maxClientFk, c; + + UPDATE tmp.client + SET isSelected = TRUE + WHERE id = c; + + SET c = 0; + + END WHILE; + + SELECT c.id, c.name FROM tmp.client tc + JOIN vn.client c ON c.id = tc.clientFk + WHERE isSelected + ORDER BY clientFk; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `clonTravelComplete__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clonTravelComplete__`(IN `vTravelFk` INT, IN `vDateStart` DATE, IN `vDateEnd` DATE, IN `vRef` VARCHAR(255)) +BEGIN +-- DEPRECATED usar travel_cloneWithEntries. jgallego +/* + * Clona un travel, junto con sus entradas y compras + * @param vTravelFk travel a clonar + * @param vDateStart fecha de salida del nuevo travel + * @param vDateEnd fecha de llegada del nuevo travel + * @param vRef referencia del nuevo travel +*/ + DECLARE vTravelNew INT; + DECLARE vEntryNew INT; + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vAuxEntryFk INT; + DECLARE vRsEntry CURSOR FOR + SELECT e.id + FROM entry e + JOIN travel t ON t.id = e.travelFk + WHERE e.travelFk = vTravelFk; + + DECLARE vRsBuy CURSOR FOR + SELECT b.* + FROM buy b + JOIN entry e ON b.entryFk = e.id + WHERE e.travelFk = vTravelNew and b.entryFk = entryNew + ORDER BY e.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg) + SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg + FROM travel + WHERE id = vTravelFk; + + SET vTravelNew = LAST_INSERT_ID(); + SET vDone = FALSE; + OPEN vRsEntry; + FETCH vRsEntry INTO vAuxEntryFk; + + WHILE NOT vDone DO + INSERT INTO entry (supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + travelFk, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk) + SELECT supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + vTravelNew, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk + FROM entry + WHERE id = vAuxEntryFk; + + SET vEntryNew = LAST_INSERT_ID(); + + INSERT INTO buy (entryFk, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight) + SELECT vEntryNew, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight + FROM buy + WHERE entryFk = vAuxEntryFk; + + FETCH vRsEntry INTO vAuxEntryFk; + END WHILE; + CLOSE vRsEntry; + 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 `cmr_getByTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_getByTicket`(vTicketFk INT) +BEGIN + + DECLARE vLandingDays INT; + + SELECT landingDays INTO vLandingDays + FROM vn.cmrConfig; + + IF vTicketFk THEN + + IF (SELECT count(ticketFk) FROM vn.cmr WHERE ticketFk = vTicketFk) THEN + + SELECT id FROM vn.cmr WHERE ticketFk = vTicketFk; + + ELSE + + INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, supplierFk, ead) + SELECT vTicketFk, t.companyFk, a.id, t.addressFk, ag.supplierFk, vLandingDays + FROM vn.ticket t + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.agency ag ON ag.id = am.agencyFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.address a ON a.id = w.addressFk + WHERE t.id = vTicketFk; + + SELECT LAST_INSERT_ID(); + + END IF; + + ELSE + + INSERT INTO vn.cmr(created, ead) VALUES(NOW(), NOW() + INTERVAL vLandingDays DAY); + + SELECT LAST_INSERT_ID(); + + END IF; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `cmr_new__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_new__`(vTicketFk INT) +BEGIN + + IF vTicketFk THEN + + IF (SELECT count(ticketFk) FROM vn.cmr WHERE ticketFk = vTicketFk) THEN + + SELECT id FROM vn.cmr WHERE ticketFk = vTicketFk; + + ELSE + + INSERT INTO vn.cmr(ticketFk, companyFk, addressFromFk, addressToFk, supplierFk) + SELECT vTicketFk, t.companyFk, a.id, t.addressFk, ag.supplierFk + FROM vn.ticket t + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.agency ag ON ag.id = am.agencyFk + JOIN vn.company cm ON cm.id = t.companyFk + JOIN vn.client c ON c.id = cm.clientFk + JOIN vn.address a ON a.clientFk = c.id AND a.isDefaultAddress + WHERE t.id = vTicketFk; + + SELECT LAST_INSERT_ID(); + + END IF; + + ELSE + + INSERT INTO vn.cmr(created) VALUES(NOW()); + + SELECT LAST_INSERT_ID(); + + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `cmr_sendOverview` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `cmr_sendOverview`() +BEGIN +/** + * Insert the monthly CMR summary in vn.mail on the 5th of each month. + */ + + SET SESSION group_concat_max_len = 1000000; +-- IF (DAY(CURDATE()) = 5) THEN + INSERT INTO + vn.mail (receiver, + replyTo, + subject, + body) + SELECT + c2.email, + 'cmr@verdnatura.es', + 'Resumen CMR', + CONCAT('
+

Resumen Mensual CMR

+ + + + + + + + ' + , GROUP_CONCAT('' ORDER BY c.id SEPARATOR '' ), + '
+ Estimado cliente,
+ A continuación le enviamos el resumen menual de CMR ',UPPER(MONTHNAME(CURDATE() - INTERVAL 1 MONTH)),' ', YEAR(CURDATE() - INTERVAL 1 MONTH), '.

+ Le rogamos que nos devuelva el resumen firmado a cmr@verdnatura.es
+

+
CMRTicket
', c.id, ' ', c.ticketFk, '
+ +

+ Saludos cordiales, Dpto administración. +

') + FROM vn.cmr c + JOIN vn.address a ON c.addressToFk = a.id + JOIN vn.client c2 ON a.clientFk = c2.id + WHERE c.state = 'Pending' + AND MONTH(c.created) = MONTH(CURDATE() - INTERVAL 1 MONTH) + AND YEAR(c.created) = YEAR(CURDATE() - INTERVAL 1 MONTH) + AND c2.email IS NOT NULL -- No cogemos los CMRs dirigidos a 'Verdnatura' + GROUP BY c2.id; + + -- Actualizamos el estado a 'Enviado' + UPDATE vn.cmr c + SET c.state = 'Sent' + WHERE c.state = 'Pending' + AND MONTH(c.created) = MONTH(CURDATE() - INTERVAL 1 MONTH) + AND YEAR(c.created) = YEAR(CURDATE() - INTERVAL 1 MONTH); +-- 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 `collectionOrTicket_printSticker` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `collectionOrTicket_printSticker`(vParam INT, vSectorFk INT) +BEGIN + + /*Imprime una etiqueta amarilla a partir de una colección o ticket + * + * @param vParam colección o ticket a imprimir + * @param vSectorFk id del sector + */ + + DECLARE vLabelReport INT; + + SELECT labelReportFk INTO vLabelReport + FROM sector + WHERE id = vSectorFk; + + IF vLabelReport THEN + + INSERT INTO ticketTrolley(ticket, labelCount) + SELECT ticketFk, 1 + FROM ticketCollection + WHERE collectionFk = vParam OR ticketFK = vParam + ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; + + INSERT INTO printServerQueue(labelReportFk, param1, workerFk) + SELECT vLabelReport, vParam, getUser(); + + 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 `collectionPlacement_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collectionPlacement_get`(vParamFk INT(11), vIsPicker bool) +BEGIN + + /* Devuelve el listado de ubicaciones a las que hay que ir para preparar una colección o ticket + * + * @param vParamFk Identificador de vn.collection o Identificador de vn.ticket + * @param vIsPicker Booleano para distinguer el sacador del revisador + */ + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + DECLARE vWarehouseAliasFk INT; + DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + ENGINE = MEMORY + SELECT 00000000 as ticketFk, + 00000000 as saleFk, + 00000000 as itemFk, + FALSE as isStowaway, + 0 as quantity; + + INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.ticketCollection tc + -- JOIN vn.collection c ON c.id = tc.collectionFk + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + -- JOIN vn.item i ON i.id = s.itemFk + WHERE tc.collectionFk = vParamFk + -- AND (IFNULL(i.itemPackingTypeFk,c.itemPackingTypeFk) = c.itemPackingTypeFk OR ISNULL(c.itemPackingTypeFk)) + UNION ALL + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.sale s + WHERE s.ticketFk = vParamFk; + + SELECT t.warehouseFk, w.aliasFk + INTO vWarehouseFk, vWarehouseAliasFk + FROM vn.ticket t + JOIN tmp.sale ts ON ts.ticketFk = t.id + JOIN vn.warehouse w ON w.id = t.warehouseFk + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + UPDATE tmp.sale ts + JOIN ( SELECT itemFk, sum(visible) as visible + FROM vn.itemShelvingStock iss + JOIN vn.warehouse w ON w.id = iss.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + GROUP BY iss.itemFk ) iss ON iss.itemFk = ts.itemFk + SET ts.quantity = iss.visible; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale2; + CREATE TEMPORARY TABLE tmp.sale2 + ENGINE = MEMORY + SELECT * FROM tmp.sale; + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + (INDEX(itemFk)) + ENGINE = MEMORY + SELECT b.itemFk, + CASE b.groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN b.packing + ELSE b.`grouping` + END AS `grouping` + FROM buy b + JOIN cache.last_buy lb ON lb.buy_id = b.id + WHERE lb.warehouse_id = vWarehouseFk + GROUP BY b.itemFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE MEMORY + SELECT * FROM tmp.`grouping`; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList; + CREATE TEMPORARY TABLE tmp.salePlacementList + ENGINE MEMORY + + SELECT ts.saleFk, + ts.itemFk, + CAST(0 AS DECIMAL(10,0)) as saleOrder, + IF(ts.isStowaway, - 100000, IF(ish.visible > 0 OR iss.id, 1, 100000)) * p.pickingOrder as `order`, + IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) /* + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW())) */) as priority, + CONCAT( + IF( iss.id, + CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), + ''), + p.`code`) COLLATE utf8_general_ci as placement , + sh.priority shelvingPriority, + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + ish.visible, + IFNULL(IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`),1) as `grouping`, + sc.isPreviousPrepared, + iss.id as itemShelvingSaleFk, + ts.ticketFk + ,iss.id + , st.saleFk as salePreviousPrepared + , iss.userFk + FROM tmp.sale ts + LEFT JOIN (SELECT DISTINCT saleFk + FROM vn.saleTracking st + JOIN vn.state s ON s.id = st.stateFk + WHERE st.isChecked + AND s.semaphore = 1) st ON st.saleFk = ts.saleFk + JOIN vn.itemShelving ish ON ish.itemFk = ts.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + LEFT JOIN tmp.`grouping` g ON g.itemFk = ts.itemFk + LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = ts.saleFk AND iss.itemShelvingFk = ish.id + LEFT JOIN vn.worker wk ON wk.id = iss.userFk + WHERE w.aliasFk = vWarehouseAliasFk + AND NOT sc.isHideForPickers + HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL + ; + + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_2; + CREATE TEMPORARY TABLE tmp.salePlacementList_2 + ENGINE MEMORY + SELECT saleFk, priority as olderPriority + FROM (SELECT saleFk, priority + FROM tmp.salePlacementList + ORDER BY IF(isPreviousPrepared,2,1), + IF(visible > 0 OR itemShelvingSaleFk,1,2), + IFNULL(shelvingPriority,0) DESC, + priority + ) sub + GROUP BY saleFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_3; + CREATE TEMPORARY TABLE tmp.salePlacementList_3 + ENGINE MEMORY + SELECT s1.saleFk, `order`as saleOrder + FROM tmp.salePlacementList s1 + JOIN tmp.salePlacementList_2 s2 ON s2.saleFk = s1.saleFk AND s2.olderPriority = s1.priority; + + UPDATE tmp.salePlacementList s1 + JOIN tmp.salePlacementList_3 s3 ON s3.saleFk = s1.saleFk + SET s1.saleOrder = s3.saleOrder; + /* + -- Anula el orden de antigüedad y ordena por ubicación + UPDATE tmp.salePlacementList + SET saleOrder = `order`;*/ + + SELECT * + FROM tmp.salePlacementList + ORDER BY saleOrder, + IF(isPreviousPrepared,2,1), + IF(itemShelvingSaleFk,1,2), + IF(vIsPicker, visible = 0, TRUE), + shelvingPriority DESC, -- PAK 05/11/2021 + priority; + + DROP TEMPORARY TABLE + tmp.sale, + tmp.sale2, + tmp.`grouping`, + tmp.grouping2, + tmp.salePlacementList_2, + tmp.salePlacementList_3; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collectionSticker_print` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collectionSticker_print`(vCollectionFk INT, vSectorFk INT) +BEGIN + + /*@deprecated :utilizar collectionOrTicket_printSticker*/ + + DECLARE vLabelReport INT; + + SELECT labelReportFk INTO vLabelReport + FROM vn.sector + WHERE id = vSectorFk; + + IF vLabelReport THEN + + INSERT INTO vn.ticketTrolley(ticket, labelCount) + SELECT ticketFk, 1 + FROM vn.ticketCollection + WHERE collectionFk = vCollectionFk + ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; + + INSERT INTO vn.printServerQueue(labelReportFk, param1, workerFk) + SELECT vLabelReport, vCollectionFk, getUser(); + + 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 `collection_addItem` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_addItem`(vItemFk INT, vQuantity INT, vTicketFk INT) +BEGIN + DECLARE vConcept VARCHAR(50); + DECLARE itemFk INT; + DECLARE vSaleFk INT default 0; + + DECLARE vDescription VARCHAR(50); + DECLARE vItemName VARCHAR(50); + + SELECT barcodeToItem(vItemFk) INTO itemFk; + + SELECT CONCAT(vn.getUser()," ",DATE_FORMAT(NOW( ), "%H:%i" )," ",i.name) INTO vConcept FROM vn.item i WHERE i.id = itemFk; + + SELECT name INTO vItemName FROM vn.item WHERE id = vItemFk; + SELECT CONCAT("Añadido articulo ", vItemName, " cantidad:", vQuantity) INTO vDescription; + + INSERT INTO vn.ticketLog (originFk, userFk, action , description) + VALUES(vTicketFk, vn.getUser(), 'update', vDescription); + + INSERT INTO vn.sale (itemFk,ticketFk,concept,quantity,isAdded) + VALUES (itemFk,vTicketFk,vConcept,vQuantity,1); + + SELECT last_insert_id() INTO vSaleFk; + + CALL vn.sale_calculateComponent(vSaleFk, 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 `collection_get` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `collection_get`(vWorkerFk INT) +BEGIN + + /* Obtiene colección del sacador si tiene líneas pendientes + * + * @param vWorkerFk id del worker + */ + + SELECT c.id AS collectionFk, date(c.created) AS created, count(DISTINCT s.id) totalRow, count(DISTINCT st.id) pickedRow + FROM vn.collection c + JOIN vn.ticketCollection tc on tc.collectionFk = c.id + JOIN vn.sale s on s.ticketFk = tc.ticketFk + JOIN vn.state ss on ss.code = 'PREPARED' + LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id + WHERE c.workerFk = vWorkerFk + AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) + AND s.quantity != 0 + GROUP BY c.id + HAVING totalRow > pickedRow; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collection_getTickets` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_getTickets`(vParamFk INT) +BEGIN +/** + * Selecciona los tickets de una colección/ticket + * @param vParamFk ticketFk/collectionFk + * @return Retorna ticketFk, level, agencyName, warehouseFk, salesPersonFk, observaciones + */ + DECLARE vItemPackingTypeFk VARCHAR(1); + + -- Si los sacadores son los de pruebas, pinta los colores + SELECT itemPackingTypeFk INTO vItemPackingTypeFk + FROM vn.collection + WHERE id = vParamFk; + + SELECT t.id ticketFk, + IF (!(vItemPackingTypeFk <=> 'V'), cc.code,CONCAT(SUBSTRING('ABCDEFGH',tc.wagon, 1),'-',tc.`level` )) `level`, + am.name agencyName, + t.warehouseFk, + w.id salesPersonFk, + IFNULL(tob.description,'') observaciones + FROM vn.ticket t + LEFT JOIN vn.ticketCollection tc ON t.id = tc.ticketFk + LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk -- PAK 23/12/21 + LEFT JOIN vn.collectionColors cc + ON cc.wagon = tc.wagon + AND cc.shelve = tc.`level` + AND cc.trainFk = c2.trainFk -- PAK 23/12/21 + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk + LEFT JOIN vn.client c ON c.id = t.clientFk + LEFT JOIN vn.worker w ON w.id = c.salesPersonFk + LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id + AND tob.observationTypeFk = 1 + WHERE t.id = vParamFk + AND t.shipped >= util.yesterday() + UNION ALL + SELECT t.id ticketFk, + IF(!(vItemPackingTypeFk <=> 'V'), cc.code, CONCAT(SUBSTRING('ABCDEFGH', tc.wagon, 1), '-', tc.`level`)) `level`, + am.name agencyName, + t.warehouseFk, + w.id salesPersonFk, + IFNULL(tob.description, '') observaciones + FROM vn.ticket t + JOIN vn.ticketCollection tc ON t.id = tc.ticketFk + LEFT JOIN vn.collection c2 ON c2.id = tc.collectionFk -- PAK 23/12/21 + LEFT JOIN vn.collectionColors cc + ON cc.wagon = tc.wagon + AND cc.shelve = tc.`level` + AND cc.trainFk = c2.trainFk -- PAK 23/12/21 + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk + LEFT JOIN vn.client c ON c.id = t.clientFk + LEFT JOIN vn.worker w ON w.id = c.salesPersonFk + LEFT JOIN vn.ticketObservation tob ON tob.ticketFk = t.id + AND tob.observationTypeFk = 1 + WHERE tc.collectionFk = vParamFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collection_get_` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_get_`(vWorkerFk INT) +BEGIN + + /* Obtiene colección del sacador si tiene líneas pendientes + * + * @param vWorkerFk id del worker + */ + + SELECT c.id AS collectionFk, date(c.created) AS created + FROM vn.collection c + LEFT JOIN vn.state s ON c.stateFk = s.id + WHERE c.workerFk = vWorkerFk AND s.code = 'ON_PREPARATION' + AND created >= TIMESTAMPADD(HOUR , -6,NOW()); + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collection_kill` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_kill`(vSelf INT) +BEGIN + + /* Elimina una coleccion y coloca sus tickets en OK + * + */ + + INSERT INTO vncontrol.inter(state_id, Id_Ticket) + SELECT s.id, ticketFk + FROM vn.ticketCollection tc + JOIN vn.state s ON s.code = 'OK' + WHERE tc.collectionFk = vSelf; + + DELETE FROM vn.collection + WHERE id = vSelf; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `collection_missingTrash` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_missingTrash`(vSaleFk BIGINT, vQuantity INT, vIsTrash BOOLEAN, vWarehouseFk INT, vNewQuantity INT) +BEGIN + DECLARE vTicketFk INT; + DECLARE vClientFk INT DEFAULT 400; + DECLARE vClientName VARCHAR(50); + DECLARE vConsignatario INT; + DECLARE vOriginalQuantity INT; + DECLARE vDescription VARCHAR(100); + DECLARE vConcept VARCHAR(100); + DECLARE vOrigin INT; + + IF vIsTrash THEN + SELECT 200 INTO vClientFk; + END IF; + + SELECT concept INTO vConcept FROM vn.sale WHERE id = vSaleFk; + SELECT ticketFk INTO vOrigin FROM vn.sale WHERE id = vSaleFk; + SELECT CONCAT("Cambio cantidad ",vConcept," de ", vQuantity ," a ", vNewQuantity) INTO vDescription; + + INSERT INTO vn.ticketLog (originFk, userFk, action , description) + VALUES(vOrigin, vn.getUser(), 'update', vDescription); + + SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; + + IF vTicketFk IS NULL THEN + SELECT c.name , co.id INTO vClientName,vConsignatario + FROM vn.client c + INNER JOIN vn.address co ON c.id = co.clientFk + WHERE c.id = vClientFk + LIMIT 1; + + CALL ticket_add(vClientFk, + NOW(), vWarehouseFk, + 442, + vConsignatario, + NULL, + NULL, + NULL, + account.userGetId(), + TRUE, + vTicketFk); + + SELECT t.id INTO vTicketFk FROM vn.ticket t WHERE t.created > DATE_SUB(NOW(), INTERVAL 1 DAY) AND t.clientFk = vClientFk AND t.warehouseFk = vWarehouseFk LIMIT 1; + + END IF; + + INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded) + SELECT itemFk, vTicketFk, CONCAT(concept," ",vn.getWorkerCode(), " ",LEFT(CAST(NOW() AS TIME),5)), vQuantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded + FROM vn.sale s WHERE s.id = vSaleFk; + + SELECT quantity INTO vOriginalQuantity FROM vn.sale WHERE id = vSaleFk; + UPDATE vn.sale SET originalQuantity = vOriginalQuantity ,quantity = vNewQuantity WHERE id = vSaleFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collection_newSmartTag` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_newSmartTag`(vSectorFk INT) +proc:BEGIN + + DECLARE vIsPreviousPrepared BOOLEAN; + DECLARE vCollectionFk INT; + DECLARE vWarehouseFk INT; + DECLARE vMaxTickets INT; + DECLARE vStateFk INT; + DECLARE vFirstTicketFk INT; + DECLARE vHour INT; + DECLARE vMinute INT; + DECLARE vWorker INT; + DECLARE vWorkerCode VARCHAR(3); + DECLARE vWagon INT; + DECLARE vWagonCounter INT; + DECLARE vShelve INT; + DECLARE vTicket INT; + DECLARE vTicketToSplit INT; + DECLARE myUserIsSalesPersonRole BOOLEAN; + DECLARE vPrintedTickets INT; + DECLARE vMaxTicketPrinted INT; + DECLARE vItemPackingTypeFk VARCHAR(1); + DECLARE hasAssignedTickets BOOLEAN; + DECLARE vMaxNotReadyCollections INT DEFAULT 0; + DECLARE vNotReadyCollections INT; + DECLARE vSectorCode VARCHAR(20); + DECLARE vWagons INT; + + SELECT w.code, w.id INTO vWorkerCode, vWorker + FROM vn.worker w + WHERE w.id = vn.getUser(); + +-- Si hay colecciones sin terminar, sale del proceso + SELECT count(*) INTO vNotReadyCollections + FROM vn.collection c + WHERE c.workerFk = vn.getUser() + AND c.saleTotalCount > c.salePickedCount + 1 + AND c.created > TIMESTAMPADD(HOUR , -5,NOW()); + + IF vMaxNotReadyCollections < vNotReadyCollections THEN + + LEAVE proc; + + END IF; + + -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando + SELECT isPreviousPrepared, warehouseFk, itemPackingTypeFk, code + INTO vIsPreviousPrepared, vWarehouseFk, vItemPackingTypeFk, vSectorCode + FROM vn.sector + WHERE id = vSectorFk; + + -- Cogemos el numero de wagons del trabajador + SELECT COUNT(ws.id) + FROM workerShelving ws + WHERE ws.workerFk = vWorker + AND ws.collectionFk IS NULL + INTO vWagons; + + SET vMaxTicketPrinted = 8 * vWagons; + SET vMaxTickets = 3 * vWagons; + + + IF vIsPreviousPrepared THEN + + LEAVE proc; -- Hasta que tengamos el altillo, vamos a cancelar esta opcion + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'PREVIOUS_PREPARATION'; + ELSE + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'ON_PREPARATION'; + + END IF; + + -- Averiguamos si es comercial el usuario + SELECT FALSE -- (r.name = 'salesPerson') + INTO myUserIsSalesPersonRole + FROM account.user u + JOIN account.role r ON r.id = u.role + WHERE u.id = vn.getUser(); + + -- Se obtiene nº de colección y el buffer con los pedidos preparables + INSERT INTO vn.collection + SET workerFk = account.myUser_getId(), + itemPackingTypeFk = vItemPackingTypeFk; + + SELECT LAST_INSERT_ID() INTO vCollectionFk; + + UPDATE workerShelving + SET collectionFk = vCollectionFk + WHERE workerFk = vWorker + AND collectionFk IS NULL; + + CALL vn.productionControl(vWarehouseFk, 0); + + -- Comprobamos si hay tickets asignados. En ese caso, nos centramos exclusivamente en esos tickets + -- y los sacamos independientemente de problemas o tamaños + SELECT COUNT(*) INTO hasAssignedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode + AND LENGTH(pb.problem) = 0; + + IF hasAssignedTickets THEN + + UPDATE vn.collection + SET itemPackingTypeFk = NULL + WHERE id = vCollectionFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; + CREATE TEMPORARY TABLE tmp.ticketToSplit + SELECT pb.ticketFk + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode + AND LENGTH(pb.problem) = 0 + ORDER BY HH, + mm, + s.`order` DESC, + pb.m3 DESC; + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + + SELECT MIN(ticketFk) INTO vTicketToSplit + FROM tmp.ticketToSplit; + + CALL vn.ticket_splitItemPackingType(vTicketToSplit); + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT ticketFk, vCollectionFk + FROM tmp.ticketIPT; + + DELETE FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit; + + DROP TEMPORARY TABLE tmp.ticketIPT; + + END WHILE; + + CALL vn.productionControl(vWarehouseFk, 0); + + ELSE + + SELECT COUNT(*) INTO vPrintedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + WHERE pb.shipped = CURDATE() + AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) + AND s.isPreparable + AND (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH) + OR pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV) + OR pb.F > 0 AND vItemPackingTypeFk = 'F' AND ISNULL(pb.collectionF) + OR pb.P > 0 AND vItemPackingTypeFk = 'P' AND ISNULL(pb.collectionP)); + + SET vMaxTicketPrinted = vMaxTicketPrinted - vPrintedTickets; + -- AutoPRINT + + IF vMaxTicketPrinted > 0 THEN + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT s2.id, pb.ticketFk, vn.getUser() + FROM tmp.productionBuffer pb + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.state s ON s.id = pb.state + JOIN vn.state s2 ON s2.code = 'PRINTED_AUTO' + JOIN vn.ticket t ON t.id = pb.ticketFk + WHERE pb.shipped = CURDATE() + AND LENGTH(pb.problem) = 0 + AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) + AND s.isPrintable + AND (pb.m3 > 0.05 OR s.isOK) + AND (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH) + OR pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV) + OR pb.F > 0 AND vItemPackingTypeFk = 'F' AND ISNULL(pb.collectionF) + OR pb.P > 0 AND vItemPackingTypeFk = 'P' AND ISNULL(pb.collectionP)) + AND t.created < TIMESTAMPADD(MINUTE, -10, NOW()) + ORDER BY HH, + mm, + s.`order` DESC, + pb.m3 DESC + LIMIT vMaxTicketPrinted; + + END IF; + + -- Se seleccionan los primeros tickets, asignando colección para dejarlos bloqueados a otros sacadores. + -- Se splitan los tickets preparables, para que solo tengan un tipo de empaquetado + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; + CREATE TEMPORARY TABLE tmp.ticketToSplit + SELECT pb.ticketFk + FROM tmp.productionBuffer pb + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.ticketStateToday tst ON tst.ticket = pb.ticketFk + JOIN vn.state s ON s.id = tst.state + WHERE ( pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH) + OR pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV) + OR pb.F > 0 AND vItemPackingTypeFk = 'F' AND ISNULL(pb.collectionF) + OR pb.P > 0 AND vItemPackingTypeFk = 'P' AND ISNULL(pb.collectionP)) + AND (pb.ubicacion IS NOT NULL OR a.isOwn = FALSE ) + AND LENGTH(pb.problem) = 0 + AND s.isPreparable + AND NOT myUserIsSalesPersonRole + ORDER BY pb.HH, pb.mm, s.`order` DESC + LIMIT vMaxTickets; + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + + SELECT MIN(ticketFk) INTO vTicketToSplit + FROM tmp.ticketToSplit; + + CALL vn.ticket_splitItemPackingType(vTicketToSplit); + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT ticketFk, vCollectionFk + FROM tmp.ticketIPT + WHERE itemPackingTypeFk = vItemPackingTypeFk; + + DELETE FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit; + + DROP TEMPORARY TABLE tmp.ticketIPT; + + END WHILE; + + END IF; + + -- Creamos una tabla temporal con los datos que necesitamos para depurar la colección + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.ticketFk, + pb.`lines`, + pb.m3 * 1000 liters, + 0 as height, + 0 as shelve, + 0 as wagon, + pb.productionOrder, + pb.HH, + pb.mm + FROM tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON tc.ticketFk = pb.ticketFk + WHERE tc.collectionFk = vCollectionFk + LIMIT vMaxTickets; + + -- Es importante que el primer ticket se coja en todos los casos + SET vFirstTicketFk = 0; + + SELECT ticketFk, HH, mm + INTO vFirstTicketFk, vHour, vMinute + FROM tmp.ticket + ORDER BY productionOrder DESC, HH, mm + LIMIT 1; + + -- Hay que excluir aquellos que no tengan la misma hora de preparación + DELETE + FROM tmp.ticket + WHERE HH != vHour + OR mm != vMinute; + + -- En el caso de pedidos de más volumen de un carro, la colección será monoticket. Pero si el primer pedido + -- no es monoticket, excluimos a los de más de un carro + IF (SELECT (t.liters > vc.trolleyM3 * 1000) + FROM tmp.ticket t + JOIN vn.volumeConfig vc + WHERE t.ticketFk = vFirstTicketFk) THEN + + DELETE + FROM tmp.ticket + WHERE ticketFk != vFirstTicketFk; + + ELSE + + DELETE t.* + FROM tmp.ticket t + JOIN vn.volumeConfig vc + WHERE t.liters > vc.trolleyM3 * 1000; + + END IF; + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + + /* + * + * Construccion del tren + * + */ + + -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. + UPDATE tmp.ticket t + JOIN + ( SELECT MAX(i.size) maxHeigth, + tc.ticketFk + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.item i ON i.id = s.itemFk + WHERE i.itemPackingTypeFk = 'V' + AND tc.collectionFk = vCollectionFk + GROUP BY tc.ticketFk) sub ON sub.ticketFk = t.ticketFk + SET t.height = IFNULL(sub.maxHeigth,0); + + -- Vamos a generar una tabla con todas las posibilidades de asignacion de pedido + DROP TEMPORARY TABLE IF EXISTS tmp.wagonsVolumetry; + CREATE TEMPORARY TABLE tmp.wagonsVolumetry + SELECT cv.`level` as shelve, + 1 as wagon, + cv.`lines`, + cv.liters, + cv.height + FROM vn.collectionVolumetry cv; + + SET vWagonCounter = 1; + + WHILE vWagonCounter < vWagons DO + + SET vWagonCounter = vWagonCounter + 1; + + INSERT INTO tmp.wagonsVolumetry(shelve, wagon, `lines`, liters, height) + SELECT cv.`level` as shelve, + vWagonCounter as wagon, + cv.`lines`, + cv.liters, + cv.height + FROM vn.collectionVolumetry cv + WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H'); + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelve; + CREATE TEMPORARY TABLE tmp.ticketShelve + SELECT ticketFk, shelve, wagon, linesDif, LitersDif, heightDif + FROM ( + SELECT t.ticketFk, + wv.shelve, + wv.wagon, + t.productionOrder, + CAST(wv.`lines` AS SIGNED) - t.`lines` as linesDif, + CAST(wv.liters AS SIGNED) - t.liters as litersDif, + CAST(wv.height AS SIGNED) - t.height as heightDif + FROM tmp.wagonsVolumetry wv + JOIN tmp.ticket t + ) sub + WHERE linesDif >= 0 + AND litersDif >= 0 + AND heightDif >= 0 + ORDER BY productionOrder DESC, linesDif, LitersDif, heightDif ; + + -- Insertamos una opcion virtual para carro completo. Todo ticket tiene que poder entrar en un carro completo.... + INSERT INTO tmp.ticketShelve(ticketFk, shelve, wagon, linesDif, LitersDif, heightDif) + SELECT t.ticketFk, 0, wv.wagon, 999, 999,999 + FROM tmp.ticket t + JOIN tmp.wagonsVolumetry wv + GROUP BY t.ticketFk, wv.wagon; + + SET vWagonCounter = 0; + + WHILE vWagonCounter < vWagons DO + + SET vWagonCounter = vWagonCounter + 1; + + -- Asignamos la primera balda util al primer pedido + IF vWagonCounter = 1 THEN + + SELECT shelve INTO vShelve + FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + AND wagon = vWagonCounter + ORDER BY heightDif, litersDif, linesDif + LIMIT 1; + + ELSE + + SELECT shelve, ticketFk INTO vShelve, vFirstTicketFk + FROM tmp.ticketShelve + WHERE wagon = vWagonCounter + ORDER BY heightDif, litersDif, linesDif + LIMIT 1; + + END IF; + + IF vShelve > 0 THEN + + UPDATE tmp.ticket + SET shelve = vShelve, + wagon = vWagonCounter + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + OR (shelve = vShelve AND wagon = vWagonCounter); + + WHILE (SELECT COUNT(*) FROM tmp.ticketShelve WHERE wagon = vWagonCounter) DO + + SELECT ticketFk, shelve + INTO vTicket, vShelve + FROM tmp.ticketShelve + WHERE wagon = vWagonCounter + LIMIT 1; + + UPDATE tmp.ticket + SET shelve = vShelve, + wagon = vWagonCounter + WHERE ticketFk = vTicket; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vTicket + OR (shelve = vShelve AND wagon = vWagonCounter); + + END WHILE; + + ELSE + + UPDATE tmp.ticket + SET shelve = 1, wagon = vWagonCounter + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + AND wagon != vWagonCounter; + + END IF; + + END WHILE; + + -- Eliminamos los que se han quedado sin balda + DELETE FROM tmp.ticket WHERE shelve = 0; + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + + -- Elimina los tickets que ya estan en otra coleccion + DELETE tc.* + FROM vn.ticketCollection tc + JOIN vn.ticketCollection tc2 ON tc2.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND tc2.collectionFk != vCollectionFk; + + -- Actualiza el estado de la colección + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + -- Asigna las bandejas y las smartTags + SET @wagon := 0; + UPDATE vn.ticketCollection tc + JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + JOIN (SELECT @wagon:=@wagon+1 as wagon, ws.shelvingFk + FROM workerShelving ws + WHERE ws.collectionFk = vCollectionFk) sub ON sub.wagon = t.wagon + JOIN smartTag s ON s.shelvingFk = sub.shelvingFk AND s.`level` = t.shelve + SET tc.`level` = t.shelve, tc.wagon = t.wagon, tc.smartTagFk = s.code; + + -- Actualiza el estado de los tickets + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT vStateFk, ticketFk, account.myUser_getId() + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + -- Aviso para la preparacion previa + INSERT INTO vn.ticketDown(ticketFk, collectionFk) + SELECT tc.ticketFk, tc.collectionFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + IF (SELECT count(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk) THEN + + CALL vn.salesMerge_byCollection(vCollectionFk); + + UPDATE vn.collection c + JOIN (SELECT count(*) saleTotalCount , + sum(s.isPicked != 0) salePickedCount + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND s.quantity > 0 + ) sub + SET c.saleTotalCount = sub.saleTotalCount, + c.salePickedCount = sub.salePickedCount + WHERE c.id = vCollectionFk; + + SELECT vCollectionFk; + + ELSE + + DELETE FROM vn.collection WHERE id = vCollectionFk; + -- SELECT NULL; + + END IF; + + DROP TEMPORARY TABLE tmp.ticketToSplit; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collection_newWithWagon` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_newWithWagon`(vSectorFk INT, vWagons INT) +proc:BEGIN + + DECLARE vIsPreviousPrepared BOOLEAN; + DECLARE vCollectionFk INT; + DECLARE vWarehouseFk INT; + DECLARE vMaxTickets INT; + DECLARE vStateFk INT; + DECLARE vFirstTicketFk INT; + DECLARE vHour INT; + DECLARE vMinute INT; + DECLARE vWorkerCode VARCHAR(3); + DECLARE vWagon INT; + DECLARE vWagonCounter INT; + DECLARE vShelve INT; + DECLARE vTicket INT; + DECLARE vTicketToSplit INT; + DECLARE vPrintedTickets INT; + DECLARE vMaxTicketPrinted INT; + DECLARE vItemPackingTypeFk VARCHAR(1); + DECLARE hasAssignedTickets BOOLEAN; + DECLARE vMaxNotReadyCollections INT; + DECLARE vNotReadyCollections INT; + DECLARE vTrainFk INT DEFAULT 1; + DECLARE vUserFk INT; + DECLARE vHourMatters BOOL DEFAULT TRUE; + + SELECT pc.ticketPrintedMax * vWagons, pc.ticketTrolleyMax * vWagons, pc.maxNotReadyCollections + INTO vMaxTicketPrinted, vMaxTickets, vMaxNotReadyCollections + FROM vn.productionConfig pc; + /*IF NOT vn.deviceProductionUser_Exists(vUserFk) THEN + + LEAVE proc; + + END IF;*/ + + SELECT w.code, w.id INTO vWorkerCode, vUserFk + FROM vn.worker w + WHERE w.id =account.userGetId(); + + -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando + SELECT isPreviousPrepared, warehouseFk, itemPackingTypeFk + INTO vIsPreviousPrepared, vWarehouseFk, vItemPackingTypeFk + FROM vn.sector + WHERE id = vSectorFk; -- Hola + +-- Si está habilitado el modo cazador para las motos, y el usuario no esta registrado, se sale. + + IF (SELECT isTractorHuntingMode FROM vn.deviceProductionConfig dpc) AND vItemPackingTypeFk = 'H' THEN + IF (SELECT COUNT(*) FROM vn.workerWithoutTractor wwt WHERE wwt.workerFk = vUserFk) THEN + CALL util.throw('Usuario no registrado con moto'); + LEAVE proc; + END IF; + END IF; + + +-- Si hay colecciones sin terminar, sale del proceso + SELECT count(*) INTO vNotReadyCollections + FROM ( + SELECT count(DISTINCT s.id) totalRow, count(DISTINCT st.id) pickedRow + FROM vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.state ss ON ss.code = 'PREPARED' + LEFT JOIN vn.saleTracking st ON st.saleFk = s.id AND st.stateFk = ss.id + WHERE c.workerFk = vUserFk + AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) + AND s.quantity != 0 + GROUP BY c.id + HAVING totalRow > pickedRow) sub; + + IF vMaxNotReadyCollections < vNotReadyCollections THEN + + CALL util.throw('Hay colecciones pendientes'); + LEAVE proc; + + END IF; + + IF vIsPreviousPrepared THEN + + CALL util.throw('Es de preparación previa'); + LEAVE proc; -- Hasta que tengamos el altillo, vamos a cancelar esta opcion + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'PREVIOUS_PREPARATION'; + ELSE + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'ON_PREPARATION'; + + END IF; + + CALL vn.productionControl(vWarehouseFk, 0); + + -- Esto hay que corregirlo añadiendo un nuevo parámetro al proc. PAK 23/12/21 + IF vSectorFk = 65 THEN -- Pedidos pequeños + + SET vTrainFk = 2; + + SET vHourMatters = FALSE; + + DELETE pb.* + FROM tmp.productionBuffer pb + JOIN vn.volumeConfig vc + WHERE pb.m3 * 1000 > vc.minTicketVolume; + + END IF; + + -- Se obtiene nº de colección y el buffer con los pedidos preparables + INSERT INTO vn.collection + SET workerFk = vUserFk, + itemPackingTypeFk = vItemPackingTypeFk, + trainFk = vTrainFk; + + SELECT LAST_INSERT_ID() INTO vCollectionFk; + + -- 05/08/2021 PAK Jose Frau pide que los tickets de recogida en Algemesí sólo se saquen si están asignados. + DELETE pb.* + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE pb.agency = 'REC_ALGEMESI' + AND s.code != 'PICKER_DESIGNED'; + + -- 2/3/2022 PAK Se acuerda con Pepe que los pedidos con riesgo no se sacan aunque se asignen. + DELETE pb.* + FROM tmp.productionBuffer pb + WHERE pb.problem LIKE '%RIESGO%'; + + -- Comprobamos si hay tickets asignados. En ese caso, nos centramos exclusivamente en esos tickets + -- y los sacamos independientemente de problemas o tamaños + SELECT COUNT(*) INTO hasAssignedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode; + + IF hasAssignedTickets THEN + + UPDATE vn.collection + SET itemPackingTypeFk = NULL + WHERE id = vCollectionFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; + CREATE TEMPORARY TABLE tmp.ticketToSplit + SELECT pb.ticketFk + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode + ORDER BY HH, + mm, + s.`order` DESC, + pb.m3 DESC; + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + + SELECT MIN(ticketFk) INTO vTicketToSplit + FROM tmp.ticketToSplit; + + CALL vn.ticket_splitItemPackingType(vTicketToSplit); + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT ticketFk, vCollectionFk + FROM tmp.ticketIPT + WHERE (itemPackingTypeFk = vItemPackingTypeFk) ; + + DELETE FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit; + + DROP TEMPORARY TABLE tmp.ticketIPT; + + END WHILE; + + CALL vn.productionControl(vWarehouseFk, 0); + + ELSE + + SELECT COUNT(*) INTO vPrintedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.productionConfig pc + WHERE pb.shipped = CURDATE() + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND s.isPreparable + AND ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE); + + SET vMaxTicketPrinted = vMaxTicketPrinted - vPrintedTickets; + + -- AutoPRINT + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT s2.id, pb.ticketFk, vUserFk + FROM tmp.productionBuffer pb + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.state s ON s.id = pb.state + JOIN vn.state s2 ON s2.code = 'PRINTED_AUTO' + JOIN vn.ticket t ON t.id = pb.ticketFk + JOIN vn.ticketConfig tc + JOIN vn.productionConfig pc + WHERE pb.shipped = CURDATE() + AND (LENGTH(pb.problem) = 0 + OR (pb.problem = 'PEQUEÑO' AND vTrainFk = 2)) + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND s.isPrintable + AND s.isOK + AND ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , NOW()) + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE) + ORDER BY HH, + mm, + s.`order` DESC, + pb.m3 DESC + LIMIT vMaxTicketPrinted; + + -- Se seleccionan los primeros tickets, asignando colección para dejarlos bloqueados a otros sacadores. + -- Se splitan los tickets preparables, para que solo tengan un tipo de empaquetado + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; + CREATE TEMPORARY TABLE tmp.ticketToSplit + SELECT pb.ticketFk, (pb.H + pb.V = 0) isNeutral + FROM tmp.productionBuffer pb + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.ticketStateToday tst ON tst.ticket = pb.ticketFk + JOIN vn.state s ON s.id = tst.state + JOIN vn.productionConfig pc + WHERE ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND LENGTH(pb.problem) = 0 + AND s.isPreparable + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE) + ORDER BY pb.HH, pb.mm, s.`order` DESC + LIMIT vMaxTickets; + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + + SELECT MIN(ticketFk) INTO vTicketToSplit + FROM tmp.ticketToSplit; + + + IF (SELECT isNeutral + FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit) THEN + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + VALUES(vTicketToSplit, vCollectionFk); + + ELSE + + CALL vn.ticket_splitItemPackingType(vTicketToSplit); + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT ticketFk, vCollectionFk + FROM tmp.ticketIPT + WHERE itemPackingTypeFk = vItemPackingTypeFk; + + DROP TEMPORARY TABLE tmp.ticketIPT; + + END IF; + + DELETE FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit; + + END WHILE; + + END IF; + + -- Creamos una tabla temporal con los datos que necesitamos para depurar la colección + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.ticketFk, + pb.`lines`, + pb.m3 * 1000 liters, + 0 as height, + 0 as shelve, + 0 as wagon, + 0 AS shelveLiters, + pb.productionOrder, + pb.HH, + pb.mm + FROM tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON tc.ticketFk = pb.ticketFk + WHERE tc.collectionFk = vCollectionFk + LIMIT vMaxTickets; + + -- Voumen de las lineas de los pedidos, de acuerdo con el packingShelve establecido por los controladores + DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelveLiters; + CREATE TEMPORARY TABLE tmp.ticketShelveLiters + SELECT t.ticketFk, SUM(s.quantity * vc.shelveVolume / i.packingShelve) shelveLiters + FROM tmp.ticket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.volumeConfig vc + WHERE i.packingShelve + GROUP BY t.ticketFk; + + UPDATE tmp.ticket t + JOIN tmp.ticketShelveLiters tsl ON tsl.ticketFk = t.ticketFk + SET t.shelveLiters = tsl.shelveLiters; + + -- Es importante que el primer ticket se coja en todos los casos + + SET vFirstTicketFk = 0; + + SELECT ticketFk, HH, mm + INTO vFirstTicketFk, vHour, vMinute + FROM tmp.ticket + ORDER BY productionOrder DESC, HH, mm + LIMIT 1; + + -- Hay que excluir aquellos que no tengan la misma hora de preparación + IF vHourMatters THEN + + DELETE + FROM tmp.ticket + WHERE HH != vHour + OR mm != vMinute; + + END IF; + + -- En el caso de pedidos de más volumen de un carro, la colección será monoticket. Pero si el primer pedido + -- no es monoticket, excluimos a los de más de un carro + IF (SELECT (t.shelveLiters > vc.trolleyM3 * 1000) + FROM tmp.ticket t + JOIN vn.volumeConfig vc + WHERE t.ticketFk = vFirstTicketFk) THEN + + DELETE + FROM tmp.ticket + WHERE ticketFk != vFirstTicketFk; + + ELSE + + DELETE t.* + FROM tmp.ticket t + JOIN vn.volumeConfig vc + WHERE t.shelveLiters > vc.trolleyM3 * 1000; + + END IF; + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + + -- Construccion del tren + + -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. + UPDATE tmp.ticket t + JOIN + ( SELECT MAX(i.size) maxHeigth, + tc.ticketFk + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.item i ON i.id = s.itemFk + WHERE i.itemPackingTypeFk = 'V' + AND tc.collectionFk = vCollectionFk + GROUP BY tc.ticketFk) sub ON sub.ticketFk = t.ticketFk + SET t.height = IFNULL(sub.maxHeigth,0); + + -- Vamos a generar una tabla con todas las posibilidades de asignacion de pedido + DROP TEMPORARY TABLE IF EXISTS tmp.wagonsVolumetry; + CREATE TEMPORARY TABLE tmp.wagonsVolumetry + SELECT cv.`level` as shelve, + 1 as wagon, + cv.`lines`, + cv.liters, + cv.height + FROM vn.collectionVolumetry cv + WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') + AND cv.trainFk = vTrainFk; + + SET vWagonCounter = 1; + + WHILE vWagonCounter < vWagons DO + + SET vWagonCounter = vWagonCounter + 1; + + INSERT INTO tmp.wagonsVolumetry(shelve, wagon, `lines`, liters, height) + SELECT cv.`level` as shelve, + vWagonCounter as wagon, + cv.`lines`, + cv.liters, + cv.height + FROM vn.collectionVolumetry cv + WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') + AND cv.trainFk = vTrainFk; + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelve; + CREATE TEMPORARY TABLE tmp.ticketShelve + SELECT ticketFk, shelve, wagon, linesDif, LitersDif, heightDif + FROM ( + SELECT t.ticketFk, + wv.shelve, + wv.wagon, + t.productionOrder, + CAST(wv.`lines` AS SIGNED) - t.`lines` as linesDif, + CAST(wv.liters AS SIGNED) - t.shelveLiters as litersDif, + CAST(wv.height AS SIGNED) - t.height as heightDif + FROM tmp.wagonsVolumetry wv + JOIN tmp.ticket t + ) sub + WHERE linesDif >= 0 + AND litersDif >= 0 + AND heightDif >= 0 + ORDER BY productionOrder DESC, linesDif, LitersDif, heightDif ; + + -- Insertamos una opcion virtual para carro completo. Todo ticket tiene que poder entrar en un carro completo.... + INSERT INTO tmp.ticketShelve(ticketFk, shelve, wagon, linesDif, LitersDif, heightDif) + SELECT t.ticketFk, 0, wv.wagon, 999, 999,999 + FROM tmp.ticket t + JOIN tmp.wagonsVolumetry wv + GROUP BY t.ticketFk, wv.wagon; + + SET vWagonCounter = 0; + + WHILE vWagonCounter < vWagons DO + + SET vWagonCounter = vWagonCounter + 1; + + -- Asignamos la primera balda util al primer pedido + IF vWagonCounter = 1 THEN + + SELECT shelve INTO vShelve + FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + AND wagon = vWagonCounter + ORDER BY heightDif, litersDif, linesDif + LIMIT 1; + + ELSE + + SELECT shelve, ticketFk INTO vShelve, vFirstTicketFk + FROM tmp.ticketShelve + WHERE wagon = vWagonCounter + ORDER BY heightDif, litersDif, linesDif + LIMIT 1; + + END IF; + + IF vShelve > 0 THEN + + UPDATE tmp.ticket + SET shelve = vShelve, + wagon = vWagonCounter + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + OR (shelve = vShelve AND wagon = vWagonCounter); + + WHILE (SELECT COUNT(*) FROM tmp.ticketShelve WHERE wagon = vWagonCounter) DO + + SELECT ticketFk, shelve + INTO vTicket, vShelve + FROM tmp.ticketShelve + WHERE wagon = vWagonCounter + LIMIT 1; + + UPDATE tmp.ticket + SET shelve = vShelve, + wagon = vWagonCounter + WHERE ticketFk = vTicket; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vTicket + OR (shelve = vShelve AND wagon = vWagonCounter); + + END WHILE; + + ELSE + + UPDATE tmp.ticket + SET shelve = 1, wagon = vWagonCounter + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + AND wagon != vWagonCounter; + + END IF; + + END WHILE; + + -- Eliminamos los que se han quedado sin balda + DELETE FROM tmp.ticket WHERE shelve = 0; + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + + -- Elimina los tickets que ya estan en otra coleccion + DELETE tc.* + FROM vn.ticketCollection tc + JOIN vn.ticketCollection tc2 ON tc2.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND tc2.collectionFk != vCollectionFk; + + -- Actualiza el estado de la colección + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + -- Asigna las bandejas + UPDATE vn.ticketCollection tc + JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + SET tc.level = t.shelve, + tc.wagon = t.wagon, + tc.itemCount = t.`lines`, + tc.liters = t.shelveLiters; + + -- Actualiza el estado de los tickets + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT vStateFk, ticketFk, vUserFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + -- Aviso para la preparacion previa + INSERT INTO vn.ticketDown(ticketFk, collectionFk) + SELECT tc.ticketFk, tc.collectionFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + IF (SELECT count(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk) THEN + + CALL vn.salesMerge_byCollection(vCollectionFk); + + UPDATE vn.collection c + JOIN (SELECT count(*) saleTotalCount , + sum(s.isPicked != 0) salePickedCount + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND s.quantity > 0 + ) sub + SET c.saleTotalCount = sub.saleTotalCount, + c.salePickedCount = sub.salePickedCount + WHERE c.id = vCollectionFk; + + SELECT vCollectionFk; + + ELSE + + CALL util.throw('No ha sido posible obtener colección'); + DELETE FROM vn.collection WHERE id = vCollectionFk; + + END IF; + + DROP TEMPORARY TABLE + tmp.ticketToSplit, + tmp.ticketShelveLiters, + tmp.ticket, + tmp.wagonsVolumetry, + tmp.ticketShelve, + tmp.productionBuffer; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collection_newWithWagon_beta` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_newWithWagon_beta`(vUserFk INT, vSectorFk INT, vWagons INT) +proc:BEGIN + + DECLARE vIsPreviousPrepared BOOLEAN; + DECLARE vCollectionFk INT; + DECLARE vWarehouseFk INT; + DECLARE vMaxTickets INT; + DECLARE vStateFk INT; + DECLARE vFirstTicketFk INT; + DECLARE vHour INT; + DECLARE vMinute INT; + DECLARE vWorkerCode VARCHAR(3); + DECLARE vWagon INT; + DECLARE vWagonCounter INT; + DECLARE vShelve INT; + DECLARE vTicket INT; + DECLARE vTicketToSplit INT; + DECLARE vPrintedTickets INT; + DECLARE vMaxTicketPrinted INT; + DECLARE vItemPackingTypeFk VARCHAR(1); + DECLARE hasAssignedTickets BOOLEAN; + DECLARE vMaxNotReadyCollections INT DEFAULT 0; + DECLARE vNotReadyCollections INT; + DECLARE vTrainFk INT DEFAULT 1; + DECLARE vNow DATETIME; + + SELECT ticketPrintedMax * vWagons, ticketTrolleyMax * vWagons, pc.maxNotReadyCollections , NOW() + INTO vMaxTicketPrinted, vMaxTickets, vMaxNotReadyCollections, vNow + FROM vn.productionConfig pc; + + SELECT w.code INTO vWorkerCode + FROM vn.worker w + WHERE w.id = vUserFk; + + -- Establecemos el almacén y si es un sector de preparación previa, así como el estado para los tickets que se vayan preparando + SELECT isPreviousPrepared, warehouseFk, itemPackingTypeFk + INTO vIsPreviousPrepared, vWarehouseFk, vItemPackingTypeFk + FROM vn.sector + WHERE id = vSectorFk; -- Hola + +-- Si está habilitado el modo cazador para las motos, y el usuario no esta registrado, se sale. + + IF (SELECT isTractorHuntingMode FROM vn.deviceProductionConfig dpc) AND vItemPackingTypeFk = 'H' THEN + IF (SELECT COUNT(*) FROM vn.workerWithoutTractor wwt WHERE wwt.workerFk = vUserFk) THEN + CALL util.throw('Usuario no registrado con moto'); + LEAVE proc; + END IF; + END IF; + +-- Si hay colecciones sin terminar, sale del proceso + SELECT count(*) INTO vNotReadyCollections + FROM ( + SELECT count(DISTINCT s.id) totalRow, count(DISTINCT st.id) pickedRow + FROM vn.collection c + JOIN vn.ticketCollection tc ON tc.collectionFk = c.id + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.state ss ON ss.code = 'PREPARED' + LEFT JOIN vn.saleTracking st ON st.saleFk = s.id AND st.stateFk = ss.id + WHERE c.workerFk = vUserFk + AND c.created >= TIMESTAMPADD(HOUR , -6,NOW()) + AND s.quantity != 0 + GROUP BY c.id + HAVING totalRow > pickedRow) sub; + +call util.debugAdd('wargo',CONCAT('vMaxNotReadyCollections ', vMaxNotReadyCollections)); +call util.debugAdd('wargo',CONCAT('vNotReadyCollections ',vNotReadyCollections)); + + IF vMaxNotReadyCollections < vNotReadyCollections THEN + + CALL util.throw('Hay colecciones pendientes'); + LEAVE proc; + + END IF; + + IF vIsPreviousPrepared THEN + + CALL util.throw('Es de preparación previa'); + LEAVE proc; -- Hasta que tengamos el altillo, vamos a cancelar esta opcion + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'PREVIOUS_PREPARATION'; + + ELSE + + SELECT id INTO vStateFk + FROM vn.state + WHERE `code` = 'ON_PREPARATION'; + + END IF; + + CALL vn.productionControl(vWarehouseFk, 0); + + -- Esto hay que corregirlo añadiendo un nuevo parámetro al proc. PAK 23/12/21 + IF vSectorFk = 65 THEN -- Pedidos pequeños + + SET vTrainFk = 2; + + DELETE pb.* + FROM tmp.productionBuffer pb + JOIN vn.volumeConfig vc + WHERE pb.m3 * 1000 > vc.minTicketVolume; + + END IF; + + -- Se obtiene nº de colección y el buffer con los pedidos preparables + INSERT INTO vn.collection + SET workerFk = vUserFk, + itemPackingTypeFk = vItemPackingTypeFk, + trainFk = vTrainFk; + + SELECT LAST_INSERT_ID() INTO vCollectionFk; + + -- 05/08/2021 PAK Jose Frau pide que los tickets de recogida en Algemesí sólo se saquen si están asignados. + DELETE pb.* + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE pb.agency = 'REC_ALGEMESI' + AND s.code != 'PICKER_DESIGNED'; + + -- 2/3/2022 PAK Se acuerda con Pepe que los pedidos con riesgo no se sacan aunque se asignen. + DELETE pb.* + FROM tmp.productionBuffer pb + WHERE pb.problem LIKE '%RIESGO%'; + + -- Comprobamos si hay tickets asignados. En ese caso, nos centramos exclusivamente en esos tickets + -- y los sacamos independientemente de problemas o tamaños + SELECT COUNT(*) INTO hasAssignedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode; + + IF hasAssignedTickets THEN + + UPDATE vn.collection + SET itemPackingTypeFk = NULL + WHERE id = vCollectionFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; + CREATE TEMPORARY TABLE tmp.ticketToSplit + SELECT pb.ticketFk + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + WHERE s.code = 'PICKER_DESIGNED' + AND pb.workerCode = vWorkerCode + ORDER BY HH, + mm, + s.`order` DESC, + pb.m3 DESC; + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + + SELECT MIN(ticketFk) INTO vTicketToSplit + FROM tmp.ticketToSplit; + + CALL vn.ticket_splitItemPackingType(vTicketToSplit); + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT ticketFk, vCollectionFk + FROM tmp.ticketIPT + WHERE (itemPackingTypeFk = vItemPackingTypeFk) ; + + DELETE FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit; + + DROP TEMPORARY TABLE tmp.ticketIPT; + + END WHILE; + + CALL vn.productionControl(vWarehouseFk, 0); + + ELSE + + SELECT COUNT(*) INTO vPrintedTickets + FROM tmp.productionBuffer pb + JOIN vn.state s ON s.id = pb.state + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.productionConfig pc + WHERE pb.shipped = CURDATE() + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND s.isPreparable + AND ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE); + +call util.debugAdd('wargo',CONCAT('vMaxTicketPrinted ', vMaxTicketPrinted)); +call util.debugAdd('wargo',CONCAT('vPrintedTickets ',vPrintedTickets)); + + SET vMaxTicketPrinted = vMaxTicketPrinted - vPrintedTickets; + + -- AutoPRINT + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT s2.id, pb.ticketFk, vUserFk + FROM tmp.productionBuffer pb + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.state s ON s.id = pb.state + JOIN vn.state s2 ON s2.code = 'PRINTED_AUTO' + JOIN vn.ticket t ON t.id = pb.ticketFk + JOIN vn.ticketConfig tc + JOIN vn.productionConfig pc + WHERE pb.shipped = CURDATE() + AND (LENGTH(pb.problem) = 0 + OR (pb.problem = 'PEQUEÑO' AND vTrainFk = 2)) + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND s.isPrintable + AND s.isOK + AND ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND t.created < TIMESTAMPADD(MINUTE, - tc.pickingDelay , NOW()) + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE) + ORDER BY HH, + mm, + s.`order` DESC, + pb.m3 DESC + LIMIT vMaxTicketPrinted; + + -- Se seleccionan los primeros tickets, asignando colección para dejarlos bloqueados a otros sacadores. + -- Se splitan los tickets preparables, para que solo tengan un tipo de empaquetado + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketToSplit; + CREATE TEMPORARY TABLE tmp.ticketToSplit + SELECT pb.ticketFk, IFNULL((pb.H + pb.V = 0),TRUE) isNeutral + FROM tmp.productionBuffer pb + JOIN vn.agencyMode am ON am.id = pb.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.ticketStateToday tst ON tst.ticket = pb.ticketFk + JOIN vn.state s ON s.id = tst.state + JOIN vn.productionConfig pc + WHERE ( + (pb.H > 0 AND vItemPackingTypeFk = 'H' AND ISNULL(pb.collectionH)) + OR (pb.V > 0 AND vItemPackingTypeFk = 'V' AND ISNULL(pb.collectionV)) + OR (pb.H = 0 AND pb.V = 0 AND pb.N > 0 AND ISNULL(pb.collectionH) AND ISNULL(pb.collectionV)) + ) + AND (pb.ubicacion IS NOT NULL + OR a.isOwn = FALSE ) + AND LENGTH(pb.problem) = 0 + AND s.isPreparable + AND (pc.isPreviousPreparationRequired = FALSE + OR pb.previousWithoutParking = FALSE) + ORDER BY pb.HH, pb.mm, s.`order` DESC + LIMIT vMaxTickets; + +call util.debugAdd('wargo',CONCAT('tmp.ticketToSplit ', (SELECT COUNT(*) FROM tmp.ticketToSplit))); + + WHILE (SELECT COUNT(*) FROM tmp.ticketToSplit) DO + + SELECT MIN(ticketFk) INTO vTicketToSplit + FROM tmp.ticketToSplit; + + + IF (SELECT isNeutral + FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit) THEN + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + VALUES(vTicketToSplit, vCollectionFk); + +call util.debugAdd('wargo',CONCAT('neutral ', vTicketToSplit)); + + ELSE + + CALL vn.ticket_splitItemPackingType(vTicketToSplit); + + INSERT INTO vn.ticketCollection(ticketFk, collectionFk) + SELECT ticketFk, vCollectionFk + FROM tmp.ticketIPT + WHERE itemPackingTypeFk = vItemPackingTypeFk; + +call util.debugAdd('wargo',CONCAT('NO neutral ', + (SELECT ticketFk FROM tmp.ticketIPT WHERE itemPackingTypeFk = vItemPackingTypeFk))); + + DROP TEMPORARY TABLE tmp.ticketIPT; + + END IF; + + DELETE FROM tmp.ticketToSplit + WHERE ticketFk = vTicketToSplit; + + END WHILE; + + END IF; + +call util.debugAdd('wargo',CONCAT('vn.ticketCollection ', + (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); + + -- Creamos una tabla temporal con los datos que necesitamos para depurar la colección + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT pb.ticketFk, + pb.`lines`, + pb.m3 * 1000 liters, + 0 as height, + 0 as shelve, + 0 as wagon, + 0 AS shelveLiters, + pb.productionOrder, + pb.HH, + pb.mm + FROM tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON tc.ticketFk = pb.ticketFk + WHERE tc.collectionFk = vCollectionFk + LIMIT vMaxTickets; + + -- Voumen de las lineas de los pedidos, de acuerdo con el packingShelve establecido por los controladores + DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelveLiters; + CREATE TEMPORARY TABLE tmp.ticketShelveLiters + SELECT t.ticketFk, SUM(s.quantity * vc.shelveVolume / i.packingShelve) shelveLiters + FROM tmp.ticket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.volumeConfig vc + WHERE i.packingShelve + GROUP BY t.ticketFk; + + UPDATE tmp.ticket t + JOIN tmp.ticketShelveLiters tsl ON tsl.ticketFk = t.ticketFk + SET t.shelveLiters = tsl.shelveLiters; + + -- Es importante que el primer ticket se coja en todos los casos + + SET vFirstTicketFk = 0; + + SELECT ticketFk, HH, mm + INTO vFirstTicketFk, vHour, vMinute + FROM tmp.ticket + ORDER BY productionOrder DESC, HH, mm + LIMIT 1; + +call util.debugAdd('wargo',CONCAT('vFirstTicketFk ', vFirstTicketFk)); +call util.debugAdd('wargo',CONCAT('vHour ', vHour)); +call util.debugAdd('wargo',CONCAT('vMinute ', vMinute)); + +call util.debugAdd('wargo',CONCAT('tmp.ticket ', (SELECT COUNT(*) FROM tmp.ticket))); + + -- Hay que excluir aquellos que no tengan la misma hora de preparación + DELETE + FROM tmp.ticket + WHERE HH != vHour + OR mm != vMinute; + +call util.debugAdd('wargo',CONCAT('tmp.ticket misma hora ', (SELECT COUNT(*) FROM tmp.ticket))); + + -- En el caso de pedidos de más volumen de un carro, la colección será monoticket. Pero si el primer pedido + -- no es monoticket, excluimos a los de más de un carro + IF (SELECT (t.shelveLiters > vc.trolleyM3 * 1000) + FROM tmp.ticket t + JOIN vn.volumeConfig vc + WHERE t.ticketFk = vFirstTicketFk) THEN + + DELETE + FROM tmp.ticket + WHERE ticketFk != vFirstTicketFk; + + ELSE + + DELETE t.* + FROM tmp.ticket t + JOIN vn.volumeConfig vc + WHERE t.shelveLiters > vc.trolleyM3 * 1000; + + END IF; + +call util.debugAdd('wargo',CONCAT('tmp.ticket volumen ', (SELECT COUNT(*) FROM tmp.ticket))); + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + +call util.debugAdd('wargo',CONCAT('vn.ticketCollection ', + (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); + + -- Construccion del tren + + -- Establece altura máxima por pedido, porque las plantas no se pueden recostar. + UPDATE tmp.ticket t + JOIN + ( SELECT MAX(i.size) maxHeigth, + tc.ticketFk + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.item i ON i.id = s.itemFk + WHERE i.itemPackingTypeFk = 'V' + AND tc.collectionFk = vCollectionFk + GROUP BY tc.ticketFk) sub ON sub.ticketFk = t.ticketFk + SET t.height = IFNULL(sub.maxHeigth,0); + + -- Vamos a generar una tabla con todas las posibilidades de asignacion de pedido + DROP TEMPORARY TABLE IF EXISTS tmp.wagonsVolumetry; + CREATE TEMPORARY TABLE tmp.wagonsVolumetry + SELECT cv.`level` as shelve, + 1 as wagon, + cv.`lines`, + cv.liters, + cv.height + FROM vn.collectionVolumetry cv + WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') + AND cv.trainFk = vTrainFk; + + SET vWagonCounter = 1; + + WHILE vWagonCounter < vWagons DO + + SET vWagonCounter = vWagonCounter + 1; + + INSERT INTO tmp.wagonsVolumetry(shelve, wagon, `lines`, liters, height) + SELECT cv.`level` as shelve, + vWagonCounter as wagon, + cv.`lines`, + cv.liters, + cv.height + FROM vn.collectionVolumetry cv + WHERE cv.itemPackingTypeFk = IFNULL(vItemPackingTypeFk, 'H') + AND cv.trainFk = vTrainFk; + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketShelve; + CREATE TEMPORARY TABLE tmp.ticketShelve + SELECT ticketFk, shelve, wagon, linesDif, LitersDif, heightDif + FROM ( + SELECT t.ticketFk, + wv.shelve, + wv.wagon, + t.productionOrder, + CAST(wv.`lines` AS SIGNED) - t.`lines` as linesDif, + CAST(wv.liters AS SIGNED) - t.shelveLiters as litersDif, + CAST(wv.height AS SIGNED) - t.height as heightDif + FROM tmp.wagonsVolumetry wv + JOIN tmp.ticket t + ) sub + WHERE linesDif >= 0 + AND litersDif >= 0 + AND heightDif >= 0 + ORDER BY productionOrder DESC, linesDif, LitersDif, heightDif ; + + -- Insertamos una opcion virtual para carro completo. Todo ticket tiene que poder entrar en un carro completo.... + INSERT INTO tmp.ticketShelve(ticketFk, shelve, wagon, linesDif, LitersDif, heightDif) + SELECT t.ticketFk, 0, wv.wagon, 999, 999,999 + FROM tmp.ticket t + JOIN tmp.wagonsVolumetry wv + GROUP BY t.ticketFk, wv.wagon; + + SET vWagonCounter = 0; + + WHILE vWagonCounter < vWagons DO + + SET vWagonCounter = vWagonCounter + 1; + + -- Asignamos la primera balda util al primer pedido + IF vWagonCounter = 1 THEN + + SELECT shelve INTO vShelve + FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + AND wagon = vWagonCounter + ORDER BY heightDif, litersDif, linesDif + LIMIT 1; + + ELSE + + SELECT shelve, ticketFk INTO vShelve, vFirstTicketFk + FROM tmp.ticketShelve + WHERE wagon = vWagonCounter + ORDER BY heightDif, litersDif, linesDif + LIMIT 1; + + END IF; + + IF vShelve > 0 THEN + + UPDATE tmp.ticket + SET shelve = vShelve, + wagon = vWagonCounter + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + OR (shelve = vShelve AND wagon = vWagonCounter); + + WHILE (SELECT COUNT(*) FROM tmp.ticketShelve WHERE wagon = vWagonCounter) DO + + SELECT ticketFk, shelve + INTO vTicket, vShelve + FROM tmp.ticketShelve + WHERE wagon = vWagonCounter + LIMIT 1; + + UPDATE tmp.ticket + SET shelve = vShelve, + wagon = vWagonCounter + WHERE ticketFk = vTicket; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vTicket + OR (shelve = vShelve AND wagon = vWagonCounter); + + END WHILE; + + ELSE + + UPDATE tmp.ticket + SET shelve = 1, wagon = vWagonCounter + WHERE ticketFk = vFirstTicketFk; + + DELETE FROM tmp.ticketShelve + WHERE ticketFk = vFirstTicketFk + AND wagon != vWagonCounter; + + END IF; + + END WHILE; + + -- Eliminamos los que se han quedado sin balda + DELETE FROM tmp.ticket WHERE shelve = 0; + + -- Elimina los tickets bloqueados que no se van a preparar + DELETE tc.* + FROM vn.ticketCollection tc + LEFT JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND t.ticketFk IS NULL; + +call util.debugAdd('wargo',CONCAT('vn.ticketCollection bloqueados ', + (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); + + -- Elimina los tickets que ya estan en otra coleccion + DELETE tc.* + FROM vn.ticketCollection tc + JOIN vn.ticketCollection tc2 ON tc2.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND tc2.collectionFk != vCollectionFk; + +call util.debugAdd('wargo',CONCAT('vn.ticketCollection otra coleccion ', + (SELECT COUNT(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk))); + + -- Actualiza el estado de la colección + UPDATE vn.collection c + JOIN vn.state st ON st.code = 'ON_PREPARATION' + SET c.stateFk = st.id + WHERE c.id = vCollectionFk; + + -- Asigna las bandejas + UPDATE vn.ticketCollection tc + JOIN tmp.ticket t ON t.ticketFk = tc.ticketFk + SET tc.level = t.shelve, + tc.wagon = t.wagon, + tc.itemCount = t.`lines`, + tc.liters = t.shelveLiters; + + -- Actualiza el estado de los tickets + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT vStateFk, ticketFk, vUserFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + -- Aviso para la preparacion previa + INSERT INTO vn.ticketDown(ticketFk, collectionFk) + SELECT tc.ticketFk, tc.collectionFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vCollectionFk; + + SELECT * FROM util.debug + where variable = 'wargo' + and created >= vNow + order by created; + + IF (SELECT count(*) FROM vn.ticketCollection WHERE collectionFk = vCollectionFk) THEN + + CALL vn.salesMerge_byCollection(vCollectionFk); + + UPDATE vn.collection c + JOIN (SELECT count(*) saleTotalCount , + sum(s.isPicked != 0) salePickedCount + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND s.quantity > 0 + ) sub + SET c.saleTotalCount = sub.saleTotalCount, + c.salePickedCount = sub.salePickedCount + WHERE c.id = vCollectionFk; + + SELECT vCollectionFk; + + ELSE + + DELETE FROM vn.collection WHERE id = vCollectionFk; + + CALL util.throw('No se ha obtenido colección'); + + END IF; + + DROP TEMPORARY TABLE + tmp.ticketToSplit, + tmp.ticketShelveLiters, + tmp.ticket, + tmp.wagonsVolumetry, + tmp.ticketShelve, + tmp.productionBuffer; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `collection_printSticker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_printSticker`(vCollection INT) +BEGIN + + /*Imprime una etiqueta amarilla a partir de una colección + * + * @param vCollection colección + * @param vPrinterFk id de la impresora + */ + + DECLARE vLabelReportFk INT; + DECLARE vLabelerFk INT; + + + SELECT s.labelReportFk, w.labelerFk INTO vLabelReportFk, vLabelerFk + FROM worker w + LEFT JOIN sector s ON s.id= w.sectorFk + WHERE w.id=account.myUser_getId() ; + + + IF vLabelReportFk AND vLabelerFk THEN + + INSERT INTO ticketTrolley(ticket, labelCount) + SELECT ticketFk, 1 + FROM ticketCollection + WHERE collectionFk = vCollection + ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; + + INSERT INTO printServerQueue(labelReportFk, param1, workerFk,printerFk) + SELECT vLabelReportFk, vCollection, getUser(),vLabelerFk; + + 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 `collection_updateSale` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_updateSale`( + vSaleFk INT, + vOriginalQuantity INT, + vWorkerFk INT, + vStateFk INT, + vTicketFk INT) +BEGIN + + DECLARE vNumPrepared INT; + DECLARE vNumTotal INT; + + REPLACE INTO vn.saleTracking(saleFk,isChecked, originalQuantity, workerFk, actionFk,stateFk) + VALUES(vSaleFk,1,vOriginalQuantity,vWorkerFk,vStateFk,vStateFk); + + UPDATE vn.sale SET isPicked = 1 + WHERE id = vSaleFk; + + SELECT COUNT(s.id) INTO vNumPrepared + FROM vn.sale s + WHERE s.ticketFk = vTicketFk AND s.isPicked = 1; + + SELECT COUNT(s.id) INTO vNumTotal + FROM vn.sale s + WHERE s.ticketFk = vTicketFk; + + IF vNumPrepared = vNumTotal THEN + + INSERT INTO vncontrol.inter + SET state_id = vStateFk, Id_Ticket = vTicketFk, Id_Trabajador = vWorkerFk; + + CALL vn.collection_update(vTicketFk); + + 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 `company_getFiscaldata` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getFiscaldata`(workerFk INT) +BEGIN + +DECLARE vCompanyFk INT; + + SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk) + INTO vCompanyFk + FROM vn.routeConfig rc + LEFT JOIN userConfig uc ON uc.userFk = workerFk; + + + SELECT + s.name AS name , + s.NIF AS nif , + s.street AS street , + s.city AS city , + s.postCode AS postCode + + FROM vn.company c + JOIN vn.worker w ON w.id = c.workerManagerFk + JOIN vn.supplier s ON s.id = c.id + WHERE c.id = vCompanyFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `conveyorExpedition_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `conveyorExpedition_Add`(vStarted DATETIME, vEnded DATETIME) +BEGIN + + + DECLARE startingMinute INT; + + TRUNCATE vn.conveyorExpedition; + + INSERT INTO vn.conveyorExpedition( expeditionFk, + created, + length, + width, + height, + routeFk, + productionMinute, + truck, + criterion, + conveyorBuildingClassFk) + SELECT e.id, + e.created, + 10 * p.depth as depth, + 10 * p.width as width, + 10 * p.height as height, + IFNULL(t.routeFk,am.agencyFk) routeFk, + hour(e.created) * 60 + minute(e.created), + IFNULL(et.description , a.name), + IFNULL(t.routeFk,am.agencyFk) criterion, + IFNULL(p.conveyorBuildingClassFk , pc.defaultConveyorBuildingClass) + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.packaging p ON p.id = e.packagingFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.agencyMode am ON am.id = z.agencyModeFk + LEFT JOIN vn.agency a ON a.id = am.agencyFk + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + JOIN vn.packagingConfig pc + WHERE t.warehouseFk IN (60,1,44) + AND e.created BETWEEN vStarted AND vEnded + AND p.height < 140 + AND p.width < 60 + AND p.depth < 125; + + SELECT MIN(productionMinute) INTO startingMinute + FROM vn.conveyorExpedition ce ; + + UPDATE vn.conveyorExpedition + SET productionMinute = productionMinute - startingMinute; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `copyComponentsFromSaleList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `copyComponentsFromSaleList`(vTargetTicketFk INT) +BEGIN + +/* Copy sales and components to the target ticket +* +* ¡¡¡¡ Requires tmp.saleList(saleFk, itemFk, quantity, concept, price, discount, orden) !!!!! +* +* param VTargetTicketFk id del ticket a rellenar +*/ + + INSERT INTO vn.sale(ticketFk, itemFk, quantity,concept,price,discount) + SELECT vTargetTicketFk, itemFk, quantity,concept,price,discount + FROM tmp.saleList + ORDER BY orden; + + SET @order = 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.newSaleList; + + CREATE TEMPORARY TABLE tmp.newSaleList + SELECT id as saleFk, @order := @order + 1 as orden + FROM vn.sale + WHERE ticketFk = vTargetTicketFk + ORDER BY saleFk; + + INSERT INTO vn.saleComponent(saleFk,componentFk,value) + SELECT ns.saleFk, sc.componentFk, sc.value + FROM vn.saleComponent sc + JOIN tmp.saleList s ON s.saleFk = sc.saleFk + JOIN tmp.newSaleList ns ON ns.orden = s.orden; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `createPedidoInterno` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `createPedidoInterno`(vItemFk INT,vQuantity INT) +BEGIN + + + UPDATE vn.item SET upToDown = vQuantity WHERE id = vItemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `cristalBall__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `cristalBall__`() +BEGIN +/* +*se utiliza en campaña +* sirve para tener un control del stock en Silla y fuentes +* +*/ + +DECLARE vLastDate DATETIME DEFAULT '2019-10-30 23:59'; +DECLARE vWarehouse INT DEFAULT 1; +DECLARE vPalletVolume INT DEFAULT 2200000; + +SELECT date(sub2.dat) dat, + sub2.longName, + sub2.size, + sub2.subName, + cast(sub2.entra as decimal(10,1)) as entra, + cast(sub2.sale as decimal(10,1)) as sale, + sub2.itemFk, + @saldo := entra + sale + ifnull(fue.pal,0) + IF(sub2.itemFk = @item, @saldo, 0) as saldo, + @item := sub2.itemFk as kk, + cast(fue.pal as decimal(10,1)) as pal +FROM +( + SELECT * FROM + ( + SELECT e.dat, + e.item_id as itemFk, + i.longName, + i.size, + i.subName, + sum(e.amount * r.cm3) / vPalletVolume as entra, + 0 as sale + FROM vn2008.item_entry_in e + JOIN vn.item i ON i.id = e.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN bi.rotacion r ON r.Id_Article = e.item_id AND r.warehouse_id = e.warehouse_id + WHERE e.dat BETWEEN CURDATE() AND vLastDate + AND e.warehouse_id = vWarehouse + AND ic.display + AND e.isVirtualStock is FALSE + GROUP BY e.dat, e.item_id + + UNION ALL + + SELECT s.dat, + s.item_id as itemFk, + i.longName, + i.size, + i.subName, + 0 as entra, + sum(s.amount * r.cm3) / vPalletVolume as sale + FROM vn2008.item_out s + JOIN vn.item i ON i.id = s.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN bi.rotacion r ON r.Id_Article = s.item_id AND r.warehouse_id = s.warehouse_id + WHERE s.dat BETWEEN CURDATE() AND vLastDate + AND s.warehouse_id = vWarehouse + AND ic.display + GROUP BY date(s.dat), s.item_id + + UNION ALL + + SELECT util.yesterday(), + @item := st.item_id as itemFk, + i.longName, + i.size, + i.subName, + st.amount * r.cm3 / vPalletVolume , + @saldo := 0 + FROM cache.stock st + JOIN vn.item i ON i.id = st.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN bi.rotacion r ON r.Id_Article = st.item_id AND r.warehouse_id = st.warehouse_id + WHERE st.warehouse_id = vWarehouse + AND ic.display + + ) sub + ORDER BY itemFk, dat, entra DESC) sub2 + LEFT JOIN + ( + SELECT itemFk, + - sum(ish.visible ) * r.cm3 / vPalletVolume as pal + FROM vn.itemShelving ish + JOIN bi.rotacion r ON r.Id_Article = ish.itemFk AND r.warehouse_id = 1 + LEFT JOIN vn.shelving sh ON sh.code = ish.shelvingFk + LEFT JOIN vn.parking p ON p.id = sh.parkingFk + WHERE (sh.code = 'FUE' OR p.code = 'FUE-PI') + GROUP BY itemFk) fue ON fue.itemFk = sub2.itemFk AND sub2.dat = util.yesterday() + ; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `crypt` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `crypt`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255) ) +BEGIN + + DECLARE vEncryptedText VARCHAR(255) DEFAULT ''; + + DECLARE vKeyLength INT; + DECLARE vKeyPosition INT DEFAULT 1; + DECLARE vKeyChar VARCHAR(1); + + DECLARE vTextLength INT; + DECLARE vTextPosition INT DEFAULT 1; + DECLARE vTextChar VARCHAR(1); + + DECLARE vEncryptedChar VARCHAR(1); + DECLARE vEncryptedCharPosition INT; + + DECLARE vChain VARCHAR(255) DEFAULT '#$.-_0123456789abcdefghijklmnopqrstuvwxyz'; + DECLARE vChainTextPosition INT; + DECLARE vChainKeyPosition INT; + DECLARE vChainLength INT; + + DECLARE vInvalidadChars VARCHAR(255) DEFAULT ''; + + SET vTextLength = LENGTH(vText); + SET vKeyLength = LENGTH(vKey); + SET vChainLength = LENGTH(vChain); + + WHILE vTextPosition <= vTextLength DO + + SET vTextChar = MID(vText,vTextPosition,1); + SET vKeyChar = MID(vKey,vKeyPosition,1); + + SET vChainTextPosition = LOCATE(vTextChar, vChain); + SET vInvalidadChars = IF(vChainTextPosition, vInvalidadChars, CONCAT(vInvalidadChars,vTextChar)); + SET vChainKeyPosition = LOCATE(vKeyChar, vChain); + SET vEncryptedCharPosition = vChainTextPosition + vChainKeyPosition; + + IF vEncryptedCharPosition > vChainLength THEN + + SET vEncryptedCharPosition = vEncryptedCharPosition - vChainLength; + + END IF; + + SET vEncryptedChar = MID(vChain, vEncryptedCharPosition,1); + + SET vEncryptedText = CONCAT(vEncryptedText, vEncryptedChar); + + SET vKeyPosition = IF(vKeyPosition = vKeyLength, 1,vKeyPosition + 1); + SET vTextPosition = vTextPosition + 1; + + END WHILE; + + SET vResult = IF(LENGTH(vInvalidadChars), CONCAT('Caracteres no válidos: ',vInvalidadChars),vEncryptedText); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `cryptOff` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `cryptOff`(vText VARCHAR(255), vKey VARCHAR(255), OUT vResult VARCHAR(255)) +BEGIN + + DECLARE vUncryptedText VARCHAR(255) DEFAULT ''; + + DECLARE vKeyLength INT; + DECLARE vKeyPosition INT DEFAULT 1; + DECLARE vKeyChar VARCHAR(1); + + DECLARE vTextLength INT; + DECLARE vTextPosition INT DEFAULT 1; + DECLARE vTextChar VARCHAR(1); + + DECLARE vUncryptedChar VARCHAR(1); + DECLARE vUncryptedCharPosition INT; + + DECLARE vChain VARCHAR(255) DEFAULT '#$.-_0123456789abcdefghijklmnopqrstuvwxyz'; + DECLARE vChainTextPosition INT; + DECLARE vChainKeyPosition INT; + DECLARE vChainLength INT; + + SET vTextLength = LENGTH(vText); + SET vKeyLength = LENGTH(vKey); + SET vChainLength = LENGTH(vChain); + + WHILE vTextPosition <= vTextLength DO + + SET vTextChar = MID(vText,vTextPosition,1); + SET vKeyChar = MID(vKey,vKeyPosition,1); + + SET vChainTextPosition = LOCATE(vTextChar, vChain); + SET vChainKeyPosition = LOCATE(vKeyChar, vChain); + SET vUncryptedCharPosition = vChainTextPosition - vChainKeyPosition; + + IF vUncryptedCharPosition < 1 THEN + + SET vUncryptedCharPosition = vUncryptedCharPosition + vChainLength; + + END IF; + + SET vUncryptedChar = MID(vChain, vUncryptedCharPosition,1); + + SET vUncryptedText = CONCAT(vUncryptedText, vUncryptedChar); + + SET vKeyPosition = IF(vKeyPosition = vKeyLength, 1,vKeyPosition + 1); + SET vTextPosition = vTextPosition + 1; + + END WHILE; + + SET vResult = vUncryptedText; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `dayMinuteWorker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `dayMinuteWorker`(vDateFrom DATETIME, vDateTo DATETIME) +BEGIN + + DECLARE vDateStart DATE DEFAULT vDateFrom; + DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDateTo); + + SET @ordr := 0; + SET @user := 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.dayMinuteWorker; + CREATE TEMPORARY TABLE tmp.dayMinuteWorker + SELECT sub3.id, + sub3.hh AS `Hour`, + sub3.mm AS Minut, + sub3.userFk, + sub3.code AS workerCode, + sub3.firstname AS name, + sub3.lastName AS surnames, + sub3.workcenterFk AS center, + w.name AS centerName, + w2.name AS warehouseName, + w2.hasProduction AS production + FROM postgresql.workcenter w + JOIN(SELECT id, + hh, + mm, + userFk, + code, + firstname, + lastName, + @ordr := IF(@user != userFk,0,@ordr), + IF(@ordr MOD 2, 'presente','--') AS state, + @ordr := IFNULL(sub2.`order`,@ordr), + @user := IFNULL(sub2.`userFk`,@user), + workcenterFk + FROM(SELECT dm.id, + dm.hh, + dm.mm, + users.userFk, + sub.`order`, + users.code, + firstName, + lastName, + users.workcenterFk + FROM dayMinute dm + JOIN(SELECT DISTINCT wtc.userFk , + code , + firstName, + lastName, + wl.workCenterFk + FROM vn.workerTimeControl wtc + JOIN vn.worker w ON w.userFk = wtc.userFk + JOIN vn.workerLabour wl ON wl.workerFK = w.id + AND wtc.timed BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) + WHERE wtc.timed BETWEEN vDateStart AND vDateEnd + ) users + LEFT JOIN(SELECT `order`, + wtc.userFk, + hour(wtc.timed) * 100 + minute(wtc.timed) as dayMinuteFk + FROM vn.workerTimeControl wtc + WHERE wtc.timed BETWEEN vDateStart AND vDateEnd + ORDER BY wtc.userFk, `order` + ) sub ON sub.dayMinuteFk = dm.id AND sub.userFk = users.userFk + ORDER BY userFk,dm.id + ) sub2 + ) sub3 ON sub3.workcenterFk = w.workcenter_id + JOIN vn.warehouse w2 ON w2.id = w.warehouseFk + WHERE state = 'presente' + AND sub3.id BETWEEN HOUR(vDateFrom) *100 + MINUTE(vDateFrom) + AND HOUR(vDateTo) *100 + MINUTE(vDateTo); + + END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `department_calcTree` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `department_calcTree`() +BEGIN +/** + * Calculates the #path, #lft, #rgt, #sons and #depth columns of + * the #department table. To build the tree, it uses the #parentFk + * column. + */ + DECLARE vIndex INT DEFAULT 0; + DECLARE vSons INT; + + DROP TEMPORARY TABLE IF EXISTS tNestedTree; + CREATE TEMPORARY TABLE tNestedTree + SELECT id, path, lft, rgt, depth, sons + FROM department LIMIT 0; + + SET max_sp_recursion_depth = 5; + CALL department_calcTreeRec(NULL, '/', 0, vIndex, vSons); + SET max_sp_recursion_depth = 0; + + UPDATE department z + JOIN tNestedTree t ON t.id = z.id + SET z.path = t.path, + z.lft = t.lft, + z.rgt = t.rgt, + z.depth = t.depth, + z.sons = t.sons; + + DROP TEMPORARY TABLE tNestedTree; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `department_calcTreeRec` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `department_calcTreeRec`( + vSelf INT, + vPath VARCHAR(255), + vDepth INT, + INOUT vIndex INT, + OUT vSons INT +) +BEGIN +/** + * Calculates and sets the #path, #lft, #rgt, #sons and #depth + * columns for all children of the passed node. Once calculated + * the last node rgt index and the number of sons are returned. + * To update it's children, this procedure calls itself recursively + * for each one. + * + * @vSelf The node identifier + * @vPath The initial path + * @vDepth The initial depth + * @vIndex The initial lft index + * @vSons The number of direct sons + */ + DECLARE vChildFk INT; + DECLARE vLft INT; + DECLARE vMySons INT; + DECLARE vDone BOOL; + DECLARE vChildren CURSOR FOR + SELECT id FROM department + WHERE (vSelf IS NULL AND parentFk IS NULL) + OR (vSelf IS NOT NULL AND parentFk = vSelf); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SET vSons = 0; + + OPEN vChildren; + myLoop: LOOP + SET vDone = FALSE; + FETCH vChildren INTO vChildFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + SET vIndex = vIndex + 1; + SET vLft = vIndex; + SET vSons = vSons + 1; + + CALL department_calcTreeRec( + vChildFk, + CONCAT(vPath, vChildFk, '/'), + vDepth + 1, + vIndex, + vMySons + ); + + SET vIndex = vIndex + 1; + + INSERT INTO tNestedTree + SET id = vChildFk, + path = vPath, + lft = vLft, + rgt = vIndex, + depth = vDepth, + sons = vMySons; + END LOOP; + CLOSE vChildren; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `department_doCalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `department_doCalc`() +proc: BEGIN +/** + * Recalculates the department tree. + */ + DECLARE vIsChanged BOOL; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('vn.department_doCalc'); + RESIGNAL; + END; + + IF !GET_LOCK('vn.department_doCalc', 0) THEN + LEAVE proc; + END IF; + + SELECT isChanged INTO vIsChanged + FROM department_recalc; + + IF vIsChanged THEN + UPDATE department_recalc SET isChanged = FALSE; + CALL vn.department_calcTree; + END IF; + + DO RELEASE_LOCK('vn.department_doCalc'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `department_getHasMistake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getHasMistake`() +BEGIN + +/** + * Obtiene los sectores a los cuales les ponemos errores + * + */ + + SELECT id, name + FROM department + WHERE hasToMistake <> 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 `department_getLeaves` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getLeaves`( + vParentFk INT, + vSearch VARCHAR(255) +) +BEGIN + DECLARE vIsNumber BOOL; + DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; + + DROP TEMPORARY TABLE IF EXISTS tNodes; + CREATE TEMPORARY TABLE tNodes + (UNIQUE (id)) + ENGINE = MEMORY + SELECT id FROM department LIMIT 0; + + IF vIsSearch THEN + SET vIsNumber = vSearch REGEXP '^[0-9]+$'; + + INSERT INTO tNodes + SELECT id FROM department + WHERE (vIsNumber AND `name` = vSearch) + OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) + LIMIT 1000; + END IF; + + IF vParentFk IS NULL THEN + DROP TEMPORARY TABLE IF EXISTS tChilds; + CREATE TEMPORARY TABLE tChilds + ENGINE = MEMORY + SELECT id FROM tNodes; + + DROP TEMPORARY TABLE IF EXISTS tParents; + CREATE TEMPORARY TABLE tParents + ENGINE = MEMORY + SELECT id FROM department LIMIT 0; + + myLoop: LOOP + DELETE FROM tParents; + INSERT INTO tParents + SELECT parentFk id + FROM department g + JOIN tChilds c ON c.id = g.id + WHERE g.parentFk IS NOT NULL; + + INSERT IGNORE INTO tNodes + SELECT id FROM tParents; + + IF ROW_COUNT() = 0 THEN + LEAVE myLoop; + END IF; + + DELETE FROM tChilds; + INSERT INTO tChilds + SELECT id FROM tParents; + END LOOP; + + DROP TEMPORARY TABLE + tChilds, + tParents; + END IF; + + IF !vIsSearch THEN + INSERT IGNORE INTO tNodes + SELECT id FROM department + WHERE parentFk <=> vParentFk; + END IF; + + SELECT d.id, + d.`name`, + d.parentFk, + d.sons + FROM department d + JOIN tNodes n ON n.id = d.id + ORDER BY depth, `name`; + + DROP TEMPORARY TABLE tNodes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `deviceLog_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(100)) +BEGIN +/* + * Inserta registro en tabla devicelog el log del usuario conectado + * @param vAppName es el nombre de la app + * @param vAppVersion es la versión de la app + * @param vAndroid_id es el android_id del dispositivo que se ha logueado + */ + + INSERT INTO deviceLog (userFK, nameApp, versionApp, android_id) + VALUES(vWorkerFk, vAppName, vAppVersion, vAndroid_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 `deviceProductionUser_exists` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_exists`(vUserFk INT) +BEGIN + +/* SELECT COUNT(*) AS UserExists + FROM vn.deviceProductionUser dpu + WHERE dpu.userFk = vUserFk;*/ + SELECT 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 `deviceProductionUser_getWorker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_getWorker`(vAndroid_id VARCHAR(50)) +BEGIN +/** + * Selecciona si hay registrado un device con un android_id + * + * @param vAndroid_id el número android_id del dispositivo + * + */ + SELECT 103; +/* SELECT account.user_getNameFromId(dpu.userFk) + FROM deviceProductionUser dpu + JOIN deviceProduction dp ON dpu.deviceProductionFk = dp.id + WHERE dp.android_id = vAndroid_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 `deviceProduction_getnameDevice` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProduction_getnameDevice`(vAndroid_id VARCHAR(50)) +BEGIN +/** + * Selecciona el id del dispositivo que corresponde al vAndroid_id + * + * @param vAndroid_id el número android_id del dispositivo + * + */ + + SELECT dp.id + FROM deviceProduction dp + WHERE dp.android_id = vAndroid_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 `device_checkLogin` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `device_checkLogin`(vUserFk INT, vAndroidID VARCHAR(50)) +BEGIN + +/* + * Comprueba si está registrado el dispositivo mediante su androidId + * + * @param vUSerFk el id del user + * @param vAndroidID es el identificador android_id del dispositivo + */ + DECLARE vIsAuthorized BOOL DEFAULT TRUE; + DECLARE vIsDepartment BOOL; + DECLARE vIsAllUsersAllowed BOOL; + DECLARE vMessage VARCHAR(200); + + SELECT dpc.isAllUsersallowed INTO vIsAllUsersAllowed + FROM vn.deviceProductionConfig dpc; + + IF NOT vIsAllUsersAllowed THEN + + SELECT COUNT(*) INTO vIsDepartment + FROM vn.workerDepartment dp + JOIN department d ON d.id = dp.departmentFk + WHERE dp.workerFk = vUserFk AND d.hasToCheckLogin; + + IF vIsDepartment THEN + SELECT COUNT(*) INTO vIsAuthorized + FROM vn.deviceProductionUser dpu + JOIN vn.deviceProduction dp ON dp.id = dpu.deviceProductionFk + WHERE dpu.userFk = vUserFk + AND dp.android_id = vAndroidID; + + IF NOT vIsAuthorized THEN + SET vMessage = 'Usuario no autorizado'; + END IF; + END IF; + + END IF; + + SELECT vIsAuthorized,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 `device_checkLogin__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `device_checkLogin__`(vUserFk INT, vAndroidID VARCHAR(50)) +BEGIN + +/* + * Comprueba si está registrado el dispositivo mediante su androidId + * + * @param vUSerFk el id del user + * @param vAndroidID es el identificador android_id del dispositivo + */ + DECLARE vIsAuthorized BOOL DEFAULT TRUE; + DECLARE vIsDepartment BOOL; + DECLARE vMessage VARCHAR(200); + + SELECT COUNT(*) INTO vIsDepartment + FROM vn.workerDepartment dp + JOIN department d ON d.id = dp.departmentFk + WHERE dp.workerFk = vUserFk AND d.name = "PRODUCCION"; + + IF vIsDepartment THEN + + SELECT COUNT(*) INTO vIsAuthorized + FROM vn.deviceProductionUser dpu + JOIN vn.deviceProduction dp ON dp.id = dpu.deviceProductionFk + WHERE dpu.userFk = vUserFk + AND dp.android_id = vAndroidID; + + + IF NOT vIsAuthorized THEN + + SET vMessage = 'Usuario no autorizado'; + + END IF; + + END IF; + + + #vIsAuthorized = TRUE; #Descomentar esta linea si se quiere quitar la comprobación de autorizacion + SELECT vIsAuthorized,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 `duaEntryValueUpdate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `duaEntryValueUpdate`(vDuaFk INT) +BEGIN + + UPDATE duaEntry de + JOIN + ( SELECT b.entryFk, sum(b.quantity * b.buyingValue) as total + FROM buy b + JOIN duaEntry de ON de.entryFk = b.entryFk + WHERE duaFk = vDuaFk + GROUP BY b.entryFk + ) sub ON sub.entryFk = de.entryFk + + LEFT JOIN + (SELECT e.id, sum(iit.taxableBase) as euros + FROM entry e + JOIN invoiceInTax iit ON iit.invoiceInFk = e.invoiceInFk + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk + GROUP BY e.id + ) sub2 ON sub2.id = de.entryFk + + SET de.value = sub.total, + de.euroValue = sub2.euros + WHERE duaFk = vDuaFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `duaInvoiceInBooking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking`(vDuaFk INT) +BEGIN + + DECLARE done BOOL DEFAULT FALSE; + DECLARE vInvoiceFk INT; + DECLARE vASIEN BIGINT DEFAULT 0; + DECLARE vCounter INT DEFAULT 0; + + DECLARE rs CURSOR FOR + SELECT e.invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE de.duaFk = vDuaFk + AND de.customsValue + AND ii.isBooked = FALSE; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + UPDATE invoiceIn ii + JOIN entry e ON e.invoiceInFk = ii.id + JOIN duaEntry de ON de.entryFk = e.id + JOIN dua d ON d.id = de.duaFk + SET ii.isBooked = TRUE, + ii.booked = IFNULL(ii.booked,d.booked), + ii.operated = IFNULL(ii.operated,d.operated), + ii.issued = IFNULL(ii.issued,d.issued), + ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), + e.isConfirmed = TRUE + WHERE d.id = vDuaFk; + + SELECT IFNULL(ASIEN,0) INTO vASIEN + FROM dua + WHERE id = vDuaFk; + + FETCH rs INTO vInvoiceFk; + + WHILE NOT done DO + + CALL invoiceInBookingMain(vInvoiceFk); + + IF vCounter > 0 OR vASIEN > 0 THEN + + UPDATE vn2008.XDiario x + JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN + SET x.ASIEN = vASIEN; + + ELSE + + SELECT lastBookEntry INTO vASIEN FROM vn.ledgerConfig; + + END IF; + + SET vCounter = vCounter + 1; + + FETCH rs INTO vInvoiceFk; + + END WHILE; + + CLOSE rs; + + UPDATE dua + SET ASIEN = vASIEN + WHERE id = vDuaFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `duaInvoiceInBooking__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `duaInvoiceInBooking__`(vDuaFk INT) +BEGIN + DECLARE done BOOL DEFAULT FALSE; + DECLARE vInvoiceFk INT; + DECLARE vASIEN BIGINT DEFAULT 0; + DECLARE vCounter INT DEFAULT 0; + + DECLARE rs CURSOR FOR + SELECT e.invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + JOIN invoiceIn ii ON ii.id = e.invoiceInFk + WHERE de.duaFk = vDuaFk + AND de.customsValue + AND ii.isBooked = FALSE; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + UPDATE invoiceIn ii + JOIN entry e ON e.invoiceInFk = ii.id + JOIN duaEntry de ON de.entryFk = e.id + JOIN dua d ON d.id = de.duaFk + SET ii.isBooked = TRUE, + ii.booked = IFNULL(ii.booked,d.booked), + ii.operated = IFNULL(ii.operated,d.operated), + ii.issued = IFNULL(ii.issued,d.issued), + ii.bookEntried = IFNULL(ii.bookEntried,d.bookEntried), + e.isConfirmed = TRUE + WHERE d.id = vDuaFk; + + SELECT IFNULL(ASIEN,0) INTO vASIEN + FROM dua + WHERE id = vDuaFk; + + FETCH rs INTO vInvoiceFk; + + WHILE NOT done DO + + CALL invoiceInBookingMain(vInvoiceFk); + + IF vCounter > 0 OR vASIEN > 0 THEN + + UPDATE XDiario x + JOIN config c ON c.ASIEN = x.ASIEN + SET x.ASIEN = vASIEN; + + ELSE + + SELECT ASIEN INTO vASIEN FROM config; + + END IF; + + SET vCounter = vCounter + 1; + + FETCH rs INTO vInvoiceFk; + + END WHILE; + + CLOSE rs; + + UPDATE dua + SET ASIEN = vASIEN + WHERE id = vDuaFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `duaParcialMake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `duaParcialMake`(vDuaFk INT) +BEGIN + + DECLARE vNewDuaFk INT; + + INSERT INTO dua(awbFk,companyFk) + SELECT awbFk,companyFk + FROM dua + WHERE id = vDuaFk; + + SELECT LAST_INSERT_ID() INTO vNewDuaFk; + + INSERT INTO duaEntry(duaFk, entryFk, value, customsValue) + SELECT vNewDuaFk, entryFk, value, value - customsValue + FROM duaEntry + WHERE duaFk = vDuaFk + AND value != customsValue; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `duaTaxBooking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTaxBooking`(vDuaFk INT) +BEGIN + DECLARE vBookNumber INT; + DECLARE vBookDated DATE; + DECLARE vDiff DECIMAL(10,2); + DECLARE vApunte BIGINT; + + SELECT ASIEN, IFNULL(bookEntried, CURDATE()) INTO vBookNumber, vBookDated + FROM dua + WHERE id = vDuaFk; + + IF vBookNumber IS NULL OR NOT vBookNumber THEN + CALL ledger_next(vBookNumber); + END IF; + + -- Apunte de la aduana + + INSERT INTO XDiario( + ASIEN, + FECHA, + SUBCTA, + CONCEPTO, + EUROHABER, + SERIE, + empresa_id, + CLAVE, + FACTURA) + + SELECT + vBookNumber, + d.bookEntried, + '4700000999', + CONCAT('DUA ',d.`code`), + sum(dt.base * dt.rate / 100) EUROHABER, + 'R', + d.companyFk, + vDuaFk, + vDuaFk + FROM duaTax dt + JOIN dua d ON d.id = dt.duaFk + WHERE dt.duaFk = vDuaFk; + + -- Apuntes por tipo de IVA y proveedor + + INSERT INTO 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, + vBookDated FECHA, + tr.account SUBCTA, + '4330002067' CONTRA, + sum(dt.tax) EURODEBE, + sum(dt.base) BASEEURO, + CONCAT('DUA nº',d.code) CONCEPTO, + d.id FACTURA, + dt.rate IVA, + '*' AUXILIAR, + 'D' SERIE, + d.issued FECHA_EX, + d.operated FECHA_OP, + d.code FACTURAEX, + 1 NFACTICK, + 1 L340, + TRUE LDIFADUAN, + 1 TIPOCLAVE, + 1 TIPOEXENCI, + 1 TIPONOSUJE, + 5 TIPOFACT, + 1 TIPORECTIF, + IF(s.countryFk IN (30, 1), 1, 4) TERIDNIF, + s.nif TERNIF, + s.name TERNOM, + d.companyFk, + d.booked FECREGCON + FROM duaTax dt + JOIN dua d ON dt.duaFk = d.id + JOIN (SELECT account, rate + FROM + (SELECT rate, account + FROM invoiceInTaxBookingAccount ta + WHERE ta.effectived <= vBookDated + AND taxAreaFk = 'WORLD' + ORDER BY ta.effectived DESC + ) tba + GROUP BY rate + ) tr ON tr.rate = dt.rate + JOIN supplier s ON s.id = d.companyFk + WHERE d.id = vDuaFk + GROUP BY dt.rate; + + SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte + FROM XDiario + WHERE ASIEN = vBookNumber; + + UPDATE XDiario + SET BASEEURO = 100 * (EURODEBE - vDiff) / IVA, + EURODEBE = EURODEBE - vDiff + WHERE id = vApunte; + + UPDATE dua + SET ASIEN = vBookNumber + WHERE id = vDuaFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `duaTaxBooking__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTaxBooking__`(vDuaFk INT) +BEGIN + DECLARE vBookNumber INT; + DECLARE vBookDated DATE; + DECLARE vDiff DECIMAL(10,2); + DECLARE vApunte BIGINT; + + SELECT ASIEN, IFNULL(bookEntried, CURDATE()) INTO vBookNumber, vBookDated + FROM dua + WHERE id = vDuaFk; + + IF vBookNumber IS NULL OR NOT vBookNumber THEN + CALL ledger_next(vBookNumber); + END IF; + + -- Apunte de la aduana + + INSERT INTO XDiario( + ASIEN, + FECHA, + SUBCTA, + CONCEPTO, + EUROHABER, + SERIE, + empresa_id, + CLAVE, + FACTURA) + + SELECT + vBookNumber, + d.bookEntried, + '4700000999', + CONCAT('DUA ',d.code), + sum(di.amount * tr.rate / 100) EUROHABER, + 'R', + d.companyFk, + vDuaFk, + vDuaFk + FROM duaIntrastat di + JOIN intrastat ist ON ist.id = di.intrastatFk + JOIN (SELECT rate, taxClassFk + FROM + (SELECT rate, taxClassFk + FROM invoiceInTaxBookingAccount ta + WHERE ta.effectived <= vBookDated + ORDER BY ta.effectived DESC + ) tba + GROUP BY taxClassFk + ) tr ON tr.taxClassFk = ist.taxClassFk + JOIN dua d ON d.id = di.duaFk + WHERE di.duaFk = vDuaFk; + + -- Apuntes por tipo de IVA y proveedor + + INSERT INTO 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, + vBookDated FECHA, + tr.account SUBCTA, + '4330002067' CONTRA, + sum(dt.tax) EURODEBE, + sum(dt.base) BASEEURO, + CONCAT('DUA nº',d.code) CONCEPTO, + d.id FACTURA, + dt.rate IVA, + '*' AUXILIAR, + 'D' SERIE, + d.issued FECHA_EX, + d.operated FECHA_OP, + d.code FACTURAEX, + 1 NFACTICK, + 1 L340, + TRUE LDIFADUAN, + 1 TIPOCLAVE, + 1 TIPOEXENCI, + 1 TIPONOSUJE, + 5 TIPOFACT, + 1 TIPORECTIF, + IF(s.countryFk IN (30, 1), 1, 4) TERIDNIF, + s.nif TERNIF, + s.name TERNOM, + d.companyFk, + d.booked FECREGCON + FROM duaTax dt + JOIN dua d ON dt.duaFk = d.id + JOIN (SELECT account, rate + FROM + (SELECT rate, account + FROM invoiceInTaxBookingAccount ta + WHERE ta.effectived <= vBookDated + AND taxAreaFk = 'WORLD' + ORDER BY ta.effectived DESC + ) tba + GROUP BY rate + ) tr ON tr.rate = dt.rate + JOIN supplier s ON s.id = d.companyFk + WHERE d.id = vDuaFk + GROUP BY dt.rate; + + SELECT SUM(EURODEBE) -SUM(EUROHABER), MAX(id) INTO vDiff, vApunte + FROM XDiario + WHERE ASIEN = vBookNumber; + + UPDATE XDiario + SET BASEEURO = 100 * (EURODEBE - vDiff) / IVA, + EURODEBE = EURODEBE - vDiff + WHERE id = vApunte; + + UPDATE dua + SET ASIEN = vBookNumber + WHERE id = vDuaFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `duaTaxUpdate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTaxUpdate__`(vDuaFk INT) +BEGIN + + DECLARE vSPAIN INT DEFAULT 1; + DECLARE vDated DATE; + DECLARE vTotalDUABase DECIMAL(10,2); + + SELECT IFNULL(operated, CURDATE()) INTO vDated + FROM dua + WHERE id = vDuaFk; + + SELECT sum(amount) INTO vTotalDUABase + FROM duaIntrastat + WHERE duaFk = vDuaFk; + + DELETE FROM duaTax + WHERE duaFk = vDuaFk; + + INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base) + SELECT vDuaFk, supplierFk, taxClassFk, sum(sub.Base) as Base + FROM intrastat ist + JOIN + (SELECT + e.supplierFk, + i.intrastatFk, + CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) * di.amount/ tei.Base AS DECIMAL(10,2)) as Base + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN duaEntry de ON de.entryFk = e.id + JOIN + ( + SELECT i.intrastatFk, + CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) AS DECIMAL(10,2)) as Base + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk + GROUP BY i.intrastatFk + + ) tei ON tei.intrastatFk = i.intrastatFk + JOIN + ( + SELECT intrastatFk, sum(amount) as amount + FROM duaIntrastat + WHERE duaFk = vDuaFk + GROUP BY intrastatFK + ) di ON di.intrastatFk = i.intrastatFk + WHERE de.duaFk = vDuaFk + GROUP BY e.supplierFk, i.intrastatFk + HAVING Base + ) sub ON ist.id = sub.intrastatFk + GROUP BY ist.taxClassFk, sub.supplierFk; + + UPDATE duaTax dt + JOIN + (SELECT taxClassFk, rate + FROM + (SELECT taxClassFk, rate + FROM invoiceInTaxBookingAccount + WHERE effectived <= vDated + AND countryFk = vSPAIN + ORDER BY effectived DESC + ) ba1 + GROUP BY taxClassFk + ) ba2 ON dt.taxClassFk = ba2.taxClassFk + SET dt.rate = ba2.rate, + dt.tax = dt.base * ba2.rate / 100; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `duaTax_doRecalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `duaTax_doRecalc`(vDuaFk INT) +BEGIN +/** + * Borra los valores de duaTax y los vuelve a crear en base a la tabla duaEntry + * + * @param vDuaFk Id del dua a recalcular +**/ + DELETE FROM duaTax + WHERE duaFk = vDuaFk; + + INSERT INTO duaTax(duaFk, supplierFk, taxClassFk, base) + SELECT vDuaFk, supplierFk, taxClassFk, sum(sub.Base) as Base + FROM intrastat ist + JOIN + (SELECT + e.supplierFk, + i.intrastatFk, + CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) * di.amount/ tei.Base AS DECIMAL(10,2)) as Base + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN duaEntry de ON de.entryFk = e.id + JOIN + ( + SELECT i.intrastatFk, + CAST(sum(b.quantity * b.buyingValue * de.customsValue / de.value) AS DECIMAL(10,2)) as Base + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk + GROUP BY i.intrastatFk + + ) tei ON tei.intrastatFk = i.intrastatFk + JOIN + ( + SELECT intrastatFk, sum(amount) as amount + FROM duaIntrastat + WHERE duaFk = vDuaFk + GROUP BY intrastatFK + ) di ON di.intrastatFk = i.intrastatFk + WHERE de.duaFk = vDuaFk + GROUP BY e.supplierFk, i.intrastatFk + HAVING Base + ) sub ON ist.id = sub.intrastatFk + GROUP BY ist.taxClassFk, sub.supplierFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ediTables_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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ediTables_Update`() +BEGIN + + INSERT IGNORE INTO vn.genus(name) + SELECT latin_genus_name + FROM edi.genus ; + + INSERT IGNORE INTO vn.specie(name) + SELECT LCASE(latin_species_name) + FROM edi.specie ; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ektEntryAssign_setEntry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ektEntryAssign_setEntry`() +BEGIN + +DECLARE done INT DEFAULT FALSE; +DECLARE vEntryFk INT; +DECLARE vTravelFk INT; +DECLARE vId INT; +DECLARE vLanded DATE DEFAULT CURDATE(); + +DECLARE cur1 CURSOR FOR SELECT id FROM vn.ektEntryAssign; + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + IF HOUR(NOW()) > 12 THEN + + SET vLanded = TIMESTAMPADD(DAY,1,vLanded); + + END IF; + +OPEN cur1; + + read_loop: LOOP + + SET done = FALSE; + SET vEntryFk = 0; + + FETCH cur1 INTO vId; + + IF done THEN + LEAVE read_loop; + END IF; + + SELECT IFNULL(e.id,0) INTO vEntryFk + FROM vn.entry e + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + AND ea.supplierFk = e.supplierFk + WHERE ea.id = vId + AND tr.landed = vLanded + LIMIT 1; + + IF NOT vEntryFk THEN + + SELECT IFNULL(e.id,0) INTO vEntryFk + FROM vn.entry e + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + WHERE ea.id = vId + AND tr.landed = vLanded + AND ea.supplierFk IS NULL + LIMIT 1; + + END IF; + + IF NOT vEntryFk THEN + + SET vTravelFk = 0; + + SELECT IFNULL(MAX(tr.id),0) INTO vTravelFk + FROM vn.travel tr + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + WHERE ea.id = vId + AND tr.landed = vLanded; + + IF NOT vTravelFk THEN + + INSERT INTO vn.travel(landed, shipped, warehouseInFk, warehouseOutFk, agencyFk) + SELECT vLanded, vLanded, warehouseInFk, warehouseOutFk, agencyModeFk + FROM vn.ektEntryAssign + WHERE id = vId; + + SELECT MAX(tr.id) INTO vTravelFk + FROM vn.travel tr + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + WHERE ea.id = vId + AND tr.landed = vLanded; + + END IF; + + INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk) + SELECT vTravelFk, IFNULL(ea.supplierFk,s.id), c.id, cu.id + FROM vn.supplier s + JOIN vn.company c ON c.code = 'VNL' + JOIN vn.currency cu ON cu.code = 'EUR' + JOIN vn.ektEntryAssign ea ON ea.id = vId + WHERE s.name = 'KONINKLIJE COOPERATIEVE BLOEMENVEILING FLORAHOLLAN'; + + SELECT MAX(id) INTO vEntryFk + FROM vn.entry + WHERE travelFk = vTravelFk; + + END IF; + + UPDATE vn.ektEntryAssign + SET entryFk = vEntryFk + WHERE id = vId; + + END LOOP; + + CLOSE cur1; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ekt_add__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_add__`(vPutOrderFk INT) +BEGIN + +/** + * Añade ekt para las ordenes de compra de proveedores que no envian el ekt por email + * + * @param vPutOrderFk PutOrderId de donde coger los datos + **/ + + INSERT INTO edi.ekt(entryYear, + deliveryNumber, + fec, + hor, + item, + pac, + qty, + ori, + cat, + pro, + pri, + package, + s1, + s2, + s3, + s4, + s5, + s6, + putOrderFk, + `ref`, + kop) + SELECT year(curdate()) entryYear, + p.id deliveryNumber , + CURDATE() fec, + CURTIME() hor, + i.longName item, + sr.NumberOfItemsPerCask pac, + p.quantity qty, + o.code ori, + i.category cat, + mp.supplierFk pro, + sr.Price pri, + sr.EmbalageCode package, + i.value5 s1, + i.value6 s2, + i.value7 s3, + i.value8 s4, + i.value9 s5, + i.value10 s6, + p.id putOrderFk, + sr.Item_ArticleCode, + sr.vmpID + FROM edi.putOrder p + JOIN edi.supplyResponse sr ON sr.ID = p.supplyResponseID + JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID + JOIN vn.item i ON i.supplyResponseFk = sr.ID + JOIN vn.origin o ON o.id = i.originFk + WHERE p.id = vPutOrderFk; + + CALL edi.ekt_load(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 `energyMeter_record` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `energyMeter_record`(vInput INT, vActiveTime INT) +BEGIN + DECLARE vConsumption INT; + + SELECT consumption INTO vConsumption + FROM energyInput + WHERE input = vInput; + + INSERT INTO vn.energyMeter + SET + `input` = vInput, + `period` = DATE_FORMAT(NOW(), '%Y-%m-%d %H:00:00'), + `activeTime` = vActiveTime, + `consumption` = CAST(IFNULL((vConsumption / 3600) * vActiveTime, 0) AS DECIMAL(10,2)) + ON DUPLICATE KEY UPDATE + `activeTime` = `activeTime` + vActiveTime, + `consumption` = `consumption` + CAST(VALUES(`consumption`) AS DECIMAL(10,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 PROCEDURE IF EXISTS `entryConverter__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entryConverter__`(IN `vEntry` INT) +BEGIN + + DECLARE vWarehouseIn INT; + DECLARE vWarehouseOut INT; + DECLARE vTravel INT; + + DECLARE done BOOL DEFAULT FALSE; + + DECLARE vId_Entrada INT; + DECLARE vId_Article INT; + DECLARE vEtiquetas INT; + DECLARE vId_Cubo VARCHAR(10); + DECLARE vPacking INT; + DECLARE vGrouping INT; + DECLARE vCantidad INT; + DECLARE vCostefijo DECIMAL(10,3); + DECLARE vPortefijo DECIMAL(10,3); + DECLARE vEmbalajefijo DECIMAL(10); + DECLARE vComisionfija DECIMAL(10,3); + DECLARE vCaja INT; + DECLARE vNicho VARCHAR(5); + DECLARE vTarifa1 DECIMAL(10,2); + DECLARE vTarifa2 DECIMAL(10,2); + DECLARE vTarifa3 DECIMAL(10,2); + DECLARE vPVP DECIMAL(10,2); + DECLARE vCompra INT; + + DECLARE rs CURSOR FOR + SELECT + b.Id_Entrada, + b.Id_Article, + b.Etiquetas, + b.Id_Cubo, + b.Packing, + b.`grouping`, + b.Cantidad, + b.Costefijo, + b.Portefijo, + b.Embalajefijo, + b.Comisionfija, + b.caja, + b.Nicho, + b.Tarifa1, + b.Tarifa2, + b.Tarifa3, + b.PVP + FROM vn2008.Compres b + JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article + WHERE Id_Entrada = vEntry; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + SELECT warehouseInFk, warehouseOutFk, tr.id + INTO vWarehouseIn, vWarehouseOut, vTravel + FROM travel tr + JOIN entry e ON e.travelFk = tr.id + WHERE e.id = vEntry; + + UPDATE travel + SET warehouseInFk = vWarehouseOut, + warehouseOutFk = vWarehouseIn + WHERE id = vTravel; + + UPDATE vn2008.Compres c + LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article + SET Etiquetas = 0, Cantidad = 0 + WHERE c.Id_Entrada = vEntry + AND ic.espItemFk IS NULL; + + OPEN rs; + + DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry; + + FETCH rs INTO + vId_Entrada, + vId_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP; + + WHILE NOT done DO + + -- Primero la linea original con las cantidades invertidas + INSERT INTO vn2008.Compres + ( + Id_Entrada, + Id_Article, + Etiquetas, + Id_Cubo, + Packing, + `grouping`, + Cantidad, + Costefijo, + Portefijo, + Embalajefijo, + Comisionfija, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP + ) + VALUES + ( + vId_Entrada, + vId_Article, + - vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + - vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP); + + -- Ahora la linea nueva, con el item genérico + INSERT INTO vn2008.Compres + ( + Id_Entrada, + Id_Article, + Etiquetas, + Id_Cubo, + Packing, + `grouping`, + Cantidad, + Costefijo, + Portefijo, + Embalajefijo, + Comisionfija, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP + ) + SELECT + vId_Entrada, + genItemFk as Id_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP + FROM itemConversor + WHERE espItemFk = vId_Article; + + SELECT LAST_INSERT_ID() + INTO vCompra; + + REPLACE vn2008.Compres_mark(Id_Compra,`comment`) + SELECT vCompra, vId_Article; + + + FETCH rs INTO + vId_Entrada, + vId_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP; + + END WHILE; + + + CLOSE rs; + + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entryDelivered` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entryDelivered`(vDated DATE, vEntryFk INT) +BEGIN + + DECLARE vTravelFk INT; + + SELECT travelFk INTO vTravelFk + FROM vn.entry + WHERE id = vEntryFk; + + IF (SELECT COUNT(*) FROM vn.entry WHERE travelFk = vTravelFk) = 1 THEN + + UPDATE vn.travel SET shipped = LEAST(shipped, vDated), landed = vDated + WHERE id = vTravelFk; + + ELSE + + INSERT INTO vn.travel(shipped, landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived) + SELECT LEAST(shipped, vDated), vDated, warehouseInFk, warehouseOutFk, agencyFk, CONCAT(account.userGetName(),' ', vEntryFk), TRUE, TRUE + FROM vn.travel WHERE id = vTravelFk; + + SELECT LAST_INSERT_ID() INTO vTravelFk; + + UPDATE vn.entry + SET travelFk = vTravelFk + WHERE id = vEntryFk; + + 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 `entryPrepare__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entryPrepare__`(IN `idE` BIGINT) +BEGIN + SELECT + b.quantity / b.packing AS Paquetes, + b.packing AS `Grouping`, + barcode, + 'ASEGURADO' AS asegurado, + ic.name, + ic.order, + s.name AS Consignatario, + e.supplierFk AS Id_Cliente, + e.isOrdered, + e.isConfirmed, + 10 AS Calidad, + LPAD(IFNULL(cpd.id, ip.code), + 5, + '0') AS path, + b.entryFk AS Id_Ticket, + t.landed AS Fecha, + b.itemFk, + b.quantity, + i.name AS Concepte, + i.size, + i.inkFk, + i.category, + o.code AS Origen, + 0 AS Bultos, + wIn.`name` AS Tipo, + 0 AS OK, + 0 AS Reservado, + i.stems, + b.id AS Id_Movimiento, + ip.code, + 'PEDIDO ASEGURADO' AS MSG, + 0 AS Seguro, + i.image, + pr.name AS producer + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk + JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk + JOIN vn.item i ON i.id = b.itemFk + JOIN vn.itemType it ON it.id =i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.packaging pkg ON pkg.id = b.packageFk + LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk + LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN vn.supplier s ON s.id = e.supplierFk + LEFT JOIN vn.producer pr on pr.id = i.producerFk + LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway + WHERE + NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid + AND e.id = 158772 + AND i.typeFk IS NOT NULL + AND ic.display IS NOT 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 `entrySplit_move__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entrySplit_move__`() +BEGIN + + /* CREATED PAK 08/09/2019 + * PENDING REVIEW + * + * + */ + + DROP TEMPORARY TABLE IF EXISTS itemList; + + CREATE TEMPORARY TABLE itemList + SELECT DISTINCT b.itemFk, es.delayedFk, es.receivedFk + FROM vn.buy b + JOIN vn.entrySplit es ON es.delayedFk = b.entryFk + JOIN vn.itemPlacement ip ON ip.itemFk = b.itemFk + WHERE ip.modificationDate > CURDATE(); + + INSERT INTO itemList + SELECT DISTINCT ish.itemFk, es.delayedFk, es.receivedFk + FROM vn.buy b + JOIN vn.entrySplit es ON es.delayedFk = b.entryFk + JOIN vn.itemShelving ish ON ish.itemFk = b.itemFk + WHERE ish.created > CURDATE(); + + + UPDATE vn.buy b + JOIN vn.itemList il ON il.delayedFk = b.entryFk AND b.itemFk = il.itemFk + SET b.entryFk = il.receivedFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entryToTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entryToTicket`(vEntryFk INT, vTicketFk INT) +BEGIN + + INSERT INTO vn.sale(ticketFk, itemFk, concept, quantity) + SELECT vTicketFk, b.itemFk, i.longname, b.quantity + FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + WHERE b.entryFk = vEntryFk; + + CALL vn.ticket_recalcComponents(vTicketFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entryVolume__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entryVolume__`(vEntryFk INT) +BEGIN + + SELECT ELT(it.temperature + 1,'Calientes','Frios','Secos') AS Temp, + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.carro / 1000000 ,1) AS DECIMAL(10,2)) AS carros , + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.espai / 1000000,1) AS DECIMAL(10,2)) AS espais + FROM vn.buy b + INNER JOIN vn.entry e ON e.id = b.entryFk + INNER JOIN vn.travel tr ON tr.id = e.travelFk + INNER JOIN vn.volumeConfig vc + INNER JOIN vn.item i ON i.id = b.itemFk + INNER JOIN vn.itemType it ON it.id = i.typeFk + WHERE e.id = vEntryFk + GROUP BY Temp; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entryWithItem`(vShipmentWarehouse INT, vLandingWarehouse INT,vSale INT, vVolume INT, netCost DECIMAL(10,2), vInOutDate DATE) +BEGIN + + DECLARE vTravel INT; + DECLARE vEntry INT; + DECLARE vBucket VARCHAR(10); + DECLARE vSupplierFk INT; + + SET vSupplierFk = IF (vLandingWarehouse = 1, 850, 963); + -- seleccionamos travel + SELECT t.id, e.id INTO vTravel, vEntry + FROM travel t LEFT JOIN entry e ON t.id = e.travelFk + WHERE t.landed = vInOutDate AND t.shipped = vInOutDate AND t.warehouseOutFk = vShipmentWarehouse + AND t.warehouseInFk = vLandingWarehouse AND t.agencyFk IS NULL AND e.supplierFk = vSupplierFk + LIMIT 1; + + -- creamos el travel si es necesario + IF IFNULL(vTravel, FALSE) = FALSE THEN + INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk) + VALUES (vInOutDate, vInOutDate, vLandingWarehouse, vShipmentWarehouse); + SELECT LAST_INSERT_ID() INTO vTravel; + END IF; + + -- creamos la Entrada si es necesario + IF IFNULL(vEntry, FALSE) = FALSE THEN + INSERT INTO entry (supplierFk, travelFk) + VALUES (vSupplierFk, vTravel); -- proveedor 'CONFECCION ARTIFICIAL' + SELECT LAST_INSERT_ID() INTO vEntry; + END IF; + + -- creamos el cubo si es necesario + SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; + IF vBucket IS NULL THEN + INSERT INTO packaging (id, volume) + VALUES (CONCAT('dm',vVolume/1000), vVolume); + -- SELECT LAST_INSERT_ID() INTO vBucket; + SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; + END IF; + + INSERT INTO buy(itemFk,quantity, entryFk, packageFk, packing, stickers, buyingValue, price2, price3) + SELECT itemFk, + quantity, + vEntry, + vBucket, + 1 packing, + quantity, + netCost, + s.price, + s.price + FROM sale s + WHERE s.id = vSale; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entryWithItem__`(IN `vShipmentWarehouse` INT, IN `vLandingWarehouse` INT, IN `vSale` INT, IN `vVolume` INT, IN netCost DECIMAL(10,2), IN `vInOutDate` DATE) +BEGIN + + DECLARE vTravel INT; + DECLARE vEntry INT; + DECLARE vBucket VARCHAR(10); + DECLARE vAgencyDirectFromProvider INT DEFAULT 15; + DECLARE vSupplierFk INT DEFAULT 963; + + + -- seleccionamos travel + SELECT t.id, e.id INTO vTravel, vEntry + FROM travel t LEFT JOIN entry e ON t.id = e.travelFk + WHERE t.landed = vInOutDate AND t.shipped = vInOutDate AND t.warehouseOutFk = vShipmentWarehouse + AND t.warehouseInFk = vLandingWarehouse AND t.agencyFk = vAgencyDirectFromProvider AND e.supplierFk = vSupplierFk + LIMIT 1; + + -- creamos el travel si es necesario + IF IFNULL(vTravel, FALSE) = FALSE THEN + INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyFk) + VALUES (vInOutDate, vInOutDate, vLandingWarehouse, vShipmentWarehouse, vAgencyDirectFromProvider); + SELECT LAST_INSERT_ID() INTO vTravel; + END IF; + + -- creamos la Entrada si es necesario + IF IFNULL(vEntry, FALSE) = FALSE THEN + INSERT INTO entry (supplierFk, travelFk) + VALUES (vSupplierFk, vTravel); -- proveedor 'CONFECCION ARTIFICIAL' + SELECT LAST_INSERT_ID() INTO vEntry; + END IF; + + -- creamos el cubo si es necesario + SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; + IF vBucket IS NULL THEN + INSERT INTO packaging (id, volume) + VALUES (CONCAT('dm',vVolume/1000), vVolume); + -- SELECT LAST_INSERT_ID() INTO vBucket; + SELECT id INTO vBucket FROM packaging WHERE volume = vVolume LIMIT 1; + END IF; + + INSERT INTO buy(itemFk,quantity, entryFk, packageFk, packing, `grouping`, stickers, buyingValue, price2, price3) + SELECT itemFk, + quantity, + vEntry, + vBucket, + 1 packing, + 1 `grouping`, + quantity, + netCost, + s.price, + s.price + FROM sale s + WHERE s.id = vSale; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entry_clone` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `entry_clone`(vSelf INT) +BEGIN + +/* + * Clona una entrada + * + * @param vSelf Identificador de vn.entry + */ + + DECLARE vNewEntryFk INT; + + CALL vn.entry_cloneWithoutBuy(vSelf, vNewEntryFk); + + INSERT INTO vn.buy( entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + workerFk, + weight, + itemOriginalFk) + SELECT vNewEntryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + workerFk, + weight, + itemOriginalFk + FROM vn.buy b + WHERE b.entryFk = vSelf; + + SELECT vNewEntryFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entry_cloneWithoutBuy` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `entry_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT) +BEGIN + +/** + * Clona una entrada sin compras + * + * @param vSelf Identificador de vn.entry + * + * @return vNewEntryFk Identificador de la nueva entrada + */ + + START TRANSACTION; + + INSERT INTO vn.entry(supplierFk, + dated, + isInventory, + notes, + isRaid, + commission, + travelFk, + currencyFk, + companyFk, + loadPriority) + SELECT supplierFk, + dated, + isInventory, + notes, + isRaid, + commission, + travelFk, + currencyFk, + companyFk, + loadPriority + FROM vn.entry e + WHERE e.id = vSelf; + + SET vNewEntryFk = LAST_INSERT_ID(); + + 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 `entry_fixMisfit` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_fixMisfit`(vSelf INT) +BEGIN +/** + * Arregla el descuadre de una entrada, agregando registros en vn.buy + * para compensar la diferencia * entre las etiquetas impresas y las esperadas + * + * @param vSelf Identificador de la entrada + */ + INSERT INTO vn.buy(entryFk, itemFk) + SELECT vSelf, i.id + FROM vn.item i + WHERE i.description = 'MISFIT' + LIMIT 1; + + INSERT INTO vn.buy(entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + producer) + SELECT vSelf, + itemFk, + (printedStickers - stickers) * packing quantity, + buyingValue, + freightValue, + TRUE isIgnored, + printedStickers - stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + producer + FROM vn.buy b + WHERE b.entryFk = vSelf + AND b.printedStickers != b.stickers; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entry_getRate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_getRate`(vEntry INT) +BEGIN + DECLARE vLanded DATE; + DECLARE vWarehouseFk INT; + + -- Obtiene fecha de llegada y almacén entrante + + SELECT landed, warehouseInFk INTO vLanded, vWarehouseFk + FROM vn.travel t + JOIN vn.entry e ON t.id = e.travelFk + WHERE e.id = vEntry; + + -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén + + DROP TEMPORARY TABLE IF EXISTS tmp.rate; + CREATE TEMPORARY TABLE tmp.rate + ENGINE = MEMORY + SELECT * FROM + ( + SELECT * FROM + ( + SELECT rate0, rate1, rate2, rate3 + FROM vn.rate + WHERE dated <= vLanded + AND warehouseFk = vWarehouseFk + ORDER BY dated DESC + + ) sub + UNION ALL + SELECT rate0, rate1, rate2, rate3 + FROM rateConfig + ) sub2 + 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 `entry_moveNotPrinted` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_moveNotPrinted`(vSelf INT, vDays INT, vChangeEntry BOOL, OUT vNewEntryFk INT) +BEGIN +/** + * Crea una entrada a futuro y divide las lineas de vn.buy de la entrada original en función + * de las etiquetas impresas + * + * @param vSelf Identificador de vn.entry + * @param vDays Número de dias a futuro que se quiere la nueva entrada + * + * @return vNewEntryFk Identificador de la nueva entrada + */ + DECLARE vNewTravelFk INT; + DECLARE vTravelFk INT; + + SELECT travelFk INTO vTravelFk + FROM vn.entry + WHERE id = vSelf; + + CALL vn.travel_clone(vTravelFk, vDays, vNewTravelFk); + CALL vn.entry_cloneWithoutBuy(vSelf, vNewEntryFk); + + UPDATE vn.entry e + SET e.travelFk = vNewTravelFk, + e.evaNotes = CONCAT('No impresas de: ', vSelf, ' ', IFNULL(e.evaNotes,'')) + WHERE e.id = vNewEntryFk; + + IF vChangeEntry THEN + UPDATE vn.buy b + SET b.entryFk = vNewEntryFk + WHERE b.printedStickers = 0 + AND b.entryFk = vSelf; + END IF; + + INSERT INTO vn.buy( entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + workerFk, + weight, + itemOriginalFk) + SELECT vNewEntryFk, + itemFk, + ((stickers - printedStickers) * packing) quantity, + buyingValue, + freightValue, + isIgnored, + (stickers - printedStickers) stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + workerFk, + weight, + itemOriginalFk + FROM vn.buy b + WHERE b.entryFk = vSelf + AND b.printedStickers != b.stickers; + + IF vChangeEntry THEN + UPDATE vn.buy + SET stickers = printedStickers, + quantity = printedStickers * packing + WHERE entryFk = vSelf; + ELSE + INSERT INTO vn.buy(entryFk, itemFk) + SELECT vSelf, i.id + FROM vn.item i + WHERE i.description = 'MISFIT' + LIMIT 1; + + INSERT INTO vn.buy(entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + producer) + SELECT vSelf, + itemFk, + (printedStickers - stickers) * packing quantity, + buyingValue, + freightValue, + TRUE isIgnored, + printedStickers - stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + producer + FROM vn.buy + WHERE entryFk = vSelf + AND printedStickers != stickers; + 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 `entry_recalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_recalc`() +BEGIN +/** + * Comprueba que las ventas creadas entre un rango de fechas tienen componentes + * + * @param vCreatedFrom inicio del rango + * @param vCreatedTo fin del rango + */ + DECLARE v_done BOOL DEFAULT FALSE; + DECLARE vEntryFk INTEGER; + + DECLARE vCur CURSOR FOR + SELECT id FROM tmp.recalcEntryCommision; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET v_done = TRUE; + + OPEN vCur; + + l: LOOP + SET v_done = FALSE; + FETCH vCur INTO vEntryFk; + + IF v_done THEN + LEAVE l; + END IF; + + CALL vn2008.buy_tarifas_entry(vEntryFk); + END LOOP; + + CLOSE vCur; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entry_splitByShelving` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitByShelving`(vShelvingFk VARCHAR(3), vFromEntryFk INT, vToEntryFk INT) +BEGIN +/** + * Divide las compras entre dos entradas de acuerdo con lo ubicado en una matr�cula + * + * @param vShelvingFk Identificador de vn.shelving + * @param vFromEntryFk Entrada origen + * @param vToEntryFk Entrada destino + */ + DECLARE vBuyFk INT; + DECLARE ishStickers INT; + DECLARE buyStickers INT; + DECLARE vDone BOOLEAN DEFAULT FALSE; + + DECLARE cur CURSOR FOR + SELECT bb.id buyFk, + FLOOR(ish.visible / ish.packing) AS ishStickers, + bb.stickers buyStickers + FROM vn.itemShelving ish + JOIN (SELECT b.id, b.itemFk, b.stickers + FROM vn.buy b + WHERE b.entryFk = vFromEntryFk + ORDER BY b.stickers DESC) bb ON bb.itemFk = ish.itemFk + AND bb.stickers >= FLOOR(ish.visible / ish.packing) + WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci + GROUP BY ish.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + -- Cantidades de la matrícula que exceden la de las entradas + SELECT ish.itemFk, + i.longName, + FLOOR(ish.visible / ish.packing) AS etiEnMatricula, + bb.stickers etiEnEntrada + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + LEFT JOIN (SELECT b.id, b.itemFk, b.stickers + FROM vn.buy b + WHERE b.entryFk = vFromEntryFk + ORDER BY b.stickers DESC) bb ON bb.itemFk = ish.itemFk + WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci + AND IFNULL(bb.stickers,0) < FLOOR(ish.visible / ish.packing) + GROUP BY ish.id; + + OPEN cur; + + read_loop: LOOP + SET vDone = FALSE; + + FETCH cur INTO vBuyFk, ishStickers, buyStickers; + + IF vDone THEN + LEAVE read_loop; + END IF; + + IF ishStickers = buyStickers THEN + UPDATE vn.buy + SET entryFk = vToEntryFk + WHERE id = vBuyFk; + ELSE + UPDATE vn.buy + SET stickers = stickers - ishStickers, + quantity = stickers * packing + WHERE id = vBuyFk; + + INSERT INTO vn.buy(entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + workerFk, + isChecked, + isPickedOff, + ektFk, + weight, + deliveryFk, + itemOriginalFk) + SELECT + vToEntryFk, + itemFk, + ishStickers * packing, + buyingValue, + freightValue, + isIgnored, + ishStickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + ishStickers, + workerFk, + isChecked, + isPickedOff, + ektFk, + weight, + deliveryFk, + itemOriginalFk + FROM vn.buy + WHERE id = vBuyFk; + + END IF; + END LOOP; + + CLOSE cur; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `entry_splitMisfit` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitMisfit`(vSelf INT) +BEGIN + + /* Divide una entrada, pasando los registros que ha insertado vn.entry_fixMisfit de la entrada original + * a la nueva + */ + + DECLARE vNewEntryFk INT; + DECLARE vBuyFk INT; + + SELECT MAX(b.id) INTO vBuyFk + FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + WHERE b.entryFk = vSelf + AND i.description = 'MISFIT'; + + INSERT INTO vn.entry(supplierFk, dated, notes, travelFk, currencyFk, companyFk) + SELECT supplierFk, dated, CONCAT('E:',vSelf), travelFk, currencyFk, companyFk + FROM vn.entry e + WHERE e.id = vSelf; + + SET vNewEntryFk = LAST_INSERT_ID(); + + UPDATE vn.buy b + SET b.entryFk = vNewEntryFk + WHERE b.entryFk = vSelf + AND b.id > vBuyFk; + + SELECT vNewEntryFk; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `errorProduction_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_add`(vAction VARCHAR(25), vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * Fill in the errorProduction table + */ + + DECLARE vDepartment VARCHAR(255); + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.total; + DROP TEMPORARY TABLE IF EXISTS tmp.itemPickerErrors; + DROP TEMPORARY TABLE IF EXISTS tmp.errorsByClaim; + DROP TEMPORARY TABLE IF EXISTS tmp.volume; + DROP TEMPORARY TABLE IF EXISTS tmp.errorsByChecker; + + CASE + WHEN vAction = 'SACAR' THEN + SET vDepartment = 'Sacadores'; + WHEN vAction = 'ENCAJAR' THEN + SET vDepartment = 'Encajadores'; + WHEN vAction = 'CONTROLAR' THEN + SET vDepartment = 'Revisadores'; + END CASE; + + IF (vDepartment = 'Encajadores') THEN + CREATE TEMPORARY TABLE tmp.total + ENGINE = MEMORY + SELECT e.workerFk, + COUNT(DISTINCT t.id) ticketCount, + COUNT(s.id) lineCount + FROM expedition e + JOIN ticket t ON e.ticketFk = t.id + JOIN sale s ON s.ticketFk = t.id + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + GROUP BY e.workerFk; + ELSE + CREATE TEMPORARY TABLE tmp.total + ENGINE = MEMORY + SELECT st.workerFk, + COUNT(DISTINCT t.id) ticketCount, + COUNT(s.id) lineCount + FROM saleTracking st + JOIN vncontrol.accion a ON a.accion_id = st.actionFk + JOIN sale s ON s.id = st.saleFk + JOIN ticket t ON s.ticketFk = t.id + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND a.accion = vAction + GROUP BY st.workerFk; + END IF; + + CALL timeControl_calculateAll(vDatedFrom, vDatedTo); + + + CREATE TEMPORARY TABLE tmp.errorsByClaim + ENGINE = MEMORY + SELECT COUNT(c.ticketFk) errors, + cd.workerFk + FROM claimDevelopment cd + JOIN claim c ON cd.claimFk = c.id + JOIN ticket t ON c.ticketFk = t.id + JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + AND cr.description = vDepartment + GROUP BY cd.workerFk; + + CREATE TEMPORARY TABLE tmp.volume + ENGINE = MEMORY + SELECT SUM(w.volume) volume, + w.workerFk + FROM bs.workerProductivity w + WHERE w.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY w.workerFk; + + CREATE TEMPORARY TABLE tmp.errorsByChecker + ENGINE = MEMORY + SELECT sub1.workerFk, COUNT(id) errors + FROM ( + SELECT st.workerFk, + t.id + FROM saleMistake sm + JOIN saleTracking st ON sm.saleFk = st.saleFk + JOIN vncontrol.accion a ON a.accion_id = st.actionFk + JOIN sale s ON s.id = sm.saleFk + JOIN ticket t on t.id = s.ticketFk + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) + AND a.accion = vAction + GROUP BY s.ticketFk + ) sub1 + GROUP BY sub1.workerFk; + + INSERT INTO errorProduction(userFk, firstname, lastname, rol, ticketNumber, lineNumber, error, volume, hourStart, hourEnd, hourWorked, dated) + SELECT w.id, + w.firstName, + w.lastName, + vDepartment, + t.ticketCount totalTickets, + t.lineCount, + IFNULL(ec.errors,0) + IFNULL(ec2.errors,0) errors, + IF(vDepartment = 'Revisadores', NULL, v.volume) volume, + SUBSTRING(tc.timed, 1, 5) hourStart, + SUBSTRING(tc.timed, LENGTH(tc.timed)-4, 5) hourEnd, + IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) hourWorked, + vDatedFrom dated + FROM tmp.total t + LEFT JOIN worker w ON w.id = t.workerFk + LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = t.workerFk + LEFT JOIN tmp.errorsByClaim ec ON ec.workerFk = t.workerFk + LEFT JOIN tmp.volume v ON v.workerFk = t.workerFk + LEFT JOIN tmp.errorsByChecker ec2 ON ec2.workerFk = t.workerFk + GROUP BY w.id; + + IF (vDepartment = 'Sacadores') THEN + CREATE TEMPORARY TABLE tmp.itemPickerErrors -- Errores de los sacadores, derivadores de los revisadores + ENGINE = MEMORY + SELECT COUNT(c.ticketFk) errors, + tt.workerFk + FROM claimDevelopment cd + JOIN claim c ON cd.claimFk = c.id + JOIN ticket t ON c.ticketFk = t.id + JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id + JOIN ticketTracking tt ON tt.ticketFk = t.id + JOIN state s ON s.id = tt.stateFk + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + AND cr.description = 'Revisadores' + AND s.code = 'ON_PREPARATION' + GROUP BY workerFk; + + UPDATE errorProduction ep + JOIN tmp.itemPickerErrors ipe ON ipe.workerFk = ep.userFk + SET ep.error = ep.error + ipe.errors + WHERE vDatedFrom = ep.dated AND ep.rol = 'Sacadores'; + + END IF; + + DROP TEMPORARY TABLE tmp.timeControlCalculate; + DROP TEMPORARY TABLE tmp.total; + DROP TEMPORARY TABLE IF EXISTS tmp.itemPickerErrors; + DROP TEMPORARY TABLE tmp.errorsByClaim; + DROP TEMPORARY TABLE tmp.volume; + DROP TEMPORARY TABLE tmp.errorsByChecker; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `errorProduction_addLauncher` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_addLauncher`() +BEGIN + DECLARE vDatedFrom DATETIME; + DECLARE vDatedTo DATETIME; + + SELECT DATE_SUB(CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; + + CALL vn.errorProduction_add('SACAR', vDatedFrom, vDatedTo); + CALL vn.errorProduction_add('ENCAJAR', vDatedFrom, vDatedTo); + CALL vn.errorProduction_add('CONTROLAR', vDatedFrom, vDatedTo); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `errorProduction_addLauncher__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_addLauncher__`() +BEGIN + DECLARE vDatedFrom DATETIME; + DECLARE vDatedTo DATETIME; + + IF (DAY(CURDATE()) = 5) THEN + SELECT util.firstDayOfMonth(DATE_SUB(CURDATE(),INTERVAL 1 MONTH)), CONCAT(LAST_DAY(DATE_SUB(CURDATE(),INTERVAL 1 MONTH)),' 23:59:59') INTO vDatedFrom, vDatedTo; + + CALL vn.errorProduction_add('SACAR' ,'Sacadores','PREPARED', vDatedFrom, vDatedTo); + CALL vn.errorProduction_add('ENCAJAR' ,'Encajadores','PACKED', vDatedFrom, vDatedTo); + CALL vn.errorProduction_add('CONTROLAR' ,'Revisadores','CHECKED', vDatedFrom, vDatedTo); + 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 `errorProduction_add__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `errorProduction_add__`(vAction VARCHAR(25), vDepartment VARCHAR(25), vStateCode VARCHAR(25) CHARSET utf8, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + /** + * Fill in the errorProduction table. + */ + DROP TEMPORARY TABLE IF EXISTS tmp.total; + + IF (vDepartment = 'Encajadores') + THEN + CREATE TEMPORARY TABLE tmp.total + ENGINE = MEMORY + SELECT e.workerFk, Count(DISTINCT t.id) AS ticketCount + FROM expedition e + JOIN ticket t ON e.ticketFk = t.id + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + GROUP BY e.workerFk; + ELSE + CREATE TEMPORARY TABLE tmp.total + ENGINE = MEMORY + SELECT st.workerFk, Count(DISTINCT t.id) AS ticketCount + FROM state ss + JOIN vn.saleTracking st ON st.stateFk = ss.id + JOIN vn.sale s ON s.id = st.saleFk + JOIN ticket t ON s.ticketFk = t.id + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND ss.code = vStateCode + GROUP BY st.workerFk; + END IF; + + + INSERT INTO errorProduction(userFk, firstname, lastname, rol, ticketNumber, error, ratio, volume, month, year) + SELECT sub1.id, sub1.firstName, sub1.lastName, + CASE + WHEN vDepartment = 'Encajadores' THEN 'Encajador' + WHEN vDepartment = 'Sacadores' THEN 'Sacador' + ELSE 'Revisador' + END AS rol, + CAST(sub1.totalTickets AS DECIMAL(10,0)) AS totalTickets, + CAST(IFNULL(sub1.errors,0) + IFNULL(sub2.errors,0) AS DECIMAL(10,0)) AS errors, + ((IFNULL(sub1.errors,0) + IFNULL(sub2.errors,0))/sub1.totalTickets)*100 AS ratio, + IF(vDepartment = 'Revisadores', NULL, volume) AS volume, + MONTH(vDatedFrom) AS month, + YEAR(vDatedFrom) AS year + FROM( + SELECT w.id, w.code, w.firstName, w.lastName, t.ticketCount AS totalTickets, sub.errors, sub2.volume + FROM tmp.total AS t + JOIN worker w ON w.id = t.workerFk + LEFT JOIN ( + SELECT COUNT(c.ticketFk) AS errors, cd.workerFk + FROM claimDevelopment cd + JOIN claim c ON cd.claimFk = c.id + JOIN ticket t ON c.ticketFk = t.id + JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = vDepartment + GROUP BY cd.workerFk + )sub ON t.workerFk = sub.workerFk + LEFT JOIN ( -- Añadir volume + SELECT SUM(w.volume) AS volume, w.workerFk + FROM bs.workerProductivity w + INNER JOIN vn.`role` r ON r.id=w.roleFk + WHERE IF(vDepartment = 'Encajadores', r.name='packager', r.name='itemPicker') AND w.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY w.workerFk) sub2 ON w.id = sub2.workerFk + GROUP BY w.code) sub1 + LEFT JOIN( + SELECT sub1.workerFk, COUNT(id) AS errors + FROM ( + SELECT st.workerFk, t.id + FROM vn.saleMistake sm + JOIN vn.saleTracking st ON sm.saleFk = st.saleFk + JOIN state ss ON ss.id = st.stateFk + JOIN vncontrol.accion a ON a.accion_id = st.actionFk + JOIN vn.sale s ON s.id = sm.saleFk + JOIN vn.ticket t on t.id = s.ticketFk + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND a.accion = vAction AND ss.code = vStateCode + GROUP BY s.ticketFk + ) sub1 + GROUP BY sub1.workerFk) sub2 ON sub2.workerFk = sub1.id; + + DROP TEMPORARY TABLE tmp.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 `expeditionGetFromRoute` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionGetFromRoute`( + vExpeditionFk INT) +BEGIN +/** + * Get all expeditions from route + */ + DECLARE vRouteFk INT DEFAULT 0; + + SELECT t.routeFk INTO vRouteFk + FROM vn.expedition exp + INNER JOIN ticket t on t.id = exp.ticketFk + WHERE exp.id = vExpeditionFk; + +SELECT exp.id, exp.ticketFk, exp.checked, t.routeFk,t.packages AS bultos , ts.alertLevel, a.street, a.city,a.postalCode,a.id AS addressFk,w.name AS warehouse + FROM vn.expedition exp + INNER JOIN ticket t ON t.id = exp.ticketFk + INNER JOIN vn.ticketState ts ON ts.ticketFk = exp.ticketFk + LEFT JOIN vn.address a ON t.addressFk = a.id + LEFT JOIN vn.warehouse w ON t.warehouseFk = w.id + WHERE t.routeFk = vRouteFk AND exp.isBox > 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 `expeditionPallet_Del` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_Del`(vPalletFk INT) +BEGIN + + DELETE FROM vn.expeditionPallet + WHERE id = vPalletFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionPallet_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_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_List`(vTruckFk INT) +BEGIN + + SELECT ep.id Pallet, + count(DISTINCT t.routeFk) Rutas, + count(DISTINCT e.id) Eti + FROM vn.expeditionPallet ep + LEFT JOIN vn.expeditionScan es ON es.palletFk = ep.id + LEFT JOIN vn.expedition e ON e.id = es.expeditionFk + LEFT JOIN vn.ticket t ON t.id = e.ticketFk + WHERE ep.truckFk = vTruckFk + GROUP BY ep.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 `expeditionPallet_printLabel` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_printLabel`(vPalletFk INT) +BEGIN + + DECLARE vLabel INT; + DECLARE vPrinterFk INT; + + UPDATE vn.expeditionPallet + SET isPrint = FALSE + WHERE id = vPalletFk; + + SELECT s.labelReportFk, w.labelerFk INTO vLabel, vPrinterFK + FROM worker w + LEFT JOIN sector s ON s.id= w.sectorFk + WHERE w.id=account.myUser_getId() ; + + INSERT INTO printServerQueue (printerFk, labelReportFk, statusFk, param1, workerFk) + VALUES(vPrinterFK, vLabel, 1, vPalletFk, account.myUser_getId()); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `expeditionPallet_PrintSet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionPallet_PrintSet`(vPalletFk INT,vSectorFk INT) +BEGIN + + DECLARE vLabel INT; + DECLARE vPrinterFk INT; + + UPDATE vn.expeditionPallet + SET isPrint = FALSE + WHERE id = vPalletFk; + + SELECT labelReportFk + INTO vLabel + FROM sector + WHERE id=vSectorFk; + + SELECT printerFk + INTO vPrinterFk + FROM sector + WHERE id=vSectorFk; + + + INSERT INTO vn2008.Colas +(Id_Cola, Id_Impresora, Id_Prioridad, Id_Informe, Id_Estado, Hora_Inicio, Hora_Fin, Cola, Id_Trabajador, Cola2, Cola3, error) +VALUES(NULL, vPrinterFK, NULL, vLabel, 1, NULL, NULL, vPalletFk, NULL, vSectorFk, NULL, 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 `expeditionPallet_View` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `expeditionPallet_View`(vPalletFk INT) +BEGIN + + SELECT ep.id Pallet, + t.routeFk Rutas, + count(*) Cajas + FROM vn.expeditionPallet ep + LEFT JOIN vn.expeditionScan es ON es.palletFk = ep.id + LEFT JOIN vn.expedition e ON e.id = es.expeditionFk + LEFT JOIN vn.ticket t ON t.id = e.ticketFk + WHERE ep.id = vPalletFk + GROUP BY t.routeFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionScan_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Add`(vPalletFk INT, vTruckFk INT) +BEGIN + + DECLARE vTotal INT DEFAULT 0; + + IF vPalletFk = 0 THEN -- Nuevo pallet + + INSERT INTO vn.expeditionPallet(truckFk) + VALUES(vTruckFk); + + SELECT LAST_INSERT_ID() INTO vPalletFk; + + END IF; + + SELECT COUNT(expeditionFk) INTO vTotal FROM vn.expeditionScan WHERE palletFk = vPalletFk; + + IF vTotal <> 0 THEN + SELECT expeditionFk, + palletFk + FROM vn.expeditionScan + WHERE palletFk = vPalletFk; + ELSE + SELECT 0 expeditionFk,vPalletFk palletFk; + 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 `expeditionScan_Del` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Del`(vScanFk INT) +BEGIN + + DELETE FROM vn.expeditionScan + WHERE id = vScanFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionScan_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_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_List`(vPalletFk INT) +BEGIN + + SELECT es.id, + t.routeFk Ruta, + t.id Ticket, + e.counter Caja, + es.expeditionFk + FROM vn.expeditionScan es + JOIN vn.expedition e ON e.id = es.expeditionFk + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE es.palletFk = vPalletFk + ORDER BY Ruta, Ticket, Caja; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionScan_Put` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionScan_Put`(vPalletFk INT, vExpeditionFk INT) +BEGIN + + REPLACE vn.expeditionScan(expeditionFk, palletFk) + VALUES(vExpeditionFk, vPalletFk); + + SELECT LAST_INSERT_ID() INTO vPalletFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionState_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`@`localhost` PROCEDURE `expeditionState_add`(vParam INT, vStateCode VARCHAR(100)) +BEGIN + + /** + * Inserta nuevos registros en la tabla vn.expeditionState, segun el parámetro + * + * @param vParam Identificador de vn.expedition o de vn.route + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + + IF (SELECT COUNT(*) FROM vn.route r WHERE r.id = vParam) THEN + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT e.id, est.id + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.expeditionStateType est ON est.code = vStateCode + WHERE t.routeFk = vParam; + + ELSE + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT vParam, est.id + FROM vn.expeditionStateType est + WHERE est.code = vStateCode; + + 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 `expeditionState_addByAdress` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100)) +BEGIN + + /** + * Inserta nuevos registros en la tabla vn.expeditionState + * + * @param vAdressFk Identificador de vn.ticket + * @param vRouteFk Identificador de vn.route + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT e.id, est.id + FROM vn.expedition e + JOIN vn.expeditionStateType est ON est.code = vStateCode + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE t.addressFk = vAdressFk AND t.routeFk = vRouteFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionState_addByExpedition` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `expeditionState_addByExpedition`(vExpeditionFk INT, vStateCode VARCHAR(100)) +BEGIN + + /** + * Inserta nuevos registros en la tabla vn.expeditionState + * + * @param vExpeditionFk Identificador de vn.expedition + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT vExpeditionFk, est.id + FROM vn.expeditionStateType est + WHERE est.code = vStateCode; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionState_addByPallet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByPallet`(vPalletFk INT, vStateCode VARCHAR(100)) +BEGIN +/** + * Inserta nuevos registros en la tabla vn.expeditionState + * + * @param vPalletFk Identificador de vn.expedition + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + DROP TEMPORARY TABLE IF EXISTS tmp.expeditionScan; + CREATE TEMPORARY TABLE tmp.expeditionScan + SELECT expeditionFk, est.id typeFk + FROM vn.expeditionScan e + JOIN vn.expeditionStateType est ON est.code = vStateCode + WHERE e.palletFk = vPalletFk; + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT expeditionFk, typeFk + FROM tmp.expeditionScan; + + DROP TEMPORARY TABLE IF EXISTS tmp.expeditionScan; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionState_addByRoute` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100)) +BEGIN + + /** + * Inserta nuevos registros en la tabla vn.expeditionState, por rutas + * + * @param vRouteFk Identificador de vn.route + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT e.id, est.id + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.expeditionStateType est ON est.code = vStateCode + WHERE t.routeFk = vRouteFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionTruck_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_Add`(vHour VARCHAR(5), vDescription VARCHAR(45)) +BEGIN + + INSERT INTO vn.expeditionTruck(ETD,description) + VALUES(CONCAT(CURDATE(), ' ', vHour), vDescription); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionTruck_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_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionTruck_List`() +BEGIN + + SELECT id truckFk, + ETD, + description Destino + FROM vn.expeditionTruck + WHERE ETD BETWEEN CURDATE() AND util.dayend(CURDATE()) + ORDER BY ETD; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expeditionUpdateChecked` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionUpdateChecked`( + vExpeditionFk INT, vChecked INT) +BEGIN +/** + * Get all expeditions from route + */ + + UPDATE vn.expedition exp + SET exp.checked = vChecked + WHERE exp.id = vExpeditionFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expedition_getFromRoute` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getFromRoute`(vRouteFk INT) +BEGIN +/** + * Obtiene las expediciones a partir de una ruta + * @param vRouteFk Id de la ruta + */ + + SELECT e.id, + e.ticketFk, + e.checked, + t.routeFk, + ts.alertLevel, + a.street, + a.city, + a.postalCode, + t.addressFk, + a.nickname, + sub2.itemPackingTypeConcat, + est.code + FROM expedition e + JOIN ticket t ON t.id = e.ticketFk + JOIN ticketState ts ON ts.ticketFk = e.ticketFk + JOIN address a ON t.addressFk = a.id + LEFT JOIN warehouse w ON t.warehouseFk = w.id + LEFT JOIN (SELECT sub.ticketFk, + CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeConcat + FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + WHERE t.routeFk = vRouteFk + GROUP BY t.id,i.itemPackingTypeFk)sub + GROUP BY sub.ticketFk + ) sub2 ON sub2.ticketFk = t.id + LEFT JOIN expeditionStateType est ON est.id = e.stateTypeFk + WHERE t.routeFk = vRouteFk AND e.isBox <> 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 `expedition_getState` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_getState`(vExpeditionFk INT) +BEGIN + + DECLARE vTicketsPendientes INT; + DECLARE vEtiquetasTotales INT; + DECLARE vEtiquetasEscaneadas INT; + DECLARE vRouteFk INT; + + SELECT t.routeFk INTO vRouteFk + FROM vn.ticket t + JOIN vn.expedition e ON e.ticketFk = t.id + WHERE e.id = vExpeditionFk; + + SELECT COUNT(*) INTO vTicketsPendientes + FROM vn.ticket t + LEFT JOIN vn.expedition e ON e.ticketFk = t.id + WHERE t.routeFk = vRouteFk + AND ISNULL(e.id); + + SELECT COUNT(*) INTO vEtiquetasTotales + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE t.routeFk = vRouteFk; + + SELECT COUNT(*) INTO vEtiquetasEscaneadas + FROM vn.expeditionScan es + JOIN vn.expedition e ON e.id = es.expeditionFk + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE t.routeFk = vRouteFk; + + SELECT e.ticketFk ticket, + t.nickname cliente, + a.city ciudad, + p.name provincia, + z.name zonaTicket, + am.name zonaRuta, + t.routeFk ruta, + rm.beachFk ubicacion, + et.ETD , + et.description camion, + vTicketsPendientes AS ticketsPendientes, + vEtiquetasTotales AS etiquetasTotales, + vEtiquetasEscaneadas AS etiquetasEscaneadas + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.`zone`z ON z.id = t.zoneFk + LEFT JOIN vn.route r ON r.id = t.routeFk + LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + WHERE e.id = vExpeditionFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `expedition_StateGet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `expedition_StateGet`(vExpeditionFk INT) +BEGIN + + /* Devuelve una "ficha" con todos los datos relativos a la expedición + * + * param vExpeditionFk + */ + + DECLARE vTicketsPendientes INT; + DECLARE vEtiquetasTotales INT; + DECLARE vEtiquetasEscaneadas INT; + DECLARE vEtiquetasLeidasSorter INT; + DECLARE vRouteFk INT; + + SELECT t.routeFk INTO vRouteFk + FROM vn.ticket t + JOIN vn.expedition e ON e.ticketFk = t.id + WHERE e.id = vExpeditionFk; + + SELECT COUNT(*) INTO vTicketsPendientes + FROM vn.ticket t + LEFT JOIN vn.expedition e ON e.ticketFk = t.id + WHERE t.routeFk = vRouteFk + AND ISNULL(e.id); + + SELECT COUNT(*) INTO vEtiquetasTotales + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE t.routeFk = vRouteFk; + + SELECT COUNT(*) INTO vEtiquetasEscaneadas + FROM vn.expeditionScan es + JOIN vn.expedition e ON e.id = es.expeditionFk + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE t.routeFk = vRouteFk; + + SELECT COUNT(*) INTO vEtiquetasLeidasSorter + FROM srt.expedition e + JOIN vn.expedition ve ON ve.id = e.id + LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id + JOIN vn.ticket t ON t.id = ve.ticketFk + WHERE t.routeFk = vRouteFk + AND e.created != e.updated + AND ISNULL(es.expeditionFk); + + + SELECT e.ticketFk ticket, + t.nickname cliente, + a.city ciudad, + p.name provincia, + z.name zonaTicket, + am.name zonaRuta, + t.routeFk ruta, + rm.beachFk ubicacion, + et.ETD , + et.description camion, + vTicketsPendientes AS ticketsPendientes, + vEtiquetasTotales AS etiquetasTotales, + vEtiquetasEscaneadas AS etiquetasEscaneadas, + vEtiquetasLeidasSorter AS etiquetasSorter + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.`zone`z ON z.id = t.zoneFk + LEFT JOIN vn.route r ON r.id = t.routeFk + LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = r.id + LEFT JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + WHERE e.id = vExpeditionFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `faultsReview` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `faultsReview`(vWarehouseFk INT) +BEGIN + + DECLARE vCalcVisibleFk INT; + + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; + + CREATE TEMPORARY TABLE tmp.itemShelvingRadar + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT iss.itemFk, + i.size, + i.subName producer, + SUM(IF(s.sonFk, iss.visible,0)) upstairs, + SUM(IF(s.sonFk, 0, iss.visible)) downstairs, + v.visible + FROM vn.itemShelvingStock iss + JOIN vn.sector s ON s.id = iss.sectorFk + JOIN vn.item i on i.id = iss.itemFk + LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk + WHERE iss.warehouseFk = vWarehouseFk + GROUP BY iss.itemFk; + + SELECT ishr.*, sub.longName, + CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho, + CAST(sub.fault AS DECIMAL(10,0)) as faltas + FROM tmp.itemShelvingRadar ishr + JOIN (SELECT s.itemFk, s.quantity as fault, s.concept as longName + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.client c ON c.id = t.clientFk + WHERE c.typeFk = 'loses' COLLATE utf8_unicode_ci + AND s.isPicked = FALSE + AND date(t.shipped) = CURDATE() + AND t.warehouseFk = vWarehouseFk + ) sub ON sub.itemFk = ishr.itemFk + ; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `faultsReview_isChecked` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `faultsReview_isChecked`(vItemFk INT, vWarehouseFk INT) +BEGIN + + UPDATE vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.client c ON c.id = t.clientFk + SET s.isPicked = TRUE + WHERE c.typeFk = 'loses' COLLATE utf8_unicode_ci + AND date(t.shipped) = CURDATE() + AND t.warehouseFk = vWarehouseFk + AND s.itemFk = vItemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `freelance_getInfo` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `freelance_getInfo`(workerFk INT) +BEGIN + SELECT s.name, s.street, s.city, s.nif, s.postCode + FROM route r + JOIN agencyMode am ON r.agencyModeFk = am.id + JOIN agency a ON am.agencyFk = a.id + JOIN supplier s ON a.supplierFk = s.id + WHERE r.workerFk = workerFk + ORDER BY r.id DESC + 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 `fustControl` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControl`(vFromDated DATE, vToDated DATE) +BEGIN + + DECLARE vSijsnerClientFk INT DEFAULT 19752; + + DECLARE vDateStart DATETIME; + DECLARE vDateEnd DATETIME; + + SET vDateStart = vFromDated; + SET vDateEnd = util.Dayend(vToDated); + + SELECT p.id FustCode, + CAST(sent.stucks AS DECIMAL(10,0)) FH, + CAST(tp.stucks AS DECIMAL(10,0)) Tickets, + CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner, + CAST(IFNULL(sent.stucks,0) - IFNULL(tp.stucks,0) + IFNULL(sj.stucks,0) AS DECIMAL(10,0)) saldo + FROM vn.packaging p + LEFT JOIN ( + SELECT FustCode, sum(fustQuantity) stucks + FROM ( + SELECT IFNULL(pe.equivalentFk ,b.packageFk) FustCode, s.quantity / b.packing AS fustQuantity + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk + JOIN vn.buy b ON b.id = lb.buy_id + JOIN vn.packaging p ON p.id = b.packageFk + LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk + WHERE t.shipped BETWEEN vDateStart AND vDateEnd + AND wa.name = 'VNH' + AND p.isPackageReturnable + AND c.country = 'FRANCIA') sub + GROUP BY FustCode) sent ON sent.FustCode = p.id + LEFT JOIN ( + SELECT FustCode, sum(quantity) stucks + FROM ( + SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk + LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk + WHERE t.shipped BETWEEN vDateStart AND vDateEnd + AND wa.name = 'VNH' + AND p.isPackageReturnable + AND c.country = 'FRANCIA' + AND t.clientFk != vSijsnerClientFk + AND tp.quantity > 0) sub + GROUP BY FustCode) tp ON tp.FustCode = p.id + LEFT JOIN ( + SELECT FustCode, sum(quantity) stucks + FROM ( + SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk + LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id + WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, 1, vDateStart ) AND TIMESTAMPADD(DAY, 1, vDateEnd ) + AND wa.name = 'VNH' + AND p.isPackageReturnable + AND t.clientFk = vSijsnerClientFk) sub + GROUP BY FustCode) sj ON sj.FustCode = p.id + WHERE sent.stucks + OR tp.stucks + OR sj.stucks; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `fustControlDetail` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControlDetail`(vFromDated DATE, vToDated DATE) +BEGIN + + DECLARE vSijsnerClientFk INT DEFAULT 19752; + + DECLARE vDateStart DATETIME; + DECLARE vDateEnd DATETIME; + + SET vDateStart = vFromDated; + SET vDateEnd = util.Dayend(vToDated); + + SELECT a.nickname shopName, + a.city , + IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, + tp.quantity, + tp.ticketFk, + CONCAT('From ', vFromDated,' to ', vToDated) AS dateRange + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk + LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk + WHERE t.shipped BETWEEN vFromDated AND util.dayend(vToDated) + AND wa.name = 'VNH' + AND p.isPackageReturnable + AND c.country = 'FRANCIA' + AND t.clientFk != vSijsnerClientFk + AND tp.quantity > 0; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `fv_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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `fv_pca`() +BEGIN + +DECLARE done INT DEFAULT FALSE; + +DECLARE vTicketFk INT; +DECLARE vSaleFk INT; +DECLARE vClonTicket INT DEFAULT 0; + +DECLARE cur1 CURSOR FOR +SELECT s.ticketFk, s.id + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + WHERE t.shipped BETWEEN '2020-10-18' AND '2020-10-31' + AND it.code IN ('ANT','ANS','ORQ','TRO') + and t.warehouseFk = 1; + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + +OPEN cur1; + +FETCH cur1 INTO vTicketFk, vSaleFk; + + WHILE done = 0 DO + + SELECT t.id INTO vClonTicket + FROM vn.ticket t + JOIN (SELECT addressFk, shipped FROM vn.ticket WHERE id = vTicketFk) sub USING(addressFk, shipped) + WHERE t.warehouseFk = 44 + LIMIT 1; + + SELECT vTicketFk, vClonTicket; + + IF vClonTicket = 0 THEN + + INSERT INTO ticket ( + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk + ) + SELECT + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + 44, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk + + FROM ticket + WHERE id = vTicketFk; + + SET vClonTicket = LAST_INSERT_ID(); + + SELECT 'lstID', vClonTicket; + /* + INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) + SELECT vTicketFk, ao.observationTypeFk, ao.description + FROM addressObservation ao + JOIN ticket t ON t.addressFk = ao.addressFk + WHERE t.id = vClonTicket; +*/ + INSERT INTO ticketLog + SET originFk = vTicketFk, userFk = account.myUser_getId(), `action` = 'insert', + description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk); + + END IF; + + UPDATE vn.sale + SET ticketFk = vClonTicket + WHERE id = vSaleFk; + + SET vClonTicket = 0; + + SET done = 0; + FETCH cur1 INTO vTicketFk, vSaleFk; + + END WHILE; + + CLOSE cur1; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getDayExpeditions` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `getDayExpeditions`() +BEGIN + + SELECT + e.expeditions_id as expeditionFk, + date_format(e.odbc_date,'%Y-%m-%d') as expeditionDate, + e.ticket_id as ticketFk, + t.routeFk as routeFk + FROM vn2008.expeditions e + INNER JOIN vn.ticket t ON t.id = e.ticket_id + WHERE DATE(odbc_date) = 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 `getDeliveryWorkers` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `getDeliveryWorkers`() +BEGIN +SELECT w.id, + concat(p.firstname," ",p.name) AS fullName, + w.code AS workerCode, + pwc.name, + rl.routeFk as routeLoader + FROM postgresql.person AS p + LEFT JOIN vn.worker AS w ON p.id_trabajador=w.id + LEFT JOIN (SELECT MIN(profile_id) AS pid, person_id FROM postgresql.profile GROUP BY person_id) AS pp ON p.person_id=pp.person_id + LEFT JOIN vn2008.profile_labour_payroll AS plp ON pp.pid=plp.profile_id + LEFT JOIN (SELECT MAX(business_id) AS bimax, client_id FROM postgresql.business GROUP BY client_id) AS pbv ON pbv.client_id = plp.profile_id + LEFT JOIN postgresql.business_labour AS pbl ON pbl.business_id = pbv.bimax + LEFT JOIN vn.department AS pd ON pd.id = pbl.department_id + LEFT JOIN postgresql.workcenter AS pwc ON pwc.workcenter_id=pbl.workcenter_id + LEFT JOIN vn.user u ON u.id=w.userFK + LEFT JOIN vn.routeLoadWorker rl ON rl.workerFk = w.id + WHERE p.id_trabajador Is Not Null + AND pd.name='REPARTO' + AND u.active<>0 + ORDER BY pwc.name ASC,p.firstname ASC; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getInfoDelivery` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `getInfoDelivery`(vRouteFk INT) +BEGIN + SELECT s.name, s.street, s.city, s.nif, s.postCode FROM vn.route r + JOIN vn.agencyMode am ON r.agencyModeFk = am.id + JOIN vn.agency a ON am.agencyFk = a.id + JOIN vn.supplier s ON a.supplierFk = s.id + WHERE r.id = vRouteFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getItemUbication` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `getItemUbication`(vItemFk VARCHAR(22)) +BEGIN + + /* + * @deprecated Utilizar itemShelving_getInfo + * + */ + + CALL itemshelving_getInfo(vItemFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getItemVisibleAvailable__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `getItemVisibleAvailable__`( + vItem INT, + vDate DATE, + vWarehouse TINYINT, + vRefresh BOOL) +BEGIN + -- DEPRECADO - UTILIZAR vn.item_getVisibleAvailable() - JSB - 2019-11-20 + CALL item_getVisibleAvailable(vItem, vDate, vWarehouse, vRefresh); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `getPedidosInternos` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `getPedidosInternos`() +BEGIN + + SELECT id,name as description,upToDown as quantity FROM vn.item WHERE upToDown; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `intrastat_data_neto_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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `intrastat_data_neto_Update`(IN vInvoiceInFk INT) +BEGIN + + UPDATE vn2008.intrastat_data id + JOIN ( + SELECT i.intrastatFk, + LEAST(SUM(b.quantity) * IFNULL(it.gramsMax,100000) / 1000, + SUM(ic.cm3 * b.quantity) * IF(i.density, i.density, it.density) / 1000000) as neto + FROM entry e + JOIN travel tr ON tr.id = e.travelFk + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + join itemType it ON it.id = i.typeFk + JOIN itemCost ic ON ic.itemFk = i.id AND tr.warehouseInFk = ic.warehouseFk + WHERE e.invoiceInFk = vinvoiceInFk + GROUP BY i.intrastatFk) sub ON sub.intrastatFk = id.intrastat_id + SET id.neto = ROUND(sub.neto, 1) + WHERE id.recibida_id = vInvoiceInFk; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `inventoryFailureAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryFailureAdd`() +BEGIN + +DECLARE done BOOL DEFAULT FALSE; +DECLARE vTicketFk INT; + +DECLARE rs CURSOR FOR + SELECT id FROM vn.ticket + WHERE shipped = util.yesterday() + AND clientFk = 400 + AND warehouseFk IN (1,44); + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + +OPEN rs; + +FETCH rs INTO vTicketFk; + +WHILE NOT done DO + + INSERT INTO vn.inventoryFailure(dated, itemFk, quantity, value, warehouseFk, throwerFk) + SELECT t.shipped, + s.itemFk, + s.quantity, + b.buyingValue + b.freightValue + b.packageValue + b.comissionValue, + t.warehouseFk, + w.id + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + LEFT JOIN cache.last_buy lb ON lb.warehouse_id = t.warehouseFk AND item_id = s.itemFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN vn.worker w ON w.code = LEFT(s.concept, 3) + WHERE t.id = vTicketFk + AND s.quantity > 0; + + FETCH rs INTO vTicketFk; + +END WHILE; + + +CLOSE rs; + + + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `inventoryMake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake`(vDate DATE, vWh INT) +proc: BEGIN +/** + * Recalcula los inventarios de todos los almacenes, si vWh = 0 + * + * @param vDate Fecha de los nuevos inventarios + * @param vWh almacen al cual hacer el inventario + */ + + DECLARE vDone BOOL; + DECLARE vEntryFk INT; + DECLARE vTravelFk INT; + DECLARE vDateLastInventory DATE; + DECLARE vDateYesterday DATETIME DEFAULT TIMESTAMPADD(SECOND,-1,vDate); + + DECLARE cWarehouses CURSOR FOR + SELECT id + FROM warehouse + WHERE isInventory AND vWh IN (0,id); + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + SELECT vDateYesterday; + + OPEN cWarehouses; + SET @isModeInventory := TRUE; + l: LOOP + + SET vDone = FALSE; + FETCH cWarehouses INTO vWh; + + IF vDone THEN + LEAVE l; + END IF; + + SELECT MAX(landed) INTO vDateLastInventory + FROM travel tr + JOIN entry e ON e.travelFk = tr.id + JOIN buy b ON b.entryFk = e.id + WHERE warehouseOutFk = 13 + AND landed < vDate + AND e.supplierFk = 4 + AND warehouseInFk = vWh + AND NOT isRaid; + + IF vDateLastInventory IS NULL THEN + SELECT inventoried INTO vDateLastInventory FROM config; + END IF; + + -- Generamos travel, si no existe. + SET vTravelFK = 0; + + SELECT id INTO vTravelFk + FROM travel + WHERE warehouseOutFk = 13 + AND warehouseInFk = vWh + AND landed = vDate + AND agencyFk = 53 + AND ref = 'inventario' + LIMIT 1; + + IF NOT vTravelFK THEN + + INSERT INTO travel SET + warehouseOutFk = 13, + warehouseInFk = vWh, + shipped = vDate, + landed = vDate, + agencyFk = 53, + ref = 'inventario', + isDelivered = TRUE, + isReceived = TRUE; + + SELECT LAST_INSERT_ID() INTO vTravelFk; + + END IF; + + -- Generamos entrada si no existe, o la vaciamos. + SET vEntryFk = 0; + + SELECT id INTO vEntryFk + FROM entry + WHERE supplierFk = 4 + AND travelFk = vTravelFk; + + IF NOT vEntryFk THEN + + INSERT INTO entry SET + supplierFk = 4, + isConfirmed = TRUE, + isOrdered = TRUE, + travelFk = vTravelFk; + + SELECT LAST_INSERT_ID() INTO vEntryFk; + + ELSE + + DELETE FROM buy WHERE entryFk = vEntryFk; + + END IF; + + -- Preparamos tabla auxilar + DROP TEMPORARY TABLE IF EXISTS tmp.inventory; + + CREATE TEMPORARY TABLE tmp.inventory + ( + itemFk INT(11) NOT NULL PRIMARY KEY, + quantity int(11) DEFAULT '0', + buyingValue decimal(10,3) DEFAULT '0.000', + freightValue decimal(10,3) DEFAULT '0.000', + packing int(11) DEFAULT '0', + `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', + groupingMode tinyint(4) NOT NULL DEFAULT 0 , + comissionValue decimal(10,3) DEFAULT '0.000', + packageValue decimal(10,3) DEFAULT '0.000', + packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', + price1 decimal(10,2) DEFAULT '0.00', + price2 decimal(10,2) DEFAULT '0.00', + price3 decimal(10,2) DEFAULT '0.00', + minPrice decimal(10,2) DEFAULT '0.00', + producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + INDEX (itemFK)) + ENGINE = MEMORY ; + + -- Compras + INSERT INTO tmp.inventory(itemFk,quantity) + SELECT b.itemFk, sum(b.quantity) + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + WHERE tr.warehouseInFk = vWh + AND tr.landed BETWEEN vDateLastInventory + AND vDateYesterday + AND NOT isRaid + GROUP BY b.itemFk; + SELECT vDateLastInventory , vDateYesterday; + -- Traslados + INSERT INTO tmp.inventory(itemFk,quantity) + SELECT itemFk, quantityOut + FROM ( + SELECT b.itemFk, -sum(b.quantity) quantityOut + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + WHERE tr.warehouseOutFk = vWh + AND tr.shipped BETWEEN vDateLastInventory + AND vDateYesterday + AND NOT isRaid + GROUP BY b.itemFk + ) sub + ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.quantityOut; + + -- Ventas + INSERT INTO tmp.inventory(itemFk,quantity) + SELECT itemFk, saleOut + FROM ( + SELECT s.itemFk, -sum(s.quantity) saleOut + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + WHERE t.warehouseFk = vWh + AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday + GROUP BY s.itemFk + ) sub + ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; + + -- Actualiza valores de la ultima compra + + UPDATE tmp.inventory inv + JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh + JOIN buy b ON b.id = lb.buy_id + SET + inv.buyingValue = b.buyingValue, + inv.freightValue = b.freightValue, + inv.packing = b.packing, + inv.`grouping` = b.`grouping`, + inv.groupingMode = b.groupingMode, + inv.comissionValue = b.comissionValue, + inv.packageValue = b.packageValue, + inv.packageFk = b.packageFk, + inv.price1 = b.price1, + inv.price2 = b.price2, + inv.price3 = b.price3, + inv.minPrice = b.minPrice, + inv.producer = b.producer; + + + INSERT INTO buy( itemFk, + quantity, + buyingValue, + freightValue, + packing, + `grouping`, + groupingMode, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + entryFk) + SELECT itemFk, + GREATEST(quantity,0), + buyingValue, + freightValue, + packing, + `grouping`, + groupingMode, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + vEntryFk + FROM tmp.inventory; + + SELECT vWh, count(*), NOW() FROM tmp.inventory; + + -- DROP TEMPORARY TABLE tmp.inventory; + + END LOOP; + + CLOSE cWarehouses; + + UPDATE config SET inventoried = vDate; + SET @isModeInventory := FALSE; + + DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete; + CREATE TEMPORARY TABLE tmp.entryToDelete + (INDEX(entryId) USING BTREE) ENGINE = MEMORY + SELECT e.id as entryId, + t.id as travelId + FROM vn.travel t + JOIN vn.entry e ON e.travelFk = t.id + WHERE e.supplierFk = 4 + AND t.shipped <= TIMESTAMPADD(DAY, -2, TIMESTAMPADD(DAY, -10, CURDATE())) + AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, CURDATE())); + + DELETE e + FROM vn.entry e + JOIN tmp.entryToDelete tmp ON tmp.entryId = e.id; + + DELETE IGNORE t + FROM vn.travel t + JOIN tmp.entryToDelete tmp ON tmp.travelId = 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 `inventoryMakeLauncher` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMakeLauncher`() +BEGIN +/** + * Recalcula los inventarios de todos los almacenes. + */ + + call vn.inventoryMake(TIMESTAMPADD(DAY, -10, CURDATE()), 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 `inventoryMake__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `inventoryMake__`(vDate DATE, vWh INT) +proc: BEGIN +/** + * bernat WORKING IN THIS FILE + * Recalcula los inventarios de todos los almacenes, si vWh = 0 + * + * @param vDate Fecha de los nuevos inventarios + */ + + DECLARE vDone BOOL; + DECLARE vEntryFk INT; + DECLARE vTravelFk INT; + DECLARE vDateTime DATETIME DEFAULT TIMESTAMP(vDate, '00:00:00'); + DECLARE vDeleteDate DATE DEFAULT TIMESTAMPADD(DAY, -2, vDate); + DECLARE vDateLastInventory DATE; + DECLARE vDateYesterday DATETIME DEFAULT TIMESTAMPADD(SECOND,-1,vDate); + + DECLARE cWarehouses CURSOR FOR + SELECT id FROM vn.warehouse WHERE isInventory AND vWh IN (0,id); + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + SELECT vDateYesterday; + + OPEN cWarehouses; + SET @isModeInventory := TRUE; + l: LOOP + + SET vDone = FALSE; + FETCH cWarehouses INTO vWh; + + IF vDone THEN + LEAVE l; + END IF; + + SELECT MAX(landed) INTO vDateLastInventory + FROM vn.travel tr + JOIN vn.entry e ON e.travelFk = tr.id + JOIN vn.buy b ON b.entryFk = e.id + WHERE warehouseOutFk = 13 + AND landed < vDate + AND e.supplierFk = 4 + AND warehouseInFk = vWh + AND NOT isRaid; + + -- Generamos travel, si no existe. + SET vTravelFK = 0; + + SELECT id INTO vTravelFk + FROM vn.travel + WHERE warehouseOutFk = 13 + AND warehouseInFk = vWh + AND landed = vDate + AND agencyFk = 53 + AND ref = 'inventario' + LIMIT 1; + + IF NOT vTravelFK THEN + + INSERT INTO vn.travel SET + warehouseOutFk = 13, + warehouseInFk = vWh, + shipped = vDateTime, + landed = vDate, + agencyFk = 53, + ref = 'inventario', + isDelivered = TRUE, + isReceived = TRUE; + + SELECT LAST_INSERT_ID() INTO vTravelFk; + + END IF; + + -- Generamos entrada si no existe, o la vaciamos. + SET vEntryFk = 0; + + SELECT id INTO vEntryFk + FROM vn.entry + WHERE supplierFk = 4 + AND travelFk = vTravelFk; + + IF NOT vEntryFk THEN + + INSERT INTO entry SET + supplierFk = 4, + isConfirmed = TRUE, + isOrdered = TRUE, + travelFk = vTravelFk; + + SELECT LAST_INSERT_ID() INTO vEntryFk; + + ELSE + + DELETE FROM vn.buy WHERE entryFk = vEntryFk; + + END IF; + + -- Preparamos tabla auxilar + DROP TEMPORARY TABLE IF EXISTS tmp.inventory; + + CREATE TEMPORARY TABLE tmp.inventory + ( + itemFk INT(11) NOT NULL PRIMARY KEY, + quantity int(11) DEFAULT '0', + buyingValue decimal(10,3) DEFAULT '0.000', + freightValue decimal(10,3) DEFAULT '0.000', + packing int(11) DEFAULT '0', + `grouping` smallint(5) unsigned NOT NULL DEFAULT '1', + groupingMode tinyint(4) NOT NULL DEFAULT 0 , + comissionValue decimal(10,3) DEFAULT '0.000', + packageValue decimal(10,3) DEFAULT '0.000', + packageFk varchar(10) COLLATE utf8_unicode_ci DEFAULT '--', + price1 decimal(10,2) DEFAULT '0.00', + price2 decimal(10,2) DEFAULT '0.00', + price3 decimal(10,2) DEFAULT '0.00', + minPrice decimal(10,2) DEFAULT '0.00', + producer varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + INDEX (itemFK)) + ENGINE = MEMORY ; + + -- Compras + INSERT INTO tmp.inventory(itemFk,quantity) + SELECT b.itemFk, sum(b.quantity) + FROM vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.travel tr ON tr.id = e.travelFk + WHERE tr.warehouseInFk = vWh + AND tr.landed BETWEEN vDateLastInventory + AND vDateYesterday + AND NOT isRaid + GROUP BY b.itemFk; + SELECT vDateLastInventory , vDateYesterday; + -- Traslados + INSERT INTO tmp.inventory(itemFk,quantity) + SELECT itemFk, quantityOut + FROM ( + SELECT b.itemFk, -sum(b.quantity) quantityOut + FROM vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.travel tr ON tr.id = e.travelFk + WHERE tr.warehouseOutFk = vWh + AND tr.shipped BETWEEN vDateLastInventory + AND vDateYesterday + AND NOT isRaid + GROUP BY b.itemFk + ) sub + ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.quantityOut; + + -- Ventas + INSERT INTO tmp.inventory(itemFk,quantity) + SELECT itemFk, saleOut + FROM ( + SELECT s.itemFk, -sum(s.quantity) saleOut + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + WHERE t.warehouseFk = vWh + AND t.shipped BETWEEN vDateLastInventory AND vDateYesterday + GROUP BY s.itemFk + ) sub + ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity,0) + sub.saleOut; + + -- Actualiza valores de la ultima compra + + UPDATE tmp.inventory inv + JOIN cache.last_buy lb ON lb.item_id = inv.itemFk AND lb.warehouse_id = vWh + JOIN vn.buy b ON b.id = lb.buy_id + SET + inv.buyingValue = b.buyingValue, + inv.freightValue = b.freightValue, + inv.packing = b.packing, + inv.`grouping` = b.`grouping`, + inv.groupingMode = b.groupingMode, + inv.comissionValue = b.comissionValue, + inv.packageValue = b.packageValue, + inv.packageFk = b.packageFk, + inv.price1 = b.price1, + inv.price2 = b.price2, + inv.price3 = b.price3, + inv.minPrice = b.minPrice, + inv.producer = b.producer; + + + INSERT INTO vn.buy( itemFk, + quantity, + buyingValue, + freightValue, + packing, + `grouping`, + groupingMode, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + entryFk) + SELECT itemFk, + quantity, + buyingValue, + freightValue, + packing, + `grouping`, + groupingMode, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + vEntryFk + FROM tmp.inventory; + + SELECT vWh, count(*), NOW() FROM tmp.inventory; + + -- DROP TEMPORARY TABLE tmp.inventory; + + END LOOP; + + CLOSE cWarehouses; + + UPDATE vn2008.tblContadores SET FechaInventario = vDate; + SET @isModeInventory := FALSE; + + DELETE e, t + FROM vn.travel t + JOIN vn.entry e ON e.travelFk = t.id + WHERE e.supplierFk = 4 + AND t.shipped <= vDeleteDate + AND (DAY(t.shipped) <> 1 OR shipped < TIMESTAMPADD(MONTH, -12, 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 `inventory_repair` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `inventory_repair`() +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.lastEntry; + CREATE TEMPORARY TABLE tmp.lastEntry + (PRIMARY KEY (buyFk)) + SELECT + i.id AS itemFk, + w.id AS warehouseFk, + w.name AS warehouse, + tr.landed, + b.id AS buyFk, + b.entryFk, + b.isIgnored, + b.price2, + b.price3, + b.stickers, + b.packing, + b.grouping, + b.groupingMode, + b.weight, + i.stems, + b.quantity, + b.buyingValue, + b.packageFk , + s.id AS supplierFk, + s.name AS supplier + FROM itemType it + RIGHT JOIN (entry e + LEFT JOIN supplier s ON s.id = e.supplierFk + RIGHT JOIN buy b ON b.entryFk = e.id + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN ink ON ink.id = i.inkFk + LEFT JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN warehouse w ON w.id = tr.warehouseInFk + LEFT JOIN origin o ON o.id = i.originFk + ) ON it.id = i.typeFk + LEFT JOIN edi.ekt ek ON b.ektFk = ek.id + WHERE (b.packageFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,CURDATE())) AND s.name = 'INVENTARIO'; + + DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk; + CREATE TEMPORARY TABLE tmp.lastEntryOk + (PRIMARY KEY (buyFk)) + SELECT + i.id AS itemFk, + w.id AS warehouseFk, + w.name AS warehouse, + tr.landed, + b.id AS buyFk, + b.entryFk, + b.isIgnored, + b.price2, + b.price3, + b.stickers, + b.packing, + b.grouping, + b.groupingMode, + b.weight, + i.stems, + b.quantity, + b.buyingValue, + b.packageFk , + s.id AS supplierFk, + s.name AS supplier + FROM itemType it + RIGHT JOIN (entry e + LEFT JOIN supplier s ON s.id = e.supplierFk + RIGHT JOIN buy b ON b.entryFk = e.id + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN ink ON ink.id = i.inkFk + LEFT JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN warehouse w ON w.id = tr.warehouseInFk + LEFT JOIN origin o ON o.id = i.originFk + ) ON it.id = i.typeFk + LEFT JOIN edi.ekt ek ON b.ektFk = ek.id + WHERE b.packageFk != "--" AND b.price2 != 0 AND b.packing != 0 AND b.buyingValue > 0 AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-2,CURDATE())) + ORDER BY tr.landed DESC; + + DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOkGroup; + CREATE TEMPORARY TABLE tmp.lastEntryOkGroup + (INDEX (warehouseFk,itemFk)) + SELECT * + FROM tmp.lastEntryOk tmp + GROUP BY tmp.itemFk,tmp.warehouseFk; + + UPDATE buy b + JOIN tmp.lastEntry lt ON lt.buyFk = b.id + JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk + SET b.packageFk = eo.packageFk WHERE b.packageFk = "--"; + + UPDATE buy b + JOIN tmp.lastEntry lt ON lt.buyFk = b.id + JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk + SET b.price2 = eo.price2 WHERE b.price2 = 0 ; + + UPDATE buy b + JOIN tmp.lastEntry lt ON lt.buyFk = b.id + JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk + SET b.packing = eo.packing WHERE b.packing = 0; + + UPDATE buy b + JOIN tmp.lastEntry lt ON lt.buyFk = b.id + JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk + SET b.buyingValue = eo.buyingValue WHERE b.buyingValue = 0; + + DROP TEMPORARY TABLE tmp.lastEntry; + DROP TEMPORARY TABLE tmp.lastEntryOk; + DROP TEMPORARY TABLE tmp.lastEntryOkGroup; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceExpenceMake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceExpenceMake`(IN vInvoice INT) +BEGIN +/* Inserta las partidas de gasto correspondientes a la factura + * REQUIERE tabla ticketToInvoice + * @param vInvoice Numero de factura + */ + DELETE FROM invoiceOutExpence + WHERE invoiceOutFk = vInvoice; + + INSERT INTO invoiceOutExpence(invoiceOutFk, expenceFk, amount) + SELECT vInvoice, + expenceFk, + SUM(ROUND(quantity * price * (100 - discount)/100,2)) amount + FROM ticketToInvoice t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + GROUP BY i.expenceFk + HAVING amount != 0; + + INSERT INTO invoiceOutExpence(invoiceOutFk, expenceFk, amount) + SELECT vInvoice, + tst.expenceFk, + SUM(ROUND(ts.quantity * ts.price ,2)) amount + FROM ticketToInvoice t + JOIN ticketService ts ON ts.ticketFk = t.id + JOIN ticketServiceType tst ON tst.id = ts.ticketServiceTypeFk + HAVING 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 `invoiceExpenceMake__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceExpenceMake__`(IN vInvoice INT) +BEGIN +/* Inserta las partidas de gasto correspondientes a la factura + * REQUIERE tabla ticketToInvoice + * + * @param vInvoice Numero de factura + * + */ + DELETE FROM invoiceOutExpence + WHERE invoiceOutFk = vInvoice; + + INSERT INTO invoiceOutExpence( + invoiceOutFk, + expenceFk, + amount + ) + SELECT + vInvoice, + expenceFk, + SUM(ROUND(quantity * price * (100 - discount)/100,2)) amount + FROM ticketToInvoice t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + GROUP BY i.expenceFk + HAVING 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 `invoiceFromAddress` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromAddress`(vMaxTicketDate DATETIME,vAddress INT,vCompany INT) +BEGIN + + DECLARE vMinDateTicket DATE DEFAULT TIMESTAMPADD(MONTH, -3, CURDATE()); + + SET vMaxTicketDate = vn2008.DAYEND(vMaxTicketDate); + + DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; + + CREATE TEMPORARY TABLE `ticketToInvoice` + (PRIMARY KEY (`id`)) + ENGINE = MEMORY + SELECT Id_Ticket id FROM vn2008.Tickets WHERE (Fecha BETWEEN vMinDateTicket + AND vMaxTicketDate) AND Id_Consigna = vAddress + AND Factura IS NULL AND empresa_id = vCompany; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceFromClient` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromClient`(IN vMaxTicketDate datetime, IN vClientFk INT, IN vCompanyFk INT) +BEGIN + DECLARE vMinTicketDate DATE DEFAULT TIMESTAMPADD(YEAR, -3, CURDATE()); + SET vMaxTicketDate = util.dayend(vMaxTicketDate); + + DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; + CREATE TEMPORARY TABLE `ticketToInvoice` + (PRIMARY KEY (`id`)) + ENGINE = MEMORY + SELECT id FROM ticket t + WHERE t.clientFk = vClientFk + AND t.refFk IS NULL + AND t.companyFk = vCompanyFk + AND (t.shipped BETWEEN vMinTicketDate AND vMaxTicketDate); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceFromTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceFromTicket`(IN vTicket INT) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS `ticketToInvoice`; + + CREATE TEMPORARY TABLE `ticketToInvoice` + (PRIMARY KEY (`id`)) + ENGINE = MEMORY + SELECT id FROM vn.ticket + WHERE id = vTicket AND refFk 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 `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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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),':',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 `invoiceInBookingMain` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `invoiceInBookingMain`(vInvoiceInId INT) +BEGIN + 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' AND ti.Iva <> 'HP DEVENGADO 21 ISP', 1 +(ti.PorcentajeIva/100),1)), + SUM(iit.foreignValue * IF( i.serial= 'R', 1 + (ti.PorcentajeIva/100),1)), + iit.taxableBase/iit.foreignValue + INTO vTotalAmount, vTotalAmountDivisa, vRate + FROM newInvoiceIn i + JOIN invoiceInTax iit ON iit.invoiceInFk = i.id + LEFT JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk; + + CALL vn.ledger_next(vBookNumber); + + -- Apunte del proveedor + + INSERT INTO XDiario(ASIEN, + FECHA, + SUBCTA, + EUROHABER, + CONCEPTO, + CAMBIO, + HABERME, + NFACTICK, + CLAVE, + empresa_id + ) + SELECT + vBookNumber, + n.bookEntried, + s.supplierAccount, + vTotalAmount EUROHABER, + n.conceptWithSupplier, + vRate, + vTotalAmountDivisa, + n.invoicesCount, + vInvoiceInId, + n.companyFk + FROM newInvoiceIn n + JOIN newSupplier s; + + -- Línea de Gastos + INSERT INTO XDiario ( ASIEN, + FECHA, + SUBCTA, + CONTRA, + EURODEBE, + EUROHABER, + CONCEPTO, + CAMBIO, + DEBEME, + HABERME, + 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 AND iit.taxableBase < 0, NULL, ROUND(SUM(iit.taxableBase),2)) EURODEBE, + IF(e.isWithheld AND iit.taxableBase < 0,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 (SELECT * FROM expence e GROUP BY e.id)e ON e.id = iit.expenceFk + WHERE e.name != 'Suplidos Transitarios nacionales' + GROUP BY iit.expenceFk; + + -- Líneas de IVA + + INSERT INTO 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, + IF(n.expenceFkDeductible>0, n.expenceFkDeductible, ti.CuentaIvaSoportado) SUBCTA, + s.supplierAccount CONTRA, + SUM(ROUND(ti.PorcentajeIva * it.taxableBase / 100 /* + 0.0001*/ , 2)) EURODEBE, + SUM(it.taxableBase) BASEEURO, + GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, + vSerialNumber FACTURA, + ti.PorcentajeIva IVA, + IF(isUeeMember AND eWithheld.id IS NULL,'','*') AUXILIAR, + n.serial SERIE, + ttr.ClaveOperacionDefecto, + 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 sage.TiposIva ti ON ti.CodigoIva = it.taxTypeSageFk + JOIN sage.TiposTransacciones ttr ON ttr.CodigoTransaccion = it.transactionTypeSageFk + JOIN invoiceInSerial iis ON iis.code = n.serial + JOIN (SELECT * FROM expence e GROUP BY e.id)e ON e.id = it.expenceFk + LEFT JOIN ( + SELECT eWithheld.id + FROM invoiceInTax hold + JOIN expence eWithheld ON eWithheld.id = hold.expenceFk AND eWithheld.isWithheld + WHERE hold.invoiceInFk = vInvoiceInId LIMIT 1 + ) eWithheld ON TRUE + WHERE it.taxTypeSageFk IS NOT NULL + AND it.taxTypeSageFk NOT IN (22, 90) + GROUP BY ti.PorcentajeIva, e.id; + + -- Línea iva inversor sujeto pasivo + + INSERT INTO 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, + ti.CuentaIvaRepercutido SUBCTA, + s.supplierAccount CONTRA, + SUM(ROUND(ti.PorcentajeIva * it.taxableBase / 100,2)) EUROHABER, + ROUND(SUM(it.taxableBase),2) BASEEURO, + GROUP_CONCAT(DISTINCT e.`name` SEPARATOR ', ') CONCEPTO, + vSerialNumber FACTURA, + ti.PorcentajeIva IVA, + '*' AUXILIAR, + n.serial SERIE, + ttr.ClaveOperacionDefecto, + 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 sage.TiposIva ti ON ti.CodigoIva = it.taxTypeSageFk + JOIN sage.TiposTransacciones ttr ON ttr.CodigoTransaccion = it.transactionTypeSageFk + JOIN invoiceInSerial iis ON iis.code = n.serial + JOIN (SELECT * FROM expence e GROUP BY e.id)e ON e.id = it.expenceFk + WHERE ti.Iva = 'HP DEVENGADO 21 ISP' OR MID(s.account, 4, 1) = '1' + GROUP BY ti.PorcentajeIva, 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; + + -- Problemas derivados de la precisión en los decimales al calcular los impuestos + UPDATE XDiario + SET EURODEBE = EURODEBE - + (SELECT IF(ABS(sub.difference) = 0.01, sub.difference, 0) + FROM( + SELECT SUM(IFNULL(ROUND(EURODEBE, 2),0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) difference + FROM XDiario + WHERE ASIEN = vBookNumber + )sub + ) + WHERE ASIEN = vBookNumber + AND EURODEBE <> 0 + ORDER BY id DESC + 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 `invoiceInBookingMain__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInBookingMain__`(vInvoiceInId INT) +BEGIN + DECLARE vTotalAmount,vTotalAmountDivisa DECIMAL(10,2); + DECLARE vBookNumber,vSerialNumber INT; + DECLARE vRate DECIMAL(10,4); + DECLARE vSerial VARCHAR(2); + + CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); + + SELECT serial + INTO vSerial + FROM newInvoiceIn; + + SELECT SUM(iit.taxableBase * IF(vSerial = 'R' AND tc.`type` <> 'I', 1 +(tc.rate/100),1)), + SUM(iit.foreignValue * IF(vSerial = '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; + + CALL vn.ledger_next(vBookNumber); + + -- Apunte del proveedor + + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + EUROHABER, + CONCEPTO, + CAMBIO, + HABERME, + NFACTICK, + CLAVE, + empresa_id) + SELECT + vBookNumber, + n.bookEntried, + s.supplierAccount, + vTotalAmount EUROHABER, + n.conceptWithSupplier, + vRate, + vTotalAmountDivisa, + n.invoicesCount, + vInvoiceInId, + n.companyFk + FROM newInvoiceIn n + JOIN newSupplier s; + + -- ----------------------------------------------------------- Linea de Gastos + INSERT INTO vn2008.XDiario (ASIEN, + FECHA, + SUBCTA, + CONTRA, + EURODEBE, + EUROHABER, + CONCEPTO, + CAMBIO, + DEBEME, + HABERME, + 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 AND iit.taxableBase < 0, NULL, ROUND(SUM(iit.taxableBase),2)) EURODEBE, + IF(e.isWithheld AND iit.taxableBase < 0,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 + 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 * it.taxableBase / 100 /* + 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 = vInvoiceInId LIMIT 1 + ) eWithheld ON TRUE + WHERE tc.type != '-' + AND tc.isActive + GROUP BY tc.rate, e.id; + + -- 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, + SUM(ROUND(tcLink.rate * it.taxableBase / 100,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 + AND tc.link + JOIN expence e ON e.id = it.expenceFk + AND e.taxTypeFk = tc.taxTypeFk + WHERE tc.isActive + AND (tc.type in('S','I') OR MID(s.supplierAccount,4,1) = '1') + 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; + + -- Problemas derivados de la precisión en los decimales al calcular los impuestos + UPDATE XDiario + SET EURODEBE = EURODEBE - + (SELECT IF(ABS(sub.difference) = 0.01, sub.difference, 0) + FROM(SELECT SUM(IFNULL(ROUND(EURODEBE, 2),0)) - SUM(IFNULL(ROUND(EUROHABER, 2), 0)) difference + FROM XDiario + WHERE ASIEN = vBookNumber + )sub + ) + WHERE ASIEN = vBookNumber + AND EURODEBE <> 0 + ORDER BY id DESC + LIMIT 1; + + /*UPDATE XDiario + SET EURODEBE = EURODEBE - + (SELECT SUM(IFNULL(ROUND(EURODEBE,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) difference + FROM XDiario + WHERE ASIEN = vBookNumber + HAVING ABS(difference) = 0.01) + WHERE ASIEN = vBookNumber + AND EURODEBE <> 0 + ORDER BY id DESC + 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 `invoiceInBookingMain___` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInBookingMain___`(vInvoiceInId INT) +BEGIN + DECLARE vTotalAmount,vTotalAmountDivisa DECIMAL(10,2); + DECLARE vBookNumber,vSerialNumber INT; + DECLARE vRate DECIMAL(10,4); + DECLARE vSerial VARCHAR(2); + + CALL invoiceInBookingCommon(vInvoiceInId,vSerialNumber); + + SELECT serial + INTO vSerial + FROM newInvoiceIn; + + SELECT SUM(iit.taxableBase * IF(vSerial = 'R' AND tc.`type` <> 'I', 1 +(tc.rate/100),1)), + SUM(iit.foreignValue * IF(vSerial = '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; + + CALL vn.ledger_next(vBookNumber); + + -- Apunte del proveedor + + INSERT INTO vn2008.XDiario( + ASIEN, + FECHA, + SUBCTA, + EUROHABER, + CONCEPTO, + CAMBIO, + HABERME, + NFACTICK, + CLAVE, + empresa_id) + SELECT + vBookNumber, + n.bookEntried, + s.supplierAccount, + vTotalAmount EUROHABER, + n.conceptWithSupplier, + vRate, + vTotalAmountDivisa, + n.invoicesCount, + vInvoiceInId, + n.companyFk + FROM newInvoiceIn n + JOIN newSupplier s; + + -- ----------------------------------------------------------- Linea de Gastos + INSERT INTO vn2008.XDiario (ASIEN, + FECHA, + SUBCTA, + CONTRA, + EURODEBE, + EUROHABER, + CONCEPTO, + CAMBIO, + DEBEME, + HABERME, + 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 AND iit.taxableBase < 0, NULL, ROUND(SUM(iit.taxableBase),2)) EURODEBE, + IF(e.isWithheld AND iit.taxableBase < 0,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 + 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 * it.taxableBase / 100 /* + 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 = vInvoiceInId LIMIT 1 + ) eWithheld ON TRUE + WHERE tc.type != '-' + AND tc.isActive + GROUP BY tc.rate, e.id; + + -- 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, + SUM(ROUND(tcLink.rate * it.taxableBase / 100,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 + AND tc.link + JOIN expence e ON e.id = it.expenceFk + AND e.taxTypeFk = tc.taxTypeFk + WHERE tc.isActive + AND (tc.type in('S','I') OR MID(s.supplierAccount,4,1) = '1') + 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 `invoiceInDueDay_calculate` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(vInvoiceInFk INT) +BEGIN + + IF !(SELECT COUNT(*) + FROM invoiceInDueDay iid + WHERE iid.invoiceInFk = vInvoiceInFk) THEN + + INSERT INTO invoiceInDueDay (invoiceInFk, + dueDated, + amount, + foreignValue) + SELECT vInvoiceInFk, + IF(payDay, + IF(vn.getNextDueDate(issued, detail, payDay) < DATE_ADD(created, INTERVAL 2 DAY), + DATE_ADD(created, INTERVAL 2 DAY), + vn.getNextDueDate(issued, detail, payDay)), + GREATEST(TIMESTAMPADD(DAY, 2, created), TIMESTAMPADD(DAY, detail, issued))), + IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), + IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) + FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detail)) venc, + SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detail)) foreignValue, + s.payDemFk, + ii.companyFk, + COUNT(DISTINCT(pdd.detail)) cont, + s.payDay, + ii.issued, + DATE(ii.created) created + FROM invoiceIn ii + JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id + LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk + JOIN supplier s ON s.id = ii.supplierFk + JOIN supplier s2 ON s2.id = ii.companyFk + JOIN vn.payDemDetail pdd ON pdd.id = s.payDemFk + WHERE ii.id = vInvoiceInFk + GROUP BY ii.id + ) sub + JOIN (SELECT @cont:=0) sub2 + JOIN vn.payDemDetail pdd ON pdd.id = sub.payDemFk + GROUP BY detail; + 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 `invoiceInDueDay_calculate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_calculate__`(vInvoiceInFk INT) +BEGIN + + IF !(SELECT COUNT(*) + FROM invoiceInDueDay iid + WHERE iid.invoiceInFk = vInvoiceInFk) THEN + + INSERT INTO invoiceInDueDay (invoiceInFk, + dueDated, + amount, + foreignValue) + SELECT vInvoiceInFk, + IF(payDay, vn2008.next_venc(issued, detalle, payDay),TIMESTAMPADD(DAY, GREATEST(detalle, 2), issued)), + IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), + IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) + FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detalle)) venc, + SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detalle)) foreignValue, + s.payDemFk, + ii.companyFk, + COUNT(DISTINCT(pdd.detalle)) cont, + s.payDay, + ii.issued + FROM invoiceIn ii + JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id + LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk + JOIN supplier s ON s.id = ii.supplierFk + JOIN supplier s2 ON s2.id = ii.companyFk + JOIN vn2008.pay_dem_det pdd ON pdd.id = s.payDemFk + WHERE ii.id = vInvoiceInFk + GROUP BY ii.id + ) sub + JOIN (SELECT @cont:=0) sub2 + JOIN vn2008.pay_dem_det pdd ON pdd.id = sub.payDemFk + GROUP BY detalle; + 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 `invoiceInDueDay_recalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_recalc`(vInvoiceInFk INT) +BEGIN + + DELETE FROM invoiceInDueDay + WHERE invoiceInFk = vInvoiceInFk; + + CALL invoiceInDueDay_calculate(vInvoiceInFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceInTaxMakeByDua` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTaxMakeByDua`(vDuaFk INT) +BEGIN + + DECLARE done BOOL DEFAULT FALSE; + DECLARE vInvoiceInFk INT; + + DECLARE rs CURSOR FOR + SELECT invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + FETCH rs INTO vInvoiceInFk; + + WHILE NOT done DO + + CALL vn2008.recibidaIvaInsert(vInvoiceInFk); + CALL vn2008.recibidaVencimientoReplace(vInvoiceInFk); + + FETCH rs INTO vInvoiceInFk; + + END WHILE; + + CLOSE rs; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceInTax_getFromDua` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromDua`(vDuaFk INT) +BEGIN + + DECLARE done BOOL DEFAULT FALSE; + DECLARE vInvoiceInFk INT; + + DECLARE rs CURSOR FOR + SELECT invoiceInFk + FROM entry e + JOIN duaEntry de ON de.entryFk = e.id + WHERE de.duaFk = vDuaFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + FETCH rs INTO vInvoiceInFk; + + WHILE NOT done DO + + CALL invoiceInTax_getFromEntries(vInvoiceInFk); + CALL invoiceInDueDay_calculate(vInvoiceInFk); + + FETCH rs INTO vInvoiceInFk; + + END WHILE; + + CLOSE rs; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceInTax_getFromEntries` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInTax_getFromEntries`(IN vId INT) +BEGIN + DECLARE vRate DOUBLE DEFAULT 1; + DECLARE vDated DATE; + DECLARE vExpenceFk VARCHAR(10); + + SELECT MAX(rr.dated) INTO vDated + FROM referenceRate rr + JOIN invoiceIn ii ON ii.id = vId + WHERE rr.dated <= ii.issued + AND rr.currencyFk = ii.currencyFk ; + + IF vDated THEN + SELECT `value` INTO vRate + FROM referenceRate + WHERE dated = vDated; + END IF; + + SELECT id INTO vExpenceFk + FROM vn.expence + WHERE `name` = 'Adquisición mercancia Extracomunitaria' + GROUP BY id + LIMIT 1; + + DELETE FROM invoiceInTax + WHERE invoiceInFk = vId; + + INSERT INTO invoiceInTax(invoiceInFk, taxableBase, expenceFk, foreignValue, taxTypeSageFk, transactionTypeSageFk) + SELECT ii.id, + SUM(b.buyingValue * b.quantity) / IFNULL(vRate,1) taxableBase, + vExpenceFk, + IF(ii.currencyFk = 1,NULL,SUM(b.buyingValue * b.quantity )) divisa, + taxTypeSageFk, + transactionTypeSageFk + FROM invoiceIn ii + JOIN entry e ON e.invoiceInFk = ii.id + JOIN supplier s ON s.id = e.supplierFk + JOIN buy b ON b.entryFk = e.id + LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk + AND rr.dated = ii.issued + WHERE ii.id = vId + HAVING taxableBase IS NOT 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 `invoiceOutAgain` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutAgain`(IN vInvoiceRef VARCHAR(15), vTaxArea VARCHAR(25)) +BEGIN + +/* Para tickets ya facturados, vuelve a repetir el proceso de facturación. +* +* @param vInvoiceFk Numero de factura +* @param vTaxArea Numero de factura +*/ + + DECLARE vInvoiceFk INT; + DECLARE vCountry INT; + DECLARE vTaxArea VARCHAR(15); + DECLARE vSpainCountryCode INT DEFAULT 1; + + SELECT id INTO vInvoiceFk + FROM invoiceOut + WHERE ref = vInvoiceRef; + + UPDATE invoiceOut + SET hasPdf = 0 + WHERE id = vInvoiceFk; + + SELECT s.countryFk INTO vCountry + FROM supplier s + JOIN invoiceOut io ON io.companyFk = s.id + WHERE io.id = vInvoiceFk; + + DROP TEMPORARY TABLE IF EXISTS ticketToInvoice; + + CREATE TEMPORARY TABLE ticketToInvoice + SELECT id + FROM ticket + WHERE refFk = vInvoiceRef; + + CALL invoiceExpenceMake(vInvoiceFk); + + CALL invoiceTaxMake(vInvoiceFk,vTaxArea); + + UPDATE invoiceOut io + JOIN ( + SELECT SUM(amount) AS total + FROM invoiceOutExpence + WHERE invoiceOutFk = vInvoiceFk + ) base + JOIN ( + SELECT SUM(vat) AS total + FROM invoiceOutTax + WHERE invoiceOutFk = vInvoiceFk + ) vat + SET io.amount = base.total + vat.total + WHERE io.id = vInvoiceFk; + + CALL vn.invoiceOutBooking(vInvoiceFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceOutBooking` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutBooking`(IN vInvoice INT) +BEGIN +/* Asienta la factura emitida +* +* param vInvoice factura_id +*/ + DECLARE vBookNumber INT; + DECLARE vExpenceConcept VARCHAR(50); + DECLARE vIsUeeMember BOOL DEFAULT TRUE; + DECLARE vSpainCountryFk INT; + DECLARE vOldBookNumber INT; + + SELECT id INTO vSpainCountryFk FROM country WHERE code = 'ES'; + + SELECT ASIEN + INTO vOldBookNumber + FROM XDiario x + JOIN 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 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, + io.issued AS 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 = vSpainCountryFk, vSpainCountryFk, IF(ct.isUeeMember = vIsUeeMember,2,4)) AS TERIDNIF, + CONCAT(IF(ct.isUeeMember = vIsUeeMember AND ct.politicalCountryFk <> vSpainCountryFk,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 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; + + CALL vn.ledger_next(vBookNumber); + + -- Linea del cliente + INSERT INTO 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 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 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 `invoiceOutBookingRange` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutBookingRange`() +BEGIN + +/* Reasentar facturas +*/ + + + DECLARE vInvoice INT; + DECLARE vContador INT DEFAULT 0; + + DECLARE done BOOL DEFAULT FALSE; + + DECLARE rs CURSOR FOR + SELECT io.id + FROM invoiceOut io + WHERE RIGHT(ref,7) BETWEEN 1724215 AND 1724224 + AND serial = 'T'; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + FETCH rs INTO vInvoice; + + WHILE NOT done DO + + CALL invoiceOutBooking(vInvoice); + + FETCH rs INTO vInvoice ; + + SET vContador = vContador + 1; + + IF vContador MOD 50 = 0 THEN + + SELECT CONCAT(vContador, ' de momento') AS FACTURAS_ASENTADAS; + + END IF; + + END WHILE; + + CLOSE rs; + + 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutDelete`(vRef VARCHAR(15)) +BEGIN + DECLARE vAsien INTEGER; + DECLARE vSendMail BOOL; + DECLARE vBody TEXT; + + SELECT ASIEN INTO vAsien + FROM XDiario + WHERE SERIE = SUBSTRING(vRef, 1, 1) + AND FACTURA = SUBSTRING(vRef, 2, LENGTH(vRef)-1) + LIMIT 1; + + SELECT IF(enlazado OR enlazadoSage, TRUE, FALSE), + CONCAT( + ' + + + + + + + ', + GROUP_CONCAT( + CONCAT(' + + + + + + + ' + ) SEPARATOR ' ' + ), + '
FECHASUBCTACONTRACONCEPTOEURODEBEEUROHABER
', IFNULL(FECHA,''), '', IFNULL(SUBCTA,''), '', IFNULL(CONTRA,''), '', IFNULL(CONCEPTO,''), '', IFNULL(EURODEBE,''), '', IFNULL(EUROHABER,''), '
' + ) + INTO vSendMail, vBody + FROM XDiario + WHERE ASIEN = vAsien; + + DELETE FROM XDiario + WHERE ASIEN = vAsien; + + IF vSendMail THEN + CALL mail_insert( + 'administracion@verdnatura.es', + 'noreply@verdnatura.es', + CONCAT('Eliminada factura ' ,vRef), + CONCAT( + '
+

Se ha eliminado el asiento ', vAsien, ' que estaba enlazado en SAGE/CONTAPLUS, vinculado a la factura ', vRef ,'

+ ', vBody, '
' + ) + ); + END IF; + + UPDATE ticket + SET refFk = NULL + WHERE refFk = vRef; + + DELETE + FROM invoiceOut + WHERE ref = vRef; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 */ ; +/*!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 `invoiceOutFix_BI_RE_IVA__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutFix_BI_RE_IVA__`() +BEGIN + +DECLARE done BOOL DEFAULT FALSE; +DECLARE vInvoice INT; + +DECLARE rs CURSOR FOR + SELECT factura_id + FROM vn2008.Facturas + WHERE Importe != BI7 + BI16 + RE4 + RE1 + IVA7 + IVA16 + AND Fecha >= '2017-07-01'; + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + +OPEN rs; + +FETCH rs INTO vInvoice; + +SELECT vInvoice, done; + +WHILE NOT done DO + + UPDATE invoiceOut io + JOIN ( + SELECT SUM(amount) AS total + FROM invoiceOutExpence + WHERE invoiceOutFk = vInvoice + ) base + JOIN ( + SELECT SUM(vat) AS total + FROM invoiceOutTax + WHERE invoiceOutFk = vInvoice + ) vat + SET io.amount = base.total + vat.total + WHERE io.id = vInvoice; + + UPDATE vn2008.Facturas + SET BI16 = 0, + BI7 = 0, + RE1 = 0, + RE4 = 0, + IVA7 = 0, + IVA16 = 0 + WHERE factura_id = vInvoice; + + 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 = vInvoice + AND iot.pgcFk IN ('4770000021' ,'4770000215', '4770000002','4771000000','4770000000','4770000020'); + + UPDATE vn2008.Facturas f + JOIN invoiceOutTax iot ON iot.invoiceOutFk = f.factura_id + SET f.RE4 = iot.vat + WHERE f.factura_id = vInvoice + 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 = vInvoice + 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 = vInvoice + AND iot.pgcFk = '4770000110'; + +FETCH rs INTO vInvoice; + +END WHILE; + + +CLOSE rs; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceOutListByCompany` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutListByCompany`(vCompany INT, vStarted DATE, vEnded DATE) +BEGIN + +SELECT + c.socialName as RazonSocial, + c.fi as NIF, + io.ref as Factura, + io.serial as Serie, + io.issued as Fecha, + io.amount as Importe, + c.id as Id_Cliente, + iot.taxableBase as Base, + pgc.rate as Tipo, + iot.vat as Cuota, + pgc.name as Concepto + + FROM vn.invoiceOut io + JOIN vn.invoiceOutTax iot ON iot.invoiceOutFk = io.id + JOIN vn.client c ON c.id = io.clientFk + JOIN vn.pgc ON pgc.code = iot.pgcFk + WHERE io.companyFk = vCompany + AND io.issued BETWEEN vStarted AND vEnded + ORDER BY io.ref 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 `invoiceOutTaxAndExpence` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOutTaxAndExpence`() +BEGIN + +/* Para tickets ya facturados, vuelve a repetir el proceso de facturación. +* +* @param vInvoice Numero de factura +*/ + + DECLARE vInvoice INT; + DECLARE vInvoiceRef VARCHAR(15); + DECLARE vCountry INT; + DECLARE vTaxArea VARCHAR(15); + DECLARE vContador INT DEFAULT 0; + + DECLARE done BOOL DEFAULT FALSE; + + DECLARE rs CURSOR FOR + SELECT id,ref + FROM invoiceOut io + + WHERE issued >= '2017-07-01' + AND companyFk = 1381 + AND io.amount IS NULL + ; + + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + FETCH rs INTO vInvoice ,vInvoiceRef; + + WHILE NOT done DO + + SELECT s.countryFk + INTO vCountry + FROM supplier s + JOIN invoiceOut io ON io.companyFk = s.id + WHERE io.id = vInvoice; + + SELECT IF(c.isEqualizated 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; + + DROP TEMPORARY TABLE IF EXISTS ticketToInvoice; + + CREATE TEMPORARY TABLE ticketToInvoice + SELECT id + FROM ticket + WHERE refFk = vInvoiceRef; + + CALL invoiceExpenceMake(vInvoice); + CALL invoiceTaxMake(vInvoice,vCountry,vTaxArea); + + FETCH rs INTO vInvoice ,vInvoiceRef; + + SET vContador = vContador + 1; + + IF vContador MOD 50 = 0 THEN + + SELECT CONCAT(vContador, ' de momento') AS FACTURAS_ASENTADAS; + + END IF; + + END WHILE; + + CLOSE rs; + + 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 `invoiceOut_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new`( + vSerial VARCHAR(255), + vInvoiceDate DATETIME, + vTaxArea VARCHAR(25), + OUT vNewInvoiceId INT) +BEGIN + +/* Creación de facturas emitidas. +* requiere previamente tabla ticketToInvoice(id). +* +* @param vSerial serie a la cual se hace la factura +* @param vInvoiceDate fecha de la factura +* @param vTaxArea tipo de iva en relacion a la empresa y al cliente +* @param vNewInvoiceId id de la factura que se acaba de generar +* +* @return vNewInvoiceId +*/ + + DECLARE vSpainCountryCode INT DEFAULT 1; + DECLARE vIsAnySaleToInvoice BOOL; + DECLARE vIsAnyServiceToInvoice BOOL; + DECLARE vNewRef VARCHAR(255); + DECLARE vWorker INT DEFAULT account.myUser_getId(); + DECLARE vCompany INT; + DECLARE vSupplier 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 vNewInvoiceInId INT; + DECLARE vIsInterCompany BOOL; + + 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; + + -- 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 + OR t.isDeleted + OR c.hasToInvoice = FALSE; + + SELECT SUM(s.quantity * s.price * (100 - s.discount)/100), ts.id + INTO vIsAnySaleToInvoice, vIsAnyServiceToInvoice + FROM ticketToInvoice t + LEFT JOIN sale s ON s.ticketFk = t.id + LEFT JOIN ticketService ts ON ts.ticketFk = t.id; + + IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice) + AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase()) + THEN + + -- 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 + LEFT 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,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; + + DROP TEMPORARY TABLE tmp.updateInter; + + SELECT ios.isCEE INTO vIsInterCompany + FROM vn.ticket t + JOIN vn.company c ON c.clientFk = t.clientFk + JOIN vn.invoiceOut io ON io.`ref` = t.refFk + JOIN vn.invoiceOutSerial ios ON ios.code = io.serial + WHERE t.refFk = vNewRef; + + IF (vIsInterCompany) THEN + + SELECT vCompany INTO vSupplier; + SELECT id INTO vCompany FROM company WHERE clientFk = vClient; + + INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk) + SELECT vSupplier, vNewRef, vInvoiceDate, vCompany; + + SET vNewInvoiceInId = LAST_INSERT_ID(); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk + FROM ticketToInvoice; + + CALL `ticket_getTax`('NATIONAL'); + + SET @vTaxableBaseServices := 0.00; + SET @vTaxCodeGeneral := NULL; + + INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInId, @vTaxableBaseServices, sub.expenceFk, sub.taxTypeSageFk , sub.transactionTypeSageFk + FROM ( + SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk, @vTaxCodeGeneral := i.taxClassCodeFk + FROM tmp.ticketServiceTax tst + JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code + WHERE i.isService + HAVING taxableBase + ) sub; + + INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInId, SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, @vTaxableBaseServices, 0) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk + FROM tmp.ticketTax tt + JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code + WHERE !i.isService + GROUP BY tt.pgcFk + HAVING taxableBase + ORDER BY tt.priority; + + CALL `vn`.`invoiceInDueDay_calculate`(vNewInvoiceInId); + + INSERT INTO vn2008.intrastat_data (recibida_id, intrastat_id, importe, unidades, Paises_Id, neto) + SELECT + vNewInvoiceInId, + i.intrastatFk, + CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100)) AS DECIMAL(10,2)) importe, + CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL (10 , 2 )) stems, + s2.countryFk, + CAST(SUM(IF(sv.physicalWeight, sv.physicalWeight, i.density * sub.cm3delivery/1000000)) AS DECIMAL(10,2)) neto + FROM vn.sale s + LEFT JOIN (SELECT ic.itemFk, ic.cm3delivery + FROM vn.itemCost ic + WHERE ic.cm3 + GROUP BY ic.itemFk) sub ON s.itemFk = sub.itemFk + LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id + LEFT JOIN vn.ticket t ON s.ticketFk = t.id + LEFT JOIN vn.supplier s2 ON s2.id = t.companyFk + LEFT JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.intrastat it ON it.id = i.intrastatFk + JOIN vn.invoiceOut iOut ON iOut.ref = t.refFk + WHERE iOut.`ref` = vNewRef + GROUP BY i.intrastatFk + ORDER BY i.intrastatFk; + + + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketAmount; + DROP TEMPORARY TABLE tmp.ticketTax; + DROP TEMPORARY TABLE tmp.ticketServiceTax; + + END IF; + + END IF; + + DROP TEMPORARY TABLE `ticketToInvoice`; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceOut_newFromClient` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_newFromClient`(IN vClientFk int, IN vSerial char(2), IN vMaxShipped date, + IN vCompanyFk int, IN vTaxArea varchar(25), + IN vRef varchar(25), OUT vInvoiceId int) +BEGIN +/** + * Factura los tickets de un cliente hasta una fecha dada + * @param vClientFk Id del cliente a facturar + * @param vSerial Serie de factura + * @param vMaxShipped Fecha hasta la cual cogera tickets para facturar + * @param vCompanyFk Id de la empresa desde la que se factura + * @param vTaxArea Tipo de iva en relacion a la empresa y al cliente, NULL por defecto + * @param vRef Referencia de la factura en caso que se quiera forzar, NULL por defecto + * @return vInvoiceId factura + */ + + DECLARE vIsRefEditable BOOLEAN; + + IF vRef IS NOT NULL THEN + SELECT isRefEditable INTO vIsRefEditable + FROM invoiceOutSerial + WHERE code = vSerial; + + IF NOT vIsRefEditable THEN + CALL util.throw('serial non editable'); + END IF; + END IF; + + CALL invoiceFromClient(vMaxShipped, vClientFk, vCompanyFk); + CALL invoiceOut_new(vSerial, CURDATE(), vTaxArea, vInvoiceId); + + UPDATE invoiceOut + SET `ref` = vRef + WHERE id = vInvoiceId + AND vRef IS NOT NULL; + + IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN + CALL invoiceOutBooking(vInvoiceId); + 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 `invoiceOut_newFromTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_newFromTicket`(IN vTicketFk int, IN vSerial char(2), IN vTaxArea varchar(25), + IN vRef varchar(25), OUT vInvoiceId int) +BEGIN +/** + * Factura un ticket + * @param vTicketFk Id del ticket + * @param vSerial Serie de factura + * @param vTaxArea Area de la factura en caso de querer forzarlo, + * en la mayoria de los casos poner NULL + * @return vInvoiceId + */ + DECLARE vIsRefEditable BOOLEAN; + CALL invoiceFromTicket(vTicketFk); + CALL invoiceOut_new(vSerial, CURDATE(), vTaxArea, vInvoiceId); + + IF vRef IS NOT NULL THEN + SELECT isRefEditable INTO vIsRefEditable + FROM invoiceOutSerial + WHERE code = vSerial; + IF NOT vIsRefEditable THEN + CALL util.throw('serial non editable'); + END IF; + + UPDATE invoiceOut + SET `ref` = vRef + WHERE id = vInvoiceId; + END IF; + + IF vSerial <> 'R' AND NOT ISNULL(vInvoiceId) AND vInvoiceId <> 0 THEN + CALL invoiceOutBooking(vInvoiceId); + 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 `invoiceOut_new__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new__`( + vSerial VARCHAR(255), + vInvoiceDate DATETIME, + vTaxArea VARCHAR(25), + OUT vNewInvoiceId INT) +BEGIN + +/* Creación de facturas emitidas. +* REQUIERE previamente tabla ticketToInvoice. +* +* @param vSerial, vInvoiceDate,vTaxArea +* +* @return vNewInvoiceId +*/ + + DECLARE vSpainCountryCode INT DEFAULT 1; + DECLARE vIsAnySaleToInvoice BOOL; + DECLARE vNewRef VARCHAR(255); + DECLARE vWorker INT DEFAULT account.myUser_getId(); + 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'; + + 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; + + -- 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 + OR t.isDeleted + OR c.hasToInvoice = 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 + LEFT 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,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; + + DROP TEMPORARY TABLE `ticketToInvoice`; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `invoiceTaxMake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceTaxMake`(vInvoice INT, vTaxArea VARCHAR(25)) +BEGIN +/** + * Factura un conjunto de tickets. + * + * @param vInvoice, vTaxAreaFk + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @return tmp.ticketAmount + * @return tmp.ticketTax Impuesto desglosado para cada ticket. + */ + 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 ticket_getTax(vTaxArea); + + INSERT INTO invoiceOutTax( + invoiceOutFk, + pgcFk, + taxableBase, + vat + ) + SELECT vInvoice, + pgcFk, + SUM(taxableBase) as BASE, + CAST(SUM(taxableBase) * rate / 100 AS DECIMAL (10,2)) + FROM tmp.ticketTax + GROUP BY pgcFk + HAVING BASE + ORDER BY priority; + + 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 `invoiceTaxMake__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceTaxMake__`(vInvoice INT, vTaxArea VARCHAR(25)) +BEGIN +/** + * Factura un conjunto de tickets. + * + * @param vInvoice, vTaxAreaFk + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @return tmp.ticketAmount + * @return tmp.ticketTax Impuesto desglosado para cada ticket. + */ + 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 ticket_getTax(vTaxArea); + + INSERT INTO invoiceOutTax( + invoiceOutFk, + pgcFk, + taxableBase, + vat + ) + SELECT vInvoice, + pgcFk, + SUM(taxableBase) as BASE, + CAST(SUM(taxableBase) * rate / 100 AS DECIMAL (10,2)) + FROM tmp.ticketTax + GROUP BY pgcFk + HAVING BASE; + + 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 `itemBarcode_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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemBarcode_update`(vItemFk INT,vCode VARCHAR(22), vDelete BOOL) +BEGIN +IF vDelete THEN + DELETE FROM vn.itemBarcode WHERE itemFk = vItemFk AND code = vCode; +ELSE + INSERT INTO vn.itemBarcode(itemFk,code) VALUES (vItemFk,vCode); +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 `itemCard` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemCard`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT, IN isBarcode BOOL) +BEGIN + + /* + * @deprecated: Utilizar item_getInfo + */ + + DECLARE vCacheVisibleFk INT; + DECLARE vCacheAvailableFk INT; + DECLARE vVisibleAltillo INT; + DECLARE vItemFk INT; + + IF isBarcode THEN + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + ELSE + SELECT i.id INTO vItemFk + FROM vn.item i + WHERE i.name LIKE CONCAT('%',vBarcode,'%') + ORDER BY i.id ASC + LIMIT 1; + END IF; + + IF vItemFk IS NULL THEN + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + END IF; + + CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); + CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); + + SELECT SUM(visible) INTO vVisibleAltillo + FROM vn.itemShelvingStock + WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; + + CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + + SELECT i.id, + i.longName, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.image, + i.size, + i.stems, + i.category, + i.minimum as min, + i.upToDown as repo, + p.name as producer, + o.code as origin, + ip.code as nicho, + ip.reserve as reserva, + v.visible - IFNULL(vVisibleAltillo,0) as enNicho, + a.available, + vVisibleAltillo as enAltillo, + v.visible as total, + c.`grouping` as `grouping`, + c.Packing as packing, + CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, + CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, + i.itemPackingTypeFk, + i.comment as referencia + FROM vn.item i + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN vn.itemPlacement ip ON ip.itemFk = i.id + LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id + LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id + LEFT JOIN ( + SELECT b.itemFk, b2.`grouping`, b2.packing + FROM tmp.buyUltimate b + JOIN vn.buy b2 ON b2.id = b.buyFk + WHERE b.warehouseFk = vWarehouseFk + ) c ON i.id = c.itemFk + WHERE i.id = vItemFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemCard__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemCard__`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT, isBarcode BOOL) +BEGIN + + DECLARE vCacheVisibleFk INT; + DECLARE vCacheAvailableFk INT; + DECLARE vVisibleAltillo INT; + DECLARE vItemFk INT; + + IF isBarcode THEN + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + ELSE + SELECT i.id INTO vItemFk + FROM vn.item i + WHERE i.name LIKE CONCAT('%',vBarcode,'%') + ORDER BY i.id ASC + LIMIT 1; + END IF; + + IF vItemFk IS NULL THEN + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + END IF; + + CALL cache.visible_refresh(vCacheVisibleFk, TRUE,vWarehouseFk); + CALL cache.available_refresh(vCacheAvailableFk, TRUE,vWarehouseFk, CURDATE()); + + SELECT SUM(visible) INTO vVisibleAltillo + FROM vn.itemShelvingStock + WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; + + CALL vn2008.item_last_buy_(vWarehouseFk,vItemFk); + + SELECT i.id, + i.longName, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.image, + i.size, + i.stems, + i.category, + i.minimum as min, + i.upToDown as repo, + p.name as producer, + o.code as origin, + ip.code as nicho, + ip.reserve as reserva, + v.visible - IFNULL(vVisibleAltillo,0) as enNicho, + a.available, + vVisibleAltillo as enAltillo, + v.visible as total, + c.`grouping` as `grouping`, + c.Packing as packing, + CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, + CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, + i.itemPackingTypeFk + FROM vn.item i + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN vn.itemPlacement ip ON ip.itemFk = i.id + LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id + LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id + LEFT JOIN + (SELECT b.item_id,c.`grouping`,c.Packing + FROM vn2008.t_item_last_buy b + INNER JOIN vn2008.Compres c ON c.Id_Compra = b.buy_id + where b.warehouse_id = vWarehouseFk) c + ON i.id= c.item_id + WHERE i.id = vItemFk; + + DROP TEMPORARY TABLE vn2008.t_item_last_buy; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemDiary__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemDiary__`(IN vItemId INT, IN vWarehouse INT) +BEGIN + DECLARE vDateInventory DATETIME; + DECLARE vCurdate DATE DEFAULT CURDATE(); + DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); + + SELECT vn.barcodeToItem(vItemId) INTO vItemId; + + -- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance + SELECT inventoried INTO vDateInventory FROM config; + SET @a = 0; + SELECT DATE(date) AS date, + alertLevel, + stateName, + origin, + reference, + clientFk, + name, + `in`, + `out`, + @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, + isPicked, + isTicket, + `in` as invalue + FROM + ( SELECT tr.landed as date, + b.quantity as `in`, + NULL as `out`, + IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, + st.name AS stateName, + s.name as name, + e.ref as reference, + e.id as origin, + s.id as clientFk, + TRUE isPicked, + FALSE AS isTicket + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.id = + CASE + WHEN tr.isReceived != FALSE THEN 3 + WHEN tr.isDelivered THEN 1 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.landed >= vDateInventory + AND vWarehouse = tr.warehouseInFk + AND b.itemFk = vItemId + AND e.isInventory = 0 + AND e.isRaid = 0 + UNION ALL + + SELECT tr.shipped as date, + NULL as `in`, + b.quantity as `out`, + IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, + st.name AS stateName, + s.name as name, + e.ref as reference, + e.id as origin, + s.id as clientFk, + TRUE isPicked, + FALSE AS isTicket + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.id = + CASE + WHEN tr.isReceived != FALSE THEN 3 + WHEN tr.isDelivered THEN 1 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.shipped >= vDateInventory + AND vWarehouse =tr.warehouseOutFk + AND s.id <> 4 + AND b.itemFk = vItemId + AND e.isInventory = 0 + AND w.isFeedStock = 0 + AND e.isRaid = 0 + UNION ALL + + SELECT t.shipped as date, + NULL as `in`, + s.quantity as `out`, + al.id as alertLevel, + st.name AS stateName, + t.nickname as name, + t.refFk as reference, + t.id as origin, + t.clientFk, + stk.id as isPicked, -- TRUE as isPicked + TRUE as isTicket + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN ticketState ts ON ts.ticket = t.id + LEFT JOIN state st ON st.code = ts.code + JOIN client c ON c.id = t.clientFk + JOIN alertLevel al ON al.id = + CASE + WHEN t.shipped < vCurdate THEN 3 + WHEN t.shipped > vDayEnd THEN 0 + ELSE IFNULL(ts.alertLevel, 0) + END + LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14 -- comentar + WHERE t.shipped >= vDateInventory + AND s.itemFk = vItemId + AND vWarehouse =t.warehouseFk + ) AS itemDiary + ORDER BY date, isTicket, alertLevel DESC, isPicked DESC, `in` DESC, `out` 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 `itemFreight_Show` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFreight_Show`(vItemFk INT, vWarehouseFk INT) +BEGIN + + SELECT cm3 Volumen_Entrada, + cm3delivery Volumen_Salida, + p.volume Volumen_del_embalaje, + p.width Ancho_del_embalaje, + p.`depth` Largo_del_embalaje, + b.packageFk , + IFNULL(p.height, i.`size`) + 10 Altura, + b.packing Packing_Entrada, + i.packingOut Packing_Salida, + i.id itemFk, + b.id buyFk, + b.entryFk, + w.name warehouseFk + FROM vn.itemCost ic + JOIN vn.item i ON i.id = ic.itemFk + LEFT JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN vn.packaging p ON p.id = b.packageFk + LEFT JOIN vn.warehouse w ON w.id = ic.warehouseFk + WHERE ic.itemFk = vItemFk + AND ic.warehouseFk = vWarehouseFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemFuentesBalance` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemFuentesBalance`(vDaysInFuture INT) +BEGIN + + /* Se utiliza para calcular la necesidad de mover mercancia entre el almacén de fuentes y el nuestro + * + * @param vDaysInFuture Rango de dias para calcular entradas y salidas + * + */ + + DECLARE vWarehouseFk INT; + + SELECT s.warehouseFk INTO vWarehouseFk + FROM vn.sector s + WHERE s.code = 'FUENTES_PICASSE'; + + CALL cache.stock_refresh(FALSE); + + SELECT i.id itemFk, + i.longName, + i.size, + i.subName, + v.amount - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as visible, + fue.Fuentes, + alb.Albenfruit, + sale.venta, + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, + IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) + - IFNULL(fue.Fuentes,0) - IFNULL(alb.albenfruit,0) as saldo + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN ( + SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS Fuentes + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + WHERE s.code = 'FUENTES_PICASSE' + GROUP BY ish.itemFk + ) fue ON fue.itemFk = i.id + LEFT JOIN ( + SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS Albenfruit + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + WHERE s.code = 'ALBENFRUIT' + GROUP BY ish.itemFk + ) alb ON alb.itemFk = i.id + LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta + FROM vn2008.item_out + WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + AND warehouse_id = vWarehouseFk + GROUP BY item_id + ) sale ON sale.item_id = i.id + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra + FROM vn2008.item_entry_in + WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + AND warehouse_id = vWarehouseFk + AND isVirtualStock = FALSE + GROUP BY item_id + ) buy ON buy.item_id = i.id + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado + FROM vn2008.item_entry_out + WHERE dat BETWEEN CURDATE() AND TIMESTAMPADD(DAY,vDaysInFuture , util.dayend(curdate())) + AND warehouse_id = vWarehouseFk + GROUP BY item_id + ) mov ON mov.item_id = i.id + WHERE (v.amount OR fue.Fuentes OR alb.Albenfruit) + AND i.itemPackingTypeFk = 'H' + AND ic.shortLife + ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemGetVisibleAvailable__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemGetVisibleAvailable__`( + vItem INT, + vDate DATE, + vWarehouse TINYINT, + vRefresh BOOL) +BEGIN + -- DEPRECADO - UTILIZAR vn.item_getVisibleAvailable() - JSB - 2019-11-20 + CALL item_getVisibleAvailable(vItem, vDate, vWarehouse, vRefresh); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemLastEntries__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemLastEntries__`(IN `vItem` INT, IN `vDays` DATE) +BEGIN + SELECT + w.id AS warehouseFk, + w.name AS warehouse, + tr.landed, + b.entryFk, + b.isIgnored, + b.price2, + b.price3, + b.stickers, + b.packing, + b.`grouping`, + b.groupingMode, + b.weight, + i.stems, + b.quantity, + b.buyingValue, + b.packageFk , + s.id AS supplierFk, + s.name AS supplier + FROM itemType it + RIGHT JOIN (entry e + LEFT JOIN supplier s ON s.id = e.supplierFk + RIGHT JOIN buy b ON b.entryFk = e.id + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN ink ON ink.id = i.inkFk + LEFT JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN warehouse w ON w.id = tr.warehouseInFk + LEFT JOIN origin o ON o.id = i.originFk + ) ON it.id = i.typeFk + LEFT JOIN edi.ekt ek ON b.ektFk = ek.id + WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND DATE_ADD(CURDATE(), INTERVAl + 10 DAY) + ORDER BY tr.landed DESC , b.id 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 `itemPlacementFromTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementFromTicket`(vTicket INT) +BEGIN +/** + * Llama a itemPlacementUpdateVisible + * de los articulos de la tabla temporal tmp.itemPlacement(itemFk) + * @treturn tmp.itemPlacement + * @param vTicket Id del Ticket + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.itemPlacement; + CREATE TEMPORARY TABLE tmp.itemPlacement + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT s.itemFk + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + WHERE t.id = vTicket; + + CALL itemPlacementUpdateVisible(); + + DROP TEMPORARY TABLE tmp.itemPlacement; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemPlacementReloadVisible` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementReloadVisible`() +BEGIN +/** + * Reemplaza únicamente el campo itemPlacement.pickable + * restando al cache.visible los valores de las tablas + * itemShelving y los tickets con estado impreso + * que aun no han sido preparados. + */ + + DECLARE vCalc INT; + DECLARE vTodayIni DATE DEFAULT CURDATE(); + DECLARE vTodayEnd DATETIME DEFAULT util.dayend(vTodayIni); + DECLARE vproductionOrderPrinted INT DEFAULT 4; + DECLARE vWarehouseSillaFv INT DEFAULT 1; + + UPDATE itemPlacement SET pickable = 0; + + CALL cache.visible_refresh(vCalc, FALSE, vWarehouseSillaFv); +-- SELECT * FROM cache.visible v; + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelving; + CREATE TEMPORARY TABLE tmp.itemShelving + SELECT itemFk, IFNULL(SUM(visible),0) visible + FROM itemShelving its + GROUP BY its.itemFk; +-- SELECT * FROM tmp.itemShelving; + DROP TEMPORARY TABLE IF EXISTS tmp.itemPlacement; + CREATE TEMPORARY TABLE tmp.itemPlacement + SELECT s.itemFk, cast(SUM(s.quantity) AS UNSIGNED) visible + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id AND productionOrder = vproductionOrderPrinted + JOIN sale s ON s.ticketFk = t.id + WHERE t.shipped BETWEEN vTodayIni AND vTodayEnd + GROUP BY s.itemFk; +-- SELECT * FROM tmp.itemPlacement; + +/*SELECT v.item_id, vWarehouseSillaFv, v.visible - IFNULL(tis.visible,0) - IFNULL(tip.visible,0) + FROM cache.visible v + LEFT JOIN tmp.itemShelving tis ON tis.itemFk = v.item_id + LEFT JOIN tmp.itemPlacement tip ON tip.itemFk = v.item_id + WHERE v.calc_id = vCalc; + */ + INSERT INTO itemPlacement(itemFk, warehouseFk, pickable) + SELECT v.item_id, vWarehouseSillaFv, v.visible - IFNULL(tis.visible,0) - IFNULL(tip.visible,0) + FROM cache.visible v + LEFT JOIN tmp.itemShelving tis ON tis.itemFk = v.item_id + LEFT JOIN tmp.itemPlacement tip ON tip.itemFk = v.item_id + WHERE v.calc_id = vCalc + ON DUPLICATE KEY UPDATE pickable = VALUES(pickable); + + DROP TEMPORARY TABLE tmp.itemShelving; + DROP TEMPORARY TABLE tmp.itemPlacement; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemPlacementSave` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSave`( + vCode VARCHAR(22), + vPlacement VARCHAR(10), + vWarehouseFk INT ) +BEGIN + DECLARE vItemFk INT; + SET vItemFk = barcodeToItem(vCode); + + IF ASCII(vPlacement) > 57 THEN + INSERT INTO itemPlacement(itemFk, warehouseFk, reserve, pickable) + VALUES(vItemFk, vWarehouseFk, vPlacement, 0) + ON DUPLICATE KEY UPDATE reserve = vPlacement, modificationDate = NOW(); + ELSE + INSERT INTO itemPlacement(itemFk, warehouseFk, code) + VALUES(vItemFk, vWarehouseFk, vPlacement) + ON DUPLICATE KEY UPDATE code = vPlacement, modificationDate = 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 */ ; +/*!50003 DROP PROCEDURE IF EXISTS `itemPlacementSupplyAiming` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyAiming`(vShelvingFk VARCHAR(10), quantity INT, vItemFk INT) +BEGIN + + SELECT ish.itemFk, + ish.longName, + ish.size, + ish.subName, + ish.itemShelvingFk, + ish.shelving, + ish.stock, + LEAST(ish.stock,quantity) as total, + CONCAT( + CAST(FLOOR(LEAST(ish.stock,quantity) / ish.packing) AS DECIMAL(10,0)), + ' x ', + ish.packing, + IF ( + LEAST(ish.stock,quantity) MOD ish.packing, + CONCAT(' + ',CAST(LEAST(ish.stock,quantity) MOD ish.packing AS DECIMAL(10,0))), + '' + ), + ' = ', + LEAST(ish.stock,quantity) + ) as proposal + FROM vn.itemShelvingPlacementSupplyStock ish + WHERE ish.shelving = vShelvingFk COLLATE utf8_general_ci + AND ish.itemFk = vItemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemPlacementSupplyCloseOrder` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyCloseOrder`(vId INT, vQuantity INT) +BEGIN + + UPDATE vn.itemPlacementSupply + SET priority = 10 + WHERE id = vId; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemPlacementSupplyGetOrder` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyGetOrder`(vSector INT ) +BEGIN + + DECLARE vId INT; + DECLARE vLastParkingFk INT; + DECLARE vNextParkingFk INT; + + SELECT sh.parkingFk INTO vLastParkingFk + FROM vn.itemShelvingPlacementSupply isps + JOIN vn.itemShelving ish ON ish.id = isps.itemShelvingFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + WHERE isps.userFk = getUser() + ORDER BY isps.created DESC + LIMIT 1; + + SET vNextParkingFk = vn.itemShelvingPlacementSupply_ClosestGet(vLastParkingFk); + + SELECT ipsl.id INTO vId + FROM vn.itemPlacementSupplyList ipsl + JOIN vn.itemShelvingPlacementSupplyStock ispss ON ispss.itemFk = ipsl.itemFk + WHERE ipsl.saldo > 0 + AND (ipsl.repoUserFk is NULL OR ipsl.repoUserFk = getUser()) + AND ipsl.sectorFk = vSector + ORDER BY ipsl.repoUserFk DESC, ipsl.priority DESC, (ispss.parkingFk = vNextParkingFk) DESC, ispss.parking DESC, ipsl.created + LIMIT 1; + + UPDATE vn.itemPlacementSupply + SET repoUserFk = getUser() + WHERE id = vId; + + SELECT * FROM vn.itemPlacementSupplyList + WHERE id = vId + AND sectorFk = vSector; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemPlacementSupplyStockGetTargetList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementSupplyStockGetTargetList`(vItemFk INT,vSectorFk INT) +BEGIN + + /* Devuelve la lista de ubicaciones para itemFk en ese sector. Se utiliza en la preparación previa. + * Este proc se llama a continuacion de ticketToPrePrepare + * + * @param vItemFk Identificador de vn.item + * @param vSectorFk Identificador de vn.sector + */ + + DECLARE vWarehouseAliasFk INT; + + SELECT w.aliasFk INTO vWarehouseAliasFk + FROM vn.sector s + JOIN vn.warehouse w ON w.id = s.warehouseFk + WHERE s.id = vSectorFk; + + SELECT ish.shelvingFk shelving, + p.code parking, + sum(ish.visible) as stockTotal, + ish.created, + p.pickingOrder + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + AND ish.visible > 0 + AND ish.itemFk = vItemFk + GROUP BY ish.id + ORDER BY sh.priority 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 `itemPlacementUpdateVisible` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemPlacementUpdateVisible`() +BEGIN +/** + * Reemplaza únicamente el campo itemPlacement.pickable + * de los articulos de la tabla temporal tmp.itemPlacement(itemFk) + * restando al cache.visible los valores de las tablas + * itemShelving y los tickets con estado impreso + * que aun no han sido preparados. + */ + DECLARE vCalc INT; + DECLARE vTodayIni DATE DEFAULT CURDATE(); + DECLARE vTodayEnd DATETIME DEFAULT util.dayend(vTodayIni); + DECLARE vproductionOrderPrinted INT DEFAULT 4; + DECLARE vWarehouseSillaFv INT DEFAULT 1; + + UPDATE itemPlacement SET pickable = 0; + + CALL cache.visible_refresh(vCalc, FALSE, vWarehouseSillaFv); +SELECT * FROM cache.visible v; + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelving; + CREATE TEMPORARY TABLE tmp.itemShelving + SELECT its.itemFk, IFNULL(SUM(visible),0) visible + FROM itemShelving its + JOIN tmp.itemPlacement tip ON tip.itemFk = its.itemFk + GROUP BY its.itemFk; +SELECT * FROM tmp.itemShelving; + +SELECT s.itemFk, cast(SUM(s.quantity) AS UNSIGNED) visible + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id AND productionOrder = vproductionOrderPrinted + JOIN sale s ON s.ticketFk = t.id + JOIN tmp.itemPlacement tip ON tip.itemFk = s.itemFk + WHERE t.shipped BETWEEN vTodayIni AND vTodayEnd + GROUP BY s.itemFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT s.itemFk, cast(SUM(s.quantity) AS UNSIGNED) visible + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id AND productionOrder = vproductionOrderPrinted + JOIN sale s ON s.ticketFk = t.id + JOIN tmp.itemPlacement tip ON tip.itemFk = s.itemFk + WHERE t.shipped BETWEEN vTodayIni AND vTodayEnd + GROUP BY s.itemFk; +SELECT * FROM tmp.ticket; + +SELECT v.item_id, vWarehouseSillaFv, v.visible - IFNULL(tis.visible,0) - IFNULL(tik.visible,0) + FROM cache.visible v + LEFT JOIN tmp.itemShelving tis ON tis.itemFk = v.item_id + LEFT JOIN tmp.ticket tik ON tik.itemFk = v.item_id + WHERE v.calc_id = vCalc; + + INSERT INTO itemPlacement(itemFk, warehouseFk, pickable) + SELECT v.item_id, vWarehouseSillaFv, v.visible - IFNULL(tis.visible,0) - IFNULL(tik.visible,0) + FROM cache.visible v + LEFT JOIN tmp.itemShelving tis ON tis.itemFk = v.item_id + LEFT JOIN tmp.ticket tik ON tik.itemFk = v.item_id + WHERE v.calc_id = vCalc + ON DUPLICATE KEY UPDATE pickable = VALUES(pickable); + + DROP TEMPORARY TABLE tmp.itemShelving; + DROP TEMPORARY TABLE 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 `itemProposal` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal`(vItemFk INT, vTicketFk INT,vShowType BOOL) +BEGIN + +/** + * Propone articulos disponible ordenado, con la cantidad de veces usado y segun sus caracteristicas + * + * @param vItemFk item id + * @param vTicketFk ticket id + * @param vShowType mostrar tipos + */ + + DECLARE vWarehouseFk INT; + DECLARE vShipped DATE; + DECLARE vCalcFk INT; + DECLARE vTypeFk INT; + + + DECLARE vTag1 VARCHAR(25); + DECLARE vTag5 VARCHAR(25); + DECLARE vTag6 VARCHAR(25); + DECLARE vTag7 VARCHAR(25); + DECLARE vTag8 VARCHAR(25); + + DECLARE vValue1 VARCHAR(50); + DECLARE vValue5 VARCHAR(50); + DECLARE vValue6 VARCHAR(50); + DECLARE vValue7 VARCHAR(50); + DECLARE vValue8 VARCHAR(50); + + SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped + FROM vn.ticket + WHERE id = vTicketFk; + + SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value + INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 + FROM vn.item i + LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 + LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + WHERE i.id = vItemFk; + + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); + + SELECT i.id itemFk, + i.longName, + i.subName, + i.tag5, + i.value5, + (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, + i.tag6, + i.value6, + (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, + i.tag7, + i.value7, + (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, + i.tag8, + i.value8, + (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, + a.available, + IFNULL(ip.counter,0) counter, + IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity + FROM vn.item i + JOIN cache.available a ON a.item_id = i.id + LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk + LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 + LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + WHERE a.calc_id = vCalcFk + AND available > 0 + AND IF(vShowType,i.typeFk = vTypeFk,true) + AND i.id != vItemFk + ORDER BY counter DESC, + (t1.name = vTag1 COLLATE utf8_general_ci) DESC, + (it1.value = vValue1 COLLATE utf8_general_ci) DESC, + (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, + (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, + (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, + (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, + (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, + (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, + (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, + (i.value8 = vValue8 COLLATE utf8_general_ci) 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 `itemProposal_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal_Add`(vSaleFk INT, vMateFk INT, vQuantity INT) +BEGIN +/** + * Añade un nuevo articulo para sustituir a otro, y actualiza la memoria de sustituciones. + * + * @param vSaleFk id de la tabla sale + * @param vMateFk articulo sustituto + * @ param vQuantity cantidad que se va a sustituir + */ + DECLARE vTicketFk INT; + DECLARE vItemFk INT; + DECLARE vWarehouseFk SMALLINT; + DECLARE vDate DATE; + DECLARE vGrouping INT; + DECLARE vBox INT; + DECLARE vPacking INT; + DECLARE vRoundQuantity INT DEFAULT 1; + + SELECT s.ticketFk, LEAST(s.quantity, vQuantity), s.itemFk,t.shipped,t.warehouseFk + INTO vTicketFk, vQuantity, vItemFk,vDate,vWarehouseFk + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + WHERE s.id = vSaleFk; + + UPDATE vn.sale + SET quantity = quantity - vQuantity + WHERE id = vSaleFk; + + CALL vn.buyUltimate(vWarehouseFk, vDate); + + SELECT `grouping`, groupingMode, packing + INTO vGrouping,vBox,vPacking + FROM buy b + JOIN tmp.buyUltimate tmp ON b.id = tmp.buyFk + WHERE tmp.itemFk = vMateFk AND tmp.WarehouseFk = vWarehouseFk; + + IF vBox = 2 AND vPacking > 0 THEN + SET vRoundQuantity = vPacking; + END IF; + IF vBox = 1 AND vGrouping > 0 THEN + SET vRoundQuantity = vGrouping; + END IF; + + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept) + SELECT vTicketFk, vMateFk, CEIL(vQuantity / vRoundQuantity) * vRoundQuantity, CONCAT('+ ',i.longName) + FROM vn.item i + WHERE id = vMateFk; + + SELECT LAST_INSERT_ID() INTO vSaleFk; + + CALL vn.sale_calculateComponent(vSaleFk, NULL); + + INSERT INTO vn.itemProposal(itemFk, mateFk, counter) + VALUES(vItemFk, vMateFk, 1) + ON DUPLICATE KEY UPDATE counter = counter + 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 `itemProposal_beta` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal_beta`(vItemFk INT, vTicketFk INT) +BEGIN + + DECLARE vWarehouseFk INT; + DECLARE vShipped DATE; + DECLARE vCalcFk INT; + DECLARE vTypeFk INT; + DECLARE vResultsMax INT DEFAULT 10; + + DECLARE vTag1 VARCHAR(25); + DECLARE vTag5 VARCHAR(25); + DECLARE vTag6 VARCHAR(25); + DECLARE vTag7 VARCHAR(25); + DECLARE vTag8 VARCHAR(25); + + DECLARE vValue1 VARCHAR(50); + DECLARE vValue5 VARCHAR(50); + DECLARE vValue6 VARCHAR(50); + DECLARE vValue7 VARCHAR(50); + DECLARE vValue8 VARCHAR(50); + + SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped + FROM vn.ticket + WHERE id = vTicketFk; + + SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value + INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 + FROM vn.item i + LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 + LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + WHERE i.id = vItemFk; + + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); + + SELECT i.id itemFk, + i.longName, + i.subName, + i.tag5, + i.value5, + (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, + i.tag6, + i.value6, + (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, + i.tag7, + i.value7, + (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, + i.tag8, + i.value8, + (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, + a.available, + IFNULL(ip.counter,0) counter + FROM vn.item i + JOIN cache.available a ON a.item_id = i.id + LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk + LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 + LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + WHERE a.calc_id = vCalcFk + AND available > 0 + AND i.typeFk = vTypeFk + AND i.id != vItemFk + ORDER BY counter DESC, + (t1.name = vTag1 COLLATE utf8_general_ci) DESC, + (it1.value = vValue1 COLLATE utf8_general_ci) DESC, + (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, + (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, + (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, + (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, + (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, + (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, + (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, + (i.value8 = vValue8 COLLATE utf8_general_ci) DESC + LIMIT vResultsMax; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemProposal__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal__`(vItemFk INT, vTicketFk INT) +BEGIN + + DECLARE vWarehouseFk INT; + DECLARE vShipped DATE; + DECLARE vCalcFk INT; + DECLARE vTypeFk INT; + DECLARE vResultsMax INT DEFAULT 10; + + DECLARE vTag5 VARCHAR(25); + DECLARE vTag6 VARCHAR(25); + DECLARE vTag7 VARCHAR(25); + DECLARE vTag8 VARCHAR(25); + + DECLARE vValue5 VARCHAR(50); + DECLARE vValue6 VARCHAR(50); + DECLARE vValue7 VARCHAR(50); + DECLARE vValue8 VARCHAR(50); + + SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped + FROM vn.ticket + WHERE id = vTicketFk; + + SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8 + INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8 + FROM vn.item i + LEFT JOIN vn.tag t5 ON t5.name = i.tag5 COLLATE utf8_general_ci + LEFT JOIN vn.tag t6 ON t6.name = i.tag6 COLLATE utf8_general_ci + LEFT JOIN vn.tag t7 ON t7.name = i.tag7 COLLATE utf8_general_ci + LEFT JOIN vn.tag t8 ON t8.name = i.tag8 COLLATE utf8_general_ci + WHERE i.id = vItemFk; + + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); + + SELECT i.id itemFk, + i.longName, + i.subName, + i.tag5, + i.value5, + (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, + i.tag6, + i.value6, + (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, + i.tag7, + i.value7, + (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, + i.tag8, + i.value8, + (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, + a.available, + IFNULL(ip.counter,0) counter + FROM vn.item i + JOIN cache.available a ON a.item_id = i.id + LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk + WHERE a.calc_id = vCalcFk + AND available > 0 + AND i.typeFk = vTypeFk + AND i.id != vItemFk + ORDER BY counter DESC, + (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, + (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, + (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, + (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, + (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, + (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, + (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, + (i.value8 = vValue8 COLLATE utf8_general_ci) DESC + LIMIT vResultsMax; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemProposal__2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemProposal__2`(vItemFk INT, vTicketFk INT) +BEGIN + + DECLARE vWarehouseFk INT; + DECLARE vShipped DATE; + DECLARE vCalcFk INT; + DECLARE vTypeFk INT; + DECLARE vResultsMax INT DEFAULT 10; + + DECLARE vTag1 VARCHAR(25); + DECLARE vTag5 VARCHAR(25); + DECLARE vTag6 VARCHAR(25); + DECLARE vTag7 VARCHAR(25); + DECLARE vTag8 VARCHAR(25); + + DECLARE vValue1 VARCHAR(50); + DECLARE vValue5 VARCHAR(50); + DECLARE vValue6 VARCHAR(50); + DECLARE vValue7 VARCHAR(50); + DECLARE vValue8 VARCHAR(50); + + SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped + FROM vn.ticket + WHERE id = vTicketFk; + + SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value + INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 + FROM vn.item i + LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 + LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + WHERE i.id = vItemFk; + + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped); + + SELECT i.id itemFk, + i.longName, + i.subName, + i.tag5, + i.value5, + (i.value5 <=> vValue5 COLLATE utf8_general_ci) match5, + i.tag6, + i.value6, + (i.value6 <=> vValue6 COLLATE utf8_general_ci) match6, + i.tag7, + i.value7, + (i.value7 <=> vValue7 COLLATE utf8_general_ci) match7, + i.tag8, + i.value8, + (i.value8 <=> vValue8 COLLATE utf8_general_ci) match8, + a.available, + IFNULL(ip.counter,0) counter + FROM vn.item i + JOIN cache.available a ON a.item_id = i.id + LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk + LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 + LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + WHERE a.calc_id = vCalcFk + AND available > 0 + AND i.typeFk = vTypeFk + AND i.id != vItemFk + ORDER BY counter DESC, + (t1.name = vTag1 COLLATE utf8_general_ci) DESC, + (it1.value = vValue1 COLLATE utf8_general_ci) DESC, + (i.tag5 = vTag5 COLLATE utf8_general_ci) DESC, + (i.value5 = vValue5 COLLATE utf8_general_ci) DESC, + (i.tag6 = vTag6 COLLATE utf8_general_ci) DESC, + (i.value6 = vValue6 COLLATE utf8_general_ci) DESC, + (i.tag7 = vTag7 COLLATE utf8_general_ci) DESC, + (i.value7 = vValue7 COLLATE utf8_general_ci) DESC, + (i.tag8 = vTag8 COLLATE utf8_general_ci) DESC, + (i.value8 = vValue8 COLLATE utf8_general_ci) DESC + LIMIT vResultsMax; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemRefreshTags` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemRefreshTags`(IN vItem INT) +BEGIN +/** + * Crea la tabla temporal necesaria para el procedimiento item_refreshTags + * + * @param vItem Articulo a modificar + * @param temporary table tmp.item(id) del articulo + **/ + DROP TEMPORARY TABLE IF EXISTS tmp.item; + + CREATE TEMPORARY TABLE tmp.item + SELECT vItem id; + + CALL item_refreshTags(); + + DROP TEMPORARY TABLE 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 `itemSale_byWeek` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSale_byWeek`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT) +BEGIN + + DECLARE vStarted DATE; + DECLARE vEnded DATETIME; + + SELECT MIN(dated), util.dayEnd(MAX(dated)) INTO vStarted, vEnded + FROM `time` t + WHERE CONCAT(vYear, LPAD(vWeek, 2, 0)) = t.period; + + SELECT t.shipped, + w.name warehouse, + s.ticketFk, + c.quality, + t.nickname client, + am.name agencyName, + wk.code salesPerson, + s.itemFk, + IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept, + s.quantity, + s.price, + s.priceFixed, + s.discount, + tls.name stateName, + sb.buyFk, + s.id saleFk, + wk.id salesPersonFk + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN warehouse w ON w.id = t.warehouseFk + JOIN address a ON a.id = t.addressFk + LEFT JOIN agencyMode am ON am.id = t.agencyModeFk + JOIN `client` c ON c.id = a.clientFk + LEFT JOIN worker wk ON wk.id = c.salesPersonFk + LEFT JOIN ticketLastState tls ON tls.ticketFk = t.id + LEFT JOIN saleBuy sb ON sb.saleFk = s.id + LEFT JOIN buy b ON b.id = sb.buyFk + LEFT JOIN item ig ON ig.id = b.itemOriginalFk + WHERE s.itemFk = vItemFk + AND t.shipped BETWEEN vStarted AND vEnded + AND IF(vWarehouseFk = 0, w.hasComission , t.warehouseFk = vWarehouseFk) + ORDER BY t.shipped, 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 `itemSale_byWeek__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSale_byWeek__`(vWeek INT, IN vYear INT, vItemFk INT, vWarehouseFk INT) +BEGIN + + DECLARE vStarted DATE; + DECLARE vEnded DATETIME; + + SELECT MIN(dated), util.dayEnd(MAX(dated)) INTO vStarted, vEnded + FROM vn.`time` t + WHERE CONCAT(vYear, vWeek) = t.period; + + SELECT + t.shipped, + w.name warehouse, + s.ticketFk, + c.quality, + t.nickname AS client, + am.name AS agencyName, + wk.code AS salesPerson, + s.itemFk, + IFNULL(CONCAT(ig.longName,' ',ig.`size`,' ',ig.subName), s.concept) AS concept, + s.quantity, + s.price, + s.priceFixed, + s.discount, + tls.name stateName, + sb.buyFk, + s.id saleFk, + wk.id salesPersonFk + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.address a ON a.id = t.addressFk + LEFT JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.client c ON c.id = a.clientFk + LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk + LEFT JOIN vn.ticketLastState tls ON tls.ticketFk = t.id + LEFT JOIN vn.saleBuy sb ON sb.saleFk = s.id + LEFT JOIN vn.buy b ON b.id = sb.buyFk + LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk + WHERE s.itemFk = vItemFk + AND t.shipped BETWEEN vStarted and vEnded + AND IF(vWarehouseFk = 0, w.hasComission , t.warehouseFk= vWarehouseFk) + ORDER BY t.shipped, 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 `itemSaveMin` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSaveMin`(min INT,vBarcode VARCHAR(22)) +BEGIN + + DECLARE vItemFk INT; + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + + UPDATE vn.item SET minimum = min WHERE id = vItemFk; + + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemSearchShelving` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemSearchShelving`(`vShelvingFk` VARCHAR(3)) +BEGIN + SELECT p.`column` AS col , p.`row` + FROM vn.shelving s + JOIN parking p ON s.parkingFk = p.id + WHERE s.`code` = vShelvingFk 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 `itemShelvingDelete` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingDelete`(vId INT) +BEGIN + + DELETE FROM vn.itemShelving WHERE id = vId; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingLog_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingLog_get`(vShelvingFk VARCHAR(10) ) +BEGIN + +/** + * Devuelve el log de los item en cada carro + * + * @param vShelvingFk Matrícula del carro + * + */ + + SELECT isl.itemShelvingFk, + isl.created, + isl.accion, + isl.itemFk, + isl.shelvingFk, + isl.quantity, + isl.visible, + isl.available, + isl.grouping, + isl.packing, + isl.stars, + item.longName, + item.size, + item.subName, + worker.code, + isl.accion + FROM item + JOIN itemShelvingLog isl ON item.id = isl.itemFk + JOIN worker ON isl.workerFk = worker.id + WHERE shelvingFk = vShelvingFk OR isl.itemFk = vShelvingFk + ORDER BY isl.created 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 `itemShelvingMakeFromDate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMakeFromDate`(IN `vShelvingFk` VARCHAR(8), IN `vBarcode` VARCHAR(22), IN `vShelve` VARCHAR(2), IN `vQuantity` INT, IN `vPackagingFk` VARCHAR(10), IN `vGrouping` INT, IN `vPacking` INT, IN `vWarehouseFk` INT, `vCreated` VARCHAR(22)) +BEGIN + + DECLARE vItemFk INT; + + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + + SELECT itemFk INTO vItemFk + FROM vn.buy b + WHERE b.id = vItemFk; + + IF (SELECT COUNT(*) FROM vn.shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN + + INSERT IGNORE INTO vn.parking(`code`) VALUES(vShelvingFk); + INSERT INTO vn.shelving(`code`, parkingFk) + SELECT vShelvingFk, id + FROM vn.parking + WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; + + END IF; + + IF (SELECT COUNT(*) FROM vn.itemShelving + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk + AND packing = vPacking) = 1 THEN + + UPDATE vn.itemShelving + SET visible = visible+vQuantity, + created = vCreated + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk + AND packing = vPacking; + + ELSE + CALL cache.last_buy_refresh(FALSE); + INSERT INTO itemShelving( itemFk, + shelvingFk, + shelve, + visible, + created, + `grouping`, + packing, + packagingFk) + SELECT vItemFk, + vShelvingFk, + vShelve, + vQuantity, + vCreated, + IF(vGrouping = 0, IFNULL(b.packing, vPacking), vGrouping) `grouping`, + IF(vPacking = 0, b.packing, vPacking) packing, + IF(vPackagingFk = '', b.packageFk, vPackagingFk) packaging + FROM vn.item i + LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + WHERE i.id = vItemFk; + 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 `itemShelvingMatch` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingMatch`(vEntryFk INT, vAllTravel BOOLEAN, vFromTimed DATETIME, vToTimed DATETIME) +BEGIN + + DECLARE vTravelFk INT; + + SELECT travelFk INTO vTravelFk + FROM entry + WHERE id = vEntryFk; + + SELECT i.id, i.longName, i.size, i.subName, b.stickers, ish.etiquetas, b.printed + FROM item i + JOIN ( + SELECT itemFk, sum(stickers) AS stickers, sum(printedStickers) as printed + FROM buy b + JOIN entry e ON e.id = b.entryFk + WHERE IF(vAllTravel , travelFk = vTravelFk, b.entryFk = vEntryFk) + GROUP BY itemFk + ) b ON b.itemFk = i.id + LEFT JOIN ( + SELECT itemFk, sum(cast(visible / packing AS DECIMAL(10,0))) AS etiquetas + FROM itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + LEFT JOIN parking pk ON pk.id = sh.parkingFk + WHERE ish.created BETWEEN vFromTimed AND vToTimed + GROUP BY itemFk + ) ish ON ish.itemFk = id + WHERE b.stickers OR ish.etiquetas; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingPlacementSupplyAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingPlacementSupplyAdd`(vItemShelvingFk INT, vItemPlacementSupplyFk INT, vQuantity INT) +BEGIN + + INSERT INTO vn.itemShelvingPlacementSupply( itemShelvingFk, + itemPlacementSupplyFk, + quantity, + userFk) + VALUES (vItemShelvingFk, + vItemPlacementSupplyFk, + vQuantity, + getUser()); + + UPDATE vn.itemShelving + SET visible = visible - vQuantity + WHERE id = vItemShelvingFk; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingProblem` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingProblem`(vSectorFk INT) +BEGIN + + DECLARE vVisibleCache INT; + DECLARE vWarehouseFk INT; + + SELECT warehouseFk INTO vWarehouseFk + FROM vn.sector + WHERE id = vSectorFk; + + CALL cache.visible_refresh (vVisibleCache, FALSE, vWarehouseFk); + + SELECT t.id as ticketFk, + CAST(s.quantity AS DECIMAL(10,0)) as Cantidad, + s.itemFk, + s.concept, + v.visible - GREATEST(0,iss.visible) + IFNULL(sub3.transit,0) as Nicho, + i.subName, + GREATEST(0,iss.visible - IFNULL(sub3.transit,0)) as Altillo, + s.id as saleFk, + IFNULL(sub3.transit,0) transit, + v.visible, s.isPicked, s.reserved, t.shipped, tst.productionOrder, mm.Id_Movimiento + FROM vn.ticket t + JOIN vn.ticketState tst ON tst.ticketFk = t.id + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN cache.visible v ON s.itemFk = v.item_id AND v.calc_id = vVisibleCache + LEFT JOIN vn2008.Movimientos_mark mm ON mm.Id_Movimiento = s.id AND mm.stateFk = 26 + JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id + LEFT JOIN + (SELECT itemFk, sum(saldo) as transit + FROM vn.itemPlacementSupplyList + WHERE saldo > 0 + AND sectorFk = vSectorFk + GROUP BY itemFk) sub3 ON sub3.itemFk = i.id + WHERE v.visible + IFNULL(sub3.transit,0) - GREATEST(0,iss.visible) < s.quantity + AND IFNULL(sub3.transit,0) < s.quantity + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND t.shipped BETWEEN CURDATE() AND MIDNIGHT(CURDATE()) + AND tst.isPreviousPreparable = TRUE + AND t.warehouseFk = vWarehouseFk + AND iss.sectorFk = vSectorFk + AND mm.Id_Movimiento IS NULL + ORDER BY itemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingRadar` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar`(vSectorFk INT) +proc:BEGIN + + DECLARE vCalcVisibleFk INT; + DECLARE vCalcAvailableFk INT; + DECLARE hasFatherSector BOOLEAN; + DECLARE vBuyerFk INT DEFAULT 0; + DECLARE vWarehouseFk INT DEFAULT 0; + DECLARE vSonSectorFk INT; + DECLARE vWorkerFk INT; + + SELECT s.workerFk + INTO vWorkerFk + FROM vn.sector s + WHERE s.id = vSectorFk; + + IF IFNULL(vWorkerFk,0) THEN + + CALL vn.itemShelvingRadar_Urgent(vWorkerFk); + LEAVE proc; + + end if; + + + SELECT w.id, s.warehouseFk INTO vBuyerFk, vWarehouseFk + FROM vn.worker w + JOIN vn.sector s ON s.code = w.code + WHERE s.id = vSectorFk; + + SELECT s.id INTO vSectorFk + FROM vn.sector s + WHERE s.warehouseFk = vWarehouseFk + AND s.isMain; + + + SELECT COUNT(*) INTO hasFatherSector + FROM vn.sector + WHERE sonFk = vSectorFk; + + SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk + FROM vn.sector + WHERE id = vSectorFk; + + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); + CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); + + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingRadar; + + IF hasFatherSector THEN + + CREATE TEMPORARY TABLE tmp.itemShelvingRadar + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT * FROM ( + SELECT iss.itemFk, + i.longName, + i.size, + i.subName producer, + IFNULL(a.available,0) available, + SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible,0), 0)) upstairs, + SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible,0), 0)) downstairs, + IF(it.isPackaging, null, IFNULL(v.visible,0)) as visible, + vSectorFk as sectorFk + + FROM vn.itemShelvingStock iss + JOIN vn.sector s ON s.id = iss.sectorFk + JOIN vn.item i on i.id = iss.itemFk + JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) + LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk + LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk + WHERE vSectorFk IN (iss.sectorFk, s.sonFk) + AND it.workerFk != 3366 + + GROUP BY iss.itemFk + + UNION ALL + + SELECT v.item_id, + i.longName, + i.size, + i.subName producer, + IFNULL(a.available,0) as available, + 0 upstairs, + 0 downstairs, + IF(it.isPackaging, NULL, v.visible) visible, + vSectorFk as sectorFk + FROM cache.visible v + JOIN vn.item i on i.id = v.item_id + JOIN vn.itemType it ON it.id = i.typeFk AND vBuyerFk IN (0,it.workerFk) + LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = v.item_id AND iss.warehouseFk = vWarehouseFk + LEFT JOIN cache.available a ON a.item_id = v.item_id AND a.calc_id = vCalcAvailableFk + WHERE v.calc_id = vCalcVisibleFk + AND iss.itemFk IS NULL + AND it.isInventory + ) sub GROUP BY itemFk; + + SELECT ishr.*, + CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) AS nicho, + CAST(downstairs - IFNULL(notPickedYed,0) AS DECIMAL(10,0)) as pendiente + FROM tmp.itemShelvingRadar ishr + JOIN vn.item i ON i.id = ishr.itemFk + LEFT JOIN (SELECT s.itemFk, sum(s.quantity) as notPickedYed + FROM vn.ticket t + JOIN vn.ticketStateToday tst ON tst.ticket = t.id + JOIN vn.sale s ON s.ticketFk = t.id + WHERE t.warehouseFk = vWarehouseFk + AND tst.alertLevel = 0 + GROUP BY s.itemFk + ) sub ON sub.itemFk = ishr.itemFk + ORDER BY i.typeFk, i.longName + ; + + + ELSE + + CREATE TEMPORARY TABLE tmp.itemShelvingRadar + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT iss.itemFk, + 0 `hour`, + 0 `minute`, + IFNULL(ip.`code`,'--') itemPlacementCode, + i.longName, + i.size, + i.subName producer, + i.upToDown, + IFNULL(a.available,0) available, + IFNULL(v.visible - iss.visible,0) dayEndVisible, + IFNULL(v.visible - iss.visible,0) firstNegative, + IFNULL(v.visible - iss.visible,0) itemPlacementVisible, + IFNULL(i.minimum * b.packing,0) itemPlacementSize, + ips.onTheWay, + iss.visible itemShelvingStock, + IFNULL(v.visible,0) visible, + b.isPickedOff, + iss.sectorFk + FROM vn.itemShelvingStock iss + JOIN vn.item i on i.id = iss.itemFk + LEFT JOIN vn.itemPlacement ip ON ip.itemFk = iss.itemFk AND ip.warehouseFk = vWarehouseFk + LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk AND lb.warehouse_id = vWarehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN cache.available a ON a.item_id = iss.itemFk AND a.calc_id = vCalcAvailableFk + LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk + LEFT JOIN (SELECT itemFk, sum(saldo) as onTheWay + FROM vn.itemPlacementSupplyList + WHERE saldo > 0 + GROUP BY itemFk + ) ips ON ips.itemFk = i.id + WHERE IFNULL(iss.sectorFk,0) IN (0, vSectorFk) + OR iss.sectorFk = vSectorFk; + /* + UPDATE tmp.itemShelvingRadar isr + JOIN vn.itemShelvingStock iss ON iss.itemFk = isr.itemFk + SET isr.dayEndVisible = isr.dayEndVisible + iss.visible, + isr.firstNegative = isr.firstNegative + iss.visible, + isr.itemPlacementVisible = isr.itemPlacementVisible + iss.visible + WHERE iss.sectorFk = vSonSectorFk; + */ + DROP TEMPORARY TABLE IF EXISTS tmp.itemOutTime; + CREATE TEMPORARY TABLE tmp.itemOutTime + SELECT *,SUM(amount) quantity + FROM + (SELECT item_id itemFk, + amount, + IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) as hours, + IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) as minutes + FROM vn2008.item_out io + JOIN tmp.itemShelvingRadar isr ON isr.itemFk = io.item_id + JOIN vn.ticket t on t.id= io.ticketFk + JOIN vn.ticketState ts on ts.ticketFk = io.ticketFk + JOIN vn.state s ON s.id = ts.stateFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN (SELECT DISTINCT saleFk + FROM vn.saleTracking st + WHERE st.created > CURDATE() + AND st.isChecked + ) stPrevious ON `stPrevious`.`saleFk` = io.saleFk + WHERE t.warehouseFk = vWarehouseFk + AND s.isPicked = 0 + AND NOT io.Reservado + AND stPrevious.saleFk IS NULL + AND io.dat >= CURDATE() + AND io.dat < CURDATE()+1 + ) sub + GROUP BY itemFk, hours, minutes; + + INSERT INTO tmp.itemShelvingRadar (itemFk) + SELECT itemFk FROM tmp.itemOutTime + ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity, + firstNegative = if (firstNegative < 0, firstNegative, firstNegative + quantity), + `hour` = ifnull(if (firstNegative > 0 , `hour`, hours),0), + `minute` = ifnull(if (firstNegative > 0, `minute`, minutes),0); +/* + UPDATE tmp.itemShelvingRadar + SET itemPlacementVisible = 0, + dayEndVisible = 0, + firstNegative = 0 + WHERE itemPlacementVisible = - itemShelvingStock; + */ + SELECT * FROM tmp.itemShelvingRadar; + + END IF; + + DROP TEMPORARY TABLE tmp.itemShelvingRadar; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingRadar_Entry` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Entry`(vEntryFk INT) +BEGIN + + DECLARE vWarehouseFk INT DEFAULT 1; + DECLARE vCalcVisibleFk INT; + DECLARE vCalcAvailableFk INT; + DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(CURDATE()); + + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); + CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); + + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + ENGINE = MEMORY + SELECT DISTINCT itemFk + FROM vn.buy + WHERE entryFk = vEntryFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.item2; + CREATE TEMPORARY TABLE tmp.item2 + ENGINE = MEMORY + SELECT * + FROM tmp.item; + + SELECT i.id as itemFk, + i.minimum, + CAST(IFNULL(v.visible,0) - IFNULL(iss.visible,0) AS DECIMAL(10,0)) as enNicho, + CAST(IFNULL(a.available,0) AS DECIMAL(10,0)) as disponible, + CAST(IFNULL(v.visible,0) - IFNULL(iss.visible,0) - ts.todaySold AS DECIMAL(10,0)) as finalDia + FROM vn.item i + JOIN tmp.item ti ON ti.itemFk = i.id + LEFT JOIN cache.visible v ON v.calc_id = vCalcVisibleFk AND v.item_id = i.id + LEFT JOIN cache.available a ON i.id = a.item_id AND a.calc_id = vCalcAvailableFk + LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id + LEFT JOIN ( SELECT s.itemFk, sum(s.quantity) as todaySold + FROM vn.sale s + JOIN tmp.item2 ti ON ti.itemFk = s.itemFk + JOIN vn.ticket t ON t.id = s.ticketFk + LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id + WHERE t.shipped BETWEEN CURDATE() AND vTodayDayEnd + AND t.warehouseFk = vWarehouseFk + AND IFNULL(tst.productionOrder,0) < 5 + GROUP BY s.itemFK + ) ts ON ts.itemFk = i.id; + + + DROP TEMPORARY TABLE tmp.item; + DROP TEMPORARY TABLE tmp.item2; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingRadar_Entry_State_beta` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Entry_State_beta`(vEntryFk INT) +BEGIN + + DECLARE vWarehouseFk INT DEFAULT 1; + DECLARE vCalcVisibleFk INT; + DECLARE vCalcAvailableFk INT; + DECLARE vTodayDayEnd DATETIME DEFAULT util.dayEnd(CURDATE()); + + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, 1); + CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, CURDATE()); + + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + ENGINE = MEMORY + SELECT DISTINCT itemFk + FROM vn.buy + WHERE entryFk = vEntryFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.item2; + CREATE TEMPORARY TABLE tmp.item2 + ENGINE = MEMORY + SELECT * + FROM tmp.item; + + SELECT i.id as itemFk, + CAST(IFNULL(iss.visible,0) - IFNULL(v.visible,0) AS DECIMAL(10,0)) as outShelving + FROM vn.item i + JOIN tmp.item ti ON ti.itemFk = i.id + LEFT JOIN cache.visible v ON v.calc_id = vCalcVisibleFk AND v.item_id = i.id + LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id; + + + DROP TEMPORARY TABLE tmp.item; + DROP TEMPORARY TABLE tmp.item2; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingRadar_Urgent` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingRadar_Urgent`() +BEGIN +/** + * Devuelve lo mismo que itemShelving_filterBuyer per sin filtrar + */ + DECLARE vCalcVisibleFk INT; + DECLARE vWarehouseFk INT DEFAULT 60; + + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); + + SELECT * FROM + (SELECT sub.itemFk, + sub.longName, + CONCAT(DATE_FORMAT(sub2.etd,'%H:%i'), ' salen ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, + sub.upstairs, + sub.downstairs, + sub.visible, + sub.sectorFk, + CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho, + sub2.etd + FROM (SELECT iss.itemFk, + CONCAT(i.longName,' ',i.size,' ',IFNULL(i.subName,'') ) longName, + '' size, + CONCAT(iss.parkingCode , ' ', iss.shelvingFk) producer, + 0 upstairs, + SUM(IFNULL(iss.visible,0)) downstairs, + IF(it.isPackaging, null, IFNULL(v.visible,0)) visible, + IFNULL(iss.sectorFk,0) sectorFk + FROM itemShelvingStock iss + JOIN sector s ON s.id = iss.sectorFk + JOIN item i on i.id = iss.itemFk + JOIN itemType it ON it.id = i.typeFk + LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = @vCalcVisibleFk + WHERE s.warehouseFk = vWarehouseFk + GROUP BY itemFk + ) sub LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente, MIN(zc.`hour`) etd + FROM sale s + LEFT JOIN saleTracking st ON st.saleFk = s.id + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk + JOIN client c on c.id = t.clientFk + JOIN clientType ct ON ct.id = c.clientTypeFk + WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND ISNULL(st.saleFk) + AND ct.code IN ('normal', 'trust') + GROUP BY s.itemFk + ) sub2 ON sub2.itemFk = sub.itemFk + UNION ALL + SELECT v.item_id , + i.longName, + CONCAT(DATE_FORMAT(sub5.etd,'%H:%i'), ' salen ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, + 0, + 0, + v.visible, + IFNULL(iss.sectorFk,0), + v.visible nicho, + sub5.etd + FROM cache.visible v + JOIN item i ON i.id = v.item_id + JOIN itemType it ON it.id = i.typeFk + LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id + LEFT JOIN (SELECT s.itemFk , SUM(s.quantity) pendiente, MIN(zc.`hour`) etd + FROM sale s + LEFT JOIN saleTracking st ON st.saleFk = s.id + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk + JOIN client c on c.id = t.clientFk + JOIN clientType ct ON ct.id = c.clientTypeFk + WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND ISNULL(st.saleFk) + AND ct.code IN ('normal', 'trust') + GROUP BY s.itemFk + ) sub5 ON sub5.itemFk = v.item_id + WHERE v.calc_id = @vCalcVisibleFk + AND ISNULL(iss.itemFk) + ) sub3 + WHERE nicho + ORDER BY LEFT(producer,3), etd, producer; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingSaleAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSaleAdd`(vItemShelvingFk INT, saleFk INT, vQuantity INT) +BEGIN + + IF saleFk <> 0 THEN + INSERT INTO vn.itemShelvingSale(itemShelvingFk, + saleFk, + quantity, + userFk) + VALUES (vItemShelvingFk, + saleFk, + vQuantity, + getUser()); + + END IF; + + UPDATE vn.itemShelving + SET visible = (visible - vQuantity) + WHERE id = vItemShelvingFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelvingSaleSupplyAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSaleSupplyAdd`(vItemShelvingFk INT, saleFk INT, vQuantity INT) +BEGIN +/** + * Añade línea a itemShelvingSale y regulariza el carro + * + * @param vItemShelvingFk Id itemShelving + * @param saleFk Id de sale + * @param vQuantity cantidad a regularizar + */ + INSERT INTO itemShelvingSale(itemShelvingFk, + saleFk, + quantity, + userFk) + VALUES (vItemShelvingFk, + saleFk, + vQuantity, + getUser()); + + UPDATE itemShelving + SET visible = visible - vQuantity + WHERE id = vItemShelvingFk; + + UPDATE vn2008.Movimientos_mark + SET valor = 1 + WHERE Id_Movimiento = saleFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `itemShelvingTransfer` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingTransfer`(vItemShelvingFk INT,shelvingFkD VARCHAR(22)) +BEGIN + + UPDATE vn.itemShelving + SET shelvingFk = shelvingFkD + WHERE id = vItemShelvingFk; + + SELECT 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 `itemShelving_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_add`(IN vShelvingFk VARCHAR(8), IN vBarcode VARCHAR(22), IN vShelve VARCHAR(2), IN vQuantity INT, IN vPackagingFk VARCHAR(10), IN vGrouping INT, IN vPacking INT, IN vWarehouseFk INT) +BEGIN + + +/** + * Añade registro o lo actualiza si ya existe. + * + * @param vShelvingFk matrícula del carro + * @param vBarcode el id del registro + * @param vShelve de itemshleving + * @param vQuantity indica la cantidad del producto + * @param vPackagingFk el packaging del producto en itemShelving, NULL para coger el de la ultima compra + * @param vGrouping el grouping del producto en itemShelving, NULL para coger el de la ultima compra + * @param vPacking el packing del producto, NULL para coger el de la ultima compra + * @param vWarehouseFk indica el sector + * + **/ + + DECLARE vItemFk INT; + + SELECT barcodeToItem(vBarcode) INTO vItemFk; + + IF (SELECT COUNT(*) FROM shelving WHERE code = vShelvingFk COLLATE utf8_unicode_ci) = 0 THEN + + INSERT IGNORE INTO parking(code) VALUES(vShelvingFk); + INSERT INTO shelving(code, parkingFk) + SELECT vShelvingFk, id + FROM parking + WHERE `code` = vShelvingFk COLLATE utf8_unicode_ci; + + END IF; + + IF (SELECT COUNT(*) FROM itemShelving + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk + AND itemFk = vItemFk + AND packing = vPacking) = 1 THEN + + UPDATE itemShelving + SET visible = visible+vQuantity + WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; + + ELSE + CALL cache.last_buy_refresh(FALSE); + INSERT INTO itemShelving( itemFk, + shelvingFk, + shelve, + visible, + grouping, + packing, + packagingFk) + + SELECT vItemFk, + vShelvingFk, + vShelve, + vQuantity, + IFNULL(vGrouping, b.grouping), + IFNULL(vPacking, b.packing), + IFNULL(vPackagingFk, b.packageFk) + FROM item i + LEFT JOIN cache.last_buy lb ON i.id = lb.item_id AND lb.warehouse_id = vWarehouseFk + LEFT JOIN buy b ON b.id = lb.buy_id + WHERE i.id = vItemFk; + 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 `itemShelving_addByClaim` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_addByClaim`(vClaimFk INT, vShelvingFk VARCHAR(3)) +BEGIN +/** + * Insert items of claim into itemShelving. + * + * @param vClaimFk The claim + * @param vShelvingFk The shelving + * @table tmp.buyUltimate + */ + DECLARE vWarehouseFk INT; + + SELECT t.warehouseFk INTO vWarehouseFk + FROM claim c + JOIN ticket t ON t.id = c.ticketFk + WHERE c.id = vClaimFk; + + CALL buyUltimate (vWarehouseFk, CURDATE()); + + INSERT INTO itemShelving (itemFk, shelvingFk, packing, `grouping`, visible) + SELECT s.itemFk, vShelvingFk, b.packing, b.`grouping`, cb.quantity AS visible + FROM claim c + JOIN claimBeginning cb ON c.id = cb.claimFk + JOIN sale s ON s.id = cb.saleFk + JOIN ticket t ON t.id = s.ticketFk + JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk AND bu.warehouseFk = t.warehouseFk + JOIN buy b ON b.id = bu.buyFk + WHERE c.id = vClaimFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelving_BuyerGet` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_BuyerGet`( ) +BEGIN + + SELECT * FROM vn.buyer; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelving_BuyerTask` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_BuyerTask`(vWorkerFk INT ) +BEGIN + + SELECT ish.id, + ish.itemFk, + i.longName, + i.image, + p.code as parking, + ish.shelvingFk, + ish.visible, + ish.created, + ish.stars + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + WHERE s.warehouseFk = 1 + AND it.workerFk = vWorkerFk + AND ish.stars IS NULL + ORDER BY p.pickingOrder; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelving_filterBuyer` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_filterBuyer`(vBuyerFk INT, vWarehouseFk INT) +proc:BEGIN +/** + * Lista de articulos filtrados por comprador + * + * @param vBuyerFk Comprador a filtrar + * @param vWarehouseFk Warehouse + * @return Lista de articulos + */ + DECLARE vCalcVisibleFk INT; + + IF vBuyerFk = 103 THEN -- hay que arreglarlo despues de la campaña PAK 23/04/2022 + CALL vn.itemShelvingRadar_Urgent(); + LEAVE proc; + END IF; + + CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk); + + SELECT * FROM + (SELECT sub.itemFk, + sub.longName, + CONCAT('Hoy saldrán ', CAST(sub2.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT(IF(sub2.itemFk, IF(sub2.pendiente > (sub.upstairs + sub.downstairs),'(1) ','(2) '),'(3) ' ),sub.producer) producer, + sub.upstairs, + sub.downstairs, + sub.visible, + sub.sectorFk, + CAST(visible - upstairs - downstairs AS DECIMAL(10,0)) nicho + FROM (SELECT iss.itemFk, + CONCAT(i.longName,' ',i.size,' ',IFNULL(i.subName,'') ) longName, + '' size, + CONCAT(iss.parkingCode , ' ', iss.shelvingFk) producer, + 0 upstairs, + SUM(IFNULL(iss.visible,0)) downstairs, + IF(it.isPackaging, null, IFNULL(v.visible,0)) visible, + IFNULL(iss.sectorFk,0) sectorFk + FROM itemShelvingStock iss + JOIN sector s ON s.id = iss.sectorFk + JOIN item i on i.id = iss.itemFk + JOIN itemType it ON it.id = i.typeFk + LEFT JOIN cache.visible v ON v.item_id = iss.itemFk AND v.calc_id = vCalcVisibleFk + WHERE s.warehouseFk = vWarehouseFk + AND it.workerFk = vBuyerFk + GROUP BY itemFk + ) sub LEFT JOIN (SELECT s.itemFk, SUM(s.quantity) pendiente + FROM sale s + LEFT JOIN saleTracking st ON st.saleFk = s.id + JOIN ticket t ON t.id = s.ticketFk + JOIN client c on c.id = t.clientFk + JOIN clientType ct ON ct.id = c.clientTypeFk + WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND ISNULL(st.saleFk) + AND ct.code IN ('normal', 'trust') + GROUP BY s.itemFk + ) sub2 ON sub2.itemFk = sub.itemFk + UNION ALL + SELECT v.item_id , + i.longName, + CONCAT('Hoy saldrán ', CAST(sub5.pendiente AS DECIMAL(10,0)), ' unidades.') `size`, + CONCAT(IF(sub5.pendiente,'(0) ','(3) ')) producer, + 0, + 0, + v.visible, + IFNULL(iss.sectorFk,0), + v.visible nicho + FROM cache.visible v + JOIN item i ON i.id = v.item_id + JOIN itemType it ON it.id = i.typeFk + LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id + LEFT JOIN (SELECT s.itemFk , SUM(s.quantity) pendiente + FROM sale s + LEFT JOIN saleTracking st ON st.saleFk = s.id + JOIN ticket t ON t.id = s.ticketFk + JOIN client c on c.id = t.clientFk + JOIN clientType ct ON ct.id = c.clientTypeFk + WHERE t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND ISNULL(st.saleFk) + AND ct.code IN ('normal', 'trust') + GROUP BY s.itemFk + ) sub5 ON sub5.itemFk = v.item_id + WHERE v.calc_id = vCalcVisibleFk + AND ISNULL(iss.itemFk) + AND it.workerFk = vBuyerFk + ) sub3 + WHERE nicho + ORDER BY producer; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelving_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_get`(IN vShelvingFk VARCHAR(8)) +BEGIN +/** + * Lista artículos de itemshelving + * + * @param vShelvingFk matrícula del carro + * + **/ + + SELECT ish.itemFk as item, + IFNULL(i.longName, CONCAT(i.name, ' ', i.size)) as description, + ish.visible as visible, + ceil(ish.visible/ish.packing) as stickers, + ish.packing as packing, + ish.grouping, + IF (p.column IS NULL, "", p.column) as col, + IF (p.row IS NULL, "", p.row) as row, + IF (p.code IS NULL, "", p.code) as code, + ish.id, + s.priority + FROM itemShelving ish + JOIN item i ON i.id = ish.itemFk + INNER JOIN shelving s ON vShelvingFk = s.code COLLATE utf8_unicode_ci + LEFT JOIN parking p ON s.parkingFk = p.id + WHERE ish.shelvingFk COLLATE utf8_unicode_ci = vShelvingFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelving_getInfo` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getInfo`(vItemFk VARCHAR(22)) +BEGIN +/** + * Muestra información realtiva a la ubicación de un item + * + * @param vItemFk Id del item + */ + SELECT vn.barcodeToItem(vItemFk) + INTO vItemFk; + + SELECT pk.code Parking, + sh.code Matricula, + ish.visible visible, + ish.created created, + ish.itemFk itemFk, + sh.priority + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.`code` = ish.shelvingFk + JOIN vn.parking pk ON pk.id = sh.parkingFk + WHERE ish.itemFk = vItemFk + ORDER BY sh.priority DESC, created ASC; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelving_getSaleDate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_getSaleDate`(vShelvingFk VARCHAR(3)) +BEGIN + + /* Devuelve la minima fecha en que se necesita cada producto en esa matricula. + * + * @param vShelvingFk Matrícula del carro o pallet + */ + + DECLARE vWarehouseFk INT; + + SELECT warehouseFk INTO vWarehouseFk + FROM shelving s + JOIN parking p ON s.parkingFk = p.id + JOIN sector st ON st.id = p.sectorFk + WHERE s.code = vShelvingFk COLLATE utf8_unicode_ci; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemShelvingDistinct; + CREATE TEMPORARY TABLE tmp.itemShelvingDistinct + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT itemFk, SUM(visible) visible + FROM vn.itemShelving + WHERE shelvingFk = vShelvingFk COLLATE utf8_unicode_ci + GROUP BY itemFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT * FROM tmp.itemShelvingDistinct; + + DROP TEMPORARY TABLE IF EXISTS tmp.stockByDay; + CREATE TEMPORARY TABLE tmp.stockByDay + (index (itemFk, dated)) + ENGINE = MEMORY + SELECT t3.amount, dated, + @stock := IF(@itemFk = t3.itemFk, @stock + t3.amount, t3.amount) stock, + @itemFk := t3.itemFk itemFk + FROM ( + SELECT * FROM ( + SELECT t2.* FROM ( + SELECT item_id itemFk, amount, CURDATE() dated + FROM cache.stock + WHERE warehouse_id = vWarehouseFk + UNION ALL + SELECT ish.itemFk, - sum(visible), CURDATE() + FROM vn.itemShelving ish + JOIN shelving sh ON sh.code = ish.shelvingFk + JOIN parking p ON sh.parkingFk = p.id + JOIN sector s ON s.id = p.sectorFk + WHERE s.isReserve + GROUP BY ish.itemFk + UNION ALL + SELECT item_id, sum(iei.amount), dat + FROM vn2008.item_entry_in iei + WHERE dat >= CURDATE() + AND warehouse_id = vWarehouseFk + AND isVirtualStock = FALSE + GROUP BY item_id, dat + UNION ALL + SELECT item_id, sum(ieo.amount), dat + FROM vn2008.item_entry_out ieo + WHERE dat >= CURDATE() + AND warehouse_id = vWarehouseFk + GROUP BY item_id, dat + UNION ALL + SELECT i.itemFk, sum(io.amount), dat + FROM vn2008.item_out io + JOIN tmp.item i ON i.itemFk = io.item_id + WHERE io.dat >= CURDATE() + AND io.warehouse_id = vWarehouseFk + GROUP BY io.item_id, io.dat + ) t2 + JOIN tmp.itemShelvingDistinct ish ON ish.itemFk = t2.itemFk) t + order by t.itemFk, DATE(t.dated), t.amount DESC) t3; + + SELECT sbd.itemFk, i.longName, DATE(dated) dated, ish.visible amount, sbd.stock + FROM tmp.stockByDay sbd + JOIN vn.item i ON i.id = sbd.itemFk + JOIN tmp.itemShelvingDistinct ish ON ish.itemFk = sbd.itemFk + WHERE ish.visible >= sbd.stock + GROUP BY itemFk + ORDER BY dated; + + DROP TEMPORARY TABLE tmp.stockByDay, + tmp.itemShelvingDistinct, + 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 `itemShelving_inventory` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_inventory`(vParkingFromFk INT, vParkingToFk INT) +BEGIN + + /** + * Devuelve un listado de ubicaciones a revisar + * + * @param vParkingFromFk Parking de partida, identificador de vn.parking + * @param vParkingToFk Parking de llegada, identificador de vn.parking + */ + + DECLARE vSectorFk INT; + DECLARE vPickingOrderFrom INT; + DECLARE vPickingOrderTo INT; + + SELECT p.sectorFk, p.pickingOrder INTO vSectorFk, vPickingOrderFrom + FROM vn.parking p + WHERE p.id = vParkingFromFk; + + SELECT p.pickingOrder INTO vPickingOrderTo + FROM vn.parking p + WHERE p.id = vParkingToFk; + + CALL vn.visible_getMisfit(vSectorFk); + + SELECT p.code parking , + ish.shelvingFk , + ish.itemFk, + i.longName, + ish.visible , + ish.visible / ish.packing packs, + ish.packing, + sm.visible - sm.parked faltan + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo + AND p.sectorFk = vSectorFk + ORDER BY p.pickingOrder ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelving_StarsUpdate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_StarsUpdate`(vId INT, vStars INT) +BEGIN + + UPDATE vn.itemShelving + SET stars = vStars + WHERE id = vId; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemShelving_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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_update`(vVisible INT, vPacking INT, vShelf INT ,vGrouping INT ) +BEGIN +/** + * Actualiza itemShelving. + * + * @param vVisible la cantidad visible del registro a actualizar + * @param vShelf el id del registro a actualizar + * @param vPacking el packing del del producto en itemShelving + * @param vGrouping el grouping del producto en itemShelving + */ + UPDATE itemShelving + SET visible = vVisible, + packing = vPacking, + grouping = vGrouping + WHERE id = vShelf; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemStock` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemStock`(vWarehouseFk SMALLINT, vDated DATETIME, vItemFk INT) +BEGIN +/** + * Calcula el stock del vWarehouseFk desde FechaInventario hasta vDated + * @param vWarehouse warehouse id + * @param vDated max date to filter + * @param vItemFk item id + **/ + + + DECLARE vIsLogifloraDay BOOLEAN; + + SET vDated = TIMESTAMP(DATE(vDated), '00:00:00'); + + SELECT vn.isLogifloraDay(vDated, vWarehouseFk) INTO vIsLogifloraDay ; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemList; + CREATE TEMPORARY TABLE tmp.itemList + (UNIQUE INDEX i USING HASH (itemFk)) + ENGINE = MEMORY + SELECT itemFk, SUM(quantity) stock, SUM(quantity) visible, SUM(quantity) available FROM ( + SELECT itemFk, quantity + FROM itemTicketOut + WHERE shipped >= CURDATE() AND shipped < vDated + AND warehouseFk = vWarehouseFk + AND (vItemFk IS NULL OR itemFk = vItemFk) + UNION ALL + SELECT itemFk, quantity + FROM itemEntryIn i + LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk + WHERE i.landed >= CURDATE() AND i.landed < vDated + AND i.warehouseInFk = vWarehouseFk + AND (vItemFk IS NULL OR i.itemFk = vItemFk) + AND (ISNULL(wf.entryFk) OR vIsLogifloraDay) + UNION ALL + SELECT itemFk, quantity + FROM itemEntryOut + WHERE shipped >= CURDATE() AND shipped < vDated + AND warehouseOutFk = vWarehouseFk + AND (vItemFk IS NULL OR itemFk = vItemFk) + ) t + GROUP BY itemFk HAVING stock != 0; + + CALL `cache`.stock_refresh (FALSE); + + INSERT INTO tmp.itemList (itemFk,stock,visible,available) + SELECT item_id,amount,amount,amount + FROM `cache`.stock + WHERE warehouse_id = vWarehouseFk AND (vItemFk IS NULL OR vItemFk = item_id) + ON DUPLICATE KEY UPDATE + stock = stock + VALUES(stock), + visible = visible + VALUES(visible), + available = available + VALUES(available); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemStockUpdate__` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `itemStockUpdate__`( + vItemFk INT, + vWarehouseFk INT, + vNewVisible INT, + vIsTrash BOOLEAN) +BEGIN + + DECLARE vTicketFk INT; + DECLARE vClientFk INT; + DECLARE vCompanyVnlFk INT DEFAULT 442; + DECLARE vVisible INT DEFAULT 0; + DECLARE vCalc INT; + DECLARE vParkedStuff INT; + + SELECT barcodeToItem(vItemFk) INTO vItemFk; + + CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); + + SELECT IFNULL(visible,0) INTO vVisible + FROM cache.visible + WHERE calc_id = vCalc + AND item_id = vItemFk; + + SELECT sum(visible) INTO vParkedStuff + FROM itemShelvingStock + WHERE warehouseFk = vWarehouseFk + AND itemFk = vItemFk; + + SET vNewVisible = vNewVisible + IFNULL(vParkedStuff,0); + + SELECT IF(vIsTrash, 200, 400) INTO vClientFk; + + SELECT t.id INTO vTicketFk + FROM ticket t + JOIN address a ON a.id=t.addressFk + WHERE t.warehouseFk = vWarehouseFk + AND t.clientFk = vClientFk + AND DATE(t.shipped) = CURDATE() + AND a.isDefaultAddress + LIMIT 1; + + IF vTicketFk IS NULL THEN + + CALL ticket_add( + vClientFk, + CURDATE(), + vWarehouseFk, + vCompanyVnlFk, + NULL, + NULL, + NULL, + CURDATE(), + account.userGetId(), + FALSE, + vTicketFk); + + END IF; + + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) + SELECT vTicketFk, vItemFk, CONCAT(longName,' ', getWorkerCode(), ' ',LEFT(CAST(NOW() AS TIME),5)), vVisible - vNewVisible, 0, 0 + FROM item + WHERE id = vItemFk; + + UPDATE cache.visible + SET visible = vNewVisible + WHERE calc_id = vCalc + AND item_id = vItemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemTagMake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagMake`(vItemFk INT) +BEGIN + +/* * Crea los tags usando la tabla plantilla itemTag + * y si no existe a partir de la ficha del artículo. + * @param vItemFk El item al que se le añaden los tags +*/ + DECLARE vInk VARCHAR(50); + DECLARE vSize INTEGER; + DECLARE vCategory VARCHAR(3); + DECLARE vProducer VARCHAR(50); + DECLARE vOrigin VARCHAR(20); + DECLARE vTypeFk INTEGER; + + DELETE FROM itemTag + WHERE itemFk = vItemFk; + + SELECT typeFk INTO vTypeFk + FROM item + WHERE id = vItemFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT vItemFk, itt.tagFk, NULL, itt.priority + FROM itemTag it + LEFT JOIN itemTypeTag itt ON itt.itemTypeFk = vTypeFk + WHERE it.itemFk = vItemFk; + + IF (SELECT COUNT(*) FROM itemTag WHERE itemFk = vItemFk LIMIT 1) = 0 THEN + + SELECT ik.name, i.size, i.category, p.name, o.name + INTO vInk, vSize, vCategory, vProducer, vOrigin + FROM item i + LEFT JOIN ink ik ON ik.id = i.inkFk + LEFT JOIN producer p ON p.id = i.producerFk AND p.isVisible + LEFT JOIN origin o ON o.id = i.originFk + WHERE i.id = vItemFk; + + INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) + VALUES(vItemFk, 1, vInk, 1); + + INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) + VALUES (vItemFk, 8, vSize, 2); + + INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) + VALUES(vItemFk, 47, vCategory, 3); + + INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) + VALUES(vItemFk, 37, vProducer, 4); + + INSERT IGNORE INTO itemTag(itemFk, tagFk, value, priority) + VALUES(vItemFk, 35, vOrigin, 5); + 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 `itemTagReorder` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `itemTagReorder`(itemTypeFk INT) +BEGIN + + SET @isTriggerDisabled = TRUE; + + -- No se puede usar temporary porque da error Error Code: 1137. No puedo reabrir tabla: 'i + DROP TABLE IF EXISTS tmp.item; + CREATE TABLE tmp.item + SELECT DISTINCT i.id + FROM vn.item i + WHERE i.typeFk = itemTypeFk; + + UPDATE itemTag it + JOIN tmp.item i ON i.id = it.itemFk + JOIN vn.item ON item.id = i.id + JOIN itemTypeTag itt ON itt.itemTypeFk = item.typeFk AND itt.tagFk = it.tagFk + SET it.priority = itt.priority + WHERE itt.itemTypeFk = itemTypeFk; + + CALL item_refreshTags(); + + SET @isTriggerDisabled = FALSE; + + DROP TABLE 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 `itemTagReorderByName` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorderByName`(vName VARCHAR(255)) +BEGIN + + SET @isTriggerDisabled = TRUE; + + -- No se puede usar temporary porque da error Error Code: 1137. No puedo reabrir tabla: 'i + DROP TABLE IF EXISTS tmp.item; + CREATE TABLE tmp.item + SELECT DISTINCT i.id + FROM vn.item i + WHERE i.`name` LIKE CONCAT(vName,'%'); + + UPDATE itemTag it + JOIN tmp.item i ON i.id = it.itemFk + JOIN vn.item ON item.id = i.id + JOIN itemTypeTag itt ON itt.itemTypeFk = item.typeFk AND itt.tagFk = it.tagFk + SET it.priority = itt.priority + WHERE itt.itemTypeFk = itemTypeFk; + + CALL item_refreshTags(); + + SET @isTriggerDisabled = FALSE; + + DROP TABLE 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 `itemTagReorderByName__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorderByName__`(vName VARCHAR(255)) +BEGIN + +DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vItem INT; + + DECLARE cur CURSOR FOR + SELECT id + FROM upda; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SET @isTriggerDisabled = TRUE; + + DROP TEMPORARY TABLE IF EXISTS upda; + CREATE TEMPORARY TABLE upda + SELECT DISTINCT i.id + FROM vn.item i + WHERE i.name LIKE CONCAT(vName,'%'); + + UPDATE itemTag it + JOIN item i ON i.id = it.itemFk + JOIN itemTypeTag itt ON itt.itemTypeFk = i.typeFk AND itt.tagFk = it.tagFk + SET it.priority = itt.priority + WHERE itt.itemTypeFk = itemTypeFk; + + OPEN cur; + proc: LOOP + SET vDone = FALSE; + FETCH cur INTO vItem; + IF vDone THEN + LEAVE proc; + END IF; + CALL vn.itemRefreshTags(vItem); + END LOOP; + CLOSE cur; + SET @isTriggerDisabled = 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 `itemTagReorder__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReorder__`(itemTypeFk INT) +BEGIN + +DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vItem INT; + + DECLARE cur CURSOR FOR + SELECT id + FROM upda; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SET @isTriggerDisabled = TRUE; + + DROP TEMPORARY TABLE IF EXISTS upda; + create temporary table upda + SELECT DISTINCT i.id + FROM vn.item i + WHERE i.typeFk = itemTypeFk; + + UPDATE itemTag it + JOIN item i ON i.id = it.itemFk + JOIN itemTypeTag itt ON itt.itemTypeFk = i.typeFk AND itt.tagFk = it.tagFk + SET it.priority = itt.priority + WHERE itt.itemTypeFk = itemTypeFk; + + OPEN cur; + proc: LOOP + SET vDone = FALSE; + FETCH cur INTO vItem; + IF vDone THEN + LEAVE proc; + END IF; + CALL vn.itemRefreshTags(vItem); + END LOOP; + CLOSE cur; + SET @isTriggerDisabled = 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 `itemTagReplace__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTagReplace__`(fromItemFk INT, toItemFk INT) +BEGIN + +/* + * deprecated use itemTag_replace + */ + DELETE FROM itemTag + WHERE itemFk = toItemFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT toItemFk, tagFk, value, priority + FROM itemTag + WHERE itemFk = fromItemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemTag_replace` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100)) +BEGIN + + /* Reemplaza los tags de un artículo por los de otro, así como su imagen + * + * @param vItemFromFk id de vn.item con el artículo del que se toman los tags + * @param vItemToFk id de vn.item con el artículo del que se toman los tags + * @param vPicture imagen del artículo. Opcional. Si no se especifica, hereada la del vItemFromFk + */ + + DELETE FROM vn.itemTag + WHERE itemFk = vItemToFk; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT vItemToFk, tagFk, value, priority + FROM vn.itemTag + WHERE itemFk = vItemFromFk; + + IF ISNULL(vPicture) THEN + + SELECT image INTO vPicture + FROM vn.item + WHERE id = vItemFromFk; + + END IF; + + UPDATE vn.item i + SET i.image = vPicture + WHERE i.id = vItemToFk; + + CALL vn.itemRefreshTags(vItemToFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemTopSeller` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTopSeller`() +BEGIN + DECLARE vCategoryFk INTEGER; + DECLARE vDone INT DEFAULT FALSE; + DECLARE rs CURSOR FOR + SELECT DISTINCT id + FROM vn.itemCategory + WHERE merchandise <> FALSE; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + RESIGNAL; + END; + + DROP TABLE IF EXISTS tmp.topSellerMin; + CREATE TEMPORARY TABLE tmp.topSellerMin ENGINE = MEMORY + SELECT s.itemFk, SUM(s.quantity) AS total, v.tipo_id typeFk + FROM vn.sale s + INNER JOIN bs.ventas v ON v.Id_Movimiento = s.id + WHERE v.fecha BETWEEN TIMESTAMPADD(DAY, - 7, CURDATE()) AND CURDATE() + GROUP BY s.itemFk; + + DROP TABLE IF EXISTS tmp.topSeller; + CREATE TEMPORARY TABLE tmp.topSeller + ( + `id` int(11) NOT NULL DEFAULT '0', + `typeFk` smallint(5) unsigned NOT NULL, + `itemCategoryFk` int(10) unsigned NOT NULL, + `total` bigint(21) NOT NULL DEFAULT '0' + ) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + + OPEN rs; + read_loop: LOOP + FETCH rs INTO vCategoryFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + INSERT INTO tmp.topSeller + SELECT tsm.itemFk, tsm.typeFk, it.categoryFk, tsm.total + FROM tmp.topSellerMin tsm + INNER JOIN vn.itemType it ON it.id = tsm.typeFk + WHERE it.categoryFk = vCategoryFk + ORDER BY tsm.itemFk ,tsm.total DESC + LIMIT 5; + + END LOOP; + CLOSE rs; + + SELECT i.name ,i.id, i.image, i.typeFk, it.categoryFk AS itemCategoryFk, + ic.name AS itemCategoryName, it.name AS itemTypeName, ts.total + FROM tmp.topSeller ts + INNER JOIN vn.item i ON i.id = ts.id + INNER JOIN vn.itemType it ON it.id = ts.typeFk + INNER JOIN vn.itemCategory ic ON ic.id = it.categoryFk; + + DROP TABLE IF EXISTS topSellerMin; + DROP TABLE IF EXISTS tmp.topSeller; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemTrash` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTrash`( + vItemFk INT, + vWarehouseFk INT, + vQuantity INT, + vIsTrash BOOLEAN) +BEGIN + + DECLARE vTicketFk INT; + DECLARE vClientFk INT; + DECLARE vCompanyVnlFk INT DEFAULT 442; + DECLARE vCalc INT; + + SELECT barcodeToItem(vItemFk) INTO vItemFk; + + SELECT IF(vIsTrash, 200, 400) INTO vClientFk; + + SELECT t.id INTO vTicketFk + FROM ticket t + JOIN address a ON a.id=t.addressFk + WHERE t.warehouseFk = vWarehouseFk + AND t.clientFk = vClientFk + AND DATE(t.shipped) = CURDATE() + AND a.isDefaultAddress + LIMIT 1; + + CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); + + IF vTicketFk IS NULL THEN + + CALL ticket_add( + vClientFk, + CURDATE(), + vWarehouseFk, + vCompanyVnlFk, + NULL, + NULL, + NULL, + CURDATE(), + account.userGetId(), + FALSE, + vTicketFk); + END IF; + + INSERT INTO sale(ticketFk, itemFk, concept, quantity) + SELECT vTicketFk, + vItemFk, + CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(NOW() AS TIME),5)), + vQuantity + FROM item + WHERE id = vItemFk; + + UPDATE cache.visible + SET visible = visible - vQuantity + WHERE calc_id = vCalc + AND item_id = vItemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `itemUpdateTag` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemUpdateTag`(IN vItem BIGINT) +BEGIN + + +UPDATE item i +JOIN producer p ON p.id = i.producerFk +SET i.subName = p.name +WHERE p.isVisible +AND (vItem IS NULL OR vItem = i.id); + +UPDATE item i +JOIN itemTag it ON it.itemFk = i.id +JOIN tag t ON t.id = it.tagFk +SET tag5 = t.name, value5 = it.value +WHERE it.priority = 1 +AND (vItem IS NULL OR vItem = i.id); + +UPDATE item i +JOIN itemTag it ON it.itemFk = i.id +JOIN tag t ON t.id = it.tagFk +SET tag6 = t.name, value6 = it.value +WHERE it.priority = 2 +AND (vItem IS NULL OR vItem = it.itemFk); + +UPDATE item i +JOIN itemTag it ON it.itemFk = i.id +JOIN tag t ON t.id = it.tagFk +SET tag7 = t.name, value7 = it.value +WHERE it.priority = 3 +AND (vItem IS NULL OR vItem = it.itemFk); + +UPDATE item i +JOIN itemTag it ON it.itemFk = i.id +JOIN tag t ON t.id = it.tagFk +SET tag8 = t.name, value8 = it.value +WHERE it.priority = 4 +AND (vItem IS NULL OR vItem = it.itemFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_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 = 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`@`localhost` PROCEDURE `item_clean`(vItemFrom INT, vItemTo INT) +BEGIN + +/* + * Elimina todos los items repetidos y los sustituye por el que tiene menor id + */ + + START TRANSACTION; + + SET @isModeInventory:= TRUE; + + -- Deletes + + UPDATE IGNORE vn.itemCost ic + JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld + SET ic.itemFk = itr.idNew; + + DELETE ic.* + FROM vn.itemCost ic + JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld; + + DELETE rt.* + FROM vn2008.rec_translator rt + JOIN tmp.itemsToReplace itr ON rt.Id_Article = itr.idOld; + + DELETE w.* + FROM bs.waste w + JOIN tmp.itemsToReplace itr ON w.itemFk = itr.idOld; + + DELETE pf.* + FROM vn.priceFixed pf + JOIN tmp.itemsToReplace itr ON pf.itemFk = itr.idOld; + + DELETE imp.* + FROM vn.itemMatchProperties imp + JOIN tmp.itemsToReplace itr ON imp.itemFk = itr.idOld; + + DELETE ib.* + FROM vn.itemBotanical ib + JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; + + DELETE ip.* + FROM vn.itemProposal ip + JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; + + DELETE it.* + FROM vn.itemTag it + JOIN tmp.itemsToReplace itr ON it.itemFk = itr.idOld; + + DELETE ib.* + FROM vn.itemBarcode ib + JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; + + DELETE itc.* + FROM vn.itemTaxCountry itc + JOIN tmp.itemsToReplace itr ON itc.itemFk = itr.idOld; + + DELETE ip.* + FROM vn.itemPlacement ip + JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; + + -- Updates + + UPDATE vn.buy b + JOIN tmp.itemsToReplace itr ON b.itemFk = itr.idOld + SET b.itemFk = itr.idNew; + + UPDATE vn.sale s + JOIN tmp.itemsToReplace itr ON s.itemFk = itr.idOld + SET s.itemFk = itr.idNew; + + UPDATE vn.specialPrice sp + JOIN tmp.itemsToReplace itr ON sp.itemFk = itr.idOld + SET sp.itemFk = itr.idNew; + + UPDATE vn.packaging p + JOIN tmp.itemsToReplace itr ON p.itemFk = itr.idOld + SET p.itemFk = itr.idNew; + + UPDATE vn.packaging p + JOIN tmp.itemsToReplace itr ON p.freightItemFk = itr.idOld + SET p.freightItemFk = itr.idNew; + + UPDATE hedera.orderRow o + JOIN tmp.itemsToReplace itr ON o.itemFk = itr.idOld + SET o.itemFk = itr.idNew; + + UPDATE vn.itemLog il + JOIN tmp.itemsToReplace itr ON il.originFk = itr.idOld + SET il.originFk = itr.idNew; + + UPDATE vn.itemShelving ish + JOIN tmp.itemsToReplace itr ON ish.itemFk = itr.idOld + SET ish.itemFk = itr.idNew; + + UPDATE vn.ticketPackagingStartingStock tpss + JOIN tmp.itemsToReplace itr ON tpss.itemFk = itr.idOld + SET tpss.itemFk = itr.idNew; + + UPDATE vn.inventoryFailure ifa + JOIN tmp.itemsToReplace itr ON ifa.itemFk = itr.idOld + SET ifa.itemFk = itr.idNew; + + UPDATE vn.genericAllocation ga + JOIN tmp.itemsToReplace itr ON ga.itemFk = itr.idOld + SET ga.itemFk = itr.idNew; + + UPDATE vn.itemPlacementSupply ips + JOIN tmp.itemsToReplace itr ON ips.itemFk = itr.idOld + SET ips.itemFk = itr.idNew; + + -- Eliminamos los items repetidos + + DELETE i.* + FROM vn.item i + JOIN tmp.itemsToReplace itr ON i.id = itr.idOld; + + SET @isModeInventory:= FALSE; + + 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 `item_cleanLauncher` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `item_cleanLauncher`() +BEGIN + + DECLARE vItemTo INT DEFAULT 0; + DECLARE vStep INT DEFAULT 500; + DECLARE vCounter INT DEFAULT 0; + DECLARE vItemFrom INT; + DECLARE vItemEnd INT; + + SELECT itemFrom INTO vItemFrom + FROM tmp.itemCleanCount + ORDER BY created DESC + LIMIT 1; + + SET vItemEnd = vItemFrom + 100000; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplaceSource; + CREATE TEMPORARY TABLE tmp.itemsToReplaceSource + SELECT i.id idOld, + i2.id idNew + FROM vn.item i + JOIN ( SELECT i.id, + i.name, + i.subname, + i.value5, + i.value6, + i.value7, + i.value8, + i.value9, + i.value10, + i.NumberOfItemsPerCask, + i.EmbalageCode, + i.quality + FROM vn.item i + LEFT JOIN (SELECT i.id, + sr.NumberOfUnits, + MAX(di.LatestOrderDateTime) lodt + FROM vn.item i + JOIN edi.supplyResponse sr ON sr.ID = i.supplyResponseFk + JOIN edi.deliveryInformation di ON di.supplyResponseID = i.supplyResponseFk + GROUP BY i.id) sub ON sub.id = i.id + WHERE i.id > 170000 + AND (ISNULL(i.supplyResponseFk) + OR sub.NumberOfUnits=0 + OR sub.lodt < NOW()) + GROUP BY i.name, + subname, + value5, + value6, + value7, + value8, + value9, + value10, + NumberOfItemsPerCask, + EmbalageCode, + quality + ORDER BY i.id) i2 ON i2.name <=> i.name + AND i2.subname <=> i.subname + AND i2.value5 <=> i.value5 + AND i2.value6 <=> i.value6 + AND i2.value7 <=> i.value7 + AND i2.value8 <=> i.value8 + AND i2.value9 <=> i.value9 + AND i2.value10 <=> i.value10 + AND i2.NumberOfItemsPerCask <=> i.NumberOfItemsPerCask + AND i2.EmbalageCode <=> i.EmbalageCode + AND i2.quality <=> i.quality + WHERE i.id > 170000 + AND i.id <> i2.id + ORDER BY i2.id; + + WHILE vItemTo < vItemEnd AND NOT (SELECT isStop FROM tmp.stoper) DO + + SET vItemTo = LEAST(vItemEnd, vItemFrom + vStep); + + SELECT COUNT(*) INTO vCounter + FROM tmp.itemsToReplaceSource + WHERE idNew BETWEEN vItemFrom + AND vItemTo; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplace; + CREATE TEMPORARY TABLE tmp.itemsToReplace + SELECT * + FROM tmp.itemsToReplaceSource + WHERE idNew BETWEEN vItemFrom + AND vItemTo; + + CALL vn.item_clean(vItemFrom, vItemTo); + + SET vItemFrom = vItemTo; + + INSERT INTO tmp.itemCleanCount(itemFrom, itemDeleted) + VALUES (vItemFrom, vCounter); + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplace; + DROP TEMPORARY TABLE IF EXISTS tmp.itemsToReplaceSource; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getBalance` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getBalance`(IN vItemId int, IN vWarehouse int) +BEGIN + DECLARE vDateInventory DATETIME; + DECLARE vCurdate DATE DEFAULT CURDATE(); + DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); + + SELECT inventoried INTO vDateInventory FROM config; + SET @a = 0; + SET @currentLineFk = 0; + SET @shipped = ''; + + SELECT DATE(@shipped:= shipped) shipped, + alertLevel, + stateName, + origin, + reference, + clientFk, + name, + `in` AS invalue, + `out`, + @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, + @currentLineFk := IF (@shipped < CURDATE() + OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)), + lineFk,@currentLineFk) lastPreparedLineFk, + isTicket, + lineFk, + isPicked, + clientType, + claimFk + FROM + ( SELECT tr.landed AS shipped, + b.quantity AS `in`, + NULL AS `out`, + al.id AS alertLevel, + st.name AS stateName, + s.name AS name, + e.ref AS reference, + e.id AS origin, + s.id AS clientFk, + IF(al.id = 3, TRUE, FALSE) isPicked, + FALSE AS isTicket, + b.id lineFk, + NULL `order`, + NULL AS clientType, + NULL AS claimFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.id = + CASE + WHEN tr.landed < CURDATE() THEN 3 + WHEN tr.landed = CURDATE() AND tr.isReceived = TRUE THEN 3 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.landed >= vDateInventory + AND vWarehouse = tr.warehouseInFk + AND b.itemFk = vItemId + AND e.isInventory = FALSE + AND e.isRaid = FALSE + UNION ALL + + SELECT tr.shipped, + NULL, + b.quantity, + al.id, + st.name, + s.name, + e.ref, + e.id, + s.id, + IF(al.id = 3, TRUE, FALSE), + FALSE, + b.id, + NULL, + NULL, + NULL + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.id = + CASE + WHEN tr.shipped < CURDATE() THEN 3 + WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.shipped >= vDateInventory + AND vWarehouse =tr.warehouseOutFk + AND s.id <> 4 + AND b.itemFk = vItemId + AND e.isInventory = FALSE + AND w.isFeedStock = FALSE + AND e.isRaid = FALSE + UNION ALL + + SELECT DATE(t.shipped), + NULL, + s.quantity, + al.id, + st.name, + t.nickname, + t.refFk, + t.id, + t.clientFk, + stk.id, + TRUE, + s.id, + st.`order`, + ct.code, + cb.claimFk + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN ticketState ts ON ts.ticket = t.id + LEFT JOIN state st ON st.code = ts.code + JOIN client c ON c.id = t.clientFk + JOIN clientType ct ON ct.id = c.clientTypeFk + JOIN alertLevel al ON al.id = + CASE + WHEN t.shipped < curdate() THEN 3 + WHEN t.shipped > util.dayEnd(curdate()) THEN 0 + ELSE IFNULL(ts.alertLevel, 0) + END + LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' + LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id + LEFT JOIN claimBeginning cb ON s.id = cb.saleFk + WHERE t.shipped >= vDateInventory + AND s.itemFk = vItemId + AND vWarehouse =t.warehouseFk + ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC + ) AS itemDiary; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getInfo` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getInfo`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT) +BEGIN + + /* + * Devuelve información relativa al item correspondiente del vBarcode pasado + * + * @param vBarcode código relativo al ítem + * @param vWarehouseFk código del almacén + */ + + DECLARE vCacheVisibleFk INT; + DECLARE vCacheAvailableFk INT; + DECLARE vVisibleItemShelving INT; + DECLARE vItemFk INT; + + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + + CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); + CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); + + SELECT SUM(visible) INTO vVisibleItemShelving + FROM vn.itemShelvingStock + WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; + + CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + + SELECT i.id, + i.longName, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.image, + i.size, + i.stems, + i.category, + i.minimum as min, + p.name as producer, + o.code as origin, + v.visible - IFNULL(vVisibleItemShelving,0) as unlocated, + a.available, + vVisibleItemShelving, + v.visible, + c.`grouping`, + c.packing, + CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, + CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, + i.itemPackingTypeFk, + i.comment as reference + FROM vn.item i + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id + LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id + LEFT JOIN ( + SELECT b.itemFk, b2.`grouping`, b2.packing + FROM tmp.buyUltimate b + JOIN vn.buy b2 ON b2.id = b.buyFk + WHERE b.warehouseFk = vWarehouseFk + ) c ON i.id = c.itemFk + WHERE i.id = vItemFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getLack` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getLack`(IN vForce BOOLEAN, IN vDays INT) +BEGIN +/** + * Calcula una tabla con el máximo negativo visible para cada producto y almacen + * + * @param vForce Fuerza el recalculo del stock + * @param vDays Numero de dias a considerar +**/ + + CALL `cache`.stock_refresh(vForce); + CALL item_getMinacum(NULL, CURDATE(), vDays, NULL); + CALL item_getMinETD(); + + SELECT i.id itemFk, + i.longName, + w.id warehouseFk, + p.`name` producer, + i.`size`, + i.category, + w.name warehouse, + SUM(IFNULL(sub.amount,0)) lack, + i.inkFk, + IFNULL(im.timed, util.midnight()) timed + FROM (SELECT item_id, + warehouse_id, + amount + FROM cache.stock + WHERE amount > 0 + UNION ALL + SELECT itemFk, + warehouseFk, + amount + FROM tmp.itemMinacum + ) sub + JOIN warehouse w ON w.id = sub.warehouse_id + JOIN item i ON i.id = sub.item_id + LEFT JOIN producer p ON p.id = i.producerFk + JOIN itemType it ON it.id = i.typeFk + JOIN itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id + WHERE w.isForTicket + AND it.making IS NULL + AND ic.display <> 0 + AND it.code != 'GEN' + GROUP BY i.id, w.id + HAVING lack < 0; + + DROP TEMPORARY TABLE tmp.itemMinacum; + DROP TEMPORARY TABLE tmp.itemMinETD; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getMinacum` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getMinacum`(IN vWarehouseFk TINYINT, IN vDatedFrom DATETIME, IN vRange INT, IN vItemFk INT) +BEGIN +/** + * Cálculo del mínimo acumulado, para un item si especificado, para todo el stock si es nulo + * + * @param vWarehouseFk -> warehouseFk + * @param vDatedFrom -> fecha inicio + * @param vRange -> número de días a considerar + * @param vItemFk -> Identificador de item + * @return tmp.itemMinacum +*/ + + DECLARE vDatedTo DATETIME; + + SET vDatedFrom = TIMESTAMP(DATE(vDatedFrom), '00:00:00'); + SET vDatedTo = TIMESTAMP(TIMESTAMPADD(DAY, vRange, vDatedFrom), '23:59:59'); + + DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; + + CREATE TEMPORARY TABLE tmp.itemMinacum + (INDEX(itemFk)) + ENGINE = MEMORY + SELECT sub1.itemFk, + sub1.warehouseFk, + minacum(sub1.dated, amount, DATE(vDatedFrom)) amount + FROM (SELECT sub.itemFk, + sub.dated, + SUM(sub.amount) amount, + sub.warehouseFk + FROM (SELECT s.itemFk, + DATE(t.shipped) dated, + -s.quantity amount, + t.warehouseFk + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + AND s.quantity != 0 + AND (vItemFk IS NULL OR s.itemFk = vItemFk) + AND (vWarehouseFk IS NULL OR t.warehouseFk = vWarehouseFk) + UNION ALL + SELECT b.itemFk, + t.landed, + b.quantity, + t.warehouseInFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + LEFT JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vDatedFrom AND vDatedTo + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND !e.isInventory + AND b.quantity != 0 + AND (vItemFk IS NULL OR b.itemFk = vItemFk) + UNION ALL + SELECT b.itemFk, + t.shipped, + -b.quantity, + t.warehouseOutFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + LEFT JOIN travel t ON t.id = e.travelFk + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + AND (vWarehouseFk IS NULL OR t.warehouseOutFk = vWarehouseFk) + AND !e.isInventory + AND b.quantity != 0 + AND (vItemFk IS NULL OR b.itemFk = vItemFk) + AND !e.isRaid + ) sub + GROUP BY sub.itemFk, sub.dated, sub.warehouseFk + ) sub1 + GROUP BY sub1.itemFk, sub1.warehouseFk + HAVING 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 `item_getMinETD` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getMinETD`() +BEGIN + +/* Devuelve una tabla temporal con la primera ETD, para todos los artículos con salida hoy. + * + * @return tmp.itemMinETD(itemFk, timed) + */ + + DECLARE vMidnight DATETIME DEFAULT util.midnight(); + + DROP TEMPORARY TABLE IF EXISTS tmp.itemMinETD; + + CREATE TEMPORARY TABLE tmp.itemMinETD + (INDEX (itemFk)) + ENGINE = MEMORY + SELECT s.itemFk, MIN(TIME(IFNULL(z.`hour`,vMidnight))) timed + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + LEFT JOIN `zone` z ON z.id = t.zoneFk + WHERE t.shipped BETWEEN CURDATE() AND vMidnight + GROUP BY s.itemFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getSimilar` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getSimilar`(vItemFk INT, vWarehouseFk INT, vDate DATE, vIsShowedByType BOOL) +BEGIN + +/** + * Propone articulos similares para posible cambio, + * ordenado con la cantidad de veces usado y segun sus caracteristicas + * + * @param vItemFk item id + * @param vWarehouseFk warehouse id + * @param vDate fecha para revisar disponible + * @param vIsShowedByType para mostrar solo artículos de ese tipo + */ + + DECLARE vCalcFk INT; + DECLARE vTypeFk INT; + + DECLARE vTag1 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vTag5 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vTag6 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vTag7 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vTag8 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + + DECLARE vValue1 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vValue5 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vValue6 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci'; + + + SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value + INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1 + FROM vn.item i + LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 + LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + WHERE i.id = vItemFk; + + CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDate); + + SELECT i.id itemFk, + i.longName, + i.subName, + i.tag5, + i.value5, + (i.value5 <=> vValue5) match5, + i.tag6, + i.value6, + (i.value6 <=> vValue6) match6, + i.tag7, + i.value7, + (i.value7 <=> vValue7) match7, + i.tag8, + i.value8, + (i.value8 <=> vValue8) match8, + a.available, + IFNULL(ip.counter,0) counter, + IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity + FROM vn.item i + JOIN cache.available a ON a.item_id = i.id + LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk + LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1 + LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + WHERE a.calc_id = vCalcFk + AND available > 0 + AND IF(vIsShowedByType, i.typeFk = vTypeFk, TRUE) + AND i.id != vItemFk + ORDER BY counter DESC, + (t1.name = vTag1) DESC, + (it1.value = vValue1) DESC, + (i.tag6 = vTag6) DESC, + (i.value6 = vValue6) DESC, + (i.tag5 = vTag5) DESC, + (i.value5 = vValue5) DESC, + (i.tag7 = vTag7) DESC, + (i.value7 = vValue7) DESC, + (i.tag8 = vTag8) DESC, + (i.value8 = vValue8) DESC + LIMIT 30; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_GetVisible` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_GetVisible`(vWarehouse SMALLINT, vItem INT) +BEGIN + DECLARE vTomorrow DATETIME DEFAULT TIMESTAMPADD(DAY, 1, CURDATE()); + + INSERT INTO vn2008.tmp_item (item_id, visible) + SELECT item_id, SUM(amount) amount + FROM ( + SELECT i.itemFk AS item_id, quantity AS amount + FROM itemTicketOut i + LEFT JOIN ticketState ts ON ts.ticketFk = i.ticketFk + JOIN state s ON s.id = ts.stateFk + LEFT JOIN (SELECT DISTINCT saleFk + FROM saleTracking st + JOIN state s ON s.id = st.stateFk + WHERE st.created > CURDATE() + AND (s.isPicked OR st.isChecked) + ) stPrevious ON `stPrevious`.`saleFk` = i.saleFk + WHERE i.warehouseFk = vWarehouse + AND (vItem IS NULL OR i.itemFk = vItem) + AND (s.isPicked OR i.reserved OR stPrevious.saleFk ) + AND i.shipped >= CURDATE() AND i.shipped < vTomorrow + UNION ALL + SELECT iei.itemFk, quantity + FROM itemEntryIn iei + LEFT JOIN itemPlacement ip ON ip.itemFk = iei.itemFk AND ip.warehouseFk = vWarehouse + WHERE (iei.isReceived != FALSE /*OR ip.modificationDate > CURDATE()*/) + AND iei.landed >= CURDATE() AND iei.landed < vTomorrow + AND iei.warehouseInFk = vWarehouse + AND (vItem IS NULL OR iei.itemFk = vItem) + AND iei.isVirtualStock is FALSE + UNION ALL + SELECT itemFk, quantity + FROM itemEntryOut + WHERE isDelivered != FALSE + AND shipped >= CURDATE() AND shipped < vTomorrow + AND warehouseOutFk = vWarehouse + AND (vItem IS NULL OR itemFk = vItem) + ) t + GROUP BY item_id + ON DUPLICATE KEY UPDATE + visible = IFNULL(stock,0) + VALUES(visible); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getVisibleAvailable__` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `item_getVisibleAvailable__`( + vItem INT, + vDate DATE, + vWarehouse TINYINT, + vRefresh BOOL) +BEGIN + DECLARE vVisibleCalc INT; + DECLARE vAvailableCalc INT; + DECLARE vVisibleAltillo INT; + + CALL cache.available_refresh(vAvailableCalc, FALSE /*vRefresh*/ , vWarehouse, vDate); + CALL cache.visible_refresh(vVisibleCalc, FALSE,vWarehouse); + + SELECT SUM(visible) INTO vVisibleAltillo + FROM vn.itemShelvingStock + WHERE itemFk = vItem + AND warehouseFk = vWarehouse; + + IF vRefresh THEN + + DROP TEMPORARY TABLE IF EXISTS vn2008.tmp_item; + CREATE TEMPORARY TABLE vn2008.tmp_item + (PRIMARY KEY (item_id)) + ENGINE = MEMORY + SELECT vItem item_id, 0 stock, 0 visible; + + SELECT i.id, i.longName, i.box, i.typeFk, + i.tag5,i.value5,i.tag6,i.value6,i.tag7,i.value7,i.tag8,i.value8, + ip.code, ip.reserve, + vi.visible - IFNULL(vVisibleAltillo,0) AS visible, + av.available + FROM vn.item i + LEFT JOIN vn.itemPlacement ip + ON i.id = ip.itemFk AND ip.warehouseFk = vWarehouse + LEFT JOIN vn2008.tmp_item v + ON v.item_id = i.id + LEFT JOIN cache.available av + ON av.calc_id = vAvailableCalc AND av.item_id = i.id + LEFT JOIN cache.visible vi + ON vi.calc_id = vVisibleCalc AND vi.item_id = i.id + LEFT JOIN cache.stock st + ON st.warehouse_id = vWarehouse AND st.item_id = i.id + WHERE (vItem IS NULL OR i.id = vItem); + + ELSE + + SELECT i.id, i.longName, i.box, i.typeFk, + i.tag5,i.value5,i.tag6,i.value6,i.tag7,i.value7,i.tag8,i.value8, + ip.code, ip.reserve, + v.visible - IFNULL(vVisibleAltillo,0) AS visible, + av.available + FROM vn.item i + LEFT JOIN vn.itemPlacement ip + ON i.id = ip.itemFk AND ip.warehouseFk = vWarehouse + LEFT JOIN cache.visible v + ON v.item_id = i.id AND v.calc_id = vVisibleCalc + LEFT JOIN cache.available av + ON av.item_id = i.id AND av.calc_id = vAvailableCalc + WHERE (vItem IS NULL OR i.id = vItem); + + 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 `item_refreshTags` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags`() +BEGIN +/** + * Actualiza la tabla item, los campos "cache" de tags + * + * @param temporary table tmp.item(id) del articulo + **/ + + DECLARE done INT DEFAULT FALSE; + DECLARE vItemFk INT; + DECLARE cur1 CURSOR FOR SELECT id FROM tmp.item; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN cur1; + + read_loop: LOOP + + FETCH cur1 INTO vItemFk; + + IF done THEN + LEAVE read_loop; + END IF; + + UPDATE item i + LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id + LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id + LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id + SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, IF(it3.`value` = 'A1','',it3.`value`)) + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id + LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` + LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id + LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` AND ta2.`value` != 'Rosa' + LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id + LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` + SET i.`name` = CONCAT_WS(' ', + IFNULL(ta1.abbreviation,it1.`value`), + IFNULL(ta2.abbreviation,it2.`value`), + IF(i.id > 400000,'',IFNULL(ta3.abbreviation,it3.`value`))) + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 + SET i.subName = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag5 = t.name, value5 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag6 = t.name, value6 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7 + LEFT JOIN tag t ON t.id = it.tagFk + SET i.tag7 = t.name, i.value7 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag8 = t.name, value8 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag9 = t.name, value9 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag10 = t.name, value10 = it.`value` + WHERE i.id = vItemFk; + + -- Al insertar el tag color se modifica también el antiguo campo color + UPDATE item i + JOIN tag t ON t.overwrite = 'inkFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN ink ON ink.`name` = it.`value` + SET i.inkFk = ink.id + WHERE i.id = vItemFk; + + -- Al insertar el tag origen se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'originFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN origin o ON o.`name` = it.`value` + SET i.originFk = o.id + WHERE i.id = vItemFk; + + -- Al insertar el tag medida se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'size' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + SET i.size = it.`value` + WHERE i.id = vItemFk; + + -- Al insertar el tag productor se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'producerFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN producer p ON p.`name` = it.`value` + SET i.producerFk = p.id + WHERE i.id = vItemFk; + + -- Al insertar el tag tallos se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'stems' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + SET i.stems = it.`value` + WHERE i.id = vItemFk; + + -- Al insertar el tag categoria se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'category' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + SET i.category = it.`value` + WHERE i.id = vItemFk; + + -- Comprueba si existe un genérico y lo asigna + CALL vn.item_setGeneric(vItemFk); + + END LOOP; + + CLOSE cur1; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_refreshTags_beta` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags_beta`() +BEGIN +/** + * Actualiza la tabla item, los campos "cache" de tags + * + * @param temporary table tmp.item(id) del articulo + **/ + + DECLARE done INT DEFAULT FALSE; + DECLARE vItemFk INT; + DECLARE cur1 CURSOR FOR SELECT id FROM tmp.item; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN cur1; + + read_loop: LOOP + + FETCH cur1 INTO vItemFk; + + IF done THEN + LEAVE read_loop; + END IF; + + UPDATE item i + LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id + LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id + LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id + SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, IF(it3.`value` = 'A1','',it3.`value`)) + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id + LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` + LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id + LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` + LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id + LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` + SET i.`name` = CONCAT_WS(' ', + IFNULL(ta1.abbreviation,it1.`value`), + IFNULL(ta2.abbreviation,it2.`value`), + IF(i.id > 400000,'',IFNULL(ta3.abbreviation,it3.`value`))) + WHERE i.id = vItemFk; + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 + SET i.subName = it.`value`; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag5 = t.name, value5 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag6 = t.name, value6 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7 + LEFT JOIN tag t ON t.id = it.tagFk + SET i.tag7 = t.name, i.value7 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag8 = t.name, value8 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag9 = t.name, value9 = it.`value` + WHERE i.id = vItemFk; + + UPDATE item i + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag10 = t.name, value10 = it.`value` + WHERE i.id = vItemFk; + + -- Al insertar el tag color se modifica también el antiguo campo color + UPDATE item i + JOIN tag t ON t.overwrite = 'inkFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN ink ON ink.`name` = it.`value` + SET i.inkFk = ink.id + WHERE i.id = vItemFk; + + -- Al insertar el tag origen se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'originFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN origin o ON o.`name` = it.`value` + SET i.originFk = o.id + WHERE i.id = vItemFk; + + -- Al insertar el tag medida se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'size' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + SET i.size = it.`value` + WHERE i.id = vItemFk; + + -- Al insertar el tag productor se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'producerFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN producer p ON p.`name` = it.`value` + SET i.producerFk = p.id + WHERE i.id = vItemFk; + + -- Al insertar el tag tallos se modifica también en la tabla item + UPDATE item i + JOIN tag t ON t.overwrite = 'stems' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + SET i.stems = it.`value` + WHERE i.id = vItemFk; + + END LOOP; + + CLOSE cur1; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_refreshTags__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_refreshTags__`() +BEGIN +/** + * Actualiza la tabla item, los campos "cache" de tags + * Para actualizar mas de un registro, la tabla NO tiene que ser en memoria + * Error Code: 1137. No puedo reabrir tabla: 'tmpI + * + * @param temporary table tmp.item(id) del articulo + **/ + DROP TEMPORARY TABLE IF EXISTS tmp.itemToRefresh; + CREATE TEMPORARY TABLE tmp.itemToRefresh + SELECT id from tmp.item; + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id + LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id + LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id + SET i.longName = CONCAT_WS(' ', it1.`value`, it2.`value`, IF(it3.`value` = 'A1','',it3.`value`)); + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it1 ON it1.priority = 1 AND it1.itemFk = i.id + LEFT JOIN tagAbbreviation ta1 ON ta1.`value` = it1.`value` + LEFT JOIN itemTag it2 ON it2.priority = 2 AND it2.itemFk = i.id + LEFT JOIN tagAbbreviation ta2 ON ta2.`value` = it2.`value` + LEFT JOIN itemTag it3 ON it3.priority = 3 AND it3.itemFk = i.id + LEFT JOIN tagAbbreviation ta3 ON ta3.`value` = it3.`value` + SET i.`name` = CONCAT_WS(' ', + IFNULL(ta1.abbreviation,it1.`value`), + IFNULL(ta2.abbreviation,it2.`value`), + IF(i.id > 400000,'',IFNULL(ta3.abbreviation,it3.`value`))); + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 4 + SET i.subName = it.`value`; + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 5 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag5 = t.name, value5 = it.`value`; + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 6 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag6 = t.name, value6 = it.`value`; + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 7 + LEFT JOIN tag t ON t.id = it.tagFk + SET i.tag7 = t.name, i.value7 = it.`value`; + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 8 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag8 = t.name, value8 = it.`value`; + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 9 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag9 = t.name, value9 = it.`value`; + + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + LEFT JOIN itemTag it ON it.itemFk = i.id AND it.priority = 10 + LEFT JOIN tag t ON t.id = it.tagFk + SET tag10 = t.name, value10 = it.`value`; + + -- Al insertar el tag color se modifica también el antiguo campo color + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + JOIN tag t ON t.overwrite = 'inkFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN ink ON ink.`name` = it.`value` + SET i.inkFk = ink.id; + + -- Al insertar el tag origen se modifica también en la tabla item + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + JOIN tag t ON t.overwrite = 'originFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN origin o ON o.`name` = it.`value` + SET i.originFk = o.id; + + -- Al insertar el tag medida se modifica también en la tabla item + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + JOIN tag t ON t.overwrite = 'size' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + SET i.size = it.`value`; + + -- Al insertar el tag productor se modifica también en la tabla item + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + JOIN tag t ON t.overwrite = 'producerFk' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + JOIN producer p ON p.`name` = it.`value` + SET i.producerFk = p.id; + + -- Al insertar el tag tallos se modifica también en la tabla item + UPDATE item i + JOIN tmp.itemToRefresh tmpI ON tmpI.id = i.id + JOIN tag t ON t.overwrite = 'stems' + JOIN itemTag it ON it.itemFk = i.id AND it.tagFk = t.id + SET i.stems = it.`value`; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemToRefresh; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_saveReference` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_saveReference`(vBarcode VARCHAR(22), vReference VARCHAR(150)) +BEGIN + +/** + * Actualiza la referencia del item + * + * @param vBarcode del item + * @param vReference referencia a actualizar + */ + + DECLARE vItemFk INT; + + SELECT barcodeToItem(vBarcode) INTO vItemFk; + + UPDATE item SET comment = vReference WHERE id = vItemFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_setCompression__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setCompression__`() +BEGIN + /** + * Actualiza la compression de los articulos con un packing.hasCompressionVariations = TRUE + * + */ + DECLARE done INT DEFAULT FALSE; + DECLARE vBuyFk INT; + DECLARE cur1 CURSOR FOR SELECT b.id + FROM vn.item i + JOIN edi.supplyResponse ii ON i.supplyResponseFk = ii.ID + JOIN vn.packaging p ON p.id = ii.EmbalageCode AND hasCompressionVariations + JOIN vn.itemTag diameter ON diameter.itemFk = i.id + JOIN vn.tag tDiameter ON tDiameter.overwrite = 'diameter' AND tDiameter.id = diameter.tagFk + JOIN vn.itemTag size ON size.itemFk = i.id + JOIN vn.tag tSize ON tSize.overwrite = 'size' AND tSize.id = size.tagFk + JOIN vn.buy b ON b.itemFk = i.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + UPDATE vn.item i + JOIN edi.supplyResponse ii ON i.supplyResponseFk = ii.ID + JOIN vn.packaging p ON p.id = ii.EmbalageCode AND hasCompressionVariations + JOIN vn.itemTag diameter ON diameter.itemFk = i.id + JOIN vn.tag tDiameter ON tDiameter.overwrite = 'diameter' AND tDiameter.id = diameter.tagFk + JOIN vn.itemTag size ON size.itemFk = i.id + JOIN vn.tag tSize ON tSize.overwrite = 'size' AND tSize.id = size.tagFk + SET i.`compression` = (PI() * POW(diameter.`value`/ 2, 2) * size.`value`) + / + ((p.width * p.depth * p.height) / ii.NumberOfItemsPerCask) + WHERE (PI() * POW(diameter.`value`/ 2, 2) * size.`value`) + / + ((p.width * p.depth * p.height) / ii.NumberOfItemsPerCask) <> 0; + + OPEN cur1; + + read_loop: LOOP + SET done = FALSE; + FETCH cur1 INTO vBuyFk; + IF done THEN + LEAVE read_loop; + END IF; + + call vn.buy_afterUpsert(vBuyFk); + + END LOOP; + + CLOSE cur1; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_setGeneric` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setGeneric`(vSelf INT) +BEGIN +/** + * Asigna el código genérico a un item, salvo que sea un código de item genérico. + * + * @param vSelf identificador de vn.item + */ + DECLARE vGenericFk INT; + + SELECT itemFk INTO vGenericFk + FROM ( + SELECT itemFk, (sum(matches) = maxMatches) `match` + FROM ( + SELECT ga.id gaid, + ga.itemFk, + (it.value <=> ga.origin) + + (it.value <=> ga.color) + + (it.value <=> ga.quality) + + (it.value <=> ga.numFlores) + + (it.value <=> ga.category) + + (it.value <=> ga.productor) matches, + !ISNULL(ga.origin) + +!ISNULL(ga.color) + +!ISNULL(ga.quality) + +!ISNULL(ga.numFlores) + +!ISNULL(ga.category) + +!ISNULL(ga.productor) maxMatches + FROM vn.item i + JOIN vn.itemTag it ON it.itemFk = i.id + JOIN vn.genericAllocation ga + ON (i.typeFk = ga.typeFk OR ga.typeFk IS NULL) + AND (i.longName = ga.longName OR ga.longName IS NULL) + AND (i.`size` = ga.`size` OR ga.`size` IS NULL) + AND i.id != ga.itemFk + WHERE i.id = vSelf + AND NOT i.isFloramondo) sub + GROUP BY gaid + HAVING `match`) sub2; + + UPDATE vn.item + SET genericFk = vGenericFk + WHERE id = vSelf; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingShelve` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `item_updatePackingShelve`(vSelf INT, vPacking INT) +BEGIN + + /** + * Actualiza el valor de item.packingShelve + * + * @param vSelf Identificador de vn.item + * @param vPacking Cantidad de unidades de venta que caben en una bandeja + */ + + UPDATE vn.item i + SET i.packingShelve = vPacking + WHERE i.id = vSelf; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `item_updatePackingType` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingType`(vItem INT, vItemPackingTypeFk VARCHAR(1)) +BEGIN +/** + * Update the packing type of an item + * + * @param vItem id del item a actualizar + * @param vItemPackingTypeFk packing type + */ + UPDATE item SET itemPackingTypeFk = vItemPackingTypeFk WHERE id = vItem; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_ValuateInventory` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_ValuateInventory`(IN vDated DATE, IN vIsDetailed BOOLEAN) +BEGIN + + DECLARE vInventoried DATE; + DECLARE vHasNotInventory BOOLEAN DEFAULT FALSE; + DECLARE vInventoried2 DATE; + DECLARE vDateDayEnd DATETIME; + + SET vDateDayEnd = util.dayEnd(vDated); + + SELECT landed INTO vInventoried + FROM travel tr + JOIN entry E ON E.travelFk = tr.id + WHERE landed <= vDateDayEnd + AND E.supplierFk = 4 + ORDER BY landed DESC + LIMIT 1; + + SET vHasNotInventory = IF (vInventoried is null, TRUE, FALSE); + + IF vHasNotInventory THEN + + SELECT landed INTO vInventoried2 + FROM travel tr + JOIN entry E ON E.travelFk = tr.id + WHERE landed >= vDated + AND E.supplierFk = 4 + ORDER BY landed ASC + LIMIT 1; + + SET vInventoried = TIMESTAMPADD(DAY,1,vDated); + SET vDateDayEnd = vInventoried2; + + END IF; + + DROP TEMPORARY TABLE IF EXISTS inv; + + CREATE TEMPORARY TABLE inv + (warehouseFk SMALLINT, + Id_Article BIGINT, + cantidad INT, + coste DOUBLE DEFAULT 0, + total DOUBLE DEFAULT 0, + Almacen VARCHAR(20), + PRIMARY KEY (Almacen, Id_Article) USING HASH) + ENGINE = MEMORY; + + IF vHasNotInventory = TRUE THEN + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, SUM(b.quantity), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = warehouseInFk + WHERE landed = vDateDayEnd + AND e.supplierFk = 4 + AND w.valuatedInventory + AND t.isInventory + GROUP BY tr.warehouseInFk, b.itemFk; + + END IF; + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, b.quantity * IF(vHasNotInventory,-1,1), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = tr.warehouseInFk + WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd + AND IF(tr.landed = CURDATE(), tr.isReceived, trUE) + AND NOT e.isRaid + AND w.valuatedInventory + AND t.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,-1,1)); + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseOutFk, b.itemFk, b.quantity * IF(vHasNotInventory,1,-1), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd + AND NOT e.isRaid + AND w.valuatedInventory + AND t.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,1,-1)); + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,1,-1), w.`name` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN `client` c ON c.id = t.clientFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN vInventoried AND vDateDayEnd + AND w.valuatedInventory + AND it.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,1,-1); + + IF vDated = CURDATE() THEN -- volver a poner lo que esta aun en las estanterias + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,0,1), w.`name` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN `client` c ON c.id = t.clientFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN vDated AND vDateDayEnd + AND (s.isPicked <> 0 or t.isLabeled <> 0 ) + AND w.valuatedInventory + AND it.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,0,1); + + END IF; + + -- Mercancia en transito + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, b.quantity, CONCAT(wOut.`name`,' - ', wIn.`name`) + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + WHERE vDated >= tr.shipped AND vDated < tr.landed + AND NOT isRaid + AND wIn.valuatedInventory + AND t.isInventory + AND e.isConfirmed + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity); + + CALL vn.buyUltimate(NULL,vDateDayEnd); + + UPDATE inv i + JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.Id_Article = bu.itemFk + JOIN buy b ON b.id = bu.buyFk + SET total = i.cantidad * (ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0)), + coste = ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0) + WHERE i.cantidad <> 0; + + DELETE FROM inv WHERE Cantidad IS NULL or Cantidad = 0; + + IF vIsDetailed THEN + + SELECT inv.warehouseFk, + i.id itemFk, + i.longName , + i.size, + inv.Cantidad, + tp.name Tipo, + ic.name Reino, + inv.coste, + cast(inv.total as decimal(10,2)) total, + almacen + FROM inv + JOIN warehouse w on w.id = warehouseFk + JOIN item i ON i.id = inv.Id_Article + JOIN itemType tp ON tp.id = i.typeFk + JOIN itemCategory ic ON ic.id = tp.categoryFk + WHERE w.valuatedInventory + and inv.total > 0 + order by inv.total desc; + + ELSE + + SELECT i.Almacen, ic.name as Reino, cast(i.total as decimal(10,2)) as Euros, w.code as Comprador,it.id + FROM inv i + JOIN warehouse wh on wh.id = warehouseFk + JOIN item it ON it.id = i.Id_Article + JOIN itemType itp ON itp.id = it.typeFk + LEFT JOIN worker w ON w.id = itp.workerFk + JOIN itemCategory ic ON ic.id = itp.categoryFk + WHERE wh.valuatedInventory + AND i.total > 0; + + END IF; + DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE inv; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_ValuateInventory__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `item_ValuateInventory__`(IN vDated DATE, IN vIsDetailed BOOLEAN) +BEGIN + + DECLARE vInventoried DATE; + DECLARE vHasNotInventory BOOLEAN DEFAULT 0; + DECLARE vInventoried2 DATE; + DECLARE vDateDayEnd DATETIME; + + SET vDateDayEnd = util.dayEnd(vDated); + SELECT landed INTO vInventoried + FROM travel tr + JOIN entry E ON E.travelFk = tr.id + WHERE landed <= vDateDayEnd + AND E.supplierFk = 4 + ORDER BY landed DESC + LIMIT 1; + + SET vHasNotInventory = IF (vInventoried is null, TRUE, FALSE); + + IF vHasNotInventory THEN + + SELECT landed INTO vInventoried2 + FROM travel tr + JOIN entry E ON E.travelFk = tr.id + WHERE landed >= vDated + AND E.supplierFk = 4 + ORDER BY landed ASC + LIMIT 1; + + SET vInventoried = TIMESTAMPADD(DAY,1,vDated); + SET vDateDayEnd = vInventoried2; + + END IF; + + DROP TEMPORARY TABLE IF EXISTS inv; + + CREATE TEMPORARY TABLE inv + (warehouseFk SMALLINT, + Id_Article BIGINT, + cantidad INT, + coste DOUBLE DEFAULT 0, + total DOUBLE DEFAULT 0, + Almacen VARCHAR(20), + PRIMARY KEY (Almacen, Id_Article) USING HASH) + ENGINE = MEMORY; + + IF vHasNotInventory = TRUE THEN + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, SUM(b.quantity), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = warehouseInFk + WHERE landed = vDateDayEnd + AND e.supplierFk = 4 + AND w.valuatedInventory + AND t.isInventory + GROUP BY tr.warehouseInFk, b.itemFk; + + END IF; + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, b.quantity * IF(vHasNotInventory,-1,1), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = tr.warehouseInFk + WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd + AND IF(tr.landed = CURDATE(), tr.isReceived, trUE) + AND NOT e.isRaid + AND w.valuatedInventory + AND t.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,-1,1)); + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseOutFk, b.itemFk, b.quantity * IF(vHasNotInventory,1,-1), w.`name` + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd + AND NOT e.isRaid + AND w.valuatedInventory + AND t.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity * IF(vHasNotInventory,1,-1)); + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,1,-1), w.`name` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN `client` c ON c.id = t.clientFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN vInventoried AND vDateDayEnd + AND w.valuatedInventory + AND it.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,1,-1); + + IF vDated = CURDATE() THEN -- volver a poner lo que esta aun en las estanterias + + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT w.id, s.itemFk, s.quantity * IF(vHasNotInventory,0,1), w.`name` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN `client` c ON c.id = t.clientFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.shipped BETWEEN vDated AND vDateDayEnd + AND (s.isPicked <> 0 or t.isLabeled <> 0 ) + AND w.valuatedInventory + AND it.isInventory + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + s.quantity * IF(vHasNotInventory,0,1); + + END IF; + + -- Mercancia en transito + INSERT INTO inv(warehouseFk, Id_Article, cantidad, Almacen) + SELECT tr.warehouseInFk, b.itemFk, b.quantity, CONCAT(wOut.`name`,' - ', wIn.`name`) + FROM buy b + JOIN item i ON i.id = b.itemFk + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN itemType t ON t.id = i.typeFk + JOIN warehouse wIn ON wIn.id = tr.warehouseInFk + JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk + WHERE vDated >= tr.shipped AND vDated < tr.landed + AND NOT isRaid + AND wIn.valuatedInventory + AND t.isInventory + AND e.isConfirmed + ON DUPLICATE KEY UPDATE inv.cantidad = inv.cantidad + (b.quantity); + + CALL vn.buyUltimate(NULL,vDateDayEnd); + + UPDATE inv i + JOIN tmp.buyUltimate bu ON i.warehouseFk = bu.warehouseFk AND i.Id_Article = bu.itemFk + JOIN buy b ON b.id = bu.buyFk + SET total = i.cantidad * (ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0)), + coste = ifnull(b.buyingValue,0) + IFNULL(b.packageValue,0) + IFNULL(b.freightValue,0) + IFNULL(b.comissionValue,0) + WHERE i.cantidad <> 0; + + DELETE FROM inv WHERE Cantidad IS NULL or Cantidad = 0; + + IF vIsDetailed THEN + + SELECT inv.warehouseFk, i.id, i.name, i.size, inv.Cantidad, tp.code, + tp.categoryFk, inv.coste, cast(inv.total as decimal(10,2)) total,Almacen + FROM inv + JOIN warehouse w on w.id = warehouseFk + JOIN item i ON i.id = inv.Id_Article + JOIN itemType tp ON tp.id = i.typeFk + WHERE w.valuatedInventory + and inv.total > 0 + order by inv.total desc; + + ELSE + + SELECT i.Almacen, ic.name as Reino, cast(i.total as decimal(10,2)) as Euros, w.code as Comprador,it.id + FROM inv i + JOIN warehouse wh on wh.id = warehouseFk + JOIN item it ON it.id = i.Id_Article + JOIN itemType itp ON itp.id = it.typeFk + LEFT JOIN worker w ON w.id = itp.workerFk + JOIN itemCategory ic ON ic.id = itp.categoryFk + WHERE wh.valuatedInventory + AND i.total > 0; + + END IF; + DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE inv; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ledger_doCompensation` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_doCompensation`(vDated DATE, vCompensationAccount VARCHAR(10) , vBankFk VARCHAR(10), vConcept VARCHAR(255), vAmount DECIMAL(10,2), vCompanyFk INT, vOriginalAccount VARCHAR(10)) +BEGIN +/** + * Compensa un pago o un recibo insertando en contabilidad + * + * @param vDated fecha en la cual se anota + * @param vCompensationAccount cuenta contable contra la que se compensa + * @param vBankFk banco de la compensacion + * @param vConcept descripcion + * @param vAmount cantidad que se compensa + * @param vCompany empresa + * @param vOriginalAccount cuenta contable desde la cual se compensa + * + */ + DECLARE vNewBookEntry INT; + DECLARE vIsClientCompensation INT; + DECLARE vClientFk INT; + DECLARE vSupplierFk INT; + DECLARE vIsOriginalAClient BOOL; + DECLARE vPayMethodCompensation INT; + + CALL ledger_next(vNewBookEntry); + + SELECT COUNT(id) INTO vIsOriginalAClient FROM client WHERE accountingAccount LIKE vOriginalAccount COLLATE utf8_general_ci; + + SELECT id, COUNT(id) INTO vClientFk, vIsClientCompensation + FROM client + WHERE accountingAccount LIKE vCompensationAccount COLLATE utf8_general_ci; + + SET @vAmount1:= 0.0; + SET @vAmount2:= 0.0; + + INSERT INTO XDiario (ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EUROHABER, empresa_id) + VALUES ( vNewBookEntry, + vDated, + vOriginalAccount, + vCompensationAccount, + vConcept, + @vAmount1:= IF( + (vIsOriginalAClient AND vAmount > 0) OR + (NOT vIsOriginalAClient AND vAmount < 0), + 0, + ABS(vAmount) + ), + @vAmount2:= IF(@vAmount1, + 0, + ABS(vAmount) + ), + vCompanyFk + ), + ( vNewBookEntry, + vDated, + vCompensationAccount, + vOriginalAccount, + vConcept, + @vAmount2, + @vAmount1, + vCompanyFk); + + IF vIsClientCompensation THEN + IF vIsOriginalAClient THEN + SET vAmount = -vAmount; + END IF; + INSERT INTO receipt(invoiceFk, amountPaid, payed, bankFk, companyFk, clientFk, isConciliate) + VALUES (vConcept, vAmount, vDated, vBankFk, vCompanyFk, vClientFk, TRUE); + ELSE + IF NOT vIsOriginalAClient THEN + SET vAmount = -vAmount; + END IF; + SELECT id INTO vSupplierFk FROM supplier WHERE `account` LIKE vCompensationAccount COLLATE utf8_general_ci; + SELECT id INTO vPayMethodCompensation FROM payMethod WHERE `code` = 'compensation'; + + INSERT INTO payment (received, dueDated, supplierFk, amount, bankFk, payMethodFk, concept, companyFk, isConciliated) + VALUES(vDated, vDated, vSupplierFk, vAmount, vBankFk, vPayMethodCompensation, vConcept, vCompanyFk, TRUE); + 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 `ledger_next` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ledger_next`(OUT vNewBookEntry INT) +BEGIN + + UPDATE vn.ledgerConfig SET lastBookEntry = LAST_INSERT_ID(lastBookEntry + 1); + SET vNewBookEntry = 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 `logAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 vEntity Nombre que hace referencia a la tabla. + * @param descripcion Descripción de la acción realizada por el usuario + */ + + CALL logAddWithUser(vOriginFk, account.userGetId(), vActionCode, vEntity, vDescription); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `logAddWithUser` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `logAddWithUser`(vOriginFk INT, vUserId 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 vEntity Nombre que hace referencia a la tabla. + * @param descripcion Descripción de la acción realizada por el usuario + */ + DECLARE vTableName VARCHAR(255) DEFAULT CONCAT(IFNULL(vEntity, ''), 'Log'); + + SET @sqlQuery = CONCAT( + 'INSERT INTO vn.', vTableName, ' SET originFk = ?, userFk = ?, action = ?, description = ?' + ); + SET @originFk = vOriginFk; + SET @userFk = vUserId; + SET @action = vActionCode; + SET @description = vDescription; + + PREPARE stmt FROM @sqlQuery; + EXECUTE stmt USING @originFk, @userFk, @action, @description; + 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 `logShow` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `logShow`(vOriginFk INT, vEntity VARCHAR(45)) +BEGIN +/** + * Muestra las acciones realizadas por el usuario + * + * @param vOriginFk Id del registro de origen + * @param vEntity Nombre que hace referencia a la tabla. + */ + DECLARE vTableName VARCHAR(45); + + 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', + ' INNER JOIN account.user u ON u.id = ot.userFk', + ' WHERE ot.originFk = ', vOriginFk, ' ORDER BY ot.creationDate DESC' + ); + + PREPARE stmt FROM @qryLog; + EXECUTE 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 `lungSize_generator` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `lungSize_generator`(vDate DATE) +BEGIN + +SET @buildingOrder := 0; +SET @route := 0; +set @cajas := 0; + + UPDATE tmp.sorter + SET buildingOrder = @buildingOrder := IF(@route = @route := routeFk, @buildingOrder, 0) + 1 + where date(created) = vDate + order by routeFk, created, weight DESC; + + update tmp.sorter + SET palletOrder = buildingOrder mod 14, lungGrow = buildingOrder mod 14 + WHERE date(created) = vDate; + + UPDATE tmp.sorter + JOIN ( + SELECT routeFk, max(id) maxid + FROM tmp.sorter + where date(created) = vDate + GROUP BY routeFk) sub ON sub.maxid = id + SET lungGrow = 1 - palletOrder ; + + UPDATE tmp.sorter + SET lungGrow = IF(palletOrder = 0, -13, lungGrow); + + DELETE FROM tmp.lungSize WHERE dia = vDate; + + INSERT INTO tmp.lungSize(dia, hora,size) + select vDate,hora, @cajas := @cajas + cajas as size + from + ( + select IF(lungGrow BETWEEN -12 AND -1, ETD,time_format(created,"%H:%i")) as hora, sum(if(lungGrow <= 0, lungGrow, 1)) as cajas, @cajas := 0 + from tmp.sorter + where date(created) = vDate + group by hora + ) sub; + + SELECT * FROM tmp.lungSize + WHERE dia = 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 `machineWorker_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT) +BEGIN + +/** + * Inserta registro si el vWorkerFk no ha registrado nada en las últimas 12 horas + * @param vPlate número de matrícula + * @param vWorkerFk id del worker + * +*/ + UPDATE vn.machineWorker mw + JOIN vn.machine m ON m.id = mw.machineFk + SET mw.outTimed = NOW() + WHERE (mw.workerFk = vWorkerFk OR m.plate = vPlate) + AND ISNULL(mw.outTimed); + + INSERT INTO machineWorker (machineFk, workerFk) + SELECT m.id, vWorkerFk + FROM machine m + WHERE m.plate= vPlate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `machineWorker_getHistorical` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT) +BEGIN +/** + * Obtiene historial de la matrícula vPlate que el trabajador vWorkerFk escanea, + * si es jefe de producción muestra el historial completo. + * + * @param vPlate número de matrícula + * @param vWorkerFk id del trabajador + * +*/ + DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vWorkerFk); + + SELECT mw.inTimed,account.user_getNameFromId(mw.workerFk) as workerName, mw.outTimed + FROM machineWorker mw + JOIN machine m ON m.plate = vPlate + WHERE mw.machineFk = m.id + AND mw.workerFk = IF(account.user_hasRole(vWorkerName, 'coolerAssist'), mw.workerFk, vWorkerFk) + ORDER BY mw.inTimed 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 `machineWorker_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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT) +BEGIN + +/** + * Actualiza el registro correspondiente si el vWorkerFk se ha registrado en las últimas horas (campo maxHours de machineWorkerConfig) con vPlate, + * + * @param vPlate número de matrícula + * @param vWorkerFk id del trabajador + * +*/ + + DECLARE vMachineFk INT(10); + DECLARE vMaxHours INT(10); + + SELECT m.id INTO vMachineFk + FROM machine m + WHERE m.plate = vPlate; + + SELECT maxHours INTO vMaxHours + FROM machineWorkerConfig; + + IF (SELECT COUNT(*) + FROM machineWorker m + WHERE m.workerFk = vWorkerFk + AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, NOW()) AND ISNULL(m.outTimed)) THEN + + UPDATE machineWorker m + SET m.outTimed = CURRENT_TIMESTAMP() + WHERE m.workerFk = vWorkerFk + AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, NOW()) + AND ISNULL(m.outTimed) + AND m.machineFk = vMachineFk; + + 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 `machine_getWorkerPlate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `machine_getWorkerPlate`(vWorkerFk INT) +BEGIN +/** + * Selecciona la matrícula del vehículo del workerfk + * + * @param vWorkerFk el id del trabajador + * + * + **/ + + SELECT m.plate + FROM machine m + JOIN machineWorker mw ON mw.machineFk = m.id + WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) + AND ISNULL(mw.outTimed) + AND mw.workerFk = vWorkerFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `mail_insert` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `mail_insert`( + vReceiver VARCHAR(255), + vReplyTo VARCHAR(50), + vSubject VARCHAR(100), + vBody TEXT) +BEGIN +/** + * Inserta en la tabla vn.mail + * + * @param vReceiver Receptor del correo + * @param vReplyTo A quién contestar el correo + * @param vSubject Título del correo + * @param vBody Cuerpo del correo + */ + + DECLARE vIsRepeated BOOLEAN; + + SELECT COUNT(*) INTO vIsRepeated + FROM vn.mail + WHERE creationDate >= CURDATE() + AND `receiver` = vReceiver + AND `replyTo` = vReplyTo + AND `subject` = vSubject + AND !sent; + + IF NOT vIsRepeated THEN + + INSERT INTO vn.mail SET + `receiver` = vReceiver, + `replyTo` = vReplyTo, + `subject` = vSubject, + `body` = vBody; + + 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 `makeNewItem` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `makeNewItem`() +BEGIN + + DECLARE newItemFk INT; + + SELECT getNewItemId() INTO newItemFk; + + INSERT INTO item(id,name,typeFk,originFk) + SELECT newItemFk, 'Nuevo artículo', 78,39; + + SELECT newItemFk; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `makePCSGraf` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `makePCSGraf`(vDated DATE) +BEGIN + + + DECLARE vHour INT DEFAULT 0; + DECLARE vMinute INT DEFAULT 0; + DECLARE vBoxes INT; + + + DROP TEMPORARY TABLE IF EXISTS vn.pcsDay; + CREATE TEMPORARY TABLE vn.pcsDay + SELECT 0 as hh, 0 as mm, 0 as boxes; + + -- Creamos una tabla soporte para acumular las cajas a lo largo del dia + WHILE vHour < 24 DO + + WHILE vMinute < 59 DO + + SET vMinute = vMinute + 1; + + INSERT INTO vn.pcsDay(hh,mm) VALUES(vHour, vMinute); + + END WHILE; + + SET vMinute = -1; + SET vHour = vHour + 1; + + END WHILE; + + -- Acumulamos + UPDATE vn.pcsDay pd + LEFT JOIN (SELECT * FROM vn.pcs_graf WHERE dia = vDated) pg USING(hh,mm) + SET pd.boxes = pd.boxes + pg.box; + + SELECT * FROM vn.pcsDay; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `manaSpellersRequery` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `manaSpellersRequery`(vWorkerFk INTEGER) +BEGIN +/** + * Recalcula el mana consumido por un trabajador + * + * @param vWorkerFk Id Trabajador + */ + DECLARE vWorkerIsExcluded BOOLEAN; + DECLARE vFromDated DATE; + DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,CURDATE()); + DECLARE vMana INT; + DECLARE vAutoMana INT; + DECLARE vClaimMana INT; + DECLARE vManaBank INT; + DECLARE vManaGreugeType INT; + + SELECT COUNT(*) INTO vWorkerIsExcluded + FROM workerManaExcluded + WHERE workerFk = vWorkerFk; + + IF NOT vWorkerIsExcluded THEN + SELECT id INTO vMana + FROM `component` WHERE code = 'mana'; + + SELECT id INTO vAutoMana + FROM `component` WHERE code = 'autoMana'; + + SELECT id INTO vClaimMana + FROM `component` WHERE code = 'manaClaim'; + + SELECT id INTO vManaBank + FROM `bank` WHERE code = 'mana'; + + SELECT id INTO vManaGreugeType + FROM `greugeType` WHERE code = 'mana'; + + SELECT max(dated) INTO vFromDated + FROM clientManaCache; + + REPLACE workerMana (workerFk, amount) + SELECT vWorkerFk, sum(mana) FROM + ( + SELECT s.quantity * sc.value as mana + FROM ticket t + JOIN address a ON a.id = t.addressFk + JOIN client c ON c.id = a.clientFk + JOIN sale s ON s.ticketFk = t.id + JOIN saleComponent sc ON sc.saleFk = s.id + WHERE c.salesPersonFk = vWorkerFk AND sc.componentFk IN (vMana, vAutoMana, vClaimMana) + AND t.shipped > vFromDated AND t.shipped < vToDated + UNION ALL + SELECT - r.amountPaid + FROM receipt r + JOIN client c ON c.id = r.clientFk + WHERE c.salesPersonFk = vWorkerFk AND bankFk = vManaBank + AND payed > vFromDated + UNION ALL + SELECT g.amount + FROM greuge g + JOIN client c ON c.id = g.clientFk + WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = vManaGreugeType + AND g.shipped > vFromDated and g.shipped < CURDATE() + UNION ALL + SELECT cc.mana + FROM clientManaCache cc + JOIN client c ON c.id = cc.clientFk + WHERE c.salesPersonFk = vWorkerFk AND cc.dated = vFromDated + ) sub; + 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 `mergeTicketUnattended` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `mergeTicketUnattended`(IN vMainTicket INT(11), IN hasSameAgency BOOLEAN) +BEGIN + + DECLARE isBilled BOOLEAN; + DECLARE arrayTickets VARCHAR(255); + + SELECT Factura IS NOT NULL INTO isBilled FROM vn2008.Tickets WHERE Id_Ticket = vMainTicket; + + IF NOT isBilled THEN + + SELECT GROUP_CONCAT(distinct T.Id_Ticket) INTO arrayTickets + FROM vn2008.Tickets T LEFT JOIN vn.ticketState ts ON T.Id_Ticket = ts.ticket + JOIN vn2008.Tickets ticketOriginal ON ticketOriginal.Id_Ticket = vMainTicket + AND T.empresa_id = ticketOriginal.empresa_id + AND T.Id_Consigna = ticketOriginal.Id_Consigna + AND DATE(T.Fecha) = DATE(ticketOriginal.Fecha) + AND T.warehouse_id = ticketOriginal.warehouse_id + AND IF(hasSameAgency <> 0,T.Id_Agencia = ticketOriginal.Id_Agencia,TRUE) + LEFT JOIN vn.ticketState tsOriginal ON ticketOriginal.Id_Ticket = tsOriginal.ticket + WHERE ts.alertLevel < 3 + AND T.Factura IS NULL + AND T.Anotadoencaja = FALSE + AND T.Id_Ticket <> vMainTicket + AND ts.alertLevel = tsOriginal.alertLevel; + + CALL mergeTicketWithArray(vMainTicket,arrayTickets); + + 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 `mergeTicketWithArray` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `mergeTicketWithArray`(IN vMainTicket INT(11), IN arrayTickets VARCHAR(50)) +BEGIN + + DECLARE isBilled BOOLEAN; + DECLARE messageLog VARCHAR(50); + DECLARE company INT; + DECLARE messageForSplit VARCHAR(255); + DECLARE vMainSplit INT; + DECLARE worker INT(3); + + SELECT Factura IS NOT NULL INTO isBilled FROM vn2008.Tickets WHERE Id_Ticket = vMainTicket; + + IF NOT isBilled THEN + + SELECT Id_Trabajador INTO worker from vn2008.Trabajadores where user_id = account.userGetId(); + + DROP TEMPORARY TABLE IF EXISTS vn2008.Tickets_to_fusion; + + -- 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 + WHERE Id_Ticket IN (%s);',arrayTickets)); + + INSERT INTO vn2008.ticket_observation (Id_Ticket,observation_type_id,text) + SELECT vMainTicket,observation_type_id,CONCAT(' Ticket ', Id_Ticket, ':' , tco.text, '. ') + FROM vn2008.Tickets_to_fusion tf + INNER JOIN vn2008.ticket_observation tco USING(Id_Ticket) + ON DUPLICATE KEY UPDATE `text` = CONCAT(ticket_observation.`text`,CONCAT(' Ticket ', VALUES(Id_Ticket), ':' , VALUES(`text`), '. ')); + + UPDATE vn2008.Movimientos M + JOIN vn2008.Tickets_to_fusion USING(Id_Ticket) + SET M.Id_Ticket = vMainTicket; + + 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; + + UPDATE vn2008.Tickets + JOIN vn2008.Tickets_to_fusion USING(Id_Ticket) + SET Fecha = TIMESTAMPADD(YEAR,-1 * (YEAR(Fecha)-2000), Fecha), Id_Ruta = NULL; + + UPDATE vn.ticketLog tl + JOIN vn2008.Tickets_to_fusion t ON t.Id_Ticket = tl.originFk + SET tl.originFk = vMainTicket; + + UPDATE vn2008.Tickets + SET Localizacion = CONCAT(Tickets.Localizacion,' ',IFNULL((SELECT GROUP_CONCAT(Localizacion SEPARATOR ' ') FROM vn2008.Tickets_to_fusion),'')) + WHERE Id_Ticket = vMainTicket; + + UPDATE vn2008.Splits s + RIGHT JOIN vn2008.Tickets_to_fusion t USING(Id_Ticket) + SET s.Id_Ticket = vMainTicket; + + UPDATE vn2008.Ordenes o + RIGHT JOIN vn2008.Tickets_to_fusion t ON t.Id_Ticket = o.ticketFk + SET o.ticketFk = vMainTicket; + + IF (SELECT COUNT(*) FROM vn2008.Splits WHERE Id_Ticket=vMainTicket) > 1 THEN + + SELECT Id_Split INTO vMainSplit FROM vn2008.Splits WHERE Id_Ticket = vMainTicket LIMIT 1; + + SELECT group_concat(Notas,',') INTO messageForSplit FROM vn2008.Splits WHERE Id_Ticket = vMainTicket; + UPDATE vn2008.Splits SET Notas = messageForSplit WHERE Id_Split=vMainSplit; + UPDATE vn2008.Split_lines sl JOIN vn2008.Splits s USING (Id_Split) SET sl.Id_Split=vMainSplit WHERE Id_Ticket=vMainTicket; + DELETE FROM vn2008.Splits WHERE Id_Ticket=vMainTicket AND Id_Split<>vMainSplit; + END IF; + + SELECT GROUP_CONCAT(Id_Ticket SEPARATOR ',') into messageLog FROM vn2008.Tickets_to_fusion; + CALL vn2008.Ditacio(vMainTicket,'Fusion','T',worker,messageLog,NULL); + + DELETE ts FROM vn2008.Tickets_state ts JOIN vn2008.Tickets_to_fusion t USING(Id_Ticket); + + DROP TEMPORARY TABLE vn2008.Tickets_to_fusion; + 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 `mysqlConnectionsSorter_kill` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlConnectionsSorter_kill`() +BEGIN + +/** + * Elimina conexiones del usuario sorter con tiempo >= 30seg. Asociado al evento con el mismo nombre + */ + + DECLARE vDone INT DEFAULT 0; + DECLARE vProcesId INT; + + DECLARE vCursor CURSOR FOR + SELECT p.id + FROM information_schema.processlist p + WHERE USER = 'sorter' + AND TIME >= 30; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + OPEN vCursor; + + l: LOOP + + FETCH vCursor INTO vProcesId; + + IF vDone THEN + LEAVE l; + END IF; + + KILL vProcesId; + + END LOOP; + + CLOSE vCursor; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `mysqlPreparedCount_check` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqlPreparedCount_check`() +BEGIN + DECLARE vPreparedCount INTEGER; + + SELECT VARIABLE_VALUE INTO vPreparedCount + FROM INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE VARIABLE_NAME LIKE '%prepared_stmt_count%'; + + IF(vPreparedCount >= 40000) THEN + CALL `vn`.`mail_insert`('cau@verdnatura.es', + NULL, + 'Problemas BBDD prepared_stmt_count', + CONCAT('Existen problemas con el servicio de Logiflora, prepared_stmt_count con valor: ', + vPreparedCount, + ', está próximo a exceder su límite. \r\n Hay que reiniciar el servicio LF.VMP.Service del servidor a3.') + ); + 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 `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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `nestAdd__`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vParentFk` INT, IN `vChild` VARCHAR(100)) +BEGIN + DECLARE vSql TEXT; + DECLARE vTableClone VARCHAR(45); + + SET vTableClone = CONCAT(vTable, 'Clone'); + + CALL util.exec(CONCAT('DROP TEMPORARY TABLE IF EXISTS tmp.', vTableClone)); + CALL util.exec(CONCAT( + 'CREATE TEMPORARY TABLE tmp.', vTableClone, + ' ENGINE = MEMORY' + ' SELECT * FROM ', vScheme, '.', vTable + )); + + -- 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, 'tmp', vTableClone, 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, 'tmp', vTableClone, 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; + + CALL util.exec(CONCAT('DROP TEMPORARY TABLE tmp.', vTableClone)); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `nestLeave__`(vScheme VARCHAR(45), vTable VARCHAR(45), vParentFk INT) +BEGIN + DROP TEMPORARY TABLE IF EXISTS tmp.tree; + + CALL util.exec(CONCAT( + 'CREATE TEMPORARY TABLE tmp.tree ', + 'SELECT + node.id, + node.name, + node.lft, + node.rgt, + node.depth, + node.sons + FROM ', + vScheme, '.', vTable, ' AS node, ', + vScheme, '.', vTable, ' AS parent ', + 'WHERE + node.lft BETWEEN parent.lft AND parent.rgt + AND node.depth = parent.depth + 1 + AND parent.id = ', vParentFk, ' ' + 'GROUP BY node.id + ORDER BY node.lft')); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `nestTree__`( + vSourceSchema VARCHAR(45), + vSourceTable VARCHAR(45), + vDestinationSchema VARCHAR(45), + vDestinationTable VARCHAR(45)) +BEGIN + DECLARE vTableClone VARCHAR(45); + + SET vTableClone = CONCAT(vSourceTable, 'Clone'); + + CALL util.exec(CONCAT('DROP TEMPORARY TABLE IF EXISTS tmp.', vTableClone)); + CALL util.exec(CONCAT( + 'CREATE TEMPORARY TABLE tmp.', vTableClone, + ' ENGINE = MEMORY', + ' SELECT * FROM ', vSourceSchema, '.', vSourceTable + )); + + CALL util.exec(CONCAT( + 'TRUNCATE TABLE ', vDestinationSchema, '.', vDestinationTable)); + CALL util.exec(CONCAT( + 'INSERT INTO ', vDestinationSchema, '.', vDestinationTable, + '(id, name, lft, rgt, depth, sons)', + 'SELECT + node.id, + node.name, + node.lft, + node.rgt, + COUNT(parent.id) - 1 depth, + CAST((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons + FROM ', + vSourceSchema, '.', vSourceTable, ' AS node,', + 'tmp.', vTableClone, ' AS parent ', + 'WHERE node.lft + BETWEEN parent.lft AND parent.rgt + GROUP BY node.id + ORDER BY node.lft')); + + CALL util.exec(CONCAT('DROP TEMPORARY TABLE tmp.', vTableClone)); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `nextShelvingCodeMake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `nextShelvingCodeMake`() +BEGIN + + DECLARE newShelving VARCHAR(3); + DECLARE vCode VARCHAR(3); + + SELECT MAX(code) INTO vCode + FROM vn.shelving + WHERE isPrinted = FALSE; + + SET @a1 := ASCII(MID(vCode,1,1)); + SET @a2 := ASCII(MID(vCode,2,1)); + SET @a3 := ASCII(MID(vCode,3,1)) + 1; + + IF @a3 > 90 THEN + + SET @a3 = 65; + SET @a2 = @a2 + 1; + + IF @a2 > 90 THEN + + SET @a2 = 65; + SET @a1 = @a1 + 1; + + IF @a1 > 90 THEN + + SET @a1 = 65; + + END IF; + + END IF; + + END IF; + + SET newShelving = CHAR(@a1,@a2,@a3 USING utf8); + + INSERT INTO vn.shelving(code) VALUES(newShelving); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `observationAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `observationAdd`(vOriginFk INT, vTableCode VARCHAR(45), vDescription TEXT) +BEGIN +/** + * Guarda las observaciones realizadas por el usuario + * + * @param vOriginFk Id del registro de origen + * @param vTypeCode Código que referencia a la tabla. + * @param descripcion Texto de la observacion + */ + DECLARE vTableName VARCHAR(45); + + SET vTableName = CONCAT(vTableCode,'Observation'); + + IF ISNULL(vTableName) THEN + CALL util.throw('CODE_NOT_FOUND'); + END IF; + + SET @qryLog := CONCAT( + 'INSERT INTO ', vTableName, ' (originFk, userFk, description)', + ' VALUES (', vOriginFk, ', ', account.userGetId(), ', "', vDescription, '")' + ); + + PREPARE stmt FROM @qryLog; + 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 `orderCreate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `orderCreate`( + vLanded DATE, + vAgencyMode INT, + vAddress INT, + vSourceApp VARCHAR(10), + OUT vOrderId INT) +BEGIN + + DECLARE vDeliveryMethod INT; + DECLARE vClient INT; + + SELECT deliveryMethodFk INTO vDeliveryMethod + FROM vn.agencyMode + WHERE id = vAgencyMode; + + SELECT clientFk INTO vClient + FROM vn.address + WHERE id = vAddress; + + INSERT INTO hedera.order(date_send,customer_id,delivery_method_id,agency_id,address_id,source_app) + VALUES( vLanded,vClient ,vDeliveryMethod,vAgencyMode ,vAddress ,vSourceApp); + + SET vOrderId = 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 `orderDelete` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `orderDelete`(IN vId INT) +BEGIN + + DELETE FROM hedera.`order` where id = vId; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `orderListCreate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListCreate`( + vLanded DATE, + vAgencyMode INT, + vAddress INT, + vSourceApp VARCHAR(10)) +BEGIN + + DECLARE vOrderId INT; + CALL vn.orderCreate(vLanded,vAgencyMode,vAddress,vSourceApp,vOrderId); + SELECT vOrderId; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `orderListVolume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `orderListVolume`(IN vOrderId INT) +BEGIN + + SELECT + o.id, + o.itemFk, + i.description, + o.amount, + round(ic.cm3delivery * o.amount / 1000000,3) as volume + FROM hedera.orderRow o + JOIN item i ON i.id = o.itemFk + JOIN itemCost ic ON ic.itemFk = o.itemFk AND ic.warehouseFk = o.warehouseFk + WHERE o.orderFk = vOrderId; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 vComponentCost INT DEFAULT 28; + DECLARE vGraceDate DATE; + DECLARE vDateEnd DATE; + + SET vGraceDays = IF(vIsAllInvoiceable ,0, 30); + SET vGraceDate = TIMESTAMPADD(DAY, - vGraceDays, vDate); + + /* Clientes especiales: + 3240 MADEFLOR + 992 JAVIER FELIU + 4 TONI VENDRELL + */ + + IF vClient IN (992, 3240, 4) THEN + + SET vGraceDays = 365; + + END IF; + /* Fin clientes especiales */ + + SET vDateEnd = DATE_ADD(vDate, INTERVAL 1 DAY); + + 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 packaging p ON p.id = tp.packagingFk + JOIN ticket t ON t.id = tp.ticketFk + WHERE t.shipped BETWEEN vDateStart AND vDateEnd + 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 COUNT(*) + INTO vIsInvoiceable + FROM tmp.packageToInvoicePositives; + + IF vIsInvoiceable THEN + + CALL ticket_add(vClient, + vDateEnd, + vWarehouse, + vCompany, + NULL, + NULL, + NULL, + vDateEnd, + account.userGetId(), + TRUE, + 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 `packingListPrinted` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `packingListPrinted`(ticketFk INT) +BEGIN + + UPDATE vn2008.Movimientos_mark mm + JOIN vn2008.Movimientos m ON m.Id_Movimiento = mm.Id_Movimiento + SET mm.valor = 2 -- Impreso + WHERE mm.valor = 1 -- Listo para imprimir + AND mm.stateFk = 9 -- Encajando + AND m.Id_Ticket = ticketFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `packingListSwitch` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `packingListSwitch`(saleFk INT) +BEGIN + + DECLARE valueFk INT; + DECLARE encajando INT DEFAULT 9; + + SELECT valor INTO valueFk + FROM vn2008.Movimientos_mark + WHERE Id_Movimiento = saleFk + AND stateFk = encajando; + + SET valueFk = (IFNULL(valueFk,0) + 1) MOD 3; + + REPLACE vn2008.Movimientos_mark(Id_Movimiento, valor, Id_Trabajador, stateFk) + VALUES(saleFk,valueFk,account.myUser_getId(),encajando); + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `parking_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_add`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN) +BEGIN + + DECLARE vColumn INT; + DECLARE vRow INT; + DECLARE vLetters VARCHAR(26) DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + DECLARE vMaxId INT; + DECLARE vCode VARCHAR(8); + + SET vColumn = vFromColumn; + SET vRow = vFromRow; + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); + + SELECT MAX(id) INTO vMaxId + FROM vn.parking; + + WHILE vColumn <= vToColumn DO + + WHILE vRow <= vToRow DO + + INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`, pickingOrder) + VALUES (vColumn, vRow, vSectorFk, vCode, vColumn * 100 + vRow ) + ON DUPLICATE KEY UPDATE `code` = vCode; + + SET vRow = vRow + 1; + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); + + END WHILE; + + SET vRow = vFromRow; + SET vColumn = vColumn + 1; + + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); + + END WHILE; + + SELECT * FROM vn.parking WHERE `column` BETWEEN vFromColumn AND vToColumn; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `parking_add__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_add__`(vFromColumn INT, vToColumn INT, vFromRow INT, vToRow INT, vSectorFk INT, vIsLetterMode BOOLEAN) +BEGIN + + DECLARE vColumn INT; + DECLARE vRow INT; + DECLARE vLetters VARCHAR(26) DEFAULT 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + DECLARE vMaxId INT; + DECLARE vCode VARCHAR(8); + + SET vColumn = vFromColumn; + SET vRow = vFromRow; + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); + + SELECT MAX(id) INTO vMaxId + FROM vn.parking; + + WHILE vColumn <= vToColumn DO + + WHILE vRow <= vToRow DO + + INSERT IGNORE INTO vn.parking(`column`, `row`, sectorFk, `code`, pickingOrder) + VALUES (vColumn, vRow, vSectorFk, vCode, vColumn * 100 + vRow ) + ON DUPLICATE KEY UPDATE `code` = vCode; + + SET vRow = vRow + 1; + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); + + END WHILE; + + SET vRow = vFromRow; + SET vColumn = vColumn + 1; + + SET vCode = CONCAT(LPAD(vColumn,3,'0'),'-',IF(vIsLetterMode, MID(vLetters, vRow, 1), LPAD(vRow, 2,'0'))); + + END WHILE; + + SELECT * FROM vn.parking WHERE `column` BETWEEN vFromColumn AND vToColumn; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `parking_algemesi` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_algemesi`(vFromRow INT, vToRow INT, vSectorFk INT, vLetter VARCHAR(1), vPickingOrder INT, vTrolleysByLine INT) +BEGIN + + DECLARE vRow INT; + DECLARE vCode VARCHAR(8); + DECLARE i INT; + + IF vToRow < vFromRow THEN + + SET vRow = vFromRow; + + WHILE vRow >= vToRow DO + + SET i = 1; + + WHILE i <= vTrolleysByLine DO + + SET vCode = CONCAT(vLetter,'-', LPAD(vRow,2,'0'),'-', i); + + INSERT IGNORE INTO vn.parking( sectorFk, `code`, pickingOrder) + VALUES (vSectorFk, vCode, vPickingOrder + (i * 10)) + ON DUPLICATE KEY UPDATE `code` = vCode; + + SET i = i + 1; + + END WHILE; + + SET vRow = vRow - 1; + + END WHILE; + + ELSE + + SET vRow = vFromRow; + + WHILE vRow <= vToRow DO + + SET i = 1; + + WHILE i <= vTrolleysByLine DO + + SET vCode = CONCAT(vLetter,'-', LPAD(vRow,2,'0'),'-', i); + + INSERT IGNORE INTO vn.parking( sectorFk, `code`, pickingOrder) + VALUES (vSectorFk, vCode, vPickingOrder + (i * 10) ) + ON DUPLICATE KEY UPDATE `code` = vCode; + + SET i = i + 1; + + END WHILE; + + SET vRow = vRow + 1; + + END WHILE; + + + 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 `parking_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_new`(vStart INT, vEnd INT, vSectorFk INT) +BEGIN + + DECLARE vRow INT; + DECLARE vColumn INT; + DECLARE vLetters VARCHAR(200); + DECLARE vLettersLength INT; + + SET vColumn = vStart; + SET vRow = 1; + SET vLetters = 'ABCDEF'; + SET vLettersLength = LENGTH(vLetters); + + WHILE vColumn <= vEnd DO + + REPLACE vn.parking(`column`, `row`, `code`, sectorFk) + VALUES(vColumn, vRow, CONCAT(vColumn,MID(vLetters,vRow,1)), vSectorFk); + + SET vRow = vRow + 1; + + IF vRow > vLettersLength THEN + + SET vRow = 1; + SET vColumn = vColumn + 1; + + END IF; + + 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 `parking_new__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_new__`(vStart INT, vEnd INT, vSectorFk INT) +BEGIN + + DECLARE vRow INT; + DECLARE vColumn INT; + DECLARE vLetters VARCHAR(200); + DECLARE vLettersLength INT; + + SET vColumn = vStart; + SET vRow = 1; + SET vLetters = 'ABCDEF'; + SET vLettersLength = LENGTH(vLetters); + + WHILE vColumn <= vEnd DO + + REPLACE vn.parking(`column`, `row`, `code`, sectorFk) + VALUES(vColumn, vRow, CONCAT(vColumn,MID(vLetters,vRow,1)), vSectorFk); + + SET vRow = vRow + 1; + + IF vRow > vLettersLength THEN + + SET vRow = 1; + SET vColumn = vColumn + 1; + + END IF; + + 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 `parking_setOrder` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_setOrder`(vWarehouseFk INT) +BEGIN + + /* + * Ordena el orden de preparacion de los parking de acuerdo con la tabla vn.corridor + */ + + UPDATE vn.parking p + JOIN ( + SELECT code, + @orden := @orden + 10 AS po + FROM ( + SELECT c.prepOrder, + p.code, + @orden := 0, + IF(c.isAscendent, 1,-1) * CAST(SUBSTRING(p.code,3,2) AS DECIMAL(2,0)) subCorridor , + CAST(IF(LENGTH(p.code) > 5, SUBSTRING(p.code,6,2), 0) AS DECIMAL(2,0)) ubication + FROM vn.parking p + JOIN vn.sector s ON s.id = p.sectorFk + JOIN vn.corridor c ON c.code = LEFT(p.code,1) COLLATE utf8_general_ci + WHERE s.warehouseFk = vWarehouseFk) sub + ORDER BY sub.prepOrder, subCorridor, ubication) sub2 ON sub2.code = p.code + SET p.pickingOrder = sub2.po; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `payRoll__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `payRoll__`(IN vFromDated DATE, IN vToDated DATE, IN vFromPaid DATE, IN vToPaid DATE, IN vPartTime BOOL) +BEGIN + + SET @userFk := 0; + + SELECT CONCAT(w.lastName,', ',w.firstname) AS Trabajador, + CAST(Sum((wj.total + wj.permission + wj.lunch)* wj.priceOrdinaryHour + wj.hollyday * wj.priceHollydayHour + + wj.nocturn * wj.priceNocturnHour + + wj.extra * wj.priceExtraHour) AS DECIMAL(10,2)) AS salario, + CAST(Sum(wj.permission) AS DECIMAL(10,2)) AS permission, + CAST(Sum(wj.total) AS DECIMAL(10,2)) AS total, + CAST(Sum(wj.nocturn) AS DECIMAL(10,2)) AS nocturn, + CAST(Sum(wj.hollyday) AS DECIMAL(10,2)) AS hollyday, + CAST(Sum(wj.lunch) AS DECIMAL(10,2)) AS lunch, + CAST(Sum(wj.extra) AS DECIMAL(10,2)) AS extra, + CAST(Sum(wj.contractJourney) AS DECIMAL(10,2)) AS contractJourney, + d.name AS departamento, + CAST(Sum((wj.contractJourney + wj.permission) * wj.priceOrdinaryHour) AS DECIMAL(10,2)) AS teorico, + CAST(Sum((wj.lunch + wj.permission + wj.total) * wj.priceordinaryhour) AS DECIMAL(10,2)) AS practico, + CAST(Sum(wj.nocturn * wj.pricenocturnhour) AS DECIMAL(10,2)) AS nocturno, + CAST(Sum(wj.hollyday * wj.priceHollydayHour) AS DECIMAL(10,2)) AS festivos, + CAST(Sum(wj.extra * wj.priceextrahour) AS DECIMAL(10,2)) AS extras, + MAX(wj.businessFk) as businessFk, + IF(sub.workerFk IS NULL, FALSE, TRUE) isLastBusiness, + Min(b.date_start) AS fromDated, + Max(b.date_end) AS toDated, + blp.importepactado, + bl.porhoras, + IF(wj.userFk != @userFk, CAST(IFNULL(a.Anticipos,0) AS DECIMAL(10,2)), 0) AS Anticipos, + IF(wj.userFk != @userFk, CAST(IFNULL(se.SaldoEuros,0) AS DECIMAL(10,2)), 0) AS SaldoEuros, + @userFk := wj.userFk as userFk + FROM worker w + JOIN workerJourney wj ON w.id = wj.userFk + JOIN postgresql.business b ON b.business_id = wj.businessFk + JOIN postgresql.business_labour bl ON bl.business_id = b.business_id + JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id + JOIN department d ON bl.department_id = d.id + LEFT JOIN (SELECT pe.id_trabajador, SUM(debe) Anticipos + FROM postgresql.income_employee ie + JOIN postgresql.person pe ON ie.person_id = pe.person_id + WHERE odbc_date BETWEEN vFromPaid AND vToPaid + AND id_incomeType = 14 -- Salario + GROUP BY pe.id_trabajador + ) a ON a.id_trabajador = w.id + LEFT JOIN (SELECT pe.id_trabajador, SUM(debe) - SUM(haber) as SaldoEuros + FROM postgresql.income_employee ie + JOIN postgresql.person pe ON ie.person_id = pe.person_id + GROUP BY pe.id_trabajador + ) se ON se.id_trabajador = w.id + LEFT JOIN (SELECT MAX(IFNULL(ended, DATE_ADD(vToDated, INTERVAL 1 DAY )))dated,wl.workerFk + FROM vn.workerLabour wl + GROUP BY wl.workerFk + HAVING dated<=vToDated + ) sub ON sub.workerFk = w.id + WHERE wj.dated BETWEEN vFromDated AND vToDated + AND IF(vPartTime, cl.hours_week <= 40, cl.hours_week = 40) + GROUP BY w.id + ORDER BY w.lastName, w.firstname; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `placement_test` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `placement_test`(vParamFk INT(11)) +BEGIN + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + DECLARE vWarehouseAliasFk INT; + DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + ENGINE = MEMORY + SELECT 0000000 as ticketFk, + 0000000 as saleFk, + 0000000 as itemFk, + FALSE as isStowaway, + 0 as quantity; + + INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.ticketCollection tc + JOIN vn.collection c ON c.id = tc.collectionFk + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.item i ON i.id = s.itemFk + WHERE tc.collectionFk = vParamFk + AND (i.itemPackingTypeFk = c.itemPackingTypeFk OR ISNULL(c.itemPackingTypeFk)) + UNION ALL + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.sale s + WHERE s.ticketFk = vParamFk; + + + /* UNION ALL + SELECT sw.shipFk, s.id, s.itemFk, TRUE + FROM vn.sale s + JOIN vn.stowaway sw ON sw.id = s.ticketFk + JOIN vn.ticketCollection tc ON tc.ticketFk = sw.shipFk + WHERE tc.collectionFk = vParamFk; + + INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + WHERE s.ticketFk = vParamFk + AND t.shipped > '2020-01-01' + UNION ALL + SELECT sw.shipFk, s.id, s.itemFk, TRUE + FROM vn.sale s + JOIN vn.stowaway sw ON sw.id = s.ticketFk + WHERE sw.shipFk = vParamFk; + + DELETE FROM tmp.sale + WHERE saleFk = 0; + */ + SELECT t.warehouseFk, w.aliasFk + INTO vWarehouseFk, vWarehouseAliasFk + FROM vn.ticket t + JOIN tmp.sale ts ON ts.ticketFk = t.id + JOIN vn.warehouse w ON w.id = t.warehouseFk + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + UPDATE tmp.sale ts + JOIN ( SELECT itemFk, sum(visible) as visible + FROM vn.itemShelvingStock iss + JOIN vn.warehouse w ON w.id = iss.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + GROUP BY iss.itemFk ) iss ON iss.itemFk = ts.itemFk + SET ts.quantity = iss.visible; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale2; + CREATE TEMPORARY TABLE tmp.sale2 + ENGINE = MEMORY + SELECT * FROM tmp.sale; + + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT b.itemFk, + CASE b.groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN b.packing + ELSE b.`grouping` + END AS `grouping` + FROM buy b + JOIN cache.last_buy lb ON lb.buy_id = b.id + WHERE lb.warehouse_id = vWarehouseFk + ; + + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE = MEMORY + SELECT * FROM tmp.`grouping`; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList; + CREATE TEMPORARY TABLE tmp.salePlacementList + ENGINE = MEMORY + + SELECT ts.saleFk, + ts.itemFk, + CONCAT( + IF( iss.id, + CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), + ''), + p.`code`) COLLATE utf8_general_ci as placement , + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + ish.visible, + IF(ts.isStowaway, - 100000, IF(ish.visible > 0 OR iss.id, 1, 100000)) * p.pickingOrder as `order`, + IFNULL(IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`),1) as `grouping`, + IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW()))) as priority, + 0 as saleOrder, + sc.isPreviousPrepared, + iss.id as itemShelvingSaleFk, + ts.ticketFk + ,iss.id + , st.saleFk as salePreviousPrepared + , iss.userFk + FROM tmp.sale ts + LEFT JOIN (SELECT DISTINCT saleFk + FROM vn.saleTracking st + JOIN vn.state s ON s.id = st.stateFk + WHERE st.isChecked + AND s.semaphore = 1) st ON st.saleFk = ts.saleFk + JOIN vn.itemShelving ish ON ish.itemFk = ts.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + LEFT JOIN tmp.`grouping` g ON g.itemFk = ts.itemFk + LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = ts.saleFk AND iss.itemShelvingFk = ish.id + LEFT JOIN vn.worker wk ON wk.id = iss.userFk + WHERE w.aliasFk = vWarehouseAliasFk + HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL + ; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_2; + CREATE TEMPORARY TABLE tmp.salePlacementList_2 + ENGINE MEMORY + SELECT saleFk, priority as olderPriority + FROM (SELECT saleFk, priority + FROM tmp.salePlacementList + ORDER BY IF(isPreviousPrepared,2,1), IF(visible > 0 OR itemShelvingSaleFk,1,2), priority + ) sub + GROUP BY saleFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_3; + CREATE TEMPORARY TABLE tmp.salePlacementList_3 + ENGINE MEMORY + SELECT s1.saleFk, `order`as saleOrder + FROM tmp.salePlacementList s1 + JOIN tmp.salePlacementList_2 s2 ON s2.saleFk = s1.saleFk AND s2.olderPriority = s1.priority; + + UPDATE tmp.salePlacementList s1 + JOIN tmp.salePlacementList_3 s3 ON s3.saleFk = s1.saleFk + SET s1.saleOrder = s3.saleOrder; + /* + -- Anula el orden de antigüedad y ordena por ubicación */ + UPDATE tmp.salePlacementList + SET saleOrder = `order`; + + SELECT * + FROM tmp.salePlacementList + ORDER BY visible <> 0 DESC,saleOrder, IF(isPreviousPrepared,2,1), IF(itemShelvingSaleFk,1,2),priority; + + DROP TEMPORARY TABLE + tmp.sale, + tmp.sale2, + tmp.`grouping`, + tmp.grouping2, + tmp.salePlacementList_2, + tmp.salePlacementList_3; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `prepareClientList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareClientList`() +BEGIN + + /* + * Require la tabla tmp.ticket(id,clientFk) + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.client; + CREATE TEMPORARY TABLE tmp.client + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT DISTINCT clientFk id + FROM 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 `prepareTicketList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket; + CREATE TEMPORARY TABLE tmp.productionTicket + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT t.id ticketFk, t.clientFk + FROM vn.ticket t + LEFT JOIN vn.ticketState ts ON ts.ticket = t.id + JOIN vn.client c ON c.id = t.clientFk + WHERE c.typeFk IN ('normal','handMaking','internalUse') + AND ( + t.shipped BETWEEN CURDATE() AND vEndingDate + OR ( + ts.alertLevel < 3 + AND t.shipped >= vStartingDate + AND t.shipped < 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 `previousPreparationSticker_get__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `previousPreparationSticker_get__`(vTicketFk INT) +BEGIN + + SELECT t.id ticketFk, + p.code as location, + t.observations, + IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour, + IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute , + i.itemPackingTypeFk , + count(*) items + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + -- JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk AND iss.sectorFk = 38 + JOIN vn.saleTracking st ON st.saleFk = s.id + JOIN vn.state ss ON ss.id = st.stateFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.shelving sh ON sh.code = t.id + LEFT JOIN vn.parking p ON p.id = sh.parkingFk + WHERE t.id = vTicketFk + AND ss.code = 'PREVIOUS_PREPARATION' + AND st.isChecked = FALSE + GROUP BY i.itemPackingTypeFk ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `previousSticker_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `previousSticker_get`(vSaleGroupFk INT) +BEGIN +/** + * Devuelve los campos a imprimir en una etiqueta de preparación previa. + * Actualiza el valor de vn.saleGroup.parkingFk en el caso de que exista un saleGroup del mismo ticket + * con parking, del mismo sector, para que todos se pongan juntos + * + * @param vSaleGroupFk Identificador de vn.saleGroup + */ + DECLARE vTicketFk INT; + DECLARE vParkingFk INT; + DECLARE vSectorFk INT; + + SELECT s.ticketFk + INTO vTicketFk + FROM vn.saleGroupDetail sgd + JOIN vn.sale s ON s.id = sgd.saleFk + WHERE sgd.saleGroupFk = vSaleGroupFk + LIMIT 1; + + SELECT sg.parkingFk, sc.sectorFk + INTO vParkingFk, vSectorFk + FROM vn.saleGroup sg + JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id + JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk + JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = sg.id + JOIN vn.sale s ON s.id = sgd.saleFk + WHERE s.ticketFk = vTicketFk + AND sg.parkingFk IS NOT NULL + LIMIT 1; + + UPDATE vn.saleGroup sg + SET sg.parkingFk = vParkingFk + WHERE sg.id = vSaleGroupFk + AND sg.sectorFk = vSectorFk; + + SELECT sgd.saleGroupFk, + t.id ticketFk, + p.code as location, + t.observations, + IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) shippingHour, + IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) shippingMinute , + IFNULL(MAX(i.itemPackingTypeFk),'H') itemPackingTypeFk , + count(*) items + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk + JOIN vn.ticket t ON t.id = s.ticketFk + LEFT JOIN vn.parking p ON p.id = sg.parkingFk + LEFT JOIN vn.`zone` z ON z.id = t.zoneFk + WHERE sgd.saleGroupFk = vSaleGroupFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `printTrolleyLabel`(vTicket INT, vPrinter INT, vReport INT) +BEGIN +/** + * Inserta en la cola de impresion una nueva etiqueta de carro, para el sacador + * + * @param vTicket Numero del ticket + * @param vPrinter Numero de impresora + * @param vReport Numero del informe + **/ + DECLARE vlabelCount INT DEFAULT 0; + DECLARE PRIORITY INT DEFAULT 3; + DECLARE vWorker INT; + DECLARE vShipmentHour VARCHAR(10); + + SELECT getTicketTrolleyLabelCount(vTicket) INTO vLabelCount; + SELECT account.myUser_getId() INTO vWorker; + SELECT CONCAT(getShipmentHour(vTicket),':00') INTO vShipmentHour; + + INSERT INTO printingQueue(printer + , priority + , report + , `text` + , worker + , text2 + , text3) + VALUES (vPrinter + , PRIORITY + , vReport + , vTicket + , vWorker + , vLabelCount + , vShipmentHour); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `prod` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `prod`(vWarehouseFk INT, vScopeDays INT) +proc: BEGIN + + DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); + + DECLARE vIsTodayRelative BOOLEAN; + + SELECT isTodayRelative INTO vIsTodayRelative + FROM vn.worker + WHERE userFk = vn.getUser(); + + CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT * FROM tmp.productionTicket; + + CALL vn.prepareClientList(); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems; + CREATE TEMPORARY TABLE tmp.ticketGetProblems + (INDEX (ticketFk)) ENGINE = MEMORY + SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped + FROM tmp.productionTicket tt + JOIN vn.ticket t ON t.id = tt.ticketFk; + + CALL vn.ticketGetProblems(vIsTodayRelative); + + DROP TEMPORARY TABLE IF EXISTS tmp.productionBuffer; + CREATE TEMPORARY TABLE tmp.productionBuffer + (PRIMARY KEY(ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk + , tt.clientFk + , t.warehouseFk + , t.nickname + , t.packages + , IF(HOUR(t.shipped), HOUR(t.shipped), IFNULL(HOUR(zc.hour),HOUR(z.hour))) as HH + , IFNULL(HOUR(zc.hour),HOUR(z.hour)) as Departure + , IF(MINUTE(t.shipped), MINUTE(t.shipped), IFNULL(MINUTE(zc.hour), MINUTE(z.hour))) as mm + , t.routeFk + , IF(am.deliveryMethodFk = 2,z.`id`,0) as zona + , t.nickname addressNickname + , a.postalCode + , a.city + , p.name province + , CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency + , am.id agencyModeFk + , 0 AS `lines` + , CAST( 0 AS DECIMAL(5,2)) AS m3 + , CAST( 0 AS DECIMAL(5,2)) AS preparationRate + , "" as problem + , IFNULL(tls.state,2) AS state + , w.code workerCode + , DATE(t.shipped) shipped + , wk.code AS salesPersonCode + , p.id provinceFk + , tls.productionOrder + , ifnull(tls.alertLevel,0) alertLevel + , t.isBoxed as palletized + , rg.deviceId ubicacion + , tlu.lastUpdated + -- , tls.updated lastUpdated + , ifnull(st.graphCategory,0) graphCategory + , pk.code as parking + , 0 AS H + , 0 AS V + , 0 AS F + , 0 AS P + , st.isOk + , ag.isOwn + FROM tmp.productionTicket tt + JOIN vn.ticket t on tt.ticketFk = t.id + LEFT JOIN vn.ticketStateToday tst ON tst.ticket = t.id + LEFT JOIN vn.state st ON st.id = tst.state + LEFT JOIN vn.client c ON c.id = t.clientFk + LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk + JOIN vn.address a on a.id = t.addressFk + LEFT JOIN vn.province p on p.id = a.provinceFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.agency ag ON ag.id = am.agencyFk + LEFT JOIN vn.ticketState tls on tls.ticket = tt.ticketFk + LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk + LEFT JOIN vn.worker w on w.id = tls.worker + LEFT JOIN vn.routeGate rg ON rg.routeFk = t.routeFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND date(t.shipped) = zc.dated + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk + WHERE t.warehouseFk = vWarehouseFk + AND am.deliveryMethodFk IN (1,2,3); + + ALTER TABLE tmp.productionBuffer + CHANGE COLUMN `problem` `problem` VARCHAR(255), + ADD COLUMN `collectionH` INT, + ADD COLUMN `collectionV` INT, + ADD COLUMN `collectionF` INT, + ADD COLUMN `collectionP` INT; + + -- Líneas y volumen por ticket + UPDATE tmp.productionBuffer pb + JOIN ( + SELECT tt.ticketFk, + COUNT(*) as `lines`, + sum(sv.volume) as m3, + IFNULL(sum(IF(sv.isPicked,sv.volume,0)) / sum(sv.volume),0) as rate + FROM tmp.productionTicket tt + JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk + GROUP BY tt.ticketFk + ) m on m.ticketFk = pb.ticketFk + SET pb.`lines` = m.`lines`, + pb.m3 = m.m3, + pb.preparationRate = m.rate; + + DELETE FROM tmp.productionBuffer + WHERE `lines`= 0; + + -- Lineas por linea de encajado + UPDATE tmp.productionBuffer pb + JOIN ( SELECT ticketFk, + sum(sub.H) H, + sum(sub.V) V, + sum(sub.F) F, + sum(sub.P) P + FROM ( + SELECT t.ticketFk, + sum(i.itemPackingTypeFk = 'H') H, + sum(i.itemPackingTypeFk = 'V') V, + sum(i.itemPackingTypeFk = 'F') F, + sum(i.itemPackingTypeFk = 'P') P + FROM tmp.productionTicket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + GROUP BY t.ticketFk, i.itemPackingTypeFk) sub + GROUP BY ticketFk + ) sub2 ON sub2.ticketFk = pb.ticketFk + SET pb.H = sub2.H, + pb.V = sub2.V, + pb.F = sub2.F, + pb.P = sub2.P; + + -- Colecciones segun tipo de encajado + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionH = c.id + WHERE c.itemPackingTypeFk = 'H' OR ISNULL(c.itemPackingTypeFk); + + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionV = c.id + WHERE c.itemPackingTypeFk = 'V' OR ISNULL(c.itemPackingTypeFk); + + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionF = c.id + WHERE c.itemPackingTypeFk = 'F' OR ISNULL(c.itemPackingTypeFk); + + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionP = c.id + WHERE c.itemPackingTypeFk = 'P' OR ISNULL(c.itemPackingTypeFk); + + -- Cajas + ALTER TABLE tmp.productionBuffer + ADD Cajas DOUBLE DEFAULT NULL; + /* + -- Problemas por ticket + UPDATE tmp.productionBuffer pb + JOIN tmp.ticketProblems tp ON tp.ticketFk = pb.ticketFk + SET pb.problem = CAST(CONCAT( IFNULL(tp.itemShortage,''), + IFNULL(tp.itemDelay,''), + IF(tp.isFreezed,' CONGELADO',''), + IF(tp.risk,' RIESGO',''), + IF(tp.hasTicketRequest, ' COD 100',''), + IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), + IF(tp.componentLack,' COMPONENTES', '') + ) as char(255)); + */ + -- Refresca la caché para el cierre dinámico de agencias + -- CALL cache.departure_timing(vWarehouseFk); +/* + -- Tickets de recogida + REPLACE tmp.productionBuffer( + shipped + , ticketFk + , agency + , clientFk + , addressNickname + , state + , workerCode + , alertLevel + , warehouseFk + ) + SELECT DATE(t.shipped) + , t.id + , am.name + , t.clientFk + , a.nickname + , s.id as state + , w.code + , ifnull(tls.alertLevel,0) alert_level + , vWarehouseFk + FROM vn.ticket t + JOIN vn.address a on a.id = t.addressFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = am.id + LEFT JOIN vn.ticketState tls on tls.ticket = t.id + LEFT JOIN vn.state s ON s.id = tls.state + LEFT JOIN vn.worker w on w.id = tls.worker + WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) + AND wp.warehouse_id = vWarehouseFk; +*/ + DROP TEMPORARY TABLE tmp.productionTicket; + DROP TEMPORARY TABLE tmp.ticket; + 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 `productionControl` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `productionControl`(vWarehouseFk INT, vScopeDays INT) +proc: BEGIN + + /** + * Devuelve un listado de tickets con parámetros relativos a la producción de los días en rango + * + * @param vWarehouseFk Identificador de vn.warehouse + * @param vScopeDays Número de días desde hoy en adelante que entran en el cálculo. + * + * @return Table tmp.productionBuffer + */ + + DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); + + DECLARE vIsTodayRelative BOOLEAN; + + SELECT isTodayRelative INTO vIsTodayRelative + FROM vn.worker + WHERE userFk = vn.getUser(); + + CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT * FROM tmp.productionTicket; + + CALL vn.prepareClientList(); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems; + CREATE TEMPORARY TABLE tmp.sale_getProblems + (INDEX (ticketFk)) ENGINE = MEMORY + SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped + FROM tmp.productionTicket tt + JOIN vn.ticket t ON t.id = tt.ticketFk; + + CALL vn.ticket_getProblems(vIsTodayRelative); + + DROP TEMPORARY TABLE IF EXISTS tmp.productionBuffer; + CREATE TEMPORARY TABLE tmp.productionBuffer + (PRIMARY KEY(ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk + , tt.clientFk + , t.warehouseFk + , t.nickname + , t.packages + , IF(HOUR(t.shipped), HOUR(t.shipped), IFNULL(HOUR(zc.hour),HOUR(z.hour))) as HH + , IFNULL(HOUR(zc.hour),HOUR(z.hour)) as Departure + , IF(MINUTE(t.shipped), MINUTE(t.shipped), IFNULL(MINUTE(zc.hour), MINUTE(z.hour))) as mm + , t.routeFk + , IF(am.deliveryMethodFk = 2,z.`id`,0) as zona + , t.nickname addressNickname + , a.postalCode + , a.city + , p.name province + , CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency + , am.id agencyModeFk + , 0 AS `lines` + , CAST( 0 AS DECIMAL(5,2)) AS m3 + , CAST( 0 AS DECIMAL(5,2)) AS preparationRate + , "" as problem + , IFNULL(tls.state,2) AS state + , w.code workerCode + , DATE(t.shipped) shipped + , wk.code AS salesPersonCode + , p.id provinceFk + , tls.productionOrder + , ifnull(tls.alertLevel,0) alertLevel + , t.isBoxed as palletized + , IF(rm.isPickingAllowed ,rm.bufferFk, NULL) ubicacion + , tlu.lastUpdated + , ifnull(st.graphCategory,0) graphCategory + , pk.code as parking + , 0 AS H + , 0 AS V + , 0 AS N + , st.isOk + , ag.isOwn + , rm.bufferFk + FROM tmp.productionTicket tt + JOIN vn.ticket t on tt.ticketFk = t.id + LEFT JOIN vn.ticketStateToday tst ON tst.ticket = t.id + LEFT JOIN vn.state st ON st.id = tst.state + LEFT JOIN vn.client c ON c.id = t.clientFk + LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk + JOIN vn.address a on a.id = t.addressFk + LEFT JOIN vn.province p on p.id = a.provinceFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.agency ag ON ag.id = am.agencyFk + LEFT JOIN vn.ticketState tls on tls.ticket = tt.ticketFk + LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk + LEFT JOIN vn.worker w on w.id = tls.worker + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND date(t.shipped) = zc.dated + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk + WHERE t.warehouseFk = vWarehouseFk + AND am.deliveryMethodFk IN (1,2,3); + + -- Problemas por ticket + ALTER TABLE tmp.productionBuffer + CHANGE COLUMN `problem` `problem` VARCHAR(255), + ADD COLUMN `collectionH` INT, + ADD COLUMN `collectionV` INT, + ADD COLUMN `collectionN` INT; + + UPDATE tmp.productionBuffer pb + JOIN tmp.ticket_problems tp ON tp.ticketFk = pb.ticketFk + SET pb.problem = TRIM(CAST(CONCAT( IFNULL(tp.itemShortage,''), + IFNULL(tp.itemDelay,''), + IFNULL(tp.itemLost,''), + IF(tp.isFreezed,' CONGELADO',''), + IF(tp.hasHighRisk,' RIESGO',''), + IF(tp.hasTicketRequest, ' COD 100',''), + IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), + IF(tp.hasComponentLack,' COMPONENTES', ''), + IF(HOUR(NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') + ) as char(255))); + + -- Clientes Nuevos o Recuperados + UPDATE tmp.productionBuffer pb + LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk + JOIN vn.productionConfig pc + SET pb.problem = TRIM(CAST(CONCAT('NUEVO ', pb.problem) AS CHAR(255))) + WHERE (ISNULL(cnb.clientFk) OR cnb.isRookie) + AND pc.rookieDays; + + -- Líneas y volumen por ticket + UPDATE tmp.productionBuffer pb + JOIN ( + SELECT tt.ticketFk, + COUNT(*) as `lines`, + sum(sv.volume) as m3, + IFNULL(sum(IF(sv.isPicked,sv.volume,0)) / sum(sv.volume),0) as rate + FROM tmp.productionTicket tt + JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk + GROUP BY tt.ticketFk + ) m on m.ticketFk = pb.ticketFk + SET pb.`lines` = m.`lines`, + pb.m3 = m.m3, + pb.preparationRate = m.rate; + + DELETE FROM tmp.productionBuffer + WHERE `lines`= 0; + + -- Lineas por linea de encajado + UPDATE tmp.productionBuffer pb + JOIN ( SELECT ticketFk, + sum(sub.H) H, + sum(sub.V) V, + sum(sub.N) N + FROM ( + SELECT t.ticketFk, + sum(i.itemPackingTypeFk = 'H') H, + sum(i.itemPackingTypeFk = 'V') V, + sum(ISNULL(i.itemPackingTypeFk)) N + FROM tmp.productionTicket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + GROUP BY t.ticketFk, i.itemPackingTypeFk) sub + GROUP BY ticketFk + ) sub2 ON sub2.ticketFk = pb.ticketFk + SET pb.H = sub2.H, + pb.V = sub2.V, + pb.N = sub2.N; + + -- Colecciones segun tipo de encajado + + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + SET pb.collectionH = IF(pb.H,tc.collectionFk,NULL), + pb.collectionV = IF(pb.V,tc.collectionFk,NULL), + pb.collectionN = IF(pb.N,tc.collectionFk,NULL); + + -- Previa pendiente + ALTER TABLE tmp.productionBuffer + ADD previousWithoutParking BOOL DEFAULT FALSE; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketWithPrevia; + CREATE TEMPORARY TABLE tmp.ticketWithPrevia + (ticketFk INT PRIMARY KEY, + salesCount INT DEFAULT 0, + salesInParkingCount INT DEFAULT 0) + ENGINE = MEMORY; + + -- Insertamos todos los tickets que tienen productos parkineados en sectores de previa, segun el sector + INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount) + SELECT pb.ticketFk, COUNT(DISTINCT s.id) + FROM tmp.productionBuffer pb + JOIN vn.sale s ON s.ticketFk = pb.ticketFk + JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk + JOIN vn.sector sc ON sc.id = iss.sectorFk + JOIN vn.item i ON i.id = iss.itemFk + WHERE iss.isPreviousPrepared + AND (ISNULL(sc.itemPackingTypeFk) + OR ISNULL(i.itemPackingTypeFk) + OR sc.itemPackingTypeFk = i.itemPackingTypeFk ) + GROUP BY pb.ticketFk; + + -- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado + UPDATE tmp.ticketWithPrevia twp + JOIN ( SELECT pb.ticketFk, count(DISTINCT s.id) salesInParkingCount + FROM tmp.productionBuffer pb + JOIN vn.sale s ON s.ticketFk = pb.ticketFk + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk + WHERE NOT ISNULL(sg.parkingFk) + GROUP BY pb.ticketFk ) sub ON twp.ticketFk = sub.ticketFk + SET twp.salesInParkingCount = sub.salesInParkingCount; + + -- Marcamos como pendientes aquellos que no coinciden las cantidades + UPDATE tmp.productionBuffer pb + JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk + SET pb.previousWithoutParking = TRUE + WHERE twp.salesCount > twp.salesInParkingCount; + +/* + -- Refresca la caché para el cierre dinámico de agencias + CALL cache.departure_timing(vWarehouseFk); + + -- Tickets de recogida + REPLACE tmp.productionBuffer( + shipped + , ticketFk + , agency + , clientFk + , addressNickname + , state + , workerCode + , alertLevel + , warehouseFk + ) + SELECT DATE(t.shipped) + , t.id + , am.name + , t.clientFk + , a.nickname + , s.id as state + , w.code + , ifnull(tls.alertLevel,0) alert_level + , vWarehouseFk + FROM vn.ticket t + JOIN vn.address a on a.id = t.addressFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = am.id + LEFT JOIN vn.ticketState tls on tls.ticket = t.id + LEFT JOIN vn.state s ON s.id = tls.state + LEFT JOIN vn.worker w on w.id = tls.worker + WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) + AND wp.warehouse_id = vWarehouseFk; +*/ + + DROP TEMPORARY TABLE tmp.productionTicket; + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.risk; + DROP TEMPORARY TABLE tmp.ticket_problems; + DROP TEMPORARY TABLE tmp.ticketWithPrevia; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `productionControl__` */; +/*!50003 SET @saved_cs_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 = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `productionControl__`(vWarehouseFk INT, vScopeDays INT) +proc: BEGIN + + /** + * Devuelve un listado de tickets con parámetros relativos a la producción de los días en rango + * + * @param vWarehouseFk Identificador de vn.warehouse + * @param vScopeDays Número de días desde hoy en adelante que entran en el cálculo. + * + * @return Table tmp.productionBuffer + */ + + DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); + + DECLARE vIsTodayRelative BOOLEAN; + + SELECT isTodayRelative INTO vIsTodayRelative + FROM vn.worker + WHERE userFk = vn.getUser(); + + CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT * FROM tmp.productionTicket; + + CALL vn.prepareClientList(); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems; + CREATE TEMPORARY TABLE tmp.sale_getProblems + (INDEX (ticketFk)) ENGINE = MEMORY + SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped + FROM tmp.productionTicket tt + JOIN vn.ticket t ON t.id = tt.ticketFk; + + CALL vn.ticket_getProblems(vIsTodayRelative); + + DROP TEMPORARY TABLE IF EXISTS tmp.productionBuffer; + CREATE TEMPORARY TABLE tmp.productionBuffer + (PRIMARY KEY(ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk + , tt.clientFk + , t.warehouseFk + , t.nickname + , t.packages + , IF(HOUR(t.shipped), HOUR(t.shipped), IFNULL(HOUR(zc.hour),HOUR(z.hour))) as HH + , IFNULL(HOUR(zc.hour),HOUR(z.hour)) as Departure + , IF(MINUTE(t.shipped), MINUTE(t.shipped), IFNULL(MINUTE(zc.hour), MINUTE(z.hour))) as mm + , t.routeFk + , IF(am.deliveryMethodFk = 2,z.`id`,0) as zona + , t.nickname addressNickname + , a.postalCode + , a.city + , p.name province + , CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency + , am.id agencyModeFk + , 0 AS `lines` + , CAST( 0 AS DECIMAL(5,2)) AS m3 + , CAST( 0 AS DECIMAL(5,2)) AS preparationRate + , "" as problem + , IFNULL(tls.state,2) AS state + , w.code workerCode + , DATE(t.shipped) shipped + , wk.code AS salesPersonCode + , p.id provinceFk + , tls.productionOrder + , ifnull(tls.alertLevel,0) alertLevel + , t.isBoxed as palletized + , IF(rm.isPickingAllowed ,rm.bufferFk, NULL) ubicacion + , tlu.lastUpdated + , ifnull(st.graphCategory,0) graphCategory + , pk.code as parking + , 0 AS H + , 0 AS V + , 0 AS N + , st.isOk + , ag.isOwn + FROM tmp.productionTicket tt + JOIN vn.ticket t on tt.ticketFk = t.id + LEFT JOIN vn.ticketStateToday tst ON tst.ticket = t.id + LEFT JOIN vn.state st ON st.id = tst.state + LEFT JOIN vn.client c ON c.id = t.clientFk + LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk + JOIN vn.address a on a.id = t.addressFk + LEFT JOIN vn.province p on p.id = a.provinceFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.agency ag ON ag.id = am.agencyFk + LEFT JOIN vn.ticketState tls on tls.ticket = tt.ticketFk + LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk + LEFT JOIN vn.worker w on w.id = tls.worker + LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND date(t.shipped) = zc.dated + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk + WHERE t.warehouseFk = vWarehouseFk + AND am.deliveryMethodFk IN (1,2,3); + + -- Problemas por ticket + ALTER TABLE tmp.productionBuffer + CHANGE COLUMN `problem` `problem` VARCHAR(255), + ADD COLUMN `collectionH` INT, + ADD COLUMN `collectionV` INT; + + UPDATE tmp.productionBuffer pb + JOIN tmp.ticket_problems tp ON tp.ticketFk = pb.ticketFk + SET pb.problem = TRIM(CAST(CONCAT( IFNULL(tp.itemShortage,''), + IFNULL(tp.itemDelay,''), + IF(tp.isFreezed,' CONGELADO',''), + IF(tp.hasHighRisk,' RIESGO',''), + IF(tp.hasTicketRequest, ' COD 100',''), + IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), + IF(tp.hasComponentLack,' COMPONENTES', ''), + IF(HOUR(NOW()) < pb.HH AND tp.isTooLittle,' PEQUEÑO', '') + ) as char(255))); + + -- Clientes Nuevos o Recuperados + UPDATE tmp.productionBuffer pb + LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk + SET pb.problem = TRIM(CAST(CONCAT('NUEVO ', pb.problem) AS CHAR(255))) + WHERE ISNULL(cnb.clientFk) OR cnb.isRookie ; + + -- Líneas y volumen por ticket + UPDATE tmp.productionBuffer pb + JOIN ( + SELECT tt.ticketFk, + COUNT(*) as `lines`, + sum(sv.volume) as m3, + IFNULL(sum(IF(sv.isPicked,sv.volume,0)) / sum(sv.volume),0) as rate + FROM tmp.productionTicket tt + JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk + GROUP BY tt.ticketFk + ) m on m.ticketFk = pb.ticketFk + SET pb.`lines` = m.`lines`, + pb.m3 = m.m3, + pb.preparationRate = m.rate; + + DELETE FROM tmp.productionBuffer + WHERE `lines`= 0; + + -- Lineas por linea de encajado + UPDATE tmp.productionBuffer pb + JOIN ( SELECT ticketFk, + sum(sub.H) H, + sum(sub.V) V, + sum(sub.N) N + FROM ( + SELECT t.ticketFk, + sum(i.itemPackingTypeFk = 'H') H, + sum(i.itemPackingTypeFk = 'V') V, + sum(ISNULL(i.itemPackingTypeFk)) N + FROM tmp.productionTicket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + GROUP BY t.ticketFk, i.itemPackingTypeFk) sub + GROUP BY ticketFk + ) sub2 ON sub2.ticketFk = pb.ticketFk + SET pb.H = sub2.H, + pb.V = sub2.V, + pb.N = sub2.N; + + -- Colecciones segun tipo de encajado + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionH = c.id + WHERE (c.itemPackingTypeFk = 'H' OR ISNULL(c.itemPackingTypeFk)) + AND pb.H; + + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionV = c.id + WHERE (c.itemPackingTypeFk = 'V' OR ISNULL(c.itemPackingTypeFk)) + AND pb.V; + + -- Previa pendiente + ALTER TABLE tmp.productionBuffer + ADD previousWithoutParking BOOL DEFAULT FALSE; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketWithPrevia; + CREATE TEMPORARY TABLE tmp.ticketWithPrevia + (ticketFk INT PRIMARY KEY, + salesCount INT DEFAULT 0, + salesInParkingCount INT DEFAULT 0) + ENGINE = MEMORY; + + -- Insertamos todos los tickets que tienen productos parkineados en sectores de previa, segun el sector + INSERT INTO tmp.ticketWithPrevia(ticketFk, salesCount) + SELECT pb.ticketFk, COUNT(DISTINCT s.id) + FROM tmp.productionBuffer pb + JOIN vn.sale s ON s.ticketFk = pb.ticketFk + JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk + JOIN vn.sector sc ON sc.id = iss.sectorFk + JOIN vn.item i ON i.id = iss.itemFk + WHERE iss.isPreviousPrepared + AND (ISNULL(sc.itemPackingTypeFk) + OR ISNULL(i.itemPackingTypeFk) + OR sc.itemPackingTypeFk = i.itemPackingTypeFk ) + GROUP BY pb.ticketFk; + + -- Se calcula la cantidad de productos que estan ya preparados porque su saleGroup está aparcado + UPDATE tmp.ticketWithPrevia twp + JOIN ( SELECT pb.ticketFk, count(DISTINCT s.id) salesInParkingCount + FROM tmp.productionBuffer pb + JOIN vn.sale s ON s.ticketFk = pb.ticketFk + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.saleGroup sg ON sg.id = sgd.saleGroupFk + WHERE NOT ISNULL(sg.parkingFk) + GROUP BY pb.ticketFk ) sub ON twp.ticketFk = sub.ticketFk + SET twp.salesInParkingCount = sub.salesInParkingCount; + + -- Marcamos como pendientes aquellos que no coinciden las cantidades + UPDATE tmp.productionBuffer pb + JOIN tmp.ticketWithPrevia twp ON twp.ticketFk = pb.ticketFk + SET pb.previousWithoutParking = TRUE + WHERE twp.salesCount > twp.salesInParkingCount; + +/* + -- Refresca la caché para el cierre dinámico de agencias + CALL cache.departure_timing(vWarehouseFk); + + -- Tickets de recogida + REPLACE tmp.productionBuffer( + shipped + , ticketFk + , agency + , clientFk + , addressNickname + , state + , workerCode + , alertLevel + , warehouseFk + ) + SELECT DATE(t.shipped) + , t.id + , am.name + , t.clientFk + , a.nickname + , s.id as state + , w.code + , ifnull(tls.alertLevel,0) alert_level + , vWarehouseFk + FROM vn.ticket t + JOIN vn.address a on a.id = t.addressFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = am.id + LEFT JOIN vn.ticketState tls on tls.ticket = t.id + LEFT JOIN vn.state s ON s.id = tls.state + LEFT JOIN vn.worker w on w.id = tls.worker + WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) + AND wp.warehouse_id = vWarehouseFk; +*/ + DROP TEMPORARY TABLE tmp.productionTicket; + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.risk; + DROP TEMPORARY TABLE tmp.ticket_problems; + DROP TEMPORARY TABLE tmp.ticketWithPrevia; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `productionSectorList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `productionSectorList`(vSectorFk INT) +BEGIN + + /** + * Devuelve el listado de vn.sale que se puede preparar en previa para ese sector + * + * @param vSectorFk Identificador de vn.sector + */ + + DECLARE vWarehouseFk INT; + + SELECT warehouseFk INTO vWarehouseFk + FROM vn.sector + WHERE id = vSectorFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.whiteTicket; + CREATE TEMPORARY TABLE tmp.whiteTicket + (ticketFk INT PRIMARY KEY) + SELECT s.ticketFk , count(*) AS saleNum, sum(ISNULL(i.itemPackingTypeFk)) iptNull + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticket t ON t.id = s.ticketFk + WHERE t.shipped BETWEEN CURDATE() AND TIMESTAMPADD(HOUR, 23, CURDATE()) + GROUP BY s.ticketFk + HAVING saleNum = iptNull; + + DROP TEMPORARY TABLE IF EXISTS tmp.sectorTypeTicket; + CREATE TEMPORARY TABLE tmp.sectorTypeTicket + (ticketFk INT PRIMARY KEY) + SELECT s.ticketFk , sum(i.itemPackingTypeFk <=> sc.itemPackingTypeFk) iptSector + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.sector sc ON sc.id = vSectorFk + WHERE t.shipped BETWEEN CURDATE() AND TIMESTAMPADD(HOUR, 23, CURDATE()) + GROUP BY s.ticketFk + HAVING iptSector; + + CALL vn.productionControl(vWarehouseFk, 0); + + SELECT 0,999999,0 INTO @sameTicket, @ticket, @litrosTicket; + + SELECT @litrosTicket := IF(sub.ticketFk = @ticket, @litrosTicket + Litros, Litros) as LitrosTicket, + @sameTicket := IF(sub.ticketFk = @ticket, @sameTicket, IF(@sameTicket, 0 , 1)) as sameTicket, + sub.*, + @ticket := ticketFk AS lastTicket + FROM + ( + SELECT * FROM + ( + SELECT isa.saleFk, + isa.Modificado, + isa.ticketFk, + isa.isPicked, + isa.itemFk, + isa.quantity, + isa.concept, + i.itemPackingTypeFk, + isa.`size`, + isa.Estado, + isa.sectorProdPriority, + isa.available, + isa.sectorFk, + isa.matricula, + isa.parking, + isa.itemShelving, + isa.Agency, + isa.shipped, + isa.`grouping`, + isa.packing, + isa.`hour`, + isa.isPreviousPreparable, + isa.physicalVolume, + isa.warehouseFk , + sum(isa.available) as totalAvailable, + IF (HOUR(isa.shipped),HOUR(isa.shipped), HOUR(isa.`hour`)) Hora, + IF (MINUTE(isa.shipped),MINUTE(isa.shipped), MINUTE(isa.`hour`)) Minuto, + i.subName, + CAST(isa.physicalVolume * 1000 AS DECIMAL(10,0)) as Litros + FROM vn.itemShelvingAvailable isa + JOIN vn.item i ON i.id = isa.itemFk + JOIN vn.sector s ON s.id = isa.sectorFk AND s.warehouseFk = isa.warehouseFk + JOIN vn.ticket t ON t.id = isa.ticketFk + LEFT JOIN tmp.whiteTicket wt ON wt.ticketFk = isa.ticketFk + LEFT JOIN tmp.sectorTypeTicket stt ON stt.ticketFk = isa.ticketFk + JOIN vn.client c ON c.id = t.clientFk + JOIN tmp.productionBuffer pb ON pb.ticketFk = t.id + JOIN vn.packagingConfig pc + WHERE IF(s.isPreviousPreparedByPacking, + i.`size` > pc.previousPreparationMinimumSize + AND isa.packing > 1 + AND (MOD(TRUNCATE(isa.quantity,0), isa.packing)= 0 ), + TRUE) + AND isa.sectorFk = vSectorFk + AND isa.quantity > 0 + AND pb.problem = "" + AND (i.itemPackingTypeFk <=> s.itemPackingTypeFk + OR ISNULL(s.itemPackingTypeFk) + OR wt.ticketFk + OR (stt.ticketFk AND ISNULL(i.itemPackingTypeFk))) + GROUP BY saleFk + HAVING isa.quantity <= totalAvailable + ) sub2 + ORDER BY Hora, Minuto, ticketFk + ) sub + ; + + DROP TEMPORARY TABLE tmp.whiteTicket; + DROP TEMPORARY TABLE tmp.sectorTypeTicket; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `rangeDateInfo` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `rangeDateInfo`(vStarted DATE, vEnded DATE) +BEGIN +/** + * Crea una tabla temporal con las fechas + * desde una fecha inicial a una final + * @param vStarted fecha inicial + * @param vEnded fecha final + */ + DECLARE vDated DATE DEFAULT vStarted; + + DROP TEMPORARY TABLE IF EXISTS tmp.rangeDate; + CREATE TEMPORARY TABLE tmp.rangeDate( + `dated` DATE, + `period` INT, + `month` INT, + `year` INT, + `day` INT, + `week` INT, + `yearMonth` INT + ) + ENGINE = MEMORY; + + WHILE vDated <= vEnded DO + INSERT INTO tmp.rangeDate + SET `dated` = vDated, + `period` = YEAR(vDated) * 100 + WEEK(vDated, 1), + `month` = MONTH(vDated), + `year` = YEAR(vDated), + `day` = DAY(vDated), + `week` = WEEK(vDated, 1), + `yearMonth` = YEAR(vDated) * 100 + MONTH(vDated); + + SET vDated = DATE_ADD(vDated, INTERVAL 1 DAY); + 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 `rankingTeamByQuarter` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `rankingTeamByQuarter`(vYear INT, vQuarter INT) +BEGIN + + DECLARE vMinimumSalesByQuarter INT; + + SELECT minimumSalesByQuarter INTO vMinimumSalesByQuarter + FROM commissionConfig; + + DROP TEMPORARY TABLE IF EXISTS tmp.rankingTeam; + CREATE TEMPORARY TABLE tmp.rankingTeam + (PRIMARY KEY(departmentFk)) ENGINE = MEMORY + SELECT + (sub1.importe - sub2.importe) / IF ((sub1.importe - sub2.importe) > 0,sub3.countPeople,1) AS diferencia, + CONCAT(sub1.name, + '(', + sub1.peopleMinSale, + '/', + sub3.countPeople, + ')') AS teamPeople, + sub1.departmentFk AS departmentFk + FROM + (((SELECT + SUM(sub.importe) AS importe, + sub.name AS name, + sub.año AS año, + sub.departmentFk AS departmentFk, + COUNT(*) peopleMinSale + FROM + (SELECT + SUM(v.portfolioWeight) AS importe, + d.`name`, + v.año, + wd.departmentFk + FROM (((bs.vendedores v + JOIN `account`.`user` u ON (u.id = v.Id_Trabajador)) + JOIN vn.workerDepartment wd ON (wd.workerFk = u.id)) + JOIN vn.department d ON (d.id = wd.departmentFk)) + WHERE v.año = vYear + AND d.name LIKE 'EQUIPO%' + AND CEIL(v.mes / 3) = vQuarter + GROUP BY v.Id_Trabajador + HAVING importe >= vMinimumSalesByQuarter) sub + GROUP BY sub.departmentFk) sub1 + JOIN (SELECT + SUM(v.portfolioWeight) AS importe, + d.name, + wd.departmentFk + FROM (((bs.vendedores v + JOIN account.user u ON (u.id = v.Id_Trabajador)) + JOIN vn.workerDepartment wd ON (wd.workerFk = u.id)) + JOIN vn.department d ON (d.id = wd.departmentFk)) + WHERE v.año = vYear - 1 + AND d.name LIKE 'EQUIPO%' + AND CEIL(v.mes / 3) = vQuarter + GROUP BY wd.departmentFk + ORDER BY SUM(v.importe) DESC) sub2 ON (sub1.name = sub2.name)) + JOIN (SELECT COUNT(0) AS countPeople, + wd.departmentFk AS departmentFk + FROM + (vn.salesPersonSince sps + JOIN vn.workerDepartment wd ON (sps.workerFk = wd.workerFk)) + WHERE + CONCAT(YEAR(sps.started), QUARTER(sps.started)) <= CONCAT(vYear - 1, vQuarter) + GROUP BY wd.departmentFk) sub3 ON (sub3.departmentFk = sub1.departmentFk)) + ORDER BY (sub1.importe - sub2.importe) / sub3.countPeople 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 `rate_getPrices` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices`(vDated DATE, vWarehouseFk INT) +BEGIN +/** + * Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén + * + * @param vDated fecha para la cual calcula la tarifa + * @param vWarehouseFk warehouse para el cual calcula la tafia + * @return tmp.rate(rate0, rate1, rate2, rate3) + */ + DROP TEMPORARY TABLE IF EXISTS tRate; + CREATE TEMPORARY TABLE tRate + SELECT rate0, rate1, rate2, rate3 + FROM vn.rate + WHERE dated <= vDated + AND warehouseFk = vWarehouseFk + ORDER BY dated DESC; + + DROP TEMPORARY TABLE IF EXISTS tmp.rate; + CREATE TEMPORARY TABLE tmp.rate + ENGINE = MEMORY + SELECT * FROM + ( + SELECT * FROM tRate + UNION ALL + SELECT rate0, rate1, rate2, rate3 FROM rateConfig + ) sub2 + LIMIT 1; + DROP TEMPORARY TABLE tRate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `rate_getPrices2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices2`(vLanded DATE, vWarehouseFk INT) +BEGIN + + -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén + DROP TEMPORARY TABLE IF EXISTS tRate; + CREATE TEMPORARY TABLE tRate + SELECT rate0, rate1, rate2, rate3 + FROM vn.rate + WHERE dated <= vLanded + AND warehouseFk = vWarehouseFk + ORDER BY dated DESC; + + DROP TEMPORARY TABLE IF EXISTS tmp.rate; + CREATE TEMPORARY TABLE tmp.rate + ENGINE = MEMORY + SELECT * FROM + ( + SELECT * FROM tRate + UNION ALL + SELECT rate0, rate1, rate2, rate3 FROM rateConfig + ) sub2 + LIMIT 1; + DROP TEMPORARY TABLE tRate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `rate_getPrices__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `rate_getPrices__`(vLanded DATE, vWarehouseFk INT) +BEGIN + + -- Prepara una tabla con las tarifas aplicables en funcion de la fecha y el almacén + + DROP TEMPORARY TABLE IF EXISTS tmp.rate; + CREATE TEMPORARY TABLE tmp.rate + ENGINE = MEMORY + SELECT * FROM + ( + SELECT * FROM + ( + SELECT DISTINCT rate0, rate1, rate2, rate3 + FROM vn.rate + WHERE dated <= vLanded + AND warehouseFk = vWarehouseFk + ORDER BY dated DESC + + ) sub + UNION ALL + SELECT rate0, rate1, rate2, rate3 + FROM rateConfig + ) sub2 + 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 `recipe_Cook` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `recipe_Cook`(vItemFk INT, vBunchesQuantity INT, vDate DATE) +BEGIN + + DECLARE vCalc INT; + DECLARE vWarehouseFk INT DEFAULT 1; -- Silla FV + + SET @element := ''; + SET @counter := 0; + + CALL cache.available_refresh(vCalc, FALSE, vWarehouseFk, vDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.recipeCook; + + CREATE TEMPORARY TABLE tmp.recipeCook + SELECT *, + @counter := IF(@element = element COLLATE utf8_general_ci , @counter + 1, 1) as counter, + @element := element COLLATE utf8_general_ci + FROM + ( + SELECT i.id itemFk, + CONCAT(i.longName, ' (ref: ',i.id,')') longName, + i.size, + i.inkFk, + a.available, + r.element, + vBunchesQuantity * r.quantity as quantity, + r.itemFk as bunchItemFk, + IFNULL((i.inkFk = r.inkFk ) ,0) + + IFNULL((i.size = r.size) ,0) + + IFNULL((i.name LIKE CONCAT('%',r.name,'%')) ,0) + + IFNULL((i.longName LIKE CONCAT('%',r.longName,'%')),0) + + IFNULL((i.typeFk = r.typeFk),0) as matches, + i.typeFk, + rl.previousSelected + FROM vn.recipe r + JOIN vn.item i ON (IFNULL(i.name LIKE CONCAT('%',r.name,'%'), 0) + OR IFNULL(i.longName LIKE CONCAT('%',r.longName,'%'),0)) + OR i.typeFk <=> r.typeFk + JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalc + LEFT JOIN (SELECT recipe_ItemFk, element as log_element, selected_ItemFk, count(*) as previousSelected + FROM vn.recipe_log + GROUP BY recipe_ItemFk, element, selected_ItemFk) rl ON rl.recipe_ItemFk = r.itemFk + AND rl.log_element = r.element + AND rl.selected_ItemFk = i.id + WHERE r.itemFk = vItemFk + AND a.available > vBunchesQuantity * r.quantity + UNION ALL + SELECT 100 itemFk, + CONCAT('? ',r.element,' ',IFNULL(r.size,''),' ',IFNULL(r.inkFk,'')) as longName, + NULL, + NULL, + 0, + r.element, + vBunchesQuantity * r.quantity as quantity, + r.itemFk as bunchItemFk, + -1 as matches, + r.typeFk, + NULL + FROM vn.recipe r + WHERE r.itemFk = vItemFk + GROUP BY r.element + ) sub + + ORDER BY element, matches DESC, previousSelected DESC; + + SELECT * + FROM tmp.recipeCook + WHERE counter < 6 + OR itemFk = 100 + ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `recipe_Plaster` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `recipe_Plaster`(vItemFk INT, vTicketFk INT, vQuantity INT) +BEGIN + + DECLARE vLastCost DECIMAL(10,2); + DECLARE vWarehouseFk INT; + DECLARE vShipped DATE; + DECLARE vEntryFk INT; + DECLARE vTravelFk INT; + + CALL cache.last_buy_refresh(FALSE); + + SELECT warehouseFk, shipped + INTO vWarehouseFk, vShipped + FROM vn.ticket + WHERE id = vTicketFk; + + UPDATE vn.ticket t + JOIN vn.item i ON i.id = vItemFk + SET t.nickname = CONCAT(vQuantity,' ',i.longName) + WHERE t.id = vTicketFk; + + SELECT b.buyingValue INTO vLastCost + FROM vn.buy b + JOIN cache.last_buy lb ON lb.buy_id = b.id + WHERE lb.item_id = vItemFk + ORDER BY (lb.warehouse_id = vWarehouseFk) DESC + LIMIT 1; + + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price) + SELECT vTicketFk, 98, - vQuantity, i.longName, vLastCost + FROM vn.item i + WHERE i.id = vItemFk; + /* + SELECT tr.id INTO vTravelFk + FROM vn.travel tr + JOIN vn.warehouse w ON w.id = tr.warehouseOutFk + WHERE tr.warehouseInFk = vWarehouseFk + AND tr.landed = vShipped + AND w.name = 'Confeccion'; + + IF IFNULL(vTravelFk,0) = 0 THEN + + INSERT INTO vn.travel(shipped, landed, warehouseInFk, warehouseOutFk, agencyFk) + SELECT vShipped, vShipped, vWarehouseFk, w.id, am.id + FROM vn.warehouse w + JOIN vn.agencyMode am + WHERE w.name = 'Confeccion' + AND am.name = 'DIRECTO PROVEEDOR'; + + SET vTravelFk = LAST_INSERT_ID(); + + END IF; + + SELECT e.id INTO vEntryFk + FROM vn.entry e + JOIN vn.supplier s ON s.id = supplierFk + WHERE e.travelFk = vTravelFk + AND s.name = 'Confeccion Natural' + AND e.isRaid = FALSE; + + IF IFNULL(vEntryFk,0) = 0 THEN + + INSERT INTO vn.entry(supplierFk, evaNotes, travelFk, companyFk) + SELECT s.id, t.nickname, vTravelFk, c.id + FROM vn.supplier s + JOIN vn.ticket t ON t.id = vTicketFk + JOIN vn.company c ON c.code = 'VNL' + WHERE s.name = 'Confeccion Natural'; + + SET vEntryFk = LAST_INSERT_ID(); + + END IF; + + INSERT INTO vn.buy(entryFk, itemFk, quantity, buyingValue, packageFk, packing, grouping) + SELECT vEntryFk, b.itemFk, vQuantity, b.buyingValue, b.packageFk, b.packing, b.grouping + FROM cache.last_buy lb + JOIN vn.buy b ON b.id = lb.buy_id + WHERE lb.item_id = vItemFk + ORDER BY (lb.warehouse_id = vWarehouseFk) DESC + 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 `refund` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `refund`(IN vOriginTicket INT, OUT vNewTicket INT) +BEGIN + + DECLARE vDone BIT DEFAULT 0; + DECLARE vCustomer MEDIUMINT; + DECLARE vWarehouse TINYINT; + DECLARE vCompany MEDIUMINT; + DECLARE vAddress MEDIUMINT; + DECLARE vRefundAgencyMode INT; + DECLARE vItemFk INT; + DECLARE vQuantity DECIMAL (10,2); + DECLARE vConcept VARCHAR(50); + DECLARE vPrice DECIMAL (10,2); + DECLARE vDiscount TINYINT; + DECLARE vSaleNew INT; + DECLARE vSaleMain INT; + DECLARE vZoneFk INT; + + DECLARE vRsMainTicket CURSOR FOR + SELECT id, itemFk, - quantity, concept, price, discount + FROM vn.sale + WHERE ticketFk = vOriginTicket; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; + + SELECT id INTO vRefundAgencyMode + FROM agencyMode WHERE `name` = 'ABONO'; + + SELECT clientFk, warehouseFk, companyFk, addressFk + INTO vCustomer, vWarehouse, vCompany, vAddress + FROM ticket + WHERE id = vOriginTicket; + + SELECT id INTO vZoneFk + FROM zone WHERE agencyModeFk = vRefundAgencyMode + LIMIT 1; + + INSERT INTO vn2008.Tickets ( + Id_Cliente, + Fecha, + Id_Consigna, + Id_Agencia, + Alias, + warehouse_id, + empresa_id, + landing, + zoneFk + ) + SELECT + vCustomer, + CURDATE(), + vAddress, + vRefundAgencyMode, + a.nickname, + vWarehouse, + vCompany, + CURDATE(), + vZoneFk + FROM address a + WHERE a.id = vAddress; + + SET vNewTicket = LAST_INSERT_ID(); + + SET vDone := 0; + OPEN vRsMainTicket ; + FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; + + WHILE NOT vDone DO + + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount) + VALUES( vNewTicket, vItemFk, vQuantity, vConcept, vPrice, vDiscount ); + + SET vSaleNew = LAST_INSERT_ID(); + + INSERT INTO vn.saleComponent(saleFk,componentFk,`value`) + SELECT vSaleNew,componentFk,`value` + FROM vn.saleComponent + WHERE saleFk = vSaleMain; + + FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; + + END WHILE; + CLOSE vRsMainTicket; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `replaceMovimientosMark` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `replaceMovimientosMark`( + idMovimiento INT, + detalle INT, + originalQuantity INT, + idTrabajador INT, + stateFk INT, + originFk INT, + userFk INT, + actionString VARCHAR(50), + description VARCHAR(100)) +BEGIN + + /* DEPRECATED + * + * usar vn.saleTracking_Replace + * + */ + + REPLACE INTO vn2008.Movimientos_mark(Id_Movimiento, valor, original_quantity, Id_Trabajador, stateFk) + VALUES(idMovimiento,detalle,originalQuantity,idTrabajador,stateFk); + /*INSERT INTO vn.ticketLog (originFk, userFk, action , description) + VALUES(originFk, userFk, actionString, description);*/ + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `reportLabelCollection_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `reportLabelCollection_get`(vParam INT) +BEGIN +/** + * Obtiene los datos de etiquetas a partir de de un ticket o colección. + * + * @param vParam Ticket/Colección del que sacar los datos + */ + DECLARE vIsTicket BOOL; + + SELECT IF(id, TRUE, FALSE) INTO vIsTicket + FROM ticket + WHERE created > (CURRENT_DATE() - INTERVAL 1 MONTH) + AND id = vParam; + + SELECT c.itemPackingTypeFk, + CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color, + CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV, + tc.ticketFk, + LEFT(IF(t.routeFk IS NULL, am.name, zo.name ), 12) agencyDescription, + am.name, + t.clientFk, + CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), 'm³') m3 , + CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) size, + w.code workerCode, + tt.labelCount, + IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) agencyHour, + t.shipped, + COUNT(*) lineCount, + t.nickName + FROM ticket t + JOIN ticketCollection tc ON tc.ticketFk = t.id + JOIN collection c ON c.id = tc.collectionFk + JOIN collectionColors cc ON cc.shelve = tc.`level` + AND cc.wagon = tc.wagon + AND cc.trainFk = c.trainFk + JOIN sale s ON s.ticketFk = t.id + LEFT JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN itemCategory ic ON ic.id = it.categoryFk + JOIN worker w ON w.id = c.workerFk + JOIN agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN ticketTrolley tt ON tt.ticket = t.id + LEFT JOIN `zone` zo ON t.zoneFk = zo.id + WHERE IF(vIsTicket, tc.ticketFk = vParam, tc.collectionFk = vParam) + GROUP BY t.id + ORDER BY cc.`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 */ ; +/*!50003 DROP PROCEDURE IF EXISTS `riskAllClients` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `riskAllClients`(maxRiskDate DATE) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; + CREATE TEMPORARY TABLE tmp.client_list + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT id Id_Cliente, null grade FROM vn.client; + + CALL vn2008.risk_vs_client_list(maxRiskDate); + + SELECT + c.RazonSocial, + c.Id_Cliente, + c.Credito, + CAST(r.risk as DECIMAL (10,2)) risk, + CAST(c.Credito - r.risk as DECIMAL (10,2)) Diferencia, + c.Id_Pais + FROM + vn2008.Clientes c + JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente + JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente + GROUP BY c.Id_cliente; + + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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; + */ + IF ISNULL(vDevice) THEN + + DELETE FROM routeGate + WHERE routeFk = vRouteFk; + + ELSE + + REPLACE routeGate(routeFk, deviceId) + VALUES(vRouteFk, vDevice); + + END IF; + /* + UPDATE vn.route r + JOIN vn.beach b ON b.name = vDevice + SET r.beachFk = b.id + WHERE r.id = vRouteFk; + */ +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 vn.agencyMode a ON a.id = 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 < 2 + WHERE t.Fecha BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND t.warehouse_id IN (1,44) + 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), + rg.ready = IF(rg.freeTickets, FALSE, rg.ready); + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `routeGate_assignDevice` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `routeGate_assignDevice`(vDevice VARCHAR(30), vRouteFk INT) +BEGIN +/** + * Asigna el dispositivo la ruta + * + * @param vDevice Dispositivo a remplazar + * @param vRouteFk Ruta a la cual asignarlo + */ + IF ISNULL(vDevice) THEN + + DELETE FROM routeGate + WHERE routeFk = vRouteFk; + + ELSE + + REPLACE routeGate(routeFk, deviceId) + VALUES(vRouteFk, vDevice); + + 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 `routeGuessPriority` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `routeGuessPriority`(IN vRuta INT) +BEGIN +/* Usa los valores del ultimo año para adivinar el orden de los tickets en la ruta + * vRuta id ruta +*/ + +UPDATE ticket mt + JOIN ( + SELECT tt.addressFk, ROUND(IFNULL(AVG(t.priority),0),0) AS priority + FROM ticket t + JOIN ticket tt ON tt.addressFk = t.addressFk + WHERE t.shipped > TIMESTAMPADD(YEAR,-1,CURDATE()) + AND tt.routeFk = vRuta + GROUP BY addressFk + ) sub ON sub.addressFk = mt.addressFk + SET mt.priority = sub.priority + WHERE mt.routeFk = vRuta; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `routeInfo` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `routeInfo`(vRouteFk INT) +BEGIN + + DECLARE vPackages INT; + DECLARE vM3 INT; + DECLARE vKg INT; + DECLARE vMatricula varchar(50); + + SELECT sum(packages) as bultos + INTO vPackages + FROM vn.ticket t + WHERE routeFk = vRouteFk; + + SELECT SUM(sv.physicalVolume), SUM(sv.physicalWeight) + INTO vM3, vKg + FROM vn.saleVolume sv + WHERE sv.routeFk = vRouteFk; + + SELECT v.numberPlate as matricula + INTO vMatricula + FROM vn.route r + JOIN vn.vehicle v ON r.vehicleFk = v.id + WHERE r.id = vRouteFk; + + SELECT vRouteFk as Ruta, + vPackages as Bultos, + vM3 as m3, + vKg as Kg, + vMatricula as Matricula; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `routeMonitor_calculate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `routeMonitor_calculate`(vDate DATE) +BEGIN + + DECLARE vDateEND DATETIME; + + SET vDateEND = util.dayend(vDate); + SET vDate = TIMESTAMPADD(DAY,-1,vDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.routesMonitor; + + CREATE TEMPORARY TABLE tmp.routesMonitor + (INDEX (routeFk)) + ENGINE = MEMORY + SELECT DISTINCT(t.routeFk) routeFk + FROM vn.ticket t + WHERE t.shipped BETWEEN vDate AND vDateEND + AND t.routeFk IS NOT NULL; + + INSERT IGNORE INTO routesMonitor(routeFk) + SELECT routeFk + FROM tmp.routesMonitor; + + UPDATE routesMonitor rm + JOIN route r ON r.id = rm.routeFk + JOIN agencyMode a ON a.id = r.agencyModeFk + SET rm.`name` = a.name, + rm.ticketFree = 0, + rm.ticketProduction = 0, + rm.ticketPacked = 0, + rm.dated = r.created; + + UPDATE routesMonitor rm + JOIN(SELECT t.routeFk, COUNT(*) AS ticketFree + FROM vn.ticket t + JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk + JOIN ticketLastState ts ON t.id = ts.ticketFk + JOIN ticketTracking tt ON tt.id = ts.ticketTrackingFk + JOIN state s ON s.id = tt.stateFk AND s.alertLevel = 0 + GROUP BY t.routeFk + ) sub ON sub.routeFk = rm.routeFk + SET rm.ticketFree = sub.ticketFree; + + UPDATE routesMonitor rm + JOIN(SELECT t.routeFk, COUNT(*) AS ticketPacked + FROM vn.ticket t + JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk + JOIN ticketLastState ts ON t.id = ts.ticketFk + JOIN ticketTracking tt ON tt.id = ts.ticketTrackingFk + JOIN state s ON s.id = tt.stateFk AND s.alertLevel = 2 + GROUP BY t.routeFk + ) sub ON sub.routeFk = rm.routeFk + SET rm.ticketPacked = sub.ticketPacked; + + UPDATE routesMonitor rm + JOIN(SELECT t.routeFk, COUNT(*) AS ticketProduction + FROM vn.ticket t + JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk + JOIN ticketLastState ts ON t.id = ts.ticketFk + JOIN ticketTracking tt ON tt.id = ts.ticketTrackingFk + JOIN state s ON s.id = tt.stateFk AND s.alertLevel = 3 + GROUP BY t.routeFk + ) sub ON sub.routeFk = rm.routeFk + SET rm.ticketProduction = sub.ticketProduction; + + UPDATE routesMonitor rm + JOIN( SELECT t.routeFk, COUNT(*) AS packages + FROM vn.ticket t + JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk + JOIN expedition e ON e.ticketFk = t.id + GROUP BY t.routeFk + ) sub ON sub.routeFk = rm.routeFk + SET rm.packages = sub.packages; + + UPDATE routesMonitor rm + JOIN( SELECT t.routeFk, SUM(sv.volume) AS m3 + FROM vn.ticket t + JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk + JOIN vn.saleVolume sv ON sv.ticketFk = t.id + GROUP BY t.routeFk + ) sub ON sub.routeFk = rm.routeFk + SET rm.m3 = sub.m3; + + UPDATE routesMonitor rm + JOIN( SELECT t.routeFk , sum(IFNULL(pk.volume, pk.width * pk.height * pk.`depth` )) / 1000000 m3boxes + FROM vn.ticket t + JOIN tmp.routesMonitor rm ON rm.routeFk = t.routeFk + JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.packaging pk ON pk.id = e.packagingFk + GROUP BY t.routeFk + ) sub ON sub.routeFk = rm.routeFk + SET rm.m3boxes = sub.m3boxes; + + UPDATE routesMonitor rm + JOIN vn.expeditionTruck et ON et.id = rm.expeditionTruckFk + SET rm.etd = et.ETD; + + DROP TEMPORARY TABLE tmp.routesMonitor; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `routeSetOk` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `routeSetOk`( + vRouteFk INT) +BEGIN + + UPDATE vn.route r + SET r.isOk = 1 + WHERE r.id = vRouteFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `routeUpdateM3` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `routeUpdateM3`(vRoute INT) +BEGIN +/** + * @deprecated Use vn.route_updateM3() + */ + call route_updateM3(vRoute); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `route_doRecalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `route_doRecalc`() +proc: BEGIN +/** + * Recalculates modified route. + */ + + DECLARE vDone BOOL; + DECLARE vRouteFk INT; + + DECLARE cCur CURSOR FOR + SELECT routeFk FROM routeRecalc; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('vn.route_doRecalc'); + ROLLBACK; + RESIGNAL; + END; + + IF !GET_LOCK('vn.route_doRecalc', 0) THEN + LEAVE proc; + END IF; + + OPEN cCur; + + myLoop: LOOP + SET vDone = FALSE; + FETCH cCur INTO vRouteFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + START TRANSACTION; + CALL route_updateM3(vRouteFk); + COMMIT; + + DELETE FROM routeRecalc WHERE routeFk = vRouteFk; + END LOOP; + + CLOSE cCur; + DO RELEASE_LOCK('vn.route_doRecalc'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `route_getTickets` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `route_getTickets`(vRouteFk INT) +BEGIN +/** + * Pasado un RouteFk devuelve la información + * de sus tickets. + * + * @param vRouteFk + * + * @select Información de los tickets + */ + + SELECT + t.id AS Id, + t.clientFk AS Client, + a.id AS Address, + a.nickname AS ClientName, + t.packages AS Packages, + a.street AS AddressName, + a.postalCode AS PostalCode, + a.city AS City, + sub2.itemPackingTypeFk AS PackingType, + c.phone AS ClientPhone, + c.mobile AS ClientMobile, + a.phone AS AddressPhone, + a.mobile AS AddressMobile, + tl.longitude AS Longitude, + tl.latitude AS Latitude, + wm.mediaValue AS SalePersonPhone, + tob.Note AS Note, + t.isSigned AS Signed, + st.id AS Polizon + FROM ticket t + JOIN client c ON t.clientFk = c.id + JOIN address a ON t.addressFk = a.id + LEFT JOIN ticketLocation tl ON tl.ticketFk = t.id + LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk + LEFT JOIN + (SELECT tob.description AS Note, t.id + FROM ticketObservation tob + JOIN ticket t ON tob.ticketFk = t.id + JOIN observationType ot ON ot.id = tob.observationTypeFk + WHERE t.routeFk = vRouteFk + AND ot.code = 'delivery' + )tob ON tob.id = t.id + LEFT JOIN stowaway st ON st.shipFk = t.id + LEFT JOIN + (SELECT sub.ticketFk, + CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeFk + FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + WHERE t.routeFk = vRouteFk + GROUP BY t.id,i.itemPackingTypeFk)sub + GROUP BY sub.ticketFk + ) sub2 ON sub2.ticketFk = t.id + WHERE t.routeFk = vRouteFk + GROUP BY t.id + ORDER BY t.priority; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `route_updateM3` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `route_updateM3`(vRoute INT) +BEGIN + + UPDATE vn.route r + LEFT JOIN ( + SELECT routeFk, SUM(volume) AS m3 + FROM saleVolume + WHERE routeFk = vRoute + ) v ON v.routeFk = r.id + SET r.m3 = IFNULL(v.m3,0) + WHERE r.id =vRoute; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `rutasAnalyze` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `rutasAnalyze`(vYear INT, vMonth INT) +BEGIN + +/* Analiza los costes de las rutas de reparto y lo almacena en la tabla Rutas_Master +* +* PAK 15/4/2019 +*/ + + DELETE FROM bi.rutasBoard + WHERE year = vYear AND month = vMonth; + + -- Rellenamos la tabla con los datos de las rutas VOLUMETRICAS, especialmente con los bultos "virtuales" + INSERT INTO bi.rutasBoard(year, + month, + warehouse_id, + Id_Ruta, + Id_Agencia, + km, + Dia, + Fecha, + Bultos, + Matricula, + Tipo, + Terceros) + SELECT YEAR(r.created), + MONTH(r.created), + GREATEST(1,a.warehouseFk), + r.id, + r.agencyModeFk, + r.kmEnd - r.kmStart, + DAYNAME(r.created), + r.created, + SUM(sv.volume / ebv.m3), + v.numberPlate, + IF(ISNULL(`r`.`cost`), 'P', 'A'), + r.cost + FROM vn.route r + JOIN vn.ticket t ON t.routeFk = r.id + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vn.agency a ON a.id = am.agencyFk + LEFT JOIN vn.vehicle v ON v.id = r.vehicleFk + JOIN vn.saleVolume sv ON sv.ticketFk = t.id + JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = 71 + WHERE YEAR(r.created) = vYear AND MONTH(r.created) = vMonth + AND z.isVolumetric + GROUP BY r.id; + + -- Rellenamos la tabla con los datos de las rutas NO VOLUMETRICAS, especialmente con los bultos "virtuales" + INSERT INTO bi.rutasBoard(year, + month, + warehouse_id, + Id_Ruta, + Id_Agencia, + km, + Dia, + Fecha, + Bultos, + Matricula, + Tipo, + Terceros) + SELECT YEAR(r.created), + MONTH(r.created), + GREATEST(1,a.warehouseFk), + r.id, + r.agencyModeFk, + r.kmEnd - r.kmStart, + DAYNAME(r.created), + r.created, + SUM(t.packages), + v.numberPlate, + IF(ISNULL(`r`.`cost`), 'P', 'A'), + r.cost + FROM vn.route r + JOIN vn.ticket t ON t.routeFk = r.id + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.agencyMode am ON am.id = r.agencyModeFk + LEFT JOIN vn.agency a ON a.id = am.agencyFk + LEFT JOIN vn.vehicle v ON v.id = r.vehicleFk + WHERE YEAR(r.created) = vYear AND MONTH(r.created) = vMonth + AND z.isVolumetric = FALSE + GROUP BY r.id + ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos); + + -- Coste REAL de cada bulto "virtual", de acuerdo con el valor apuntado a mano en la ruta + UPDATE bi.rutasBoard r + INNER JOIN vn2008.Rutas_Master rm ON rm.año = r.year AND rm.mes = r.month AND rm.warehouse_id = r.warehouse_id + SET r.coste_bulto = IF(r.Tipo ='A', r.Terceros, r.km * rm.coste_km ) / r.Bultos + WHERE r.Bultos > 0 + AND rm.año = vYear + AND rm.mes = vMonth; + + -- Coste PRACTICO de cada bulto, de acuerdo con los componentes de tipo AGENCIA en cada linea de venta + UPDATE bi.rutasBoard r + JOIN ( + SELECT t.routeFk, sum(s.quantity * sc.value) practicoTotal + FROM vn.route r + JOIN vn.time tm ON tm.dated = r.created + JOIN vn.ticket t ON t.routeFk = r.id + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.saleComponent sc ON sc.saleFk = s.id + JOIN vn.`component` c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE ct.type = 'agencia' + AND tm.year = vYear + AND tm.month = vMonth + GROUP BY r.id + ) sub ON sub.routeFk = r.Id_Ruta + SET r.practico = sub.practicoTotal / r.Bultos; + + -- Coste TEORICO de una caja "virtual" para cada ruta, teniendo en cuenta que hay carros, pallets, etc + UPDATE bi.rutasBoard r + JOIN ( + SELECT t.routeFk, + SUM(t.zonePrice/ ebv.ratio)/ count(*) AS BultoTeoricoMedio + FROM vn.ticket t + JOIN vn.route r ON r.id = t.routeFk + JOIN vn.time tm ON tm.dated = r.created + JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.expeditionBoxVol ebv ON ebv.boxFk = e.isBox + JOIN vn.address ad ON ad.id = t.addressFk + JOIN vn.client c ON c.id = ad.clientFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + WHERE tm.year = vYear + AND tm.month = vMonth + AND z.isVolumetric = FALSE + GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk + SET r.teorico = sub.BultoTeoricoMedio; + + -- Coste VOLUMETRICO TEORICO de una caja "virtual" para cada ruta + UPDATE bi.rutasBoard r + JOIN ( + SELECT t.routeFk, + SUM(freight) AS BultoTeoricoMedio + FROM vn.ticket t + JOIN vn.route r ON r.id = t.routeFk + JOIN vn.time tm ON tm.dated = r.created + JOIN vn.saleVolume sf ON sf.ticketFk = t.id + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.zone z ON z.id = t.zoneFk + WHERE tm.year = vYear + AND tm.month = vMonth + AND z.isVolumetric != FALSE + GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk + SET r.teorico = sub.BultoTeoricoMedio / r.Bultos; + + -- La diferencia entre el teorico y el practico se deberia de cobrar en greuges, cada noche + UPDATE bi.rutasBoard r + JOIN ( + SELECT t.routeFk, + Sum(g.amount) AS greuge + FROM vn.ticket t + JOIN vn.route r ON r.id = t.routeFk + JOIN vn.time tm ON tm.dated = r.created + JOIN vn.greuge g ON g.ticketFk = t.id + JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk + WHERE tm.year = vYear + AND tm.month = vMonth + AND gt.name = 'Diferencia portes' + GROUP BY t.routeFk) sub ON r.Id_Ruta = sub.routeFk + SET r.greuge = sub.greuge / r.Bultos; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleBuy_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleBuy_Add`(vSaleFk INT, vBuyFk INT) +BEGIN + + /* Añade un registro a la tabla saleBuy en el caso de que sea posible mantener la trazabilidad + * + * @param vSaleFk clave primaria de vn.sale + * @param vBuyFk clave primaria de vn.buy + */ + /*IF (SELECT COUNT(*) + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE s.id = vSaleFk + AND ic.code = 'fruit') THEN */ + + IF (SELECT COUNT(*) FROM vn.buy WHERE id = vBuyFk AND itemOriginalFk) THEN + + INSERT INTO vn.saleBuy (saleFk, buyFk) + VALUES(vSaleFk, vBuyFk); + + 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 `saleGroup_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_add`(vSectorFk INT) +BEGIN +/** + * Añade un nuevo registro a la tabla y devuelve su id. + * + * @param vSectorFk Identificador de vn.sector + */ + INSERT INTO vn.saleGroup(userFk, sectorFk) + VALUES (account.myUser_getId(), vSectorFk); + + SELECT 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 `saleItemShelvingDelete__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleItemShelvingDelete__`(vSaleFk INT) +BEGIN + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + SET ish.visible = sis.quantity + ish.visible, + ish.available = sis.quantity + ish.visible + WHERE sis.saleFk = vSaleFk; + + DELETE FROM vn.saleItemShelving + WHERE saleFk = vSaleFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleItemShelvingIsPicked__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleItemShelvingIsPicked__`(vTicketFk INT, vIsPicked BOOL) +BEGIN + + DECLARE vStateFk INT; + + SELECT id INTO vStateFk + FROM state + WHERE code = 'PREVIOUS_PREPARATION'; + + UPDATE vn.sale s + JOIN vn.saleItemShelving sis ON sis.saleFk = s.id + SET s.isPicked = vIsPicked + WHERE s.ticketFk = vTicketFk; + + REPLACE vn2008.Movimientos_mark(Id_Movimiento, Valor, original_quantity, Id_Trabajador, stateFk) + SELECT s.id, s.isPicked, s.quantity, account.myUser_getId(), vStateFk + FROM sale s + JOIN vn.saleItemShelving sis ON sis.saleFk = s.id + WHERE s.ticketFk = vTicketFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleItemShelvingMake__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleItemShelvingMake__`(IN `vTicketFk` INT, IN `vSectorFk` INT) +BEGIN + + SET @rest:= CAST(0 AS DECIMAL(10,0)); + SET @saleFk := CAST(0 AS DECIMAL(10,0)); + SET @reserved := CAST(0 AS DECIMAL(10,0)); + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN sale s ON s.id = sis.saleFk + SET ish.visible = sis.quantity + ish.visible, + ish.available = sis.quantity + ish.visible + WHERE s.ticketFk = vTicketFk; + + DELETE sis.* + FROM saleItemShelving sis + JOIN sale s ON s.id = sis.saleFk + WHERE s.ticketFk = vTicketFk; + + INSERT INTO saleItemShelving( saleFk, + itemShelvingFk, + quantity, + ubication) + SELECT saleFk, + itemShelvingFk, + CAST(Reserved as DECIMAL(10,0)) as Reserved, + ubication + FROM + (SELECT saleFk, + itemShelvingFk, + ubication, + @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, + @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, + @rest := @rest - @reserved, + @saleFk := saleFk + FROM + ( SELECT s.id as saleFk, + ish.created, + ish.id as itemShelvingFk, + ish.available, + s.quantity, + ish.packing, + CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk + JOIN vn.parking p ON p.sectorFk = sc.id + JOIN vn.shelving sh ON sh.parkingFk = p.id + JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk + WHERE t.id = vTicketFk + AND sc.id = vSectorFk + AND s.quantity MOD ish.packing = 0 + AND s.quantity >= ish.packing + ORDER BY s.id, + sh.priority DESC, + ish.packing DESC, + ish.created + ) sub + ) sub2 + WHERE Reserved > 0; + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN vn.sale s ON s.id = sis.saleFk + SET ish.available = ish.visible - sis.quantity, + ish.visible = ish.visible - sis.quantity + WHERE s.ticketFk = vTicketFk + AND s.isPicked = FALSE; + + CALL vn.saleItemShelvingIsPicked(vTicketFk, 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 `saleMistake_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleMistake_Add`(vSaleFk INT, vUserFk INT, vTypeFk INT) +BEGIN + + INSERT INTO vn.saleMistake(saleFk, userFk, typeFk) + VALUES(vSaleFk, vUserFk, vTypeFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleMove` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleMove`(IN vSaleFk BIGINT, IN vQuantity BIGINT) +BEGIN + + DECLARE vShipped DATE; + DECLARE vWarehouseFk INT; + DECLARE vAddressFk INT; + DECLARE vAgencyModeFk INT; + DECLARE vNewTicket BIGINT; + DECLARE vNewSale BIGINT; + DECLARE vLanded DATE; + DECLARE vShippedDayEnd DATETIME; + DECLARE vTicketOriginalFk INT; + DECLARE hasAlreadyItem BOOLEAN; + DECLARE vItemFk INT; + DECLARE vClientTypeFk VARCHAR(20); + + SELECT t.shipped, t.warehouseFk, t.addressFk, agencyModeFk, landed, t.id, s.itemfk, c.typeFk + INTO vShipped, vWarehouseFk, vAddressFk, vAgencyModeFk, vLanded, vTicketOriginalFk, vItemFk, vClientTypeFk + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN `client` c ON t.clientFk = c.id + WHERE s.id = vSaleFk; + + SET vShippedDayEnd = util.dayEnd(vShipped); + + IF vClientTypeFk <> 'handMaking' THEN + SELECT t.id INTO vNewTicket + FROM ticket t + JOIN ticketState ts ON ts.ticketFk = t.id + WHERE t.addressFk = vAddressFk + AND t.warehouseFk = vWarehouseFk + AND t.agencyModeFk = vAgencyModeFk + AND t.landed <=> vLanded + AND t.shipped BETWEEN vShipped AND vShippedDayEnd + AND t.refFk IS NULL + AND t.id <> vTicketOriginalFk + AND IFNULL(ts.alertLevel,0) = 0 + LIMIT 1; + END IF; + + IF vNewTicket IS NULL THEN + CALL vn.ticket_Clone(vTicketOriginalFk, vNewTicket); + END IF; + + INSERT INTO ticketTracking(ticketFk, workerFk, stateFk) + SELECT vNewTicket, account.myUser_getId(), s.id + FROM state s + WHERE s.code = 'FIXING'; + + SELECT COUNT(id) INTO hasAlreadyItem + FROM sale s + WHERE s.ticketFk = vNewTicket AND s.itemFk = vItemFk; + + IF hasAlreadyItem = FALSE THEN + + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) + SELECT vNewTicket, itemFk, concept, vQuantity, price, discount + FROM sale s + WHERE s.id = vSaleFk; + + SELECT LAST_INSERT_ID() INTO vNewSale; + + INSERT INTO saleComponent(saleFk, componentFk, `value`) + SELECT vNewSale, componentFk, `value` + FROM saleComponent + WHERE saleFk = vSaleFk; + + ELSE + + UPDATE sale + SET quantity = quantity + vQuantity + WHERE ticketFk = vNewTicket AND itemFk = vItemFk; + + 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 `saleParking_add__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleParking_add__`(vSaleFk INT, vParkingCode VARCHAR(10)) +BEGIN + + /* + * Inserta registro en saleParking + * + * vSaleFk Identificador de vn.sale + * vParkingCode Code de vn.parking + */ + + INSERT INTO vn.saleParking(saleFk, parkingFk, userFk) + SELECT vSaleFk, p.id, account.myUser_getId() + FROM vn.parking p + WHERE p.code = vParkingCode 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 `salePreparingList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `salePreparingList`(IN ticketFk BIGINT) +BEGIN + +CALL cache.last_buy_refresh(FALSE); + + SELECT t.clientFk, + t.shipped, + a.nickname, + s.ticketFk, + s.itemFk, + s.quantity, + s.concept, + s.reserved, + s.id saleFk, + i.size, + i.inkFk, + i.stems, + i.image, + i.subName, + b.`grouping`, + ip.code as placement, + lpad(ifnull(cooler_path_detail_id, ip.code),5,'0') as path, + IF(stPrevious.saleFk,TRUE,FALSE) as isPreviousSelected, + stPrevious.isChecked as isPrevious, + stPrepared.isChecked as isPrepared, + stControled.isChecked as isControled, + ib.code as barcode + + FROM vn.ticket t + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = t.warehouseFk + LEFT JOIN vn2008.cooler_path_detail cpd on left(ip.code,3) = cpd.pasillo + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = t.warehouseFk + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN vn.saleTracking stPrevious ON stPrevious.saleFk = s.id AND stPrevious.stateFk = 26 + LEFT JOIN vn.saleTracking stPrepared ON stPrepared.saleFk = s.id AND stPrepared.stateFk = 14 + LEFT JOIN vn.saleTracking stControled ON stControled.saleFk = s.id AND stControled.stateFk = 8 + LEFT JOIN vn.itemBarcode ib ON ib.itemFk = i.id + + WHERE t.id = ticketFk + GROUP BY s.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 `salesMerge` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `salesMerge`(vTicketFk INT) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.salesToPreserve; + + CREATE TEMPORARY TABLE tmp.salesToPreserve + SELECT id, itemFk, sum(quantity) as newQuantity + FROM vn.sale s + WHERE s.ticketFk = vTicketFk + AND s.itemFk NOT IN (95,98,100) + GROUP by itemFk, price, discount; + + UPDATE vn.sale s + JOIN tmp.salesToPreserve stp ON stp.id = s.id + SET quantity = newQuantity + WHERE s.ticketFk = vTicketFk; + + DELETE s.* + FROM vn.sale s + LEFT JOIN tmp.salesToPreserve stp ON stp.id = s.id + WHERE s.ticketFk = vTicketFk + AND stp.id IS NULL + AND s.itemFk NOT IN (95,98,100); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `salesMerge_byCollection` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `salesMerge_byCollection`(vCollectionFk INT) +BEGIN + + DECLARE vDone BOOL; + -- Fetch variables + DECLARE vTicketFk INT; + + DECLARE cCur CURSOR FOR + SELECT ticketFk + FROM vn.ticketCollection + WHERE collectionFk = vCollectionFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + OPEN cCur; + + myLoop: LOOP + + SET vDone = FALSE; + + FETCH cCur INTO vTicketFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + CALL vn.salesMerge(vTicketFk); + + END LOOP; + + CLOSE cCur; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleSplit`(vSaleFk INT, vQuantity INT) +BEGIN + + + DECLARE vNewSaleFk INT; + + INSERT INTO vn.sale(itemFk, + concept, + price, + discount, + quantity, + ticketFk, + isPriceFixed) + SELECT s.itemFk, + i.longName, + s.price, + s.discount, + vQuantity, + s.ticketFk, + s.isPriceFixed + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + WHERE s.id = vSaleFk; + + UPDATE vn.sale s + JOIN vn.item i ON i.id = s.itemFk + SET s.quantity = s.quantity - vQuantity, s.concept = i.longName + WHERE s.id = vSaleFk; + + SELECT LAST_INSERT_ID() INTO vNewSaleFk; + + INSERT INTO vn.saleComponent( saleFk, + componentFk, + value) + SELECT vNewSaleFk, + componentFk, + value + FROM vn.saleComponent + WHERE saleFk = vSaleFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleTracking_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`@`localhost` PROCEDURE `saleTracking_add`(vSaleGroupFk INT) +BEGIN + + /* Inserta en vn.saleTracking las lineas de una previa + * + * @param vSaleGroupFk Identificador de vn.saleGroup + */ + + REPLACE vn.saleTracking(saleFk, + isChecked, + workerFk, + actionFk, + stateFk) + SELECT sgd.saleFk , + TRUE, + account.myUser_getId(), + a.accion_id, + s.id + FROM vn.saleGroupDetail sgd + JOIN vncontrol.accion a ON a.accion = 'SACAR' + JOIN vn.state s ON s.code = 'ON_PREPARATION' + WHERE sgd.saleGroupFk = vSaleGroupFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleTracking_addPreparedSaleGroup` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `saleTracking_addPreparedSaleGroup`(vSaleGroupFk INT) +BEGIN + + /** + * Inserta lineas de vn.saleTracking para un saleGroup (previa) que escanea un sacador + * + * @param vSaleGroupFk Identificador de vn.saleGroup + */ + + REPLACE vn.saleTracking(saleFk, isChecked, workerFk, actionFk, stateFk) + SELECT sgd.saleFk, TRUE, account.myUser_getId(), a.accion_id id, s.id + FROM vn.saleGroupDetail sgd + JOIN vncontrol.accion a ON a.accion = 'SACAR' + JOIN vn.state s ON s.code = 'PREPARED' + WHERE sgd.saleGroupFk = vSaleGroupFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleTracking_addPrevOK` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `saleTracking_addPrevOK`(vSectorCollectionFk INT) +BEGIN + + /** + * Inserta los registros de la colección de sector con el estado PREVIA OK + * + * @param vSectorCollectionFk Identificador de vn.sectorCollection + */ + + REPLACE vn.saleTracking(saleFk, + isChecked, + workerFk, + actionFk, + stateFk) + SELECT sgd.saleFk, + TRUE, + sc.userFk, + a.accion_id, + s.id + FROM vn.sectorCollection sc + JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id + JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk + JOIN vn.state s ON s.code = 'OK PREVIOUS' + JOIN vncontrol.accion a ON a.accion = 'PRESACAR' + WHERE sc.id = vSectorCollectionFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleTracking_del` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_del`(vSaleFk INT, vState VARCHAR(50)) +BEGIN + + DELETE FROM itemShelvingSale + WHERE saleFk = vSaleFk; + + DELETE st.* + FROM vn.saleTracking st + JOIN vn.state s ON s.id = st.stateFk + WHERE st.saleFk = vSaleFk + AND s.code = vState 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 `saleTracking_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_new`( vSaleFK INT, + vIsChecked BOOLEAN, + vOriginalQuantity INT, + vWorkerFk INT, + vAction VARCHAR(50), + vState VARCHAR(50)) +BEGIN + + REPLACE vn.saleTracking(saleFk, + isChecked, + originalQuantity, + workerFk, + actionFk, + stateFk) + SELECT vSaleFk, + vIsChecked, + vOriginalQuantity, + IFNULL(vWorkerFk, vn.getUser()), + a.accion_id, + s.id + FROM vncontrol.accion a + JOIN vn.state s + WHERE s.code = vState COLLATE utf8_unicode_ci + AND a.accion = vAction 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 `saleTracking_Replace` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_Replace`(vSaleFk INT, vIsChecked INT, vOriginalQuantity INT, vStateFk INT) +BEGIN + REPLACE vn.saleTracking(saleFk, isChecked, originalQuantity, stateFk) + VALUES(vSaleFk, vIsChecked, vOriginalQuantity, vStateFk); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saleTracking_updateIsChecked` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `saleTracking_updateIsChecked`(vSaleFk INT, vIsChecked BOOL) +BEGIN + + /** + * Actualiza el estado del campo vn.saleTracking.isChecked y elimina las lineas de vn.itemShelving + * si procede, en el caso de las preparaciones previas, por usuario + * + * @param vSaleFk Identificador de vn.sale + * @param vIsChecked Estado del registro + */ + + UPDATE vn.saleTracking st + JOIN vn.state s ON s.id = st.stateFk AND s.code = 'PREVIOUS_PREPARATION' + SET st.isChecked = vIsChecked + WHERE st.saleFk = vSaleFk + AND st.workerFk = account.myUser_getId(); + + IF vIsChecked = FALSE THEN + + DELETE FROM vn.itemShelvingSale + WHERE saleFk = vSaleFk; + + 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 `sale_calculateComponent` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_calculateComponent`(vSale INT, vOption INT) +proc: BEGIN +/** + * Crea tabla temporal para vn.sale_recalcComponent() para recalcular los componentes + * + * @param vSale Id de la venta + * @param vOption indica en que componente pone el descuadre, NULL en casos habituales + */ + DROP TEMPORARY TABLE IF EXISTS tmp.recalculateSales; + CREATE TEMPORARY TABLE tmp.recalculateSales + SELECT s.id + FROM sale s + WHERE s.id = vSale; + + CALL vn.sale_recalcComponent(vOption); + + DROP TEMPORARY TABLE tmp.recalculateSales; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_calculateComponent__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_calculateComponent__`(vSale INT, vOption INT) +proc: BEGIN +/** + * Actualiza los componentes + * + * @param vSale Delivery date + * @param vOption indica en que componente pone el descuadre, NULL en casos habituales + * @return tmp.ticketLot(warehouseFk, available, itemFk, buyFk) + * @return tmp.sale(saleFk, warehouseFk) + */ + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAgencyModeFk INT; + DECLARE vAddressFk INT; + DECLARE vTicket BIGINT; + DECLARE vItem BIGINT; + DECLARE vLanded DATE; + DECLARE vTicketFree BOOLEAN DEFAULT TRUE; + DECLARE vZoneFk INTEGER; + + SELECT NOT (t.refFk IS NOT NULL OR ts.alertLevel > 0) OR s.price = 0, s.ticketFk, s.itemFk , t.zoneFk + INTO vTicketFree, vTicket, vItem, vZoneFk + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id + WHERE s.id = vSale + LIMIT 1; + + SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.agencyModeFk, t.landed + INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded + FROM agencyMode a + JOIN ticket t ON t.agencyModeFk = a.id + WHERE t.id = vTicket; + + IF IFNULL(vZoneFk,0) = 0 THEN + CALL util.throw('ticket dont have zone'); + END IF; + + CALL buyUltimate (vWarehouseFk, vShipped); + + DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk + FROM tmp.buyUltimate + WHERE itemFk = vItem; + + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT vSale saleFk,vWarehouseFk warehouseFk; + + IF vOption IS NULL THEN + SET vOption = IF(vTicketFree,1,6); + END IF; + + CALL ticketComponentUpdateSale(vOption); + + INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) + VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); + + DROP TEMPORARY TABLE tmp.buyUltimate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_calculateComponent__2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_calculateComponent__2`() +proc: BEGIN +/** + * Actualiza los componentes + * + * @param vSale Delivery date + * @param vOption indica en que componente pone el descuadre, NULL en casos habituales + */ + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAgencyModeFk INT; + DECLARE vAddressFk INT; + DECLARE vTicketFk BIGINT; + DECLARE vItemFk BIGINT; + DECLARE vLanded DATE; + DECLARE vIsEditable BOOLEAN; + DECLARE vZoneFk INTEGER; + + DECLARE vSaleFk INTEGER; + DECLARE v_done BOOL DEFAULT FALSE; + + DECLARE vCur CURSOR FOR + select id from tmp.ticketRose; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET v_done = TRUE; + + OPEN vCur; + + l: LOOP + SET v_done = FALSE; + FETCH vCur INTO vSaleFk; + + IF v_done THEN + LEAVE l; + END IF; + + SELECT t.refFk IS NULL AND (IFNULL(ts.alertLevel, 0) = 0 OR s.price = 0), + s.ticketFk, + s.itemFk , + t.zoneFk, + t.warehouseFk, + t.shipped, + t.addressFk, + t.agencyModeFk, + t.landed + INTO vIsEditable, + vTicketFk, + vItemFk, + vZoneFk, + vWarehouseFk, + vShipped, + vAddressFk, + vAgencyModeFk, + vLanded + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + WHERE s.id = vSaleFk; + + + CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); + + IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) > 0 THEN + + IF vLanded IS NULL OR vZoneFk IS NULL THEN + + UPDATE ticket t + SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) + WHERE t.id = vTicketFk AND t.landed IS NULL; + + IF vZoneFk IS NULL THEN + SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; + UPDATE ticket t + SET t.zoneFk = vZoneFk + WHERE t.id = vTicketFk AND t.zoneFk IS NULL; + END IF; + DROP TEMPORARY TABLE tmp.zoneGetLanded; + + END IF; + + -- rellena la tabla buyUltimate con la ultima compra + CALL buyUltimate (vWarehouseFk, vShipped); + + DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk + FROM tmp.buyUltimate + WHERE itemFk = vItemFk; + + CALL catalog_componentPrepare(); + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT vSaleFk saleFk,vWarehouseFk warehouseFk; + /* + IF vOption IS NULL THEN + SET vOption = IF(vIsEditable, 1, 6); + END IF; + */ + + CALL ticketComponentUpdateSale(1); + CALL catalog_componentPurge(); + + DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE tmp.sale; + + ELSE + INSERT INTO tmp.ticketFail (id) values (vSaleFk); + END IF; + + END LOOP; + CLOSE vCur; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_checkNoComponents` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_checkNoComponents`(vCreatedFrom DATETIME, vCreatedTo DATETIME) +BEGIN +/** + * Comprueba que las ventas creadas entre un rango de fechas tienen componentes + * + * @param vCreatedFrom inicio del rango + * @param vCreatedTo fin del rango + */ + DECLARE v_done BOOL DEFAULT FALSE; + DECLARE vSaleFk INTEGER; + DECLARE vTicketFk INTEGER; + DECLARE vConcept VARCHAR(50); + DECLARE vCur CURSOR FOR + SELECT s.id + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + JOIN item i ON i.id = s.itemFk + JOIN itemType tp ON tp.id = i.typeFk + JOIN itemCategory ic ON ic.id = tp.categoryFk + LEFT JOIN tmp.coste c ON c.id = s.id + WHERE s.created >= vCreatedFrom AND s.created <= vCreatedTo + AND c.id IS NULL + AND t.agencyModeFk IS NOT NULL + AND t.isDeleted IS FALSE + AND t.warehouseFk = 60 + AND ic.merchandise != FALSE + GROUP BY s.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET v_done = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.coste; + + DROP TEMPORARY TABLE IF EXISTS tmp.coste; + CREATE TEMPORARY TABLE tmp.coste + (PRIMARY KEY (id)) ENGINE = MEMORY + SELECT s.id + FROM sale s + JOIN item i ON i.id = s.itemFk + JOIN itemType tp ON tp.id = i.typeFk + JOIN itemCategory ic ON ic.id = tp.categoryFk + JOIN saleComponent sc ON sc.saleFk = s.id + JOIN component c ON c.id = sc.componentFk + JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 6 + WHERE s.created >= vCreatedFrom + AND ic.merchandise != FALSE; + + OPEN vCur; + + l: LOOP + SET v_done = FALSE; + FETCH vCur INTO vSaleFk; + + IF v_done THEN + LEAVE l; + END IF; + + SELECT ticketFk, concept + INTO vTicketFk, vConcept + FROM sale + WHERE id = vSaleFk; + + CALL util.debugAdd(vTicketFk, vConcept); + CALL sale_calculateComponent(vSaleFk, 1); + END LOOP; + + CLOSE vCur; + DROP TEMPORARY TABLE tmp.coste; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_fruitWithoutLot__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_fruitWithoutLot__`() +BEGIN +/** +* +* Manda correo a el usuario encargado de fruta y verdura +* de las lineas de tickets a las que no ha sido asignada +* un lote. +* +*/ + SET SESSION group_concat_max_len = 102400; + + INSERT INTO mail (receiver,replyTo,subject,body) + SELECT CONCAT(sub.name, '@verdnatura.es') receiver, + 'noreply@verdnatura.es' replyTo, + CONCAT( + 'El ', + CONCAT (CAST((SUM(sub.fail)/COUNT(*))*100 AS DECIMAL(10,2)), ' %'), + CONCAT(' de los artículos han sido vendidos sin lote con fecha: ', DATE_SUB(CURDATE(), INTERVAL 3 DAY )) + ) subject, + GROUP_CONCAT(sub.ticket SEPARATOR '

') body + FROM (SELECT IF (sb.saleFk IS NULL,1, 0) fail, + u.name, + IF (sb.saleFk IS NULL,CONCAT('Artículo ',i.id,', ',i.name,':
     + https://salix.verdnatura.es/#!/ticket/',t.id,'/sale'), NULL) ticket + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + LEFT JOIN saleBuy sb ON sb.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN account.user u ON u.id = it.workerFk + JOIN itemCategory ic ON ic.id = it.categoryFk + WHERE t.shipped = DATE_SUB(CURDATE(), INTERVAL 1 DAY) + AND ic.code='fruit')sub; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_getForSijsner__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getForSijsner__`(vDated DATE) +BEGIN + + /** + * Devuelve el listado de ventas que tiene que etiquetar Sijsner para la fecha dada + * + * @param vDated Fecha de preparación de los tickets + */ + + SELECT b.printedStickers OR s.isPicked isPrinted, + t.shipped , + t.nickname , + s.ticketFk , + s.itemFk , + FLOOR(s.quantity / e.pac) stickers, + CONCAT(FLOOR(s.quantity / e.pac) , ' x ', e.pac ) amount, + s.concept, + e.kop, + e.sub, + sp.company_name supplier, + b.id buyFk + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.item i ON i.id = s.itemFk + JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk + JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN edi.ekt e ON e.id = b.ektFk + LEFT JOIN edi.supplier sp ON sp.supplier_id = e.pro + WHERE t.shipped BETWEEN vDated AND TIMESTAMPADD(HOUR,23,vDated) + AND c.code != 'ES' + AND w.code IN ('FLM','VNH') + AND s.quantity ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_getFromTicketOrCollection` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getFromTicketOrCollection`(vParam INT) +BEGIN +/** + * Visualizar lineas de la tabla sale a través del parámetro vParam que puede + * ser ticket o collection. + * + * @param vParam Identificador de ticket o collection + */ + DECLARE vItemPackingTypeFk VARCHAR(1); + DECLARE vIsCollection BOOL; + + SELECT COUNT(*) INTO vIsCollection + FROM collection c + WHERE c.id = vParam; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + + IF vIsCollection THEN + CREATE TEMPORARY TABLE tmp.ticket + (INDEX (id)) + ENGINE = MEMORY + SELECT tc.ticketFk id + FROM ticketCollection tc + JOIN ticket t ON t.id = tc.ticketFk + WHERE tc.collectionFk = vParam; + + CREATE TEMPORARY TABLE tmp.ticket2 + (INDEX (id)) + ENGINE = MEMORY + SELECT tc.ticketFk id + FROM ticketCollection tc + JOIN ticket t ON t.id = tc.ticketFk + WHERE tc.collectionFk = vParam; + ELSE + CREATE TEMPORARY TABLE tmp.ticket + (INDEX (id)) + ENGINE = MEMORY + SELECT vParam id; + + CREATE TEMPORARY TABLE tmp.ticket2 + (INDEX (id)) + ENGINE = MEMORY + SELECT vParam id; + END IF; + + SELECT s.ticketFk, + sgd.saleGroupFk, + s.id as saleFk, + s.itemFk, + s.quantity, + i.longName, + i.size, + s.reserved, + MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) as isPreviousPrepared, + MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) as isPrepared, + MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) as isControlled, + MAX(IF(st.semaphore <=> 4, TRUE, FALSE)) as isPreControlled, + ic.color, + ip.productor, + s.discount, + s.price, + i.stems, + i.category, + o.code origin, + tt.clientFk, + s.originalQuantity, + TRIM(CONCAT(LPAD(s.concept,30,' '), ' ', + RPAD(IFNULL(i.size,''),5,' '))) line1, + '' cel1, + TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) line2, + IF(s.quantity MOD IFNULL(b.packing,s.quantity + 1), + CONCAT(CAST(s.quantity/IFNULL(b.`grouping`,1) AS DECIMAL(10,0)),' x ',IFNULL(b.`grouping`,1)), + CONCAT(CAST(s.quantity / IFNULL(b.packing,1) AS DECIMAL(10,0)),' pack de ',IFNULL(b.packing,1))) cel2, + TRIM(CONCAT(ic.color)) line3, + p.code cel3, + s.isAdded, + sub2.originalQuantity as startQuantity, -- eliminar cuando tengamos la nueva apk + IFNULL(c.workerFk,getUser()) as workerFk, + IFNULL(SUM(iss.quantity),0) as pickedQuantity, + i.packingShelve, + MIN(iss.created) picked + FROM tmp.ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN ticket tt ON tt.id = t.id + LEFT JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = tt.warehouseFk + LEFT JOIN buy b ON b.id = lb.buy_id + JOIN item i ON i.id = s.itemFk + LEFT JOIN ticketCollection tc ON tc.ticketFk = t.id + LEFT JOIN collection c ON c.id = tc.collectionFk + LEFT JOIN (SELECT sub.saleFk, sub.isChecked, sub.stateFk, sub.originalQuantity + FROM (SELECT DISTINCT st.id, st.saleFk, st.isChecked, st.stateFk, st.originalQuantity + FROM tmp.ticket2 t + JOIN sale s ON s.ticketFk = t.id + JOIN saleTracking st ON st.saleFk = s.id + ORDER BY st.id DESC) sub + GROUP BY sub.saleFk, sub.stateFK) sub2 ON sub2.saleFk = s.id AND sub2.isChecked = 1 + LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id + LEFT JOIN state st ON st.id = sub2.stateFk + LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk + LEFT JOIN itemProductor ip ON ip.itemFk = s.itemFk + LEFT JOIN origin o ON o.id = i.originFk + LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id + LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk + LEFT JOIN parking p ON p.id = sg.parkingFk + GROUP BY s.id; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticket2; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_getProblems` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblems`(IN vIsTodayRelative tinyint(1)) +BEGIN +/** + * Calcula los problemas de cada venta para un conjunto de tickets. + * + * @param vIsTodayRelative Indica si se calcula el disponible como si todo saliera hoy + * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular + * @return tmp.sale_problems + */ + DECLARE vWarehouseFk INT; + DECLARE vDate DATE; + DECLARE vAvailableCache INT; + DECLARE vVisibleCache INT; + DECLARE vDone INT DEFAULT 0; + DECLARE vComponentCount INT; + + DECLARE vCursor CURSOR FOR + SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)) + FROM tmp.sale_getProblems tt + WHERE DATE(tt.shipped) BETWEEN CURDATE() + AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; + + DELETE tt.* + FROM tmp.sale_getProblems tt + JOIN vn.ticketObservation tto ON tto.ticketFk = tt.ticketFk + JOIN vn.observationType ot ON ot.id = tto.observationTypeFk + WHERE ot.code = 'administrative' + AND tto.description = 'Miriam'; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale_problems; + CREATE TEMPORARY TABLE tmp.sale_problems ( + ticketFk INT(11), + saleFk INT(11), + isFreezed INTEGER(1) DEFAULT 0, + risk DECIMAL(10,2) DEFAULT 0, + hasHighRisk TINYINT(1) DEFAULT 0, + hasTicketRequest INTEGER(1) DEFAULT 0, + isAvailable INTEGER(1) DEFAULT 1, + itemShortage VARCHAR(255), + isTaxDataChecked INTEGER(1) DEFAULT 1, + itemDelay VARCHAR(255), + itemLost VARCHAR(255), + hasComponentLack INTEGER(1), + isTooLittle BOOL DEFAULT FALSE, + PRIMARY KEY (ticketFk, saleFk) + ) ENGINE = MEMORY; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; + CREATE TEMPORARY TABLE tmp.ticket_list + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT tp.ticketFk, tp.clientFk + FROM tmp.sale_getProblems tp; + + SELECT COUNT(*) INTO vComponentCount + FROM vn.component c + WHERE c.isRequired; + + -- Too Little + INSERT INTO tmp.sale_problems(ticketFk, isTooLittle) + SELECT tp.ticketFk, TRUE + FROM tmp.sale_getProblems tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN (SELECT t.addressFk, SUM(sv.litros) litros, t.totalWithoutVat + FROM tmp.ticket_list tl + JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = CURDATE() + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk + WHERE NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),CURDATE())) + AND dm.code IN('AGENCY','DELIVERY','PICKUP') + AND t.shipped BETWEEN CURDATE() AND util.midnight() + GROUP BY t.addressFk) sub ON sub.addressFk = t.addressFk + JOIN vn.volumeConfig vc + WHERE sub.litros < vc.minTicketVolume + AND sub.totalWithoutVat < vc.minTicketValue; + + -- Faltan componentes + INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk) + SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id)), s.id + FROM tmp.ticket_list tl + JOIN vn.sale s ON s.ticketFk = tl.ticketFk + LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id + LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk + WHERE dm.code IN('AGENCY','DELIVERY','PICKUP') + GROUP BY tl.ticketFk, s.id; + + -- Cliente congelado + INSERT INTO tmp.sale_problems(ticketFk, isFreezed) + SELECT DISTINCT tl.ticketFk, TRUE + FROM tmp.ticket_list tl + JOIN vn.client c ON c.id = tl.clientFk + WHERE c.isFreezed + ON DUPLICATE KEY UPDATE isFreezed = c.isFreezed; + + -- Cr�dito excedido + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + (PRIMARY KEY (clientFk)) + ENGINE = MEMORY + SELECT DISTINCT clientFk + FROM tmp.ticket_list; + + CALL clientGetDebt(CURDATE()); + + INSERT INTO tmp.sale_problems(ticketFk, risk, hasHighRisk) + SELECT DISTINCT tl.ticketFk, r.risk, ((r.risk - cc.riskTolerance) > c.credit + 10) + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.agencyMode a ON t.agencyModeFk = a.id + JOIN tmp.risk r ON r.clientFk = t.clientFk + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.clientConfig cc + WHERE r.risk > c.credit + 10 + AND a.isRiskFree = FALSE + ON DUPLICATE KEY UPDATE + risk = r.risk, hasHighRisk = ((r.risk - cc.riskTolerance) > c.credit + 10); + + -- Antiguo COD 100, son peticiones de compra sin terminar + INSERT INTO tmp.sale_problems(ticketFk, hasTicketRequest) + SELECT DISTINCT tl.ticketFk, TRUE + FROM tmp.ticket_list tl + JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk + WHERE tr.isOK IS NULL + ON DUPLICATE KEY UPDATE hasTicketRequest = TRUE; + + -- Disponible, Faltas, Inventario y Retrasos + OPEN vCursor; + + WHILE NOT vDone DO + + FETCH vCursor INTO vWarehouseFk, vDate; + + -- Disponible: no va a haber suficiente producto para preparar todos los pedidos + CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, vDate); + + INSERT INTO tmp.sale_problems(ticketFk, isAvailable, saleFk) + SELECT tl.ticketFk, FALSE, s.id + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + WHERE date(t.shipped) = vDate + AND ic.merchandise = TRUE + AND IFNULL(av.available, 0) < 0 + AND s.isPicked = FALSE + AND NOT i.generic + AND vWarehouseFk = t.warehouseFk + GROUP BY tl.ticketFk + ON DUPLICATE KEY UPDATE isAvailable = FALSE, saleFk = VALUES(saleFk); + + -- Faltas: visible, disponible y ubicado son menores que la cantidad vendida + CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); + + INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk) + SELECT ticketFk, problem, saleFk + FROM ( + SELECT tl.ticketFk, + LEFT(CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')),250) problem, + s.id AS saleFk + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) < s.quantity + AND IFNULL(av.available ,0) < s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) + AND NOT i.generic + AND CURDATE() = vDate + AND t.warehouseFk = vWarehouseFk + GROUP BY tl.ticketFk) sub + ON DUPLICATE KEY UPDATE itemShortage = sub.problem, saleFk = sub.saleFk; + + -- Inventario: Visible suficiente, pero ubicado menor a la cantidad vendida + INSERT INTO tmp.sale_problems(ticketFk, itemLost, saleFk) + SELECT ticketFk, problem, saleFk + FROM ( + SELECT tl.ticketFk, LEFT(GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' '),250) problem, s.id AS saleFk + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) >= s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) + AND NOT i.generic + AND CURDATE() = vDate + AND t.warehouseFk = vWarehouseFk + GROUP BY tl.ticketFk) sub + ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; + + -- Retraso: Disponible suficiente, pero no visible ni ubicado + INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk) + SELECT ticketFk, problem, saleFk + FROM ( + SELECT tl.ticketFk, LEFT(GROUP_CONCAT('R: ',i.id, ' ', i.longName, ' '),250) problem, s.id AS saleFk + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) < s.quantity + AND IFNULL(av.available ,0) >= s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) + AND NOT i.generic + AND CURDATE() = vDate + AND t.warehouseFk = vWarehouseFk + GROUP BY tl.ticketFk) sub + ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk; + END WHILE; + + CLOSE vCursor; + + INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked) + SELECT DISTINCT tl.ticketFk, FALSE + FROM tmp.ticket_list tl + JOIN vn.client c ON c.id = tl.clientFk + WHERE c.isTaxDataChecked = FALSE + ON DUPLICATE KEY UPDATE isTaxDataChecked = FALSE; + + DROP TEMPORARY TABLE + tmp.clientGetDebt, + tmp.ticket_list; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_getProblemsByTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1)) +BEGIN +/** + * Calcula los problemas de cada venta + * para un conjunto de tickets. + * + * @return Problems result + */ + DROP TEMPORARY TABLE IF EXISTS tmp.sale_getProblems; + CREATE TEMPORARY TABLE tmp.sale_getProblems + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped + FROM ticket t + WHERE t.id = vTicketFk; + + CALL sale_getProblems(vIsTodayRelative); + + SELECT * FROM tmp.sale_problems; + + DROP TEMPORARY TABLE + tmp.sale_getProblems, + tmp.sale_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 `sale_getProblems__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getProblems__`(IN vIsTodayRelative tinyint(1)) +BEGIN +/** + * Calcula los problemas de cada venta + * para un conjunto de tickets. + * + * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular + * @return tmp.sale_problems + */ + DECLARE vWarehouse INT; + DECLARE vDate DATE; + DECLARE vAvailableCache INT; + DECLARE vDone INT DEFAULT 0; + DECLARE vComponentCount INT; + + DECLARE vCursor CURSOR FOR + SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)) + FROM tmp.sale_getProblems tt + WHERE DATE(tt.shipped) BETWEEN CURDATE() + AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale_problems; + CREATE TEMPORARY TABLE tmp.sale_problems ( + ticketFk INT(11), + saleFk INT(11), + isFreezed INTEGER(1) DEFAULT 0, + risk DECIMAL(10,2) DEFAULT 0, + hasHighRisk TINYINT(1) DEFAULT 0, + hasTicketRequest INTEGER(1) DEFAULT 0, + isAvailable INTEGER(1) DEFAULT 1, + itemShortage VARCHAR(250), + isTaxDataChecked INTEGER(1) DEFAULT 1, + itemDelay VARCHAR(250), + hasComponentLack INTEGER(1), + isTooLittle BOOL DEFAULT FALSE, + PRIMARY KEY (ticketFk, saleFk) + ) ENGINE = MEMORY; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; + CREATE TEMPORARY TABLE tmp.ticket_list + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT tp.ticketFk, c.id clientFk + FROM tmp.sale_getProblems tp + JOIN vn.client c ON c.id = tp.clientFk; + + SELECT COUNT(*) INTO vComponentCount + FROM vn.component c + WHERE c.isRequired; + + INSERT INTO tmp.sale_problems(ticketFk, isTooLittle) + SELECT sub.ticketFk, TRUE + FROM (SELECT tl.ticketFk, SUM(sv.litros) litros + FROM tmp.ticket_list tl + JOIN vn.saleVolume sv ON sv.ticketFk = tl.ticketFk + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = CURDATE() + WHERE NOW() < TIMESTAMPADD(MINUTE,MINUTE(zc.`hour`) ,TIMESTAMPADD(HOUR,HOUR(zc.`hour`),CURDATE())) + GROUP BY tl.ticketFk) sub + JOIN vn.volumeConfig vc + WHERE sub.litros < vc.minTicketVolume; + + INSERT INTO tmp.sale_problems(ticketFk, hasComponentLack, saleFk) + SELECT tl.ticketFk, (COUNT(DISTINCT s.id) * vComponentCount > COUNT(c.id)), s.id + FROM tmp.ticket_list tl + JOIN vn.sale s ON s.ticketFk = tl.ticketFk + LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id + LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk + WHERE dm.code IN('AGENCY','DELIVERY','PICKUP') + GROUP BY tl.ticketFk, s.id; + + INSERT INTO tmp.sale_problems(ticketFk, isFreezed) + SELECT DISTINCT tl.ticketFk, TRUE + FROM tmp.ticket_list tl + JOIN vn.client c ON c.id = tl.clientFk + WHERE c.isFreezed + ON DUPLICATE KEY UPDATE + isFreezed = c.isFreezed; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + (PRIMARY KEY (clientFk)) + ENGINE = MEMORY + SELECT DISTINCT clientFk + FROM tmp.ticket_list; + + CALL clientGetDebt(CURDATE()); + + INSERT INTO tmp.sale_problems(ticketFk, risk, hasHighRisk) + SELECT DISTINCT tl.ticketFk, r.risk, ((r.risk - cc.riskTolerance) > c.credit + 10) + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.agencyMode a ON t.agencyModeFk = a.id + JOIN tmp.risk r ON r.clientFk = t.clientFk + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.clientConfig cc + WHERE r.risk > c.credit + 10 + AND a.isRiskFree = FALSE + ON DUPLICATE KEY UPDATE + risk = r.risk, hasHighRisk = ((r.risk - cc.riskTolerance) > c.credit + 10); + + INSERT INTO tmp.sale_problems(ticketFk, hasTicketRequest) + SELECT DISTINCT tl.ticketFk, TRUE + FROM tmp.ticket_list tl + JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk + WHERE tr.isOK IS NULL + ON DUPLICATE KEY UPDATE + hasTicketRequest = TRUE; + + OPEN vCursor; + + WHILE NOT vDone + DO + FETCH vCursor INTO vWarehouse, vDate; + + CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate); + + INSERT INTO tmp.sale_problems(ticketFk, isAvailable, saleFk) + SELECT tl.ticketFk, FALSE, s.id + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + LEFT JOIN cache.available av ON av.item_id = i.id + AND av.calc_id = vAvailableCache + WHERE date(t.shipped) = vDate + AND it.categoryFk != 6 + AND IFNULL(av.available, 0) < 0 + AND s.isPicked = FALSE + AND NOT i.generic + AND vWarehouse = t.warehouseFk + GROUP BY tl.ticketFk + ON DUPLICATE KEY UPDATE + isAvailable = FALSE, saleFk = VALUES(saleFk); + + INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk) + SELECT ticketFk, problem, saleFk + FROM ( + SELECT tl.ticketFk, CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')) problem, s.id AS saleFk + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + WHERE IFNULL(av.available, 0) < 0 + AND s.quantity > IFNULL(issw.visible, 0) + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND it.categoryFk != 6 + AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) + AND NOT i.generic + AND CURDATE() = vDate + AND t.warehouseFk = vWarehouse + GROUP BY tl.ticketFk LIMIT 1) sub + ON DUPLICATE KEY UPDATE + itemShortage = sub.problem, saleFk = sub.saleFk; + + INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk) + SELECT ticketFk, problem, saleFk + FROM ( + SELECT tl.ticketFk, GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' ') problem, s.id AS saleFk + FROM tmp.ticket_list tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE s.quantity > IFNULL(issw.visible, 0) + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND it.categoryFk != 6 + AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) + AND NOT i.generic + AND CURDATE() = vDate + AND t.warehouseFk = vWarehouse + GROUP BY tl.ticketFk LIMIT 1) sub + ON DUPLICATE KEY UPDATE + itemDelay = sub.problem, saleFk = sub.saleFk; + END WHILE; + + CLOSE vCursor; + + INSERT INTO tmp.sale_problems(ticketFk, isTaxDataChecked) + SELECT DISTINCT tl.ticketFk, FALSE + FROM tmp.ticket_list tl + JOIN vn.client c ON c.id = tl.clientFk + WHERE c.isTaxDataChecked = FALSE + ON DUPLICATE KEY UPDATE + isTaxDataChecked = FALSE; + + DROP TEMPORARY TABLE + tmp.clientGetDebt, + tmp.ticket_list; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_PriceFix` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `sale_PriceFix`(vTicketFk INT) +BEGIN + + DELETE sc.* + FROM vn.saleComponent sc + JOIN vn.sale s ON s.id = sc.saleFk + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE s.ticketFk = vTicketFk + AND ct.`type` = 'otros'; + + UPDATE vn.sale s + JOIN ( + SELECT sc.saleFk, sum(sc.value ) price + FROM vn.saleComponent sc + JOIN vn.sale s ON s.id = sc.saleFk + WHERE s.ticketFk = vTicketFk + GROUP BY sc.saleFk) sub ON sub.saleFk = s.id + SET s.price = sub.price; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_recalcComponent` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_recalcComponent`(vOption INT) +proc: BEGIN +/** + * Actualiza los componentes + * + * @table tmp.recalculateSales + */ + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAgencyModeFk INT; + DECLARE vAddressFk INT; + DECLARE vTicketFk BIGINT; + DECLARE vItemFk BIGINT; + DECLARE vLanded DATE; + DECLARE vIsEditable BOOLEAN; + DECLARE vZoneFk INTEGER; + + DECLARE vSale INTEGER; + DECLARE vDone BOOL DEFAULT FALSE; + + DECLARE vCur CURSOR FOR + SELECT id from tmp.recalculateSales; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + OPEN vCur; + + l: LOOP + SET vDone = FALSE; + FETCH vCur INTO vSale; + + IF vDone THEN + LEAVE l; + END IF; + + SELECT t.refFk IS NULL, + s.ticketFk, + s.itemFk , + t.zoneFk, + t.warehouseFk, + t.shipped, + t.addressFk, + t.agencyModeFk, + t.landed + INTO vIsEditable, + vTicketFk, + vItemFk, + vZoneFk, + vWarehouseFk, + vShipped, + vAddressFk, + vAgencyModeFk, + vLanded + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + WHERE s.id = vSale; + + CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); + + IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN + CALL util.throw('There is no zone for these parameters'); + END IF; + + IF vLanded IS NULL OR vZoneFk IS NULL THEN + + UPDATE ticket t + SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) + WHERE t.id = vTicketFk AND t.landed IS NULL; + + IF vZoneFk IS NULL THEN + SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; + UPDATE ticket t + SET t.zoneFk = vZoneFk + WHERE t.id = vTicketFk AND t.zoneFk IS NULL; + END IF; + + END IF; + + DROP TEMPORARY TABLE tmp.zoneGetLanded; + + -- rellena la tabla buyUltimate con la ultima compra + CALL buyUltimate (vWarehouseFk, vShipped); + + DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk + FROM tmp.buyUltimate + WHERE itemFk = vItemFk; + + CALL catalog_componentPrepare(); + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT vSale saleFk,vWarehouseFk warehouseFk; + + IF vOption IS NULL THEN + SET vOption = IF(vIsEditable, 1, 6); + END IF; + + CALL ticketComponentUpdateSale(vOption); + CALL catalog_componentPurge(); + + DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE tmp.sale; + + END LOOP; + CLOSE vCur; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_setQuantity` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_setQuantity`(vSaleFk INT, vQuantity INT) +BEGIN +/* + * Actualiza la cantidad de la línea de venta + * + * @vSaleFk id de la línea de venta + * @vQuantity cantidad a modificar + * + */ + + DECLARE vDescription VARCHAR(100); + DECLARE vOrigin INT; + + SELECT CONCAT("Cambio cantidad ",concept," de ", quantity," a ", vQuantity) INTO vDescription + FROM sale + WHERE id = vSaleFk; + + SELECT ticketFk INTO vOrigin FROM sale WHERE id = vSaleFk; + + CALL logAdd(vOrigin, 'update', 'ticket', vDescription); + + UPDATE sale + SET originalQuantity = quantity, + quantity = vQuantity + WHERE id = vSaleFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sale_updateOriginalQuantity` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_updateOriginalQuantity`(vSale INT, vQuantity INT) +proc: BEGIN + +UPDATE vn.sale SET originalQuantity = vQuantity +WHERE id = vSale; + +SELECT * FROM vn.sale WHERE id = vSale; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `saveLoadWorker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `saveLoadWorker`(routeFk INT, workerFk INT) +BEGIN + + +REPLACE INTO vn.routeLoadWorker(routeFk, workerFk) +VALUES(routeFk,workerFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `scanTreeCreate__`() +BEGIN + CALL nestTree( + 'vn2008', + 'scan', + 'vn2008', + 'scanTree' + ); + + 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 expedition e ON e.id = sl.`code` + JOIN 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 */ ; +/*!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 `sectorCollectionSaleGroup_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollectionSaleGroup_add`(vSaleGroupFk INT, vSectorCollectionFk INT) +BEGIN + + /** + * Inserta un nuevo registro en vn.sectorCollectionSaleGroup + * Actualiza el usuario en vn.saleGroup y reemplaza los registros de vn.saleTracking + * + * @param vSaleGroupFk Identificador de vn.saleGroup + * @param vSectorCollectionFk Identificador de vn.sectorCollection + */ + + REPLACE vn.sectorCollectionSaleGroup(sectorCollectionFk, saleGroupFk) + VALUES(vSectorCollectionFk, vSaleGroupFk); + + UPDATE vn.saleGroup sg + JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sg.id + JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk + SET sg.userFk = sc.userFk + WHERE sg.id = vSaleGroupFk; + + + INSERT IGNORE vn.saleTracking(saleFk, + isChecked, + workerFk, + actionFk, + stateFk) + SELECT sgd.saleFk , + FALSE, + sc.userFk, + a.accion_id, + s.id + FROM vn.saleGroupDetail sgd + JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk + JOIN vn.sectorCollection sc ON sc.id = scsg.sectorCollectionFk + JOIN vncontrol.accion a ON a.accion = 'SACAR' + JOIN vn.state s ON s.code = 'PREVIOUS_PREPARATION' + WHERE sgd.saleGroupFk = vSaleGroupFk; + + UPDATE vn.saleTracking st + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = st.saleFk + SET st.isChecked = TRUE + WHERE sgd.saleGroupFk = vSaleGroupFk AND st.workerFk = 20; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sectorCollection_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_get`(vSectorFk INT) +BEGIN + + /** + * Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas + * + * @param vSectorFk Identificador de vn.sector + */ + + SELECT DISTINCT sc.id collectionFk, sc.created + FROM vn.sectorCollection sc + JOIN vn.state s ON s.code = 'PREVIOUS_PREPARATION' + LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id + LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk + LEFT JOIN vn.saleTracking st ON st.saleFk = sgd.saleFk AND st.stateFk = s.id AND st.workerFk = sc.userFk + LEFT JOIN vn.sale sl ON sl.id = st.saleFk + WHERE sc.userFk = account.myUser_getId() + AND (ISNULL(scsg.sectorCollectionFk) + OR + (NOT st.isChecked AND sl.quantity > 0)) + AND sc.created > 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 `sectorCollection_getSale` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `sectorCollection_getSale`(vSelf INT) +BEGIN + + /** + * Devuelve las lineas de venta correspondientes a esa coleccion de sector + * + * @param vSelf Identificador de vn.sectorCollection + */ + + SELECT s.ticketFk, + s.itemFk, + i.longName, + IFNULL(i.itemPackingTypeFk,' ') itemPackingTypeFk, + IFNULL(i.subName ,' ') subName, + s.quantity, + w.code workerCode, + sgd.saleFk, + IFNULL(iss.quantity,0) pickedQuantity, + c.salesPersonFk + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk + JOIN vn.saleTracking st ON st.saleFk = s.id + JOIN vn.state stt ON stt.id = st.stateFk AND stt.code = 'PREVIOUS_PREPARATION' + JOIN vn.worker w ON w.id = st.workerFk + JOIN vn.ticket t ON t.id= s.ticketFk + JOIN vn.client c ON c.id=t.clientFk + LEFT JOIN vn.itemShelvingSaleSum iss ON iss.saleFk = s.id + WHERE scsg.sectorCollectionFk = vSelf; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `sectorCollection_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_new`(vSectorFk INT) +BEGIN + +/** + * Inserta una nueva colección, si el usuario no tiene ninguna vacia. + * Esto se hace para evitar que por error se generen colecciones sin sentido. + * + * @param vSectorFk Identificador de vn.sector + */ + DECLARE hasEmptyCollections BOOL; + DECLARE vUserFk INT; + + SET vUserFk = account.myUser_getId(); + + SELECT (COUNT(sc.id) > 0) INTO hasEmptyCollections + FROM vn.sectorCollection sc + LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id + WHERE ISNULL(scsg.id) + AND sc.userFk = vUserFk + AND sc.sectorFk = vSectorFk + AND sc.created >= CURDATE(); + + IF NOT hasEmptyCollections THEN + INSERT INTO vn.sectorCollection(userFk, sectorFk) + VALUES(vUserFk, vSectorFk); + 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 `sectorProductivity_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorProductivity_add`() +BEGIN + + DECLARE vDatedFrom DATETIME; + DECLARE vDatedTo DATETIME; + + SELECT DATE_SUB(CURDATE(),INTERVAL 1 DAY), CONCAT(DATE_SUB(CURDATE(),INTERVAL 1 DAY),' 23:59:59') INTO vDatedFrom, vDatedTo; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.errorsByChecker; + DROP TEMPORARY TABLE IF EXISTS tmp.previousErrors; + + CALL timeControl_calculateAll(vDatedFrom, vDatedTo); + + CREATE TEMPORARY TABLE tmp.errorsByChecker + ENGINE = MEMORY + SELECT sub1.workerFk, COUNT(sub1.id) errorsByChecker + FROM ( + SELECT st.workerFk, t.id + FROM saleMistake sm + JOIN saleTracking st ON sm.saleFk = st.saleFk + JOIN vncontrol.accion a ON a.accion_id = st.actionFk + JOIN sale s ON s.id = sm.saleFk + JOIN ticket t on t.id = s.ticketFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.sector se ON se.id = i.sectorFk + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND a.accion = 'PRESACAR' AND se.code IN ('ALGEMESI ARTIFI','COMPLEMENTOS') + GROUP BY s.ticketFk + ) sub1 + GROUP BY sub1.workerFk; + + CREATE TEMPORARY TABLE tmp.previousErrors -- Errores de previa, derivadores de los revisadores (por reclamación) + ENGINE = MEMORY + SELECT tt.workerFk, COUNT(c.ticketFk) errorsByClaim + FROM claimDevelopment cd + JOIN claim c ON cd.claimFk = c.id + JOIN ticket t ON c.ticketFk = t.id + JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id + JOIN ticketTracking tt ON tt.ticketFk = t.id + JOIN state s ON s.id = tt.stateFk + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = 'Revisadores' AND s.code = 'OK PREVIOUS' + GROUP BY workerFk; + + INSERT INTO sectorProductivity(workerFk, firstName, lastName, sector, ticketCount, saleCount, error, volume, hourWorked, dated) + SELECT w.id workerFk, + w.firstName, + w.lastName, + se.description sector, + COUNT(DISTINCT t.id) ticketCount, + COUNT(st.saleFk) saleCount, + IFNULL(ec2.errorsByChecker,0) + IFNULL(pe.errorsByClaim, 0) errors, + wp.volume, + IFNULL(CAST(tc.timeWorkDecimal AS DECIMAL (10,2)) , 0) AS hourWorked, + DATE(vDatedFrom) dated + FROM vn.saleTracking st + LEFT JOIN vn.worker w ON w.id = st.workerFk + LEFT JOIN vn.sale s ON s.id = st.saleFk + LEFT JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.sector se ON se.id = i.sectorFk + LEFT JOIN vn.ticket t ON s.ticketFk = t.id + LEFT JOIN vncontrol.accion a ON a.accion_id = st.actionFk + LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = w.id + LEFT JOIN bs.workerProductivity wp ON wp.workerFk = w.id AND a.accion = 'PRESACAR' + LEFT JOIN tmp.errorsByChecker ec2 ON ec2.workerFk = w.id + LEFT JOIN tmp.previousErrors pe ON pe.workerFk = w.id + WHERE DATE(st.created) = vDatedFrom + AND se.code IN ('ALGEMESI ARTIFI','COMPLEMENTOS') + AND wp.dated = vDatedFrom + GROUP BY w.id; + + DROP TEMPORARY TABLE tmp.timeControlCalculate; + DROP TEMPORARY TABLE tmp.errorsByChecker; + DROP TEMPORARY TABLE tmp.previousErrors; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sector_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sector_get`() +BEGIN + +/** + * Obtiene los sectores +*/ + + SELECT s.id,s.description,s.warehouseFk + FROM vn.sector s; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sector_getWarehouse` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sector_getWarehouse`(vSectorFk INT) +BEGIN + + SELECT s.warehouseFk + FROM vn.sector s + WHERE s.id = vSectorFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `setPlacementReserve` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `setPlacementReserve`(vItemFk INT, vPlacement VARCHAR(10), vWarehouseFk INT ) +BEGIN + + DECLARE vReserve VARCHAR(10); + DECLARE vReserveOLD VARCHAR(10); + DECLARE vPlacementOLD VARCHAR(10); + + SELECT code, reserve INTO vPlacementOLD, vReserveOLD + FROM itemPlacement + WHERE itemFk = vItemFk + AND warehouseFk = vWarehouseFk; + + IF ASCII(vPlacement) > 57 THEN + + SET vReserve = vPlacement; + SET vPlacement = vPlacementOLD; + + ELSE + + SET vReserve = vReserveOLD; + + END IF; + + REPLACE itemPlacement(itemFk, warehouseFk, code,reserve) + VALUES(vItemFk, vWarehouseFk, vPlacement, vReserve); + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `shelvingChange` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingChange`(IN `vShelvingO` VARCHAR(8), IN `vShelvingD` VARCHAR(8)) +BEGIN + + UPDATE vn.itemShelving + SET shelvingFk = vShelvingD COLLATE utf8_unicode_ci + WHERE shelvingFk = vShelvingO 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 `shelvingFuture__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingFuture__`(vSectorFk INT) +BEGIN + + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vItemFk INT; + DECLARE vItemShelvingRest INT; + DECLARE vItemShelvingFk INT; + DECLARE vItemShelvingCreated DATE; + DECLARE vSaleRest INT; + DECLARE vSaleDated DATE; + DECLARE vWarehouseFk INT; + + DECLARE rsItem CURSOR FOR + SELECT DISTINCT itemFk + FROM vn.itemShelvingStock + WHERE sectorFk = vSectorFk + AND visible > 0; + + DECLARE rsItemShelving CURSOR FOR + SELECT ish.id, + ish.visible, + date(ish.created) + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + WHERE ish.itemFk = vItemFk + AND ish.visible > 0 + AND p.sectorFk = vSectorFk + ORDER BY date(ish.created), ish.visible; + + DECLARE rsSale CURSOR FOR + SELECT - floor(sum(io.amount)) as sold, + date(io.dat) as dated + FROM vn2008.item_out io + LEFT JOIN tmp.ticketFree tf ON tf.ticketFk = io.ticketFk + WHERE (dat BETWEEN util.tomorrow() AND '2019-10-31' + OR + (dat BETWEEN CURDATE() AND util.dayEnd(CURDATE()) AND tf.ticketFk IS NOT NULL)) + AND item_id = vItemFk + AND io.warehouse_id = vWarehouseFk + GROUP BY dated; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + SELECT warehouseFk INTO vWarehouseFk + FROM vn.sector + WHERE id = vSectorFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketFree; + CREATE TEMPORARY TABLE tmp.ticketFree + SELECT ticket as ticketFk + FROM vn.ticketStateToday tst + JOIN vn.state s ON s.id = tst.state + WHERE s.isPicked = FALSE; + + DROP TEMPORARY TABLE IF EXISTS tmp.result; + CREATE TEMPORARY TABLE tmp.result + SELECT ish.id as itemShelvingFk, + date(ish.created) as created, + ish.visible, + 0 as reserve, + CAST('2019-10-31' AS DATE) as picked, + ish.shelvingFk, + 0 as Litros, + p.code as parkingCode + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + WHERE ish.visible > 0 + AND p.sectorFk = vSectorFk + ORDER BY date(ish.created), ish.visible; + + UPDATE tmp.result r + JOIN (SELECT ish.id, floor(sum(ish.visible * r.cm3) / 1000) as Litros + FROM vn.itemShelving ish + JOIN bi.rotacion r ON r.Id_Article = ish.itemFk AND r.warehouse_id = vWarehouseFk + GROUP BY ish.id) sub ON r.itemShelvingFk = sub.id + SET r.Litros = sub.Litros; + + ALTER TABLE tmp.result + ADD PRIMARY KEY (itemShelvingFk); + + OPEN rsItem; + + FETCH rsItem INTO vItemFk; + + -- TRUNCATE tmp.log; + + WHILE NOT vDone DO + + OPEN rsItemShelving; + OPEN rsSale; + + FETCH rsSale INTO vSaleRest, vSaleDated; + FETCH rsItemShelving INTO vItemShelvingFk, vItemShelvingRest, vItemShelvingCreated; + /* + INSERT INTO tmp.log(vItemFk, vItemShelvingRest, vSaleRest, vSalePicked,ifSide) + VALUES (vItemFk, vItemShelvingRest, vSaleRest, vSaleDated, '0'); + */ + bucle: LOOP + + IF vDone THEN + + LEAVE bucle; + + END IF; + + IF vSaleRest >= vItemShelvingRest THEN + /* + INSERT INTO tmp.log(vItemFk, vItemShelvingRest, vSaleRest, vSalePicked,ifSide) + VALUES (vItemFk, vItemShelvingRest, vSaleRest, vSaleDated, '1'); + */ + SET vSaleRest = vSaleRest - vItemShelvingRest; + + UPDATE tmp.result + SET reserve = reserve + vItemShelvingRest, + picked = LEAST(picked, vSaleDated) + WHERE itemShelvingFk = vItemShelvingFk; + + FETCH rsItemShelving INTO vItemShelvingFk, vItemShelvingRest, vItemShelvingCreated; + + IF vSaleRest = 0 THEN + + FETCH rsSale INTO vSaleRest, vSaleDated; + + END IF; + + ELSE + /* + INSERT INTO tmp.log(vItemFk, vItemShelvingRest, vSaleRest, vSalePicked,ifSide) + VALUES (vItemFk, vItemShelvingRest, vSaleRest, vSaleDated, '2'); + */ + SET vItemShelvingRest = vItemShelvingRest - vSaleRest; + + UPDATE tmp.result + SET reserve = reserve + vSaleRest, + picked = LEAST(picked, vSaleDated) + WHERE itemShelvingFk = vItemShelvingFk; + + FETCH rsSale INTO vSaleRest, vSaleDated; + + END IF; + + END LOOP; + + CLOSE rsItemShelving; + CLOSE rsSale; + /* + INSERT INTO tmp.log(vItemFk, vItemShelvingRest, vSaleRest, vSalePicked,ifSide) + VALUES (vItemFk, vItemShelvingRest, vSaleRest, vSaleDated, '4'); + */ + SET vDone = FALSE; + + FETCH rsItem INTO vItemFk; + + END WHILE; + + CLOSE rsItem; + + SELECT * FROM tmp.result + ORDER BY created, visible; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `shelvingLog_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingLog_get`(shelvingFk VARCHAR(10)) +BEGIN + + /* Lista el log de un carro + * + * @param shelvingFk matrícula del carro + * + */ + + SELECT originFk, name, creationDate, description + FROM shelvingLog sl + JOIN user u ON u.id = sl.userFk + WHERE sl.originFk = shelvingFk COLLATE utf8_general_ci + ORDER BY creationDate 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 `shelvingPark` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingPark`(IN `vParam` VARCHAR(8), IN `vParkingCode` VARCHAR(8)) +proc: BEGIN + +/* + * Aparca una colección, un ticket, un saleGroup o un shelving en un parking + * + * @param vParam id del ticket, colección, saleGroup o shelving + * @param vParkingCode código del parking + * + */ + + DECLARE vParkingFk INT; + DECLARE vColumn VARCHAR(3); + DECLARE vRow VARCHAR(2); + DECLARE vReturn VARCHAR(50); + DECLARE vIsSaleGroup BOOL; + DECLARE vIsTicket BOOL; + DECLARE vIsCollection BOOL; + DECLARE vCollection INT DEFAULT NULL; + DECLARE vDone INT DEFAULT FALSE; + DECLARE vTicketFk INT; + DECLARE vCursor CURSOR FOR + SELECT IFNULL(tc2.ticketFk, t.id) + FROM ticket t + LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id + LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk + WHERE t.id = vParam; + + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SET vParkingCode = replace(vParkingCode,' ','') ; + + SELECT id INTO vParkingFk + FROM vn.parking + WHERE code = vParkingCode COLLATE utf8_unicode_ci; + + IF vParkingFk IS NULL THEN + + LEAVE proc; + + END IF; + + -- Se comprueba si es una preparación previa + SELECT COUNT(*) INTO vIsSaleGroup + FROM vn.saleGroup sg + WHERE sg.id = vParam; + + IF vIsSaleGroup THEN + + UPDATE vn.saleGroup sg + SET sg.parkingFk = vParkingFk + WHERE sg.id = vParam + AND sg.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); + + CALL vn.ticket_setNextState(vn.ticket_get(vParam)); + + LEAVE proc; + + END IF; + + -- Se comprueba si es un ticket + SELECT COUNT(*) INTO vIsTicket + FROM vn.ticket t + WHERE t.id = vParam + AND t.shipped >= TIMESTAMPADD(WEEK,-1,CURDATE()); + + IF vIsTicket THEN + + INSERT INTO vn.ticketParking(ticketFk, parkingFk) + SELECT IFNULL(tc2.ticketFk, t.id), vParkingFk + FROM ticket t + LEFT JOIN ticketCollection tc1 ON tc1.ticketFk = t.id + LEFT JOIN ticketCollection tc2 ON tc2.collectionFk = tc1.collectionFk + WHERE t.id = vParam + ON DUPLICATE KEY UPDATE parkingFk = vParkingFk; + + OPEN vCursor; + l: LOOP + + FETCH vCursor INTO vTicketFk; + + IF vDone THEN + LEAVE l; + END IF; + + CALL vn.ticket_setNextState(vTicketFk); + + END LOOP; + + CLOSE vCursor; + + LEAVE proc; + + END IF; + + -- Se comprueba si es una coleccion de tickets + SELECT COUNT(*) INTO vIsCollection + FROM vn.collection c + WHERE c.id = vParam + AND c.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); + + IF vIsCollection THEN + + REPLACE vn.ticketParking(ticketFk,parkingFk) + SELECT tc.ticketFk, vParkingFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vParam; + + LEAVE proc; + + END IF; + + -- Por descarte, se considera una matrícula + INSERT INTO vn.shelvingLog (originFk, userFk, action , description) + SELECT vParam, account.userGetId(), 'update', CONCAT("Cambio parking ",vParam," de ", p.code," a ", vParkingCode) + FROM parking p + JOIN shelving s ON s.parkingFk = p.id + WHERE s.code = vParam COLLATE utf8_unicode_ci; + + UPDATE vn.shelving + SET parkingFk = vParkingFk, parked = NOW(), isPrinted = TRUE + WHERE `code` = vParam 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 `shelvingParking_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingParking_get`(vShelvingFk VARCHAR(10), vWarehouseFk INT, vDayRange INT) +BEGIN + + +SELECT s.itemFk, + s.concept, + CAST(SUM(s.quantity) AS DECIMAL(10,0)) as sinServir, + CAST(IFNULL(ist.visible,0) AS DECIMAL(10,0)) as aparcado + FROM vn.sale s + LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id + JOIN vn.ticket t ON t.id = s.ticketFk + LEFT JOIN vn.itemShelvingStock ist ON ist.itemFk = s.itemFk AND ist.warehouseFk = vWarehouseFk + JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk AND ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci + WHERE t.shipped BETWEEN CURDATE() AND util.dayend(TIMESTAMPADD(DAY, GREATEST(0,vDayRange), CURDATE())) + AND iss.saleFk IS NULL + AND t.warehouseFk = vWarehouseFk + GROUP BY s.itemFk + HAVING sinServir > aparcado; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `shelvingPark__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingPark__`(IN `vParam` VARCHAR(8), IN `vParkingCode` VARCHAR(8)) +proc: BEGIN + + /* Aparca una colección, un ticket, un saleGroup o un shelving en un parking + * + * @param vParam + * + */ + DECLARE vParkingFk INT; + DECLARE vColumn VARCHAR(3); + DECLARE vRow VARCHAR(2); + DECLARE vReturn VARCHAR(50); + DECLARE vIsSaleGroup BOOL; + DECLARE vIsTicket BOOL; + DECLARE vIsCollection BOOL; + + SET vParkingCode = replace(vParkingCode,' ','') ; + + SELECT id INTO vParkingFk + FROM vn.parking + WHERE code = vParkingCode COLLATE utf8_unicode_ci; + + IF vParkingFk IS NULL THEN + + LEAVE proc; + + END IF; + + -- Se comprueba si es una preparación previa + SELECT COUNT(*) INTO vIsSaleGroup + FROM vn.saleGroup sg + WHERE sg.id = vParam; + + IF vIsSaleGroup THEN + + UPDATE vn.saleGroup sg + SET sg.parkingFk = vParkingFk + WHERE sg.id = vParam + AND sg.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); + + CALL vn.ticket_setPreviousState(vn.ticket_get(vParam)); + + LEAVE proc; + + END IF; + + -- Se comprueba si es un ticket + SELECT COUNT(*) INTO vIsTicket + FROM vn.ticket t + WHERE t.id = vParam + AND t.shipped >= TIMESTAMPADD(WEEK,-1,CURDATE()); + + IF vIsTicket THEN + + REPLACE vn.ticketParking(ticketFk,parkingFk) + VALUES (vParam, vParkingFk); + + CALL vn.ticket_setPreviousState(vParam); + + LEAVE proc; + + END IF; + + -- Se comprueba si es una coleccion de tickets + SELECT COUNT(*) INTO vIsCollection + FROM vn.collection c + WHERE c.id = vParam + AND c.created >= TIMESTAMPADD(WEEK,-1,CURDATE()); + + IF vIsCollection THEN + + REPLACE vn.ticketParking(ticketFk,parkingFk) + SELECT tc.ticketFk, vParkingFk + FROM vn.ticketCollection tc + WHERE tc.collectionFk = vParam; + + LEAVE proc; + + END IF; + + -- Por descarte, se considera una matrícula + INSERT INTO vn.shelvingLog (originFk, userFk, action , description) + SELECT vParam, getUser(), 'update', CONCAT("Cambio parking ",vParam," de ", p.code," a ", vParkingCode) + FROM parking p + JOIN shelving s ON s.parkingFk = p.id + WHERE s.code = vParam COLLATE utf8_unicode_ci; + + UPDATE vn.shelving + SET parkingFk = vParkingFk, parked = NOW(), isPrinted = 1 + WHERE `code` = vParam COLLATE utf8_unicode_ci; + + SELECT (COUNT(*) > 0) AS IsUpdated + FROM vn.shelving + WHERE parkingFk = vParkingFk + AND `code` = vParam 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 `shelvingPriority_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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelvingPriority_update`(priority INT,vShelvingFk VARCHAR(10)) +BEGIN + + UPDATE vn.shelving SET priority = priority WHERE code=vShelvingFk 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 `shelving_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`@`localhost` PROCEDURE `shelving_clean`() +BEGIN + + DELETE FROM vn.shelving + WHERE length(code) > 3 + AND parked < TIMESTAMPADD(WEEK,-1,CURDATE()); + + DELETE FROM vn.itemShelving + WHERE visible <= 0 + AND created < TIMESTAMPADD(MONTH,-1,CURDATE()); + + DELETE ish.* + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + WHERE sh.parkingFk IS NULL + AND ish.created < TIMESTAMPADD(WEEK,-1,CURDATE()); + + UPDATE vn.shelving sh + LEFT JOIN vn.itemShelving its ON its.shelvingFk = sh.`code` + SET isPrinted = 0, + parkingFk = NULL + WHERE its.id IS NULL + AND sh.isRecyclable + AND ( sh.parked IS NULL + OR + sh.parked < TIMESTAMPADD(MONTH,-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 */ ; +/*!50003 DROP PROCEDURE IF EXISTS `shelving_getSpam` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_getSpam`(vDated DATE, vWarehouseFk INT) +BEGIN + + /** + * Devuelve las matrículas con productos que no son necesarios para la venta hasta la fecha señalada + * + * @param vDated Fecha hasta la que se puede pasar sin esos productos. + * @param vWarehouse Identificador único de vn.warehouse + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.stock; + + CALL cache.stock_refresh(FALSE); + + CREATE TEMPORARY TABLE tmp.stock + SELECT i.id itemFk, + v.amount - IFNULL(fue.reserva,0) as visible, + fue.reserva, + sale.venta, + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, + IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) - IFNULL(fue.reserva,0) as saldo + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN ( + SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS reserva + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + WHERE s.code = 'FUENTES_PICASSE' + OR sh.isSpam + GROUP BY ish.itemFk + ) fue ON fue.itemFk = i.id + LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta + FROM vn2008.item_out + WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + AND warehouse_id = vWarehouseFk + GROUP BY item_id + ) sale ON sale.item_id = i.id + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra + FROM vn2008.item_entry_in + WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + AND warehouse_id = vWarehouseFk + AND isVirtualStock = FALSE + GROUP BY item_id + ) buy ON buy.item_id = i.id + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado + FROM vn2008.item_entry_out + WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + AND warehouse_id = vWarehouseFk + GROUP BY item_id + ) mov ON mov.item_id = i.id + WHERE v.amount; + + SELECT ish.shelvingFk matricula, + i.longName articulo, + ish.visible, + count(*) lineas, + sum(ish.visible <= s.saldo) spam, + p.code parking, + s.description sector , + w.name AS almacen, + sh.isSpam + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + JOIN vn.warehouse w ON w.id = s.warehouseFk + LEFT JOIN tmp.stock s ON s.itemFk = ish.itemFk + WHERE (w.name = 'Algemesi' + OR (w.name = 'NuncaJamas' AND ish.created < curdate())) + AND ish.visible + GROUP BY ish.shelvingFk + HAVING lineas = spam OR isSpam; + + DROP TEMPORARY TABLE tmp.stock; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `silla_algemesi__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `silla_algemesi__`(vDate DATE, vItemFk INT, vQuantity INT) +BEGIN + +DECLARE done INT DEFAULT FALSE; +DECLARE vWarehouseFk INT DEFAULT 60; +DECLARE vTicketFk INT; +DECLARE vSaleFk INT; +DECLARE vClonTicket INT DEFAULT 0; +DECLARE i INT DEFAULT 0; + +DECLARE cur1 CURSOR FOR + select distinct s.ticketFk, s.id + from vn.sale s + join vn.ticket t ON t.id = s.ticketFk + left join vn.ticketStateToday tss ON tss.ticket = t.id + join vn.itemShelving ish ON ish.itemFk = s.itemFk + join vn.shelving sh ON sh.code = ish.shelvingFk + join vn.parking p ON p.id = sh.parkingFk + where t.shipped between vDate and util.dayend(vDate) + and p.sectorFk = 37 + and left(t.nickname,1) != '-' + and t.warehouseFk = 1 + and s.quantity mod ish.packing = 0 + and vItemFk IN (0,s.itemFk) + and IFNULL(tss.alertLevel,0) = 0 + and s.quantity >= ish.packing + and s.quantity >= vQuantity + and s.itemFk NOT IN (1, 130, 60002, 1778, 3899); + + +DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + +OPEN cur1; + +FETCH cur1 INTO vTicketFk, vSaleFk; + + WHILE done = 0 DO + + SELECT t.id INTO vClonTicket + FROM vn.ticket t + JOIN (SELECT t.addressFk, t.shipped + FROM vn.ticket t + LEFT JOIN vn.ticketStateToday tss ON tss.ticket = t.id + WHERE id = vTicketFk + and IFNULL(tss.alertLevel,0) = 0 ) sub USING(addressFk, shipped) + WHERE t.warehouseFk = vWarehouseFk + LIMIT 1; + + -- SELECT vTicketFk, vClonTicket; + + IF vClonTicket = 0 THEN + + INSERT INTO ticket ( + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk + ) + SELECT + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + vWarehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk + + FROM ticket + WHERE id = vTicketFk; + + SET vClonTicket = LAST_INSERT_ID(); + + -- SELECT 'lstID', vClonTicket; + + INSERT IGNORE INTO ticketObservation(ticketFk, observationTypeFk, description) + SELECT vClonTicket, ao.observationTypeFk, ao.description + FROM addressObservation ao + JOIN ticket t ON t.addressFk = ao.addressFk + WHERE t.id = vTicketFk; + + INSERT IGNORE INTO ticketLog + SET originFk = vClonTicket, userFk = account.myUser_getId(), `action` = 'insert', + description = CONCAT('Ha creado el ticket:', ' ', vClonTicket, ' clonando el ', vTicketFk); + + END IF; + + UPDATE vn.sale + SET ticketFk = vClonTicket + WHERE id = vSaleFk; + -- SELECT vTicketFk, vClonTicket; + + SET vClonTicket = 0; + + SET done = 0; + FETCH cur1 INTO vTicketFk, vSaleFk; + + SET i = i + 1; + + END WHILE; + + CLOSE cur1; + + SELECT i; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `sleep_X_min` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `sleep_X_min`() +BEGIN + # Ernesto. 4.8.2020 + # Para su uso en las tareas ejecutadas a las 2AM (visibles con: SELECT * FROM bs.nightTask order by started asc;) + # Simplemente esperar unos minutos para que en las graficas de rendimiento de Percona PMM y escritura a disco de vCenter se puedan ver los efectos de cada tarea. + do SLEEP(300); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `solunionRiskRequest` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `solunionRiskRequest`() +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; + CREATE TEMPORARY TABLE tmp.client_list + (PRIMARY KEY (Id_Cliente)) + ENGINE = MEMORY + SELECT * FROM (SELECT cc.client Id_Cliente, ci.grade FROM vn.creditClassification cc + JOIN vn.creditInsurance ci ON cc.id = ci.creditClassification + WHERE dateEnd IS NULL + ORDER BY ci.creationDate DESC) t1 GROUP BY Id_Cliente; + + CALL vn2008.risk_vs_client_list(CURDATE()); + + SELECT + c.Id_Cliente, c.Cliente, c.Credito credito_vn, c.creditInsurance solunion, cast(r.risk as DECIMAL(10,0)) riesgo_vivo, + cast(c.creditInsurance - r.risk as decimal(10,0)) margen_vivo, + f.Consumo consumo_anual, c.Vencimiento, ci.grade + FROM + vn2008.Clientes c + JOIN tmp.risk r ON r.Id_Cliente = c.Id_Cliente + JOIN tmp.client_list ci ON c.Id_Cliente = ci.Id_Cliente + JOIN bi.facturacion_media_anual f ON c.Id_Cliente = f.Id_Cliente + GROUP BY Id_cliente; + + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + DROP TEMPORARY TABLE IF EXISTS tmp.client_list; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `stockBuyedByWorker` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `stockBuyedByWorker`(vDate DATE, vWorker INT) +BEGIN + + DECLARE vVolume DECIMAL(10,2); + DECLARE vWarehouse INT DEFAULT 7; + CALL stockTraslation(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 ) * vn.buy_getVolume(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 tmp.buyUltimate bu ON bu.itemFk = a.Id_Article AND bu.warehouseFk = vWarehouse + JOIN vn2008.Compres c ON c.Id_compra = bu.buyFk + WHERE r.display <> 0 AND tr.user_id = vWorker; + + DROP TEMPORARY TABLE + tmp.buyUltimate, + 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 `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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 ) * vn.buy_getVolume(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 `stockBuyed_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `stockBuyed_add`(vDated DATE) +BEGIN +/** + * Inserta el volumen de compra por comprador en vn.stockBuyed de acuerdo con la fecha + * + * @param vDated Fecha de compra + */ + CALL vn.stockTraslation(vDated); + + DELETE + FROM vn.stockBuyed + WHERE `date` = vDated; + + INSERT INTO vn.stockBuyed(`user`, buyed, `date`, description) + SELECT it.workerFk, + SUM(( ti.amount / b.packing ) * vn.buy_getVolume(b.id)) / vc.palletM3 / 1000000 buyed, + vDated, + u.name + FROM tmp_item ti + JOIN vn.item i ON i.id = ti.item_id + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.warehouse wh ON wh.code = 'VNH' + JOIN tmp.buyUltimate bu ON bu.itemFk = i.id AND bu.warehouseFk = wh.id + JOIN vn.buy b ON b.id = bu.buyFk + JOIN vn.volumeConfig vc + JOIN account.`user` u ON u.id = it.workerFk + WHERE ic.display != 0 + GROUP BY it.workerFk; + + INSERT INTO stockBuyed(buyed, `date`, description) + SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000), vDated, IF(c.country = 'España',p.name,c.country) destiny + FROM vn.itemTicketOut ito + JOIN vn.ticket t ON t.id = ito.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.warehouse wh ON wh.id = t.warehouseFk + JOIN vn.itemCost ic ON ic.itemFk = ito.itemFk AND ic.warehouseFk = t.warehouseFk + JOIN vn.volumeConfig vc + WHERE ito.shipped BETWEEN vDated AND util.dayend(vDated) + AND wh.code = 'VNH' + GROUP BY destiny; + + DROP TEMPORARY TABLE + tmp.buyUltimate, + 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` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `stockTraslation`(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 + (UNIQUE INDEX i USING HASH (item_id)) + ENGINE = MEMORY + SELECT item_id, SUM(amount) amount + FROM vn2008.item_entry_in + WHERE dat = vDate + AND vDate >= CURDATE() + AND warehouse_id = vWarehouse + AND isVirtualStock is FALSE + GROUP BY item_id + HAVING amount != 0; + + 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 buyUltimate(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 `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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 `stowawayBoarding__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `stowawayBoarding__`(IN vShipFk INT, IN vStowawayFk INT) +BEGIN + + REPLACE stowaway(shipFk, id) + VALUES (vShipFk, vStowawayFk); + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, vShipFk, myWorker_getId() + FROM state + WHERE code = 'BOARDING'; + + -- FIXME No crear ticket 98 + INSERT INTO sale(ticketFk, itemFk, quantity, concept) + VALUES(vShipFk, 98,1, CONCAT('POLIZÓN! ',vStowawayFk)); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `stowawayControl__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `stowawayControl__`(vDated DATE) +BEGIN + + SELECT t.id ticketFV, + tst.code as stateFV, + sw.id ticketPCA, + w.code, + w.firstName, + w.lastName, + s.itemFk, + s.concept, + MAX(IF(s.isPicked,'OK',st.code)) situacion + FROM vn.ticket t + LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id + JOIN vn.stowaway sw ON sw.shipFk = t.id + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + LEFT JOIN vn.collection c ON c.id = tc.collectionFk + LEFT JOIN vn.worker w ON w.id = c.workerFk + JOIN vn.sale s ON s.ticketFk = sw.id + LEFT JOIN vn.saleTracking str ON str.saleFk = s.id AND str.isChecked = 1 + LEFT JOIN vn.state st ON st.id = str.stateFk AND st.code = 'PREPARED' + WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) + GROUP BY s.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 `stowaway_launchShip__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `stowaway_launchShip__`(vStowawayFk INT) +BEGIN + + DECLARE myShipFk INT; + + SELECT shipFk INTO myShipFk + FROM vn.stowaway + WHERE id = vStowawayFk; + + IF myShipFk THEN + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, myShipFk, account.myUser_getId() + FROM state + WHERE code = 'OK STOWAWAY'; + + 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 `stowaway_unboarding__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `stowaway_unboarding__`(vShipFk INT, vStowawayFk INT) +BEGIN + DECLARE vWorker VARCHAR(255); + + DELETE FROM stowaway + WHERE shipFk = vShipFk AND id = vStowawayFk; + + DELETE tt FROM ticketTracking tt + JOIN state s ON s.id = tt.stateFk + WHERE code = 'BOARDING' AND ticketFk = vShipFk; + + DELETE FROM sale + WHERE ticketFk = vShipFk + AND itemFk = 98 + AND concept = CONCAT('POLIZÓN! ',vStowawayFk); + + SELECT u.`name` INTO vWorker + FROM account.user u JOIN worker w ON w.userFk = u.id + WHERE w.id = client_getSalesPersonByTicket(vStowawayFk); + + SELECT messageSend(vWorker,CONCAT('El ticket: ', vStowawayFk, ' ha dejado de ser un polizón')) INTO @a; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `subordinateGetList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `subordinateGetList`(vBossFk INT) +BEGIN + + -- deprecated usar vn.worker_GetHierarch + DECLARE vBossId INT; + DECLARE vDone BOOL; + DECLARE workerCur CURSOR FOR + SELECT workerFk + FROM tmp.subordinate + WHERE NOT isChecked; + + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE EXIT HANDLER FOR 1062 BEGIN + CALL util.throw('INFINITE_LOOP'); + END; + + DROP TEMPORARY TABLE IF EXISTS tmp.subordinate; + + CREATE TEMPORARY TABLE tmp.subordinate + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBossFk AS workerFk, 0 AS isChecked; + + WHILE (SELECT COUNT(*) FROM tmp.subordinate WHERE NOT isChecked) > 0 DO + OPEN workerCur; + workerLoop: LOOP + SET vDone = FALSE; + + FETCH workerCur INTO vBossId; + + IF vDone THEN + LEAVE workerLoop; + END IF; + + INSERT INTO tmp.subordinate + SELECT id, 0 + FROM worker + WHERE bossFk = vBossId; + + UPDATE tmp.subordinate + SET isChecked = 1 + WHERE workerFk = vBossId; + END LOOP; + + CLOSE workerCur; + 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 `supplierExpenses` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierExpenses`(vEnded DATE) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS openingBalance; + + CREATE TEMPORARY TABLE openingBalance( + dueDated DATE + , supplierFk INT NOT NULL + , companyFk INT NOT NULL + , eurAmount DOUBLE NOT NULL + , foreignAmount DOUBLE NOT NULL + , PRIMARY KEY(supplierFk, companyFk)) + ENGINE = MEMORY; + + -- Calcula el balance inicial y final de cada proveedor + INSERT INTO openingBalance + SELECT MAX(dueDated), + supplierFk, + companyFk, + sum(amount) eurAmount, + sum(divisa) foreignAmount + FROM ( + SELECT p.dueDated, + p.supplierFk, + p.companyFk, + p.amount, + p.divisa + FROM payment p + JOIN currency c ON c.id = p.currencyFk + JOIN company co ON co.id = p.companyFk + WHERE p.dueDated > '2014-12-31' + AND p.dueDated <= vEnded + AND co.`code` = 'VNL' + AND c.`code` <> 'EUR' + UNION ALL + + SELECT iidd.dueDated, + ii.supplierFk, + ii.companyFk, + - iidd.amount, + - iidd.foreignValue + FROM invoiceIn ii + JOIN invoiceInDueDay iidd ON ii.id = iidd.invoiceInFk + JOIN currency c ON c.id = ii.currencyFk + JOIN company co ON co.id = ii.companyFk + WHERE iidd.dueDated > '2014-12-31' + AND iidd.dueDated <= vEnded + AND ii.isBooked AND co.`code` = 'VNL' + AND c.`code` <> 'EUR' + UNION ALL + + SELECT se.dueDated, + se.supplierFk, + se.companyFk, + - se.amount, + 0 + FROM supplierExpense se + JOIN currency c ON c.id = se.currencyFk + JOIN company co ON co.id = se.companyFk + WHERE se.dueDated > '2014-12-31' + AND se.dueDated <= vEnded + AND co.`code` = 'VNL' AND c.`code` <> 'EUR' + ) sub + GROUP BY companyFk, supplierFk; + + SELECT ob.dueDated + , ob.supplierFk + , ob.companyFk + , ob.eurAmount + , s.`name` + FROM openingBalance ob + LEFT JOIN supplier s ON s.id = ob.supplierFk + WHERE ob.eurAmount <> 0 AND ob.foreignAmount = 0; + + DROP TEMPORARY TABLE openingBalance; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `supplierPackaging_ReportSource` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `supplierPackaging_ReportSource`(vFromDated DATE, vSupplierFk INT) +BEGIN + +/** + * Selecciona los embalajes de un proveedor a partir de una fecha + * + * @param vFromDated Fecha de la que partir + * @param vSupplierFk Id del proveedor + */ + + DECLARE vCounter INT DEFAULT 0; + DECLARE vMaxRow INT DEFAULT 0; + DECLARE vItemFk INT DEFAULT 0; + SET @vRowNumber = 0; + SET @vBalance = 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackagingList; + CREATE TEMPORARY TABLE tmp.supplierPackagingList + SELECT itemFk, + @vRowNumber:= @vRowNumber + 1 `row` + FROM ( + SELECT * + FROM ( + SELECT supplierFk, + itemFk, + longName, + supplier, + entryFk, + landed, + `out`, + `in`, + warehouse, + buyingValue + FROM supplierPackaging + WHERE supplierFk = vSupplierFk + AND landed >= vFromDated + + UNION ALL + + SELECT vSupplierFk, + itemFk, + longName, + supplier, + 'previous', + vFromDated, + SUM(`out`), + SUM(`in`), + NULL, + buyingValue + FROM supplierPackaging + WHERE supplierFk = vSupplierFk + AND landed < vFromDated + GROUP BY itemFk) i + GROUP BY itemFk + ORDER BY landed) i2; + + SELECT MAX(`row`) + INTO vMaxRow + FROM tmp.supplierPackagingList; + + DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackaging; + CREATE TEMPORARY TABLE tmp.supplierPackaging( + supplierFk INT, + itemFk INT, + longName VARCHAR(50), + supplier VARCHAR(50), + entryFk VARCHAR(50), + landed DATE, + `in` VARCHAR(50), + `out` VARCHAR(50), + warehouse INT, + buyingValue INT, + balance INT); + + l1: LOOP + + IF vCounter = vMaxRow THEN + LEAVE l1; + ELSE + SET vCounter = vCounter + 1; + SET @vBalance = 0; + END IF; + + SELECT itemFk + INTO vItemFk + FROM tmp.supplierPackagingList + WHERE `row` = vCounter; + + INSERT INTO tmp.supplierPackaging + SELECT supplierFk, + itemFk, + longName, + supplier, + entryFk, + landed, + `in`, + `out`, + warehouse, + buyingValue, + @vBalance:= (`in` - `out` + @vBalance) + FROM ( + SELECT supplierFk, + itemFk, + longName, + supplier, + entryFk, + landed, + `out`, + `in`, + warehouse, + buyingValue + FROM supplierPackaging + WHERE supplierFk = vSupplierFk + AND landed >= vFromDated + AND itemFk = vItemFk + + UNION ALL + + SELECT vSupplierFk, + itemFk, + longName, + supplier, + 'previous', + vFromDated, + SUM(`out`), + SUM(`in`), + NULL, + buyingValue + FROM supplierPackaging + WHERE supplierFk = vSupplierFk + AND landed < vFromDated + AND itemFk = vItemFk + GROUP BY itemFk + ) sub + WHERE `out` OR `in` + ORDER BY itemFk, landed; + + END LOOP l1; + + SELECT * FROM tmp.supplierPackaging; + + DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackagingList; + DROP TEMPORARY TABLE IF EXISTS tmp.supplierPackaging; + SET @vRowNumber = 0; + SET @vBalance = 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 `supplier_checkBalance` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `supplier_checkBalance`(IN vDateTo DATETIME, IN vIsConciliated BOOL) +BEGIN + + DECLARE vDateFrom DATE; + SET vDateTo = TIMESTAMP(vDateTo,'23:59:59'); + SELECT util.firstDayOfYear(vDateTo) INTO vDateFrom; + + SELECT c.code, s.id , s.account, mysql, sage, mysql - sage difference, sub1.companyFk, s.name + FROM supplier s + JOIN ( SELECT companyFk, supplierFk, ROUND(SUM(mysql),2) mysql, ROUND(SUM(sage),2) sage + FROM ( SELECT companyFk, supplierFk, -SUM(iid.amount) as mysql, 0 sage + FROM invoiceInDueDay iid + JOIN invoiceIn ii ON ii.id = iid.invoiceInFk + WHERE IFNULL(ii.bookEntried, ii.issued) BETWEEN vDateFrom AND vDateTo + AND ii.isBooked + GROUP BY ii.id + UNION ALL + SELECT p.companyFk, p.supplierFk, p.amount, 0 + FROM payment p + JOIN payMethod pm ON pm.id = p.payMethodFk + WHERE p.received BETWEEN vDateFrom AND vDateTo + AND IF(vIsConciliated, p.isConciliated, TRUE) = TRUE + AND NOT pm.code <=>'previousBalance' + UNION ALL + SELECT se.companyFk, se.supplierFk, - se.amount, 0 + FROM supplierExpense se + WHERE se.dated BETWEEN vDateFrom AND vDateTo + AND IF(vIsConciliated, se.isConciliated, TRUE) = TRUE + UNION ALL + SELECT xd.empresa_id, s.id, 0, ROUND(NZ(Eurodebe)-NZ(Eurohaber),2) + FROM bi.XDiario_ALL xd + JOIN supplier s ON s.account = xd.SUBCTA + WHERE xd.Fecha BETWEEN vDateFrom AND vDateTo + ) sub + GROUP BY companyFk, supplierFk + ) sub1 ON sub1.supplierFk = s.id + JOIN company c ON c.id = sub1.companyFk + HAVING ABS(difference) > 0.05 + ORDER BY s.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 `supplier_disablePayMethodChecked` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `supplier_disablePayMethodChecked`() +BEGIN + +/* + * Deshabilita la comprobación de los datos bancarios de todos aquellos proveedores que tengan + * un número que no sea 0 en el campo graceMonthsDisableChecked de la tabla vn.payMethod + * y que no hayan recibido un pago desde el mes indicado + */ + + UPDATE vn.supplier s + JOIN ( SELECT p.supplierFk + FROM vn.payment p + LEFT JOIN vn.supplier s ON s.id = p.supplierFk + LEFT JOIN vn.payMethod pm ON pm.id = s.payMethodFk + WHERE p.created < (CURDATE() - INTERVAL pm.graceMonthsDisableChecked MONTH) + AND pm.graceMonthsDisableChecked + AND s.isPayMethodChecked + GROUP BY p.supplierFk) sdpmc ON sdpmc.supplierFk = s.id + SET s.isPayMethodChecked = FALSE; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `test` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `test`() +BEGIN +select 'procedimiento ejecutado con éxito'; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketBoxesView` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBoxesView`(IN vTicketFk INT) +BEGIN + + SELECT s.id, + s.itemFk, + s.concept, + floor(s.quantity / b.packing) as Cajas, + b.packing, + s.isPicked, + i.size + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN cache.last_buy lb on lb.warehouse_id = t.warehouseFk AND lb.item_id = s.itemFk + JOIN buy b on b.id = lb.buy_id + JOIN packaging p on p.id = b.packageFk + WHERE s.quantity >= b.packing + AND t.id = vTicketFk + AND p.isBox + GROUP BY s.itemFk; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketBuiltTime` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketBuiltTime`(vDate DATE) +BEGIN + + DECLARE vDateStart DATETIME DEFAULT DATE(vDate); + DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketBuiltTime; + + CREATE TEMPORARY TABLE tmp.ticketBuiltTime + ENGINE = MEMORY + SELECT t.id as ticketFk ,t.shipped, IFNULL(builtTime, vDateEnd) as builtTime + FROM + vn.ticket t + LEFT JOIN + ( + SELECT ticketFk, builtTime + FROM + ( + SELECT + Id_Ticket as ticketFk, + odbc_date as builtTime + FROM + vncontrol.inter + WHERE odbc_date BETWEEN vDateStart AND vDateEnd + ORDER BY Id_Ticket, odbc_date DESC + ) sub + GROUP BY ticketFk + ) sub2 ON sub2.ticketFk = t.id + WHERE t.shipped BETWEEN vDate AND util.dayEnd(vDate) + AND t.clientFk NOT IN (50,400,200) + AND t.companyFk = 442 + + ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCalculateClon` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateClon`(IN vTicketNew INT, vTicketOld INT) +BEGIN +/* + * Recalcula los componentes un ticket clonado, + * las lineas a precio cero fuerza para que tengan precio, el resto lo respeta + * @param vTicketNew nuevo ticket clonado + * @param vTicketOld icket original, a partir del qual se clonara el nuevo +*/ + DECLARE vShipped DATE; + DECLARE vClient INT; + DECLARE vWarehouse SMALLINT; + DECLARE vAgencyMode INT; + DECLARE vAddress INT; + DECLARE vLanded DATE; + DECLARE vAgency INT; + DECLARE vZoneFk INT; + + REPLACE INTO orderTicket(orderFk,ticketFk) + SELECT orderFk, vTicketNew + FROM orderTicket + WHERE ticketFk = vTicketOld; + + SELECT t.clientFk, t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk, t.zoneFk + INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk + FROM agencyMode a + JOIN ticket t ON t.agencyModeFk = a.id + WHERE t.id = vTicketNew; + + IF vLanded IS NULL THEN + CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse, TRUE); + UPDATE ticket t + JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk + SET t.landed = zgl.landed, + t.zoneFk = zgl.zoneFk + WHERE t.id = vTicketNew; + + SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; + END IF; + + -- rellena la tabla tmp.buyUltimate con la ultima compra + CALL buyUltimate(vWarehouse, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk, vZoneFk zoneFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk; + + CALL catalog_componentPrepare(); + CALL catalog_componentCalculate(vZoneFk, vAddress, vShipped, vWarehouse); + + -- Bionizamos lineas con Preu = 0 + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT s.id saleFk, vWarehouse warehouseFk + FROM sale s + JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0; + + CALL ticketComponentUpdateSale(1); + + -- Bionizamos lineas con Preu > 0 + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT s.id saleFk, vWarehouse warehouseFk + FROM sale s + JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew + AND s.price > 0; + + CALL ticketComponentUpdateSale(6); + + -- Log + CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket'); + + -- Limpieza + CALL catalog_componentPurge(); + DROP TEMPORARY TABLE IF EXISTS + tmp.buyUltimate, + tmp.sale, + tmp.zoneGetLanded; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCalculateClon__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateClon__`(IN vTicketNew INT, vTicketOld INT) +BEGIN + /* + * @vTicketNew id del nuevo ticket clonado + * @vTicketOld id ticket original, a partir del qual se clonara el nuevo + * Este procedimiento "rebioniza" una linea, eliminando los componentes existentes e insertandolos de nuevo + */ + DECLARE vShipped DATE; + DECLARE vClient INT; + DECLARE vWarehouse SMALLINT; + DECLARE vAgencyMode INT; + DECLARE vAddress INT; + DECLARE vLanded DATE; + DECLARE vAgency INT; + DECLARE vZoneFk INT; + + REPLACE INTO orderTicket(orderFk,ticketFk) + SELECT orderFk, vTicketNew + FROM orderTicket + WHERE ticketFk = vTicketOld; + + SELECT t.clientFk, t.warehouseFk, date(t.shipped), t.addressFk, t.agencyModeFk, t.landed, a.agencyFk, t.zoneFk + INTO vClient, vWarehouse, vShipped, vAddress, vAgencyMode, vLanded, vAgency, vZoneFk + FROM vn.agencyMode a + JOIN vn.ticket t ON t.agencyModeFk = a.id + WHERE t.id = vTicketNew; + + IF vLanded IS NULL THEN + CALL zone_getLanded(vShipped, vAddress, vAgency, vWarehouse); + UPDATE ticket t + JOIN tmp.zoneGetLanded zgl ON t.warehouseFk = zgl.warehouseFk + SET t.landed = zgl.landed, + t.zone = zgl.zoneFk + WHERE t.id = vTicketNew; + + SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; + END IF; + + -- rellena la tabla tmp.buyUltimate con la ultima compra + CALL buyUltimate(vWarehouse, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouse warehouseFk, NULL available, s.itemFk, bu.buyFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketOld GROUP BY s.itemFk; + + CALL catalog_componentCalculate(vZoneFk, vAddress, vAgencyMode); + + -- Bionizamos lineas con Preu = 0 + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT s.id saleFk, vWarehouse warehouseFk + FROM sale s + JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew AND s.price = 0; + + CALL ticketComponentUpdateSale(1); + + -- Bionizamos lineas con Preu > 0 + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT s.id saleFk, vWarehouse warehouseFk + FROM sale s + JOIN ticket t on t.id = s.ticketFk WHERE s.ticketFk = vTicketNew + AND s.price > 0; + + CALL ticketComponentUpdateSale(6); + + -- Log + CALL `logAdd`(vTicketNew, 'update', ' ticket' , 'Bioniza Ticket'); + + -- Limpieza + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCalculateFromType` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateFromType`( vLanded DATE, + vAddressFk INT, + vAgencyModeFk INT, + vTypeFk INT) +BEGIN + DROP TEMPORARY TABLE IF EXISTS tmp.item; + CREATE TEMPORARY TABLE tmp.item + (INDEX (itemFk)) + ENGINE = MEMORY + SELECT id itemFk FROM vn.item + WHERE typeFk = vTypeFk; + + CALL catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); + DROP TEMPORARY TABLE tmp.item; + DROP TEMPORARY TABLE tmp.ticketLot; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCalculatePurge` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculatePurge`() +BEGIN + DROP TEMPORARY TABLE + tmp.ticketCalculateItem, + tmp.ticketComponentPrice, + tmp.ticketComponent, + tmp.ticketLot, + tmp.zoneGetShipped; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCalculateSaleForcePrice2__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateSaleForcePrice2__`(IN vSale BIGINT) +proc: BEGIN + + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAddressFk INT; + DECLARE vTicket BIGINT; + DECLARE vItem BIGINT; + DECLARE vZoneFk INT; + + SELECT ticketFk, itemFk + INTO vTicket, vItem + FROM sale + WHERE id = vSale; + + SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.zoneFk + INTO vWarehouseFk, vShipped, vAddressFk, vZoneFk + FROM agencyMode a + JOIN ticket t ON t.agencyModeFk = a.id + WHERE t.id = vTicket; + + IF vZoneFk IS NULL THEN + CALL util.throw('ticket without zone'); + END IF; + + CALL buyUltimate (vWarehouseFk, vShipped); + + DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk + FROM tmp.buyUltimate + WHERE itemFk = vItem; + + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT vSale saleFk,vWarehouseFk warehouseFk; + + CALL ticketComponentUpdateSale(1); + + INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) + VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); + + DROP TEMPORARY TABLE tmp.buyUltimate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCalculateSaleForcePrice__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateSaleForcePrice__`(IN vSale BIGINT) +proc: BEGIN + + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAddressFk INT; + DECLARE vTicket BIGINT; + DECLARE vItem BIGINT; + DECLARE vZoneFk INT; + + SELECT ticketFk, itemFk + INTO vTicket, vItem + FROM sale + WHERE id = vSale; + + SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.zoneFk + INTO vWarehouseFk, vShipped, vAddressFk, vZoneFk + FROM agencyMode a + JOIN ticket t ON t.agencyModeFk = a.id + WHERE t.id = vTicket; + + IF vZoneFk IS NULL THEN + CALL util.throw('ticket without zone'); + END IF; + + CALL buyUltimate (vWarehouseFk, vShipped); + + DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk + FROM tmp.buyUltimate + WHERE itemFk = vItem; + + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT vSale saleFk,vWarehouseFk warehouseFk; + + CALL ticketComponentUpdateSale(1); + + INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) + VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); + + DROP TEMPORARY TABLE tmp.buyUltimate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCalculateSale__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculateSale__`(IN vSale BIGINT) +proc: BEGIN +-- OBSOLETO USAR: sale_calculateComponent(vSale, NULL) + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAgencyModeFk INT; + DECLARE vAddressFk INT; + DECLARE vTicket BIGINT; + DECLARE vItem BIGINT; + DECLARE vLanded DATE; + DECLARE vTicketFree BOOLEAN DEFAULT TRUE; + DECLARE vZoneFk INTEGER; + + SELECT NOT (t.refFk IS NOT NULL OR ts.alertLevel > 0) OR s.price = 0, s.ticketFk, s.itemFk , t.zoneFk + INTO vTicketFree, vTicket, vItem, vZoneFk + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id + WHERE s.id = vSale + LIMIT 1; + + SELECT t.warehouseFk, DATE(t.shipped), t.addressFk, t.agencyModeFk, t.landed + INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded + FROM agencyMode a + JOIN ticket t ON t.agencyModeFk = a.id + WHERE t.id = vTicket; + + IF IFNULL(vZoneFk,0) = 0 THEN + CALL util.throw('ticket dont have zone'); + END IF; + + CALL buyUltimate (vWarehouseFk, vShipped); + + DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk + FROM tmp.buyUltimate + WHERE itemFk = vItem; + + CALL vn.catalog_componentCalculate; + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT vSale saleFk,vWarehouseFk warehouseFk; + + CALL ticketComponentUpdateSale(IF(vTicketFree,1,6)); + + INSERT INTO vn.ticketLog (originFk, userFk, `action`, description) + VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); + + CALL catalog_componentPurge(); + DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCalculate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCalculate__`( + vLanded DATE, + vAddressFk INT, + vAgencyModeFk INT) +proc: BEGIN +-- OBSOLETO utilizar catalog_calculate + CALL vn.catalog_calculate(vLanded, vAddressFk, vAgencyModeFk); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketClon` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon`(vTicketFk INT, vNewShipped DATE) +BEGIN + + DECLARE done INT DEFAULT FALSE; + DECLARE vNewTicketFk INT; + DECLARE vOldSaleFk INT; + DECLARE vNewSaleFk INT; + + DECLARE cur1 CURSOR FOR + SELECT id + FROM vn.sale + WHERE ticketFk = vTicketFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + SET vNewShipped = IFNULL(vNewShipped, CURDATE()); + + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); + + UPDATE vn.ticket + SET landed = TIMESTAMPADD(DAY, DATEDIFF(vNewShipped, shipped), landed), + shipped = vNewShipped + WHERE id = vNewTicketFk; + + OPEN cur1; + + read_loop: LOOP + + FETCH cur1 INTO vOldSaleFk; + + IF done THEN + LEAVE read_loop; + END IF; + + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed) + SELECT vNewTicketFk, itemFk, quantity, concept, price, discount, priceFixed, isPriceFixed + FROM vn.sale + WHERE id = vOldSaleFk; + + SELECT max(id) INTO vNewSaleFk + FROM vn.sale + WHERE ticketFk = vNewTicketFk; + + INSERT INTO vn.saleComponent(saleFk, componentFk, value, isGreuge) + SELECT vNewSaleFk, componentFk, value, isGreuge + FROM vn.saleComponent + WHERE saleFk = vOldSaleFk; + + END LOOP; + + CLOSE cur1; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketClon_OneYear` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClon_OneYear`(vTicketFk INT) +BEGIN + + DECLARE vShipped DATE; + DECLARE vMaxDated DATE; + + SELECT shipped, TIMESTAMPADD(YEAR,1,shipped) + INTO vShipped, vMaxDated + FROM vn.ticket + WHERE id = vTicketFk; + + WHILE vShipped <= vMaxDated DO + + SET vShipped = TIMESTAMPADD(WEEK, 1, vShipped); + + CALL vn.ticketClon(vTicketFk, vShipped); + + 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 `ticketClosureAgencyListAdd__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClosureAgencyListAdd__`(vAgencyModeFk INT) +BEGIN +/** + * Prepara un listado de agencias sobre los que se realizará el cierre. + * Es necesario llamar al procedimiento por cada agencia. + * + * @param vAgencyModeFk Id almacén + */ + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.ticketClosureAgencyList ( + `agencyModeFk` INT, + PRIMARY KEY(agencyModeFk)) ENGINE = MEMORY; + + INSERT INTO tmp.ticketClosureAgencyList(agencyModeFk) VALUES(vAgencyModeFk); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketClosureAgencyList__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClosureAgencyList__`(vWarehouseFk INT, vDateTo DATE) +BEGIN +/** + * Inserta los tickets de todos los almacenes en la tabla temporal + * para ser cerrados. + * + * @param vWarehouseFk Id del almacén + * @param vDate Fecha del cierre + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; + + CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( + SELECT + t.id AS ticketFk + FROM expedition e + INNER JOIN ticket t ON t.id = e.ticketFk + INNER JOIN tmp.ticketClosureAgencyList al ON al.agencyModeFk = t.agencyModeFk + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + WHERE + ts.alertLevel = 2 + AND t.warehouseFk = vWarehouseFk + AND DATE(t.shipped) BETWEEN DATE_ADD(vDateTo, INTERVAL -2 DAY) AND vDateTo + AND t.refFk IS NULL + GROUP BY e.ticketFk); + + DROP TEMPORARY TABLE tmp.ticketClosureAgencyList; + + CALL ticketClosure(); + + DROP TEMPORARY TABLE tmp.ticketClosure; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketClosureRoute__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClosureRoute__`( vRouteFk INT) +BEGIN +/** + * Inserta los tickets de la ruta en la tabla temporal + * para ser cerrados. + * + * @param vWarehouseFk Almacén a cerrar + * @param vRouteFk Ruta a cerrar + * @param vDate Fecha del cierre + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; + + CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( + SELECT + t.id AS ticketFk + FROM expedition e + INNER JOIN ticket t ON t.id = e.ticketFk + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + WHERE + ts.alertLevel = 2 + AND t.routeFk = vRouteFk + AND t.refFk IS NULL + GROUP BY e.ticketFk); + + CALL ticketClosure(); + + DROP TEMPORARY TABLE tmp.ticketClosure; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketClosureTicket__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketClosureTicket__`(vTicketFk INT) +BEGIN + +/** + * @deprecated Use ticket_closeByTicket() + * Inserta el ticket en la tabla temporal + * para ser cerrado. + * + * @param vTicketFk Id del ticket + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; + + CREATE TEMPORARY TABLE tmp.ticketClosure ENGINE = MEMORY ( + SELECT + t.id AS ticketFk + FROM expedition e + INNER JOIN ticket t ON t.id = e.ticketFk + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + WHERE + ts.alertLevel = 2 + AND t.id = vTicketFk + AND t.refFk IS NULL + GROUP BY e.ticketFk); + + CALL ticketClosure(); + + DROP TEMPORARY TABLE tmp.ticketClosure; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCollection_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_get`(vTicketFk INT) +BEGIN + + SELECT tc.collectionFk + FROM vn.ticketCollection tc + WHERE ticketFk = vTicketFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketCollection_setUsedShelves` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_setUsedShelves`(vTicketFk INT, vUsedShelves INT) +BEGIN + + /* + * Inserta número de baldas que ocupa un ticket + * + * @param vTicketFk Identificador de ticket + * @param vUsedShelves Número de baldas + */ + + UPDATE ticketCollection tc + SET tc.usedShelves = vUsedShelves + WHERE tc.ticketFk = vTicketFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketComponentUpdate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentUpdate`( + vTicketFk INT, + vClientFk INT, + vAgencyModeFk INT, + vAddressFk INT, + vWarehouseFk TINYINT, + vCompanyFk SMALLINT, + vShipped DATETIME, + vLanded DATE, + vIsDeleted BOOLEAN, + vHasToBeUnrouted BOOLEAN, + vOption INT) +BEGIN + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN + + UPDATE ticket t + JOIN address a ON a.id = vAddressFk + SET t.nickname = a.nickname + WHERE t.id = vTicketFk; + + END IF; + + UPDATE ticket t + SET + t.clientFk = vClientFk, + t.agencyModeFk = vAgencyModeFk, + t.addressFk = vAddressFk, + t.warehouseFk = vWarehouseFk, + t.companyFk = vCompanyFk, + t.landed = vLanded, + t.shipped = vShipped, + t.isDeleted = vIsDeleted + WHERE + t.id = vTicketFk; + + IF vHasToBeUnrouted THEN + UPDATE ticket t SET t.routeFk = NULL + WHERE t.id = vTicketFk; + END IF; + + IF vOption <> 8 THEN + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) + ENGINE = MEMORY + SELECT id AS saleFk, vWarehouseFk warehouseFk + FROM sale s WHERE s.ticketFk = vTicketFk; + + CALL ticketComponentUpdateSale (vOption); + + DROP TEMPORARY TABLE tmp.sale; + 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 `ticketComponentUpdateSale` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketComponentUpdateSale`(vOption INT) +BEGIN +/** + * A partir de la tabla tmp.sale, crea los Movimientos_componentes + * y modifica el campo Preu de la tabla Movimientos + * + * @param i_option integer tipo de actualizacion + * @param table tmp.sale tabla memory con el campo saleFk, warehouseFk + **/ + DECLARE vComponentFk INT; + DECLARE vRenewComponents BOOLEAN; + DECLARE vKeepPrices BOOLEAN; + + CASE vOption + WHEN 1 THEN + SET vRenewComponents = TRUE; + SET vKeepPrices = FALSE; + WHEN 2 THEN + SELECT id INTO vComponentFk FROM component WHERE `code` = 'debtCollection'; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 3 THEN + SELECT id INTO vComponentFk FROM component WHERE `code` = 'mana'; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 4 THEN + SELECT id INTO vComponentFk FROM component WHERE `code` = 'buyerDiscount'; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + /* WHEN 5 THEN + SET vComponentFk = 35; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE;*/ + WHEN 6 THEN + SELECT id INTO vComponentFk FROM component WHERE `code` = 'imbalance'; + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + WHEN 7 THEN + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.8, 3) + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk NOT IN (28, 29) + GROUP BY s.id; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 29, ROUND(((s.price * (100 - s.discount) / 100) - SUM(IFNULL(sc.value, 0))) * 0.2, 3) + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk NOT IN (28, 29) + GROUP BY s.id; + + SET vRenewComponents = FALSE; + SET vKeepPrices = FALSE; + WHEN 8 THEN + DELETE sc.* + FROM tmp.sale tmps JOIN saleComponent sc ON sc.saleFk = tmps.saleFk; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 28, ROUND(((s.price * (100 - s.discount) / 100)), 3) + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id; + + SET vRenewComponents = FALSE; + SET vKeepPrices = FALSE; + WHEN 9 THEN + SET vRenewComponents = TRUE; + SET vKeepPrices = TRUE; + END CASE; + + IF vRenewComponents THEN + DELETE sc.* + FROM tmp.sale tmps + JOIN saleComponent sc ON sc.saleFk = tmps.saleFk + JOIN `component` c ON c.id = sc.componentFk + WHERE c.isRenewable; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, tc.componentFk, tc.cost + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk = tc.componentFk + LEFT JOIN `component` c ON c.id = tc.componentFk + WHERE IF(sc.componentFk IS NULL AND NOT c.isRenewable, FALSE, TRUE); + + -- Añadir componente venta por paquete + DROP TEMPORARY TABLE IF EXISTS tmp.sale2; + CREATE TEMPORARY TABLE tmp.sale2 + (PRIMARY KEY (saleFk)) + ENGINE = MEMORY + SELECT * FROM tmp.sale; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent2; + CREATE TEMPORARY TABLE tmp.ticketComponent2 + SELECT * FROM tmp.ticketComponent; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT t.id, t.componentFk, t.cost + FROM ( + SELECT s.id, tc.componentFk, tc.cost, MOD(s.quantity, b.packing) as resto + FROM vn.sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND tmps.warehouseFk = lb.warehouse_id + JOIN vn.buy b ON b.id = buy_id + JOIN tmp.ticketComponent tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk + JOIN `component` c ON c.id = tc.componentFk AND c.code = 'salePerPackage' + LEFT JOIN ( + SELECT s.id + FROM vn.sale s + JOIN tmp.sale2 tmps ON tmps.saleFk = s.id + JOIN tmp.ticketComponent2 tc ON tc.itemFk = s.itemFk AND tc.warehouseFk = tmps.warehouseFk + JOIN saleComponent sc ON sc.saleFk = s.id AND sc.componentFk = tc.componentFk + JOIN `component` c ON c.id = sc.componentFk AND c.code = 'lastUnitsDiscount' + ) tp ON tp.id = s.id + WHERE tp.id IS NULL + HAVING resto <> 0) t; + + DROP TEMPORARY TABLE IF EXISTS + tmp.sale2, + tmp.ticketComponent2; + END IF; + + IF vKeepPrices THEN + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, vComponentFk, ROUND((s.price * (100 - s.discount) / 100) - SUM(sc.value), 3) dif + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + WHERE sc.saleFk <> vComponentFk + GROUP BY s.id + HAVING dif <> 0; + ELSE + UPDATE sale s + JOIN item i on i.id = s.itemFk + JOIN itemType it on it.id = i.typeFk + JOIN (SELECT SUM(sc.value) sumValue, sc.saleFk + FROM saleComponent sc + JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk + GROUP BY sc.saleFk) sc ON sc.saleFk = s.id + SET s.price = sumValue / ((100 - s.discount) / 100) + WHERE it.code != 'PRT' ; + + REPLACE INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 21, ROUND((s.price * (100 - s.discount) / 100) - SUM(value), 3) saleValue + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + WHERE sc.componentFk != 21 + GROUP BY s.id + HAVING ROUND(saleValue, 4) <> 0; + END IF; + + UPDATE sale s + JOIN ( + SELECT SUM(sc.value) sumValue, sc.saleFk + FROM saleComponent sc + JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk + JOIN `component` c ON c.id = sc.componentFk + JOIN componentType ct on ct.id = c.typeFk AND ct.isBase + GROUP BY sc.saleFk) sc ON sc.saleFk = s.id + SET s.priceFixed = sumValue, s.isPriceFixed = 1; + + DELETE sc.* + FROM saleComponent sc + JOIN tmp.sale tmps ON tmps.saleFk = sc.saleFk + JOIN sale s on s.id = sc.saleFk + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + WHERE it.code = 'PRT'; + + INSERT INTO saleComponent(saleFk, componentFk, value) + SELECT s.id, 15, s.price + FROM sale s + JOIN tmp.sale tmps ON tmps.saleFk = s.id + JOIN item i ON i.id = s.itemFK + JOIN itemType it ON it.id = i.typeFk + WHERE it.code = 'PRT' AND s.price > 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 `ticketCreate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCreate`( + vClientId INT + ,vShipped DATE + ,vWarehouseId INT + ,vCompanyFk INT + ,vAddressFk INT + ,vAgencyType INT + ,vRouteFk INT + ,vlanded DATE + ,OUT vNewTicket INT) +BEGIN + CALL `ticketCreateWithUser`(vClientId, vShipped, vWarehouseId, vCompanyFk, vAddressFk, vAgencyType, vRouteFk, vlanded, account.userGetId(), 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 `ticketCreateWithUser` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCreateWithUser`( + vClientId INT + ,vShipped DATE + ,vWarehouseFk INT + ,vCompanyFk INT + ,vAddressFk INT + ,vAgencyModeFk INT + ,vRouteFk INT + ,vlanded DATE + ,vUserId INT + ,OUT vNewTicket INT) +BEGIN + CALL ticket_add( + vClientId, + vShipped, + vWarehouseFk, + vCompanyFk, + vAddressFk, + vAgencyModeFk, + vRouteFk, + vlanded, + vUserId, + TRUE, + 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 `ticketDown_PrintableSelection` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketDown_PrintableSelection`(vSectorFk INT) +BEGIN + + UPDATE vn.ticketDown td + JOIN + (SELECT DISTINCT t.id + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id + JOIN vn.itemShelving ish ON ish.id = iss.itemShelvingFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + WHERE p.sectorFk = vSectorFk + ) sub ON sub.id = td.ticketFk + JOIN vn.ticketDown_SelectionType tdst ON tdst.description = 'FREE' + JOIN vn.ticketDown_SelectionType tdst2 ON tdst2.description = 'SELECTED' + SET td.selected = tdst2.id + WHERE td.selected = tdst.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 `ticketFilter__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketFilter__`() +BEGIN +/** + * Obtiene un listado de tickets + * junto con el precio total y los problemas + * + * @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular + * @return Listado de tickets + */ + CALL ticketGetTotal(); + CALL ticketGetProblems(FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketFilter; + CREATE TEMPORARY TABLE tmp.ticketFilter ENGINE = MEMORY + SELECT t.*, tt.total, tp.problem + FROM tmp.ticket t + JOIN tmp.ticketTotal tt ON tt.ticketFk = t.ticketFk + LEFT JOIN tmp.ticketProblems tp ON tp.ticketFk = t.ticketFk; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTotal, + tmp.ticketProblems; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketGetProblems__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetProblems__`(IN vIsTodayRelative TINYINT(1)) +BEGIN +/** + * @deprecated Use ticket_getProblems() instead + * + * Hay que revisar los dos procesos y unificarlos. No son equivalentes. PAK 04/06/21 + * + */ + DECLARE vWarehouse INT; + DECLARE vDate DATE; + DECLARE vAvailableCache INT; + DECLARE vDone INT DEFAULT 0; + DECLARE vComponentCount INT; + DECLARE vHasUbications BOOL; + + DECLARE vCursor CURSOR FOR + SELECT DISTINCT tt.warehouseFk, IF(vIsTodayRelative, CURDATE(), date(tt.shipped)), w.hasUbications + FROM tmp.ticketGetProblems tt + JOIN vn.warehouse w ON w.id = tt.warehouseFk + WHERE DATE(tt.shipped) BETWEEN CURDATE() + AND TIMESTAMPADD(DAY, IF(vIsTodayRelative, 9.9, 1.9), CURDATE()); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketProblems; + CREATE TEMPORARY TABLE tmp.ticketProblems ( + ticketFk INT(11) PRIMARY KEY, + isFreezed INTEGER(1) DEFAULT 0, + risk DECIMAL(10,2) DEFAULT 0, + hasTicketRequest INTEGER(1) DEFAULT 0, + isAvailable INTEGER(1) DEFAULT 1, + itemShortage VARCHAR(250), + isTaxDataChecked INTEGER(1) DEFAULT 1, + itemDelay VARCHAR(250), + componentLack INTEGER(1) + ) ENGINE = MEMORY; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketList; + CREATE TEMPORARY TABLE tmp.ticketList + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT tp.ticketFk, c.id clientFk + FROM tmp.ticketGetProblems tp + JOIN vn.client c ON c.id = tp.clientFk; + + SELECT COUNT(*) INTO vComponentCount + FROM vn.component c + WHERE c.isRequired; + + INSERT INTO tmp.ticketProblems(ticketFk, componentLack) + SELECT tl.ticketFk, + (COUNT(DISTINCT s.id) * (vComponentCount - (dm.code = 'PICKUP')) > COUNT(c.id)) + FROM tmp.ticketList tl + JOIN vn.sale s ON s.ticketFk = tl.ticketFk + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk + LEFT JOIN vn.saleComponent sc ON sc.saleFk = s.id + LEFT JOIN vn.component c ON c.id = sc.componentFk AND c.isRequired + GROUP BY tl.ticketFk; + + INSERT INTO tmp.ticketProblems(ticketFk, isFreezed) + SELECT DISTINCT tl.ticketFk, 1 + FROM tmp.ticketList tl + JOIN vn.client c ON c.id = tl.clientFk + WHERE c.isFreezed + ON DUPLICATE KEY UPDATE + isFreezed = c.isFreezed; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + (PRIMARY KEY (clientFk)) + ENGINE = MEMORY + SELECT DISTINCT clientFk + FROM tmp.ticketList; + + CALL clientGetDebt(CURDATE()); + + INSERT INTO tmp.ticketProblems(ticketFk, risk) + SELECT DISTINCT tl.ticketFk, r.risk + FROM tmp.ticketList tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.agencyMode a ON t.agencyModeFk = a.id + JOIN tmp.risk r ON r.clientFk = t.clientFk + JOIN vn.client c ON c.id = t.clientFk + JOIN vn.clientConfig cc + WHERE r.risk - cc.riskTolerance > c.credit + 10 + AND a.isRiskFree = FALSE + ON DUPLICATE KEY UPDATE + risk = r.risk; + + INSERT INTO tmp.ticketProblems(ticketFk, hasTicketRequest) + SELECT DISTINCT tl.ticketFk, 1 + FROM tmp.ticketList tl + JOIN vn.ticketRequest tr ON tr.ticketFk = tl.ticketFk + WHERE tr.isOK IS NULL AND tr.saleFk IS NOT NULL + ON DUPLICATE KEY UPDATE + hasTicketRequest = 1; + + OPEN vCursor; + + WHILE NOT vDone + DO + FETCH vCursor INTO vWarehouse, vDate, vHasUbications; + + CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouse, vDate); + + INSERT INTO tmp.ticketProblems(ticketFk, isAvailable) + SELECT tl.ticketFk, 0 + FROM tmp.ticketList tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + LEFT JOIN cache.available av ON av.item_id = i.id + AND av.calc_id = vAvailableCache + WHERE date(t.shipped) = vDate + AND it.categoryFk != 6 + AND IFNULL(av.available, 0) < 0 + AND s.isPicked = FALSE + AND NOT i.generic + AND vWarehouse = t.warehouseFk + GROUP BY tl.ticketFk + ON DUPLICATE KEY UPDATE + isAvailable = 0; + + IF vHasUbications THEN + + INSERT INTO tmp.ticketProblems(ticketFk, itemShortage) + SELECT ticketFk, problem + FROM ( + SELECT tl.ticketFk, CONCAT('F: ',GROUP_CONCAT(i.id, ' ', i.longName, ' ')) problem + FROM tmp.ticketList tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + WHERE IFNULL(av.available, 0) < 0 + AND s.quantity > IFNULL(issw.visible, 0) + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND it.categoryFk != 6 + AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) + AND NOT i.generic + AND CURDATE() = vDate + AND t.warehouseFk = vWarehouse + GROUP BY tl.ticketFk) sub + ON DUPLICATE KEY UPDATE + itemShortage = sub.problem; + + INSERT INTO tmp.ticketProblems(ticketFk, itemDelay) + SELECT ticketFk, problem + FROM ( + SELECT tl.ticketFk, GROUP_CONCAT('I: ',i.id, ' ', i.longName, ' ') problem + FROM tmp.ticketList tl + JOIN vn.ticket t ON t.id = tl.ticketFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE s.quantity > IFNULL(issw.visible, 0) + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND it.categoryFk != 6 + AND IF(vIsTodayRelative, TRUE, date(t.shipped) = vDate) + AND NOT i.generic + AND CURDATE() = vDate + AND t.warehouseFk = vWarehouse + GROUP BY tl.ticketFk) sub + ON DUPLICATE KEY UPDATE + itemDelay = sub.problem; + + END IF; + + END WHILE; + + CLOSE vCursor; + + INSERT INTO tmp.ticketProblems(ticketFk, isTaxDataChecked) + SELECT DISTINCT tl.ticketFk, FALSE + FROM tmp.ticketList tl + JOIN vn.client c ON c.id = tl.clientFk + WHERE c.isTaxDataChecked= FALSE + ON DUPLICATE KEY UPDATE + isTaxDataChecked = FALSE; + + DROP TEMPORARY TABLE + tmp.clientGetDebt, + tmp.ticketList; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketGetTaxAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTaxAdd`(vTicketFk INT) +BEGIN +/** + * Añade un ticket a la tabla tmp.ticket para calcular + * el IVA y el recargo de equivalencia y devuelve el resultado. + */ + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT vTicketFk ticketFk; + + CALL vn.ticket_getTax(NULL); + + SELECT + tt.ticketFk, + CAST(tt.taxableBase AS DECIMAL(10, 2)) AS taxableBase, + CAST(tt.rate * tt.taxableBase / 100 AS DECIMAL(10, 2)) AS tax, + pgc.*, + CAST(IF(pe.equFk IS NULL, taxableBase, 0) AS DECIMAL(10, 2)) AS Base, + pgc.rate / 100 as vatPercent + FROM tmp.ticketTax tt + JOIN vn.pgc ON pgc.code = tt.pgcFk + LEFT JOIN vn.pgcEqu pe ON pe.equFk = pgc.code; + + 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 `ticketGetTax_new` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTax_new`() + 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 + * @return tmp.ticketTax Impuesto desglosado para cada ticket + * @return tmp.ticketAmount + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT t.addressFk, t.companyFk + FROM tmp.ticket tmpTicket + JOIN ticket t ON t.id = tmpTicket.ticketFk; + + CALL addressTaxArea (); + + 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 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 tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = 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 = ata.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.addressCompany; + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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 + * @return tmp.ticketAmount + * @return tmp.ticketTax Impuesto desglosado para cada ticket. + + */ + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT t.addressFk, t.companyFk + FROM tmp.ticket tmpTicket + JOIN ticket t ON t.id = tmpTicket.ticketFk; + + CALL addressTaxArea (); + + + /** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente + * No se debería cambiar el sistema por problemas con los decimales + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; + CREATE TEMPORARY TABLE tmp.ticketTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tmpTicket.ticketFk, + bp.pgcFk, + SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticket tmpTicket + 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 tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = 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 = ata.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,pgc.rate + HAVING taxableBase != 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; + CREATE TEMPORARY TABLE tmp.ticketServiceTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk, + SUM(ts.quantity * ts.price) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticketTax tt + JOIN ticketService ts ON ts.ticketFk = tt.ticketFk + JOIN ticket t ON t.id = tt.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = ts.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tt.ticketFk, tt.code,tt.rate + HAVING taxableBase != 0; + + UPDATE tmp.ticketTax tt + JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate + SET tt.taxableBase = tt.taxableBase + ts.taxableBase; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; + CREATE TEMPORARY TABLE tmp.ticketAmount + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code + FROM tmp.ticketTax + GROUP BY ticketFk, code; + + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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__2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTax__2`() + READS SQL DATA +BEGIN + CALL ticket_getTax(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 `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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetTotal`() +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 ticket_getTax(NULL); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTotal; + CREATE TEMPORARY TABLE tmp.ticketTotal + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT t.ticketFk, + IFNULL(SUM(ta.taxableBase + ta.tax), 0.0) AS total, + SUM(ta.taxableBase) totalWithoutVat + FROM tmp.ticket t + LEFT JOIN tmp.ticketAmount ta ON t.ticketFk = ta.ticketFk + GROUP BY ticketFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; + DROP TEMPORARY TABLE IF EXISTS 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 `ticketGetVisibleAvailable` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketGetVisibleAvailable`( + vTicket INT) +BEGIN + DECLARE vVisibleCalc INT; + DECLARE vAvailableCalc INT; + DECLARE vShipped DATE; + DECLARE vWarehouse TINYINT; + DECLARE vAlertLevel INT; + + SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel + FROM ticket t + LEFT JOIN ticketState ts ON ts.ticketFk = vTicket + WHERE t.id = vTicket; + + IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN + IF vShipped >= CURDATE() THEN + CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); + END IF; + IF vShipped = CURDATE() THEN + CALL cache.visible_refresh(vVisibleCalc, FALSE, vWarehouse); + END IF; + END IF; + + SELECT s.id, s.itemFk, s.quantity, s.concept, s.price, s.reserved, s.discount, v.visible, av.available, it.image, it.subName + FROM sale s + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCalc + LEFT JOIN cache.available av ON av.item_id = s.itemFk AND av.calc_id = vAvailableCalc + LEFT JOIN item it ON it.id = s.itemFk + WHERE s.ticketFk = vTicket + ORDER BY s.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 `ticketManaToPromo` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketManaToPromo`(vTicketFk INT) +BEGIN + + DECLARE vManaComponent INT; + + DECLARE vPromoComponent INT; + + SELECT id INTO vManaComponent + FROM vn.component c + WHERE c.code = 'mana'; + + SELECT id INTO vPromoComponent + FROM vn.component c + WHERE c.code = 'floramondoPromo'; + + UPDATE vn.saleComponent sc + JOIN vn.sale s ON s.id = sc.saleFk + SET componentFk = vPromoComponent + WHERE componentFk = vManaComponent + AND s.ticketFk = vTicketFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketMissed_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_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketMissed_List`(vTicketFk INT) +BEGIN + + DECLARE vParkingFk INT; + DECLARE vParked DATETIME; + DECLARE vLevel INT; + DECLARE vCollectionFk INT; + + SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) + INTO vLevel, vCollectionFk + FROM vn.ticketCollection + WHERE ticketFk = vTicketFk + LIMIT 1; + + SELECT created, parkingFk + INTO vParked, vParkingFk + FROM vn.ticketParking + WHERE ticketFk = vTicketFk; + + SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia + FROM vn.ticketParking tp + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.zone z ON z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + JOIN vn.state s ON s.id = tst.state + WHERE (s.alertLevel < 2 + AND tp.parkingFk = vParkingFk + AND sc.isPackagingArea + AND ( + ( + ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) + OR + ( tc.collectionFk = vCollectionFk AND LEFT(tc.level,1) < LEFT(vLevel,1) ) + ) + )) -- Etiquetas que no se han escaneado y ya estamos con una posterior + OR + (s.alertLevel > 1 + AND tp.parkingFk = vParkingFk + AND sc.isPackagingArea + AND tp.created < vParked + AND t.packages <=> 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 `ticketNotInvoicedByClient` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketNotInvoicedByClient`(vClientFk INT) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + + CREATE TEMPORARY TABLE tmp.ticket + SELECT id ticketFk + FROM ticket + WHERE refFk IS NULL + AND clientFk = vClientFk + AND shipped > '2001-01-01'; + + CALL vn.ticketGetTotal; + + SELECT c.id, + c.name as Cliente, + t.shipped as Fecha, + t.id as Id_Ticket, + CAST(tt.total AS DECIMAL(10,2)) as Importe + FROM tmp.ticketTotal tt + JOIN ticket t ON t.id = tt.ticketFk + JOIN client c ON c.id = t.ClientFk; + + 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 `ticketObservation_addNewBorn` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `ticketObservation_addNewBorn`(vTicketFk INT) +BEGIN + + /** + * Inserta observaciones para los tickets con clientes nuevos o recuperados + * + * @param vTicketFk Identificador de vn.ticket + */ + + DECLARE vDescription VARCHAR(20) DEFAULT '¡Cliente NUEVO! '; + + INSERT INTO vn.ticketObservation(ticketFk, observationTypeFk, description) + SELECT vTicketFk, ot.id, vDescription + FROM vn.observationType ot + WHERE ot.hasNewBornMessage + ON DUPLICATE KEY UPDATE description = CONCAT(vDescription, ticketObservation.description); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketPackagingRecovery__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketPackagingRecovery__`() +BEGIN + + /* Recupera los embalajes que han caido en el cliente 31 */ + + DECLARE done BOOL DEFAULT FALSE; + DECLARE vClientFk INT; + DECLARE vTicketFk INT; + DECLARE vTicketNewFk INT; + DECLARE vWarehouseFk INT; + DECLARE vShipped DATE; + DECLARE vCompanyFk INT; + + DECLARE rs CURSOR FOR + SELECT DISTINCT tp.ticketFk, a.clientFk, t.warehouseFk, t.shipped, t.companyFk + FROM ticket t + JOIN ticketPackaging tp ON t.id = tp.ticketFk + JOIN address a ON a.id = t.addressFk + WHERE t.clientFk = 31 + AND t.shipped > '2001-01-01'; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + FETCH rs INTO vTicketFk, vClientFk, vWarehouseFk, vShipped, vCompanyFk; + + WHILE NOT done DO + + CALL vn.ticket_add(vClientFk, + vShipped, + vWarehouseFk, + vCompanyFk, + NULL, + NULL, + NULL, + vShipped, + account.userGetId(), + TRUE, + vTicketNewFk); + + UPDATE vn.ticketPackaging set ticketFk = vTicketNewFk WHERE ticketFk = vTicketFk; + + CALL vn.ticketStateUpdate(vTicketNewFk, 'DELIVERED'); + + INSERT INTO vn.sale(ticketFk, itemFk, concept) VALUES(vTicketNewFk,90,CONCAT('Embalajes ',vTicketFk)); + + FETCH rs INTO vTicketFk, vClientFk, vWarehouseFk, vShipped, vCompanyFk; + + END WHILE; + + CLOSE rs; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketParking_findSkipped` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1)) +BEGIN + +/** + * Averigua los tickets que se han saltado por un error en el proceso encajado + * @param vTicketFk Ticket + * @param vItemPackingTypeFk Modo de encajado + * @return un select con los tickets afectados + */ + + DECLARE vParkingFk INT; + DECLARE vParked DATETIME; + DECLARE vLevel INT; + DECLARE vWagon INT; + DECLARE vCollectionFk INT; + + SELECT IFNULL(`level`,0), IFNULL(`wagon`,0),IFNULL(collectionFk,0) + INTO vLevel, vWagon, vCollectionFk + FROM vn.ticketCollection tc + JOIN vn.collection c ON c.id = tc.collectionFk AND c.itemPackingTypeFk = vItemPackingTypeFk + WHERE ticketFk = vTicketFk + ORDER BY c.id DESC + LIMIT 1; + + SELECT created, parkingFk + INTO vParked, vParkingFk + FROM vn.ticketParking tp + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + WHERE ticketFk = vTicketFk + AND s.itemPackingTypeFk = vItemPackingTypeFk + AND s.isPackagingArea ; + + SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' ', tc.wagon, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia + FROM vn.ticketParking tp + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.zone z ON z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + JOIN vn.state s ON s.id = tst.state + WHERE (s.alertLevel < 2 + AND tp.parkingFk = vParkingFk + AND sc.isPackagingArea + AND ( + ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) + OR + ( tc.collectionFk = vCollectionFk + AND (LEFT(tc.wagon,1) < LEFT(vWagon,1) + OR (LEFT(tc.wagon,1) = LEFT(vWagon,1) AND LEFT(tc.level,1) < LEFT(vLevel,1))) + ) + ) + ) -- Etiquetas que no se han escaneado y ya estamos con una posterior + OR + (s.alertLevel > 1 + AND tp.parkingFk = vParkingFk + AND sc.isPackagingArea + AND tp.created < vParked + AND t.packages <=> 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 `ticketRequest_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketRequest_Add`(vDescription VARCHAR(255), vQuantity INT, vPrice DOUBLE, vTicketFk INT, vBuyerCode VARCHAR(3)) +BEGIN + + INSERT INTO vn.ticketRequest(description, + quantity, + price, + ticketFk, + buyerCode, + requesterFk) + VALUES(vDescription, + vQuantity, + vPrice, + vTicketFk, + vBuyerCode, + vn.getUser()); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketSplitCounter` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketSplitCounter`(vTicketFk INT) +BEGIN + +SELECT CONCAT(OK,'/',Total, IF(OK = Total ,' LS','')) + FROM + ( + SELECT sum(if(l.Id_Movimiento != 0,1,0)) as OK, COUNT(*) as Total + FROM vn.sale s + LEFT JOIN movement_label l ON l.Id_Movimiento = s.id + WHERE ticketFk = vTicketFk + ) sub; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketStatePrevious__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStatePrevious__`(vTicketFk INT) +BEGIN + + DECLARE vControlFk INT; + DECLARE vLastWorkerFk INT; + DECLARE vStateId INT; + + SELECT MAX(inter_id) INTO vControlFk + FROM vncontrol.inter + WHERE Id_Ticket = vTicketFk; + + IF (SELECT s.code + FROM vn.state s + JOIN vncontrol.inter i ON i.state_id = s.id + WHERE i.inter_id = vControlFk) + = 'PREVIOUS_PREPARATION' THEN + + SELECT inter_id, Id_Trabajador + INTO vControlFk,vLastWorkerFk + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE Id_Ticket = vTicketFk + AND inter_id < vControlFk + AND s.code != 'PREVIOUS_PREPARATION' + ORDER BY inter_id DESC + LIMIT 1; + /* + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador, Id_Supervisor) + SELECT state_id, Id_Ticket, vLastWorkerFk, vn.getWorker() + FROM vncontrol.inter + WHERE inter_id = vControlFk; + */ + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador, Id_Supervisor) + SELECT s.nextStateFk, i.Id_Ticket, vLastWorkerFk, account.myUser_getId() + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE inter_id = vControlFk; + + SELECT state_id INTO vStateId + FROM vncontrol.inter + WHERE inter_id = vControlFk; + + END IF; + + /*DELETE FROM vn2008.Movimientos_mark + WHERE Id_Movimiento IN (SELECT Id_Movimiento FROM vn2008.Movimientos WHERE Id_Ticket = vTicketFk) + AND valor <> 1 + AND stateFk = 26; */ + + SELECT TRUE AS IsUpdated; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketStateToday_setOnchecking__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setOnchecking__`(vParamFk INT) +BEGIN + /* + * @deprecated:utilizar ticketStateToday_setState + */ + + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM vn.state s + JOIN vn.ticketStateToday tst ON tst.state = s.id + WHERE tst.ticket = vParamFk + LIMIT 1; + + IF vAlertLevel < 2 THEN + + CALL vn.ticketStateUpdate(vParamFk, 'ON_CHECKING'); + + 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 `ticketStateToday_setOnPreviousChecking__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setOnPreviousChecking__`(vParamFk INT) +BEGIN + + /* + * @deprecated:utilizar ticketStateToday_setState + */ + + + /* + * Cambia el estado del ticket al estado de "control previa" + * + * @param vParamFk ticket a cambiar el estado + * + */ + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM state s + JOIN ticketStateToday tst ON tst.state = s.id + WHERE tst.ticket = vParamFk + LIMIT 1; + + IF vAlertLevel < 2 THEN + + CALL ticketStateUpdate(vParamFk, 'PREVIOUS_CONTROL'); + + 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 `ticketStateToday_setState` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45)) +BEGIN + + /* Modifica el estado de un ticket de hoy + * + * @param vTicketFk el id del ticket + * @param vStateCode estado a modificar del ticket + * + */ + + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM state s + JOIN ticketStateToday tst ON tst.state = s.id + WHERE tst.ticket = vTicketFk + LIMIT 1; + + IF vAlertLevel < 2 THEN + + CALL vn.ticket_setState(vTicketFk, vStateCode); + + 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 `ticketStateUpdate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateUpdate`(vTicketFk INT, vStateCode VARCHAR(45)) +BEGIN + + /* + * @deprecated:utilizar ticket_setState + */ + + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM vn.state s + JOIN vn.ticketState ts ON ts.stateFk = s.id + WHERE ts.ticketFk = vTicketFk; + + IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, vTicketFk, account.myUser_getId() + FROM vn.state + WHERE `code` = vStateCode collate utf8_unicode_ci; + + 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 `ticketToInvoiceByAddress` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByAddress`( + vStarted DATE, + vEnded DATETIME, + vAddress INT, + vCompany INT + ) +BEGIN + + SET vEnded = util.dayEnd(vEnded); + + DROP TEMPORARY TABLE IF EXISTS vn.ticketToInvoice; + + CREATE TEMPORARY TABLE vn.ticketToInvoice + SELECT id + FROM vn.ticket + WHERE addressFk = vAddress + AND companyFk = vCompany + AND shipped BETWEEN vStarted AND vEnded + AND refFk 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 `ticketToInvoiceByDate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByDate`( + vStarted DATE, + vEnded DATETIME, + vClient INT, + vCompany INT + ) +BEGIN + + SET vEnded = util.dayEnd(vEnded); + + DROP TEMPORARY TABLE IF EXISTS vn.ticketToInvoice; + + CREATE TEMPORARY TABLE vn.ticketToInvoice + SELECT id + FROM vn.ticket + WHERE clientFk = vClient + AND companyFk = vCompany + AND shipped BETWEEN vStarted AND vEnded + AND refFk 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 `ticketToInvoiceByRef` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToInvoiceByRef`(IN vInvoiceRef VARCHAR(15)) +BEGIN + +/* Para tickets ya facturados, vuelve a repetir el proceso de facturación. +* +* @param vInvoiceRef Factura +*/ + + DECLARE vInvoice INT; + DECLARE vCountry INT; + DECLARE vTaxArea VARCHAR(15); + DECLARE vSpainCountryCode INT DEFAULT 1; + + SELECT id + INTO vInvoice + FROM vn.invoiceOut + WHERE ref = vInvoiceRef; + + SELECT s.countryFk + INTO vCountry + FROM vn.supplier s + JOIN vn.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 vn.invoiceOutSerial i + JOIN vn.invoiceOut io ON io.serial = i.code + JOIN vn.client c ON c.id = io.clientFk + WHERE io.id = vInvoice; + + DROP TEMPORARY TABLE IF EXISTS vn.ticketToInvoice; + + CREATE TEMPORARY TABLE vn.ticketToInvoice + SELECT id + FROM vn.ticket + WHERE refFk = vInvoiceRef; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketToPrePrepare` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToPrePrepare`(IN vSaleGroupFk INT, IN vSectorFk INT) +BEGIN + +/* Devuelve las lineas de vn.sale para preparación previa según el saleGroup + * + * + * @param vSaleGroupFk Identificador de vn.saleGroup +*/ + DECLARE vIsResetCode BOOLEAN; + + SELECT (vSaleGroupFk = 2000000) INTO vIsResetCode; + + IF vIsResetCode THEN + + UPDATE vn.saleTracking st + JOIN vn.state s ON s.code = 'OK PREVIOUS' + JOIN vn.state s2 ON s2.id = st.stateFk + SET st.stateFk = s.id + WHERE workerFk = vn.getUser() + AND s2.code = 'PREVIOUS_PREPARATION'; + + ELSE + + UPDATE vn.saleTracking st + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = st.saleFk + SET workerFk = vn.getUser() + WHERE sgd.saleGroupFk = vSaleGroupFk; + + UPDATE vn.saleGroup sg + SET sg.userFk = vn.getUser() + WHERE sg.id = vSaleGroupFk; + + SELECT s.ticketFk, + s.itemFk, + i.longName, + IFNULL(i.itemPackingTypeFk,' ') itemPackingTypeFk, + IFNULL(i.subName ,' ') subName, + s.quantity originalQuantity , + s.quantity, + w.code workerCode, + sgd.saleFk, + IFNULL(iss.quantity,0) pickedQuantity, + vSectorFk, + c.salesPersonFk + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.saleTracking st ON st.saleFk = s.id + JOIN vn.state stt ON stt.id = st.stateFk + JOIN vn.worker w ON w.id = st.workerFk + LEFT JOIN vn.itemShelvingSaleSum iss ON iss.saleFk = s.id + JOIN vn.ticket t ON t.id= s.ticketFk + JOIN vn.client c ON c.id=t.clientFk + WHERE st.workerFk = account.myUser_getId() + AND stt.code = 'PREVIOUS_PREPARATION'; + + 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 `ticketToPrePrepare__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToPrePrepare__`(IN vIdTicket INT, IN viewAll BOOL, IN vSectorFk INT) +BEGIN + +/* Tickets de preparacion previa (artificial) 21/03/2021 PAK +*/ + +/* Tickets de preparacion previa (artificial) 21/03/2021 PAK +*/ + + DECLARE vIsResetCode BOOLEAN; + +IF viewAll IS true THEN + + SELECT (vIdTicket = 2000000) INTO vIsResetCode; + + IF vIsResetCode THEN + + UPDATE vn.saleTracking st + JOIN vn.state s ON s.code = 'OK PREVIOUS' + JOIN vncontrol.accion a ON a.accion_id = st.actionFk + JOIN vn.state s2 ON s2.id = st.stateFk + SET st.stateFk = s.id + WHERE workerFk = vn.getUser() + AND (a.accion = 'PRESACAR') + AND st.created > TIMESTAMPADD(HOUR, -10, NOW()); + + ELSE + + UPDATE vn.saleTracking st + JOIN vn.salesToPrePrepare stpp ON stpp.Id_Movimiento_mark = st.id + SET workerFk = vn.getUser() + WHERE stpp.Id_Ticket = vIdTicket + AND stpp.isChecked = FALSE; + + SELECT stpp.Id_Ticket, + stpp.Id_Movimiento, + stpp.Id_Movimiento_mark, + stpp.Id_Trabjador, + stpp.Id_Article, + i.itemPackingTypeFk packingType, + stpp.Concepte Concepte, + stpp.subName, + stpp.Cantidad, + stpp.original_quantity, + stpp.Hora, + stpp.Departure, + stpp.Minuto, + stpp.agency_id, + stpp.warehouse_id, + stpp.province_id, + stpp.picked, + stpp.trabajador, + ispss.created, + ispss.sectorFk + FROM vn.salesToPrePrepare stpp + JOIN vn.worker w ON w.code = stpp.trabajador + LEFT JOIN vn.itemShelvingPlacementSupplyStock ispss + ON ispss.itemShelvingFk = ( SELECT itemShelvingFk + FROM vn.itemShelvingPlacementSupplyStock + WHERE itemFk = stpp.Id_Article + AND sectorFk = vSectorFk + ORDER BY parking ASC + LIMIT 1) + LEFT JOIN vn.parking p ON p.id = ispss.parkingFk + LEFT JOIN vn.item i ON i.id = stpp.Id_Article + JOIN vn.state s ON s.id = stpp.stateFk + WHERE w.id = vn.getUser() + AND stpp.created > CURDATE() + AND s.code = 'PREVIOUS_PREPARATION' + ORDER BY p.pickingOrder, p.column ASC; + + 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 DROP PROCEDURE IF EXISTS `ticketTrackingAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketTrackingAdd`(vTicketFk INT, vState VARCHAR(25) CHARSET UTF8, vWorkerFk INT) +BEGIN +/** + * Inserta un registro de cambios en un ticket. + * @param vTicketFk Id del ticket + * @param vState Código del estado + * @param vWorkerFk Id del trabajador + */ + INSERT INTO ticketTracking (stateFk, ticketFk, workerFk) + SELECT s.id, vTicketFk, vWorkerFk FROM state s WHERE s.code = vState; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `ticketVolumeByDate_ventas_Artificial__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketVolumeByDate_ventas_Artificial__`(vDate DATE) +BEGIN + + DECLARE vDateStart DATETIME DEFAULT DATE(vDate); + DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketVolumeByDate_Artificial; + + CREATE TEMPORARY TABLE tmp.ticketVolumeByDate_Artificial + ENGINE = MEMORY + SELECT s.ticketFk, + CAST(SUM(r.cm3 * s.quantity) / 1000000 AS DECIMAL(10,2)) as m3 + FROM sale s + JOIN bs.ventas v ON v.Id_Movimiento = s.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.sector sc ON sc.id = i.sectorFk + JOIN vn.ticket t on t.id = s.ticketFk + JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk + WHERE sc.description = 'Artificial' + AND t.shipped BETWEEN vDateStart AND vDateEnd + GROUP BY s.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 `ticketVolumeByDate_ventas__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketVolumeByDate_ventas__`(vDate DATE) +BEGIN + + DECLARE vDateStart DATETIME DEFAULT DATE(vDate); + DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketVolumeByDate; + + CREATE TEMPORARY TABLE tmp.ticketVolumeByDate + ENGINE = MEMORY + SELECT s.ticketFk, + CAST(SUM(r.cm3 * s.quantity) / 1000000 AS DECIMAL(10,2)) as m3 + FROM sale s + JOIN bs.ventas v ON v.Id_Movimiento = s.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.ticket t on t.id = s.ticketFk + JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk + WHERE ic.merchandise + AND t.shipped BETWEEN vDateStart AND vDateEnd + AND it.name NOT IN ('Accesorios Funerarios','Composiciones planta','Composición bajo pedido','Coronas y centros') + GROUP BY s.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 `ticketVolumeByDate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketVolumeByDate__`(vDate DATE) +BEGIN + + DECLARE vDateStart DATETIME DEFAULT DATE(vDate); + DECLARE vDateEnd DATETIME DEFAULT util.dayEnd(vDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketVolumeByDate; + + CREATE TEMPORARY TABLE tmp.ticketVolumeByDate + ENGINE = MEMORY + SELECT s.ticketFk, + CAST(SUM(ic.cm3delivery * s.quantity) / 1000000 AS DECIMAL(10,2)) as m3 + FROM sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory c ON c.id = it.categoryFk + JOIN vn.ticket t on t.id = s.ticketFk + JOIN vn.itemCost ic ON ic.itemFk = s.itemFk AND ic.warehouseFk = t.warehouseFk + WHERE c.merchandise + AND t.shipped BETWEEN vDateStart AND vDateEnd + GROUP BY s.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 `ticket_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_add`( + vClientId INT + ,vShipped DATE + ,vWarehouseFk INT + ,vCompanyFk INT + ,vAddressFk INT + ,vAgencyModeFk INT + ,vRouteFk INT + ,vlanded DATE + ,vUserId INT + ,vIsRequiredZone INT + ,OUT vNewTicket INT) +BEGIN + + DECLARE vZoneFk INT; + DECLARE vPrice DECIMAL(10,2); + DECLARE vBonus DECIMAL(10,2); + + IF vClientId IS NULL THEN + CALL util.throw ('CLIENT_NOT_ESPECIFIED'); + END IF; + + IF NOT vAddressFk OR vAddressFk IS NULL THEN + SELECT id INTO vAddressFk + FROM address + WHERE clientFk = vClientId AND isDefaultAddress; + END IF; + + IF vAgencyModeFk IS NOT NULL THEN + + CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE); + + SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus + FROM tmp.zoneGetShipped + WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; + + IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN + CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); + END IF; + END IF; + INSERT INTO ticket ( + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + routeFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus + ) + SELECT + vClientId, + vShipped, + a.id, + vAgencyModeFk, + a.nickname, + vWarehouseFk, + IF(vRouteFk,vRouteFk,NULL), + vCompanyFk, + vlanded, + vZoneFk, + vPrice, + vBonus + FROM address a + JOIN agencyMode am ON am.id = a.agencyModeFk + WHERE a.id = vAddressFk; + + 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.id = vAddressFk; + + IF (SELECT COUNT(*) FROM bs.clientNewBorn cnb + WHERE cnb.clientFk = vClientId + AND NOT cnb.isRookie) = 0 THEN + + CALL vn.ticketObservation_addNewBorn(vNewTicket); + + END IF; + + INSERT INTO vn.ticketLog + SET originFk = vNewTicket, userFk = vUserId, `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vNewTicket); + + IF (SELECT ct.isCreatedAsServed FROM vn.clientType ct JOIN vn.client c ON c.typeFk = ct.code WHERE c.id = vClientId ) <> FALSE THEN + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, vNewTicket, account.myUser_getId() + 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 `ticket_administrativeCopy` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_administrativeCopy`(vOriginalTicket INT, OUT vNewTicket INT) +BEGIN + + INSERT INTO vn.ticket(clientFk, addressFk, shipped, warehouseFk, companyFk, landed) + SELECT t.clientFk , t.addressFk , t.shipped ,w.id, t.companyFk , t.landed + FROM vn.ticket t + JOIN vn.warehouse w ON w.name = 'INVENTARIO' + WHERE t.id = vOriginalTicket; + + SELECT LAST_INSERT_ID() INTO vNewTicket; + + INSERT INTO vn.sale(ticketFk, itemFk, concept, quantity, price, discount) + SELECT vNewTicket, s.itemFk , s.concept , s.quantity , s.price , s.discount + FROM vn.sale s + WHERE s.ticketFk = vOriginalTicket; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_canAdvance` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canAdvance`(vDated DATE, vWarehouseFk INT) +BEGIN +/** + * Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar. + * + * @param vDated Fecha de los tickets que se quieren adelantar. + * @param vWarehouseFk Almacén + */ + DECLARE vDateInventory DATE; + DECLARE vDateToAdvance DATE; + + SELECT inventoried INTO vDateInventory FROM vn.config; + + SET vDateToAdvance = TIMESTAMPADD(DAY,-1,vDated); + + DROP TEMPORARY TABLE IF EXISTS tmp.stock; + CREATE TEMPORARY TABLE tmp.stock + (itemFk INT PRIMARY KEY, + amount INT) + ENGINE = MEMORY; + + INSERT INTO tmp.stock(itemFk, amount) + SELECT itemFk, SUM(quantity) amount FROM + ( + SELECT itemFk, quantity + FROM vn.itemTicketOut + WHERE shipped >= vDateInventory + AND shipped < vDated + AND warehouseFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryIn + WHERE landed >= vDateInventory + AND landed < vDated + AND isVirtualStock = FALSE + AND warehouseInFk = vWarehouseFk + UNION ALL + SELECT itemFk, quantity + FROM vn.itemEntryOut + WHERE shipped >= vDateInventory + AND shipped < vDated + AND warehouseOutFk = vWarehouseFk + ) t + GROUP BY itemFk HAVING amount != 0; + + SELECT s.ticketFk ticketFuture, + sum((s.quantity <= IFNULL(st.amount,0))) hasStock, + count(DISTINCT s.id) saleCount, + st.name tfState, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) tfIpt, + t2.ticketFk, + t2.state, + t2.ipt + FROM vn.ticket t + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + LEFT JOIN (SELECT + t2.id ticketFk, + t2.addressFk, + st.name state, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt + FROM vn.ticket t2 + JOIN vn.sale s ON s.ticketFk = t2.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticketState ts ON ts.ticketFk = t2.id + JOIN vn.state st ON st.id = ts.stateFk + WHERE t2.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance) + AND t2.warehouseFk = vWarehouseFk + GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk + WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id; + + DROP TEMPORARY TABLE tmp.stock; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_canMerge` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) +BEGIN +/** + * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vDated Fecha en cuestión + * @param vScopeDays Dias en el futuro a sondear + * @param vLitersMax Volumen máximo de los tickets a catapultar + * @param vLinesMax Número máximo de lineas de los tickets a catapultar + * @param vWarehouseFk Identificador de vn.warehouse + */ + SELECT sv.ticketFk , + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, + CAST(sum(litros) AS DECIMAL(10,0)) liters, + CAST(count(*) AS DECIMAL(10,0)) `lines`, + st.name state, + sub2.id ticketFuture, + sub2.shipped, + sub2.iptd tfIpt, + sub2.state tfState + FROM vn.saleVolume sv + JOIN vn.sale s ON s.id = sv.saleFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticket t ON t.id = sv.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.alertLevel al ON al.id = ts.alertLevel + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN ( + SELECT * FROM ( + SELECT + t.addressFk , + t.id, + t.shipped, + st.name state, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd + FROM vn.ticket t + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) + AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id + ) sub + GROUP BY sub.addressFk + ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id + WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) + AND t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + AND tp.ticketFk IS NULL + GROUP BY sv.ticketFk + HAVING liters <= vLitersMax AND `lines` <= vLinesMax AND ticketFuture; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_canMerge__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge__`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) +BEGIN + + /* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vDated Fecha en cuestión + * @param vScopeDays Dias en el futuro a sondear + * @param vLitersMax Volumen máximo de los tickets a catapultar + * @param vLinesMax Número máximo de lineas de los tickets a catapultar + * @param vWarehouseFk Identificador de vn.warehouse + */ + + SELECT sv.ticketFk , + CAST(sum(litros) AS DECIMAL(10,0)) liters, + CAST(count(*) AS DECIMAL(10,0)) `lines`, + sub2.id ticketFuture, + sub2.shipped + FROM vn.saleVolume sv + JOIN vn.ticket t ON t.id = sv.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.alertLevel al ON al.id = ts.alertLevel + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN tmp.routeDayMove ra ON ra.routeFk = t.routeFk + LEFT JOIN ( + SELECT * FROM ( + SELECT t.addressFk , t.id, t.shipped + FROM vn.ticket t + WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) + AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) + AND t.warehouseFk = vWarehouseFk + ) sub + GROUP BY sub.addressFk + ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id + WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) + AND t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + AND tp.ticketFk IS NULL + AND ra.routeFk IS NULL + GROUP BY sv.ticketFk + HAVING liters <= vLitersMax AND `lines` <= vLinesMax AND ticketFuture; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_changeClient` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_changeClient`(vNewClient INT, vUserFk INT) +BEGIN + +/** + * Dado un conjunto de tickets + * cambia el cliente al nuevo cliente dado + * + * params @vNewClient nuevo cliente + * params @vUserFk usuario que realiza el cambio + * + * table @tmp.ticket(ticketFk) conjunto de tickets + */ + + INSERT INTO ticketLog (originFk, userFk, `action`, changedModel, oldInstance, newInstance) + SELECT t.id, vUserFk, 'update', 'Ticket', CONCAT('{"clientFk":',t.clientFk,'}'), CONCAT('{"clientFk":',vNewClient,'}') + FROM ticket t + JOIN tmp.ticket tt + ON t.id = tt.ticketFk; + + UPDATE ticket t + JOIN tmp.ticket tt + ON t.id = tt.ticketFk + SET t.clientFk = vNewClient; + + UPDATE ticket t + JOIN tmp.ticket tt + ON t.id = tt.ticketFk + JOIN stowaway s + ON s.shipFk = tt.ticketFk + SET t.clientFk = vNewClient; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_checkFullyControlled` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_checkFullyControlled`(vWorkerFk INT, vTicketFk INT ) +BEGIN +/** + * Comprueba que no hay ningún ticket pendiente de revisar de alguna colección que haya revisado el trabajador + * @param vWorkerFk id del user + * @param vTicketFk número de ticket escaneada + * + */ + + SELECT t.id + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN ticketCollection tc ON tc.ticketFk = t.id + JOIN (SELECT tc.collectionFk + FROM ticketState ts + JOIN ticketCollection tc ON tc.ticketFk = ts.ticketFk + LEFT JOIN (SELECT tc.collectionFk + FROM ticketCollection tc + WHERE ticketFk = vTicketFk + AND tc.created >= CURDATE() + )sub ON sub.collectionFk = tc.collectionFk + WHERE ts.workerFk = vWorkerFk + AND sub.collectionFk IS NULL + AND tc.created >= CURDATE() + GROUP BY tc.collectionFk + )sub ON sub.collectionFk = tc.collectionFk + JOIN ticketState ts ON ts.ticketFk = t.id + WHERE ts.code IN ('ON_PREPARATION', 'PREPARED', 'PREVIOUS_PREPARATION', 'OK PREVIOUS') + AND t.shipped >= CURDATE() + AND s.quantity <>0 + 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 `ticket_checkNoComponents` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_checkNoComponents`(vShippedFrom DATETIME, vShippedTo DATETIME) +BEGIN + +/** + * Comprueba que los tickets entre un rango de fechas tienen componentes + * + * @param vShippedFrom rango inicial de fecha + * @param vShippedTo rango final de fecha + */ + DECLARE v_done BOOL DEFAULT FALSE; + DECLARE vSaleFk INTEGER; + DECLARE vCur CURSOR FOR + SELECT s.id + FROM ticket t + JOIN client clt ON clt.id = t.clientFk + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN itemType tp ON tp.id = i.typeFk + JOIN itemCategory ic ON ic.id = tp.categoryFk + LEFT JOIN tmp.coste c ON c.id = s.id + WHERE t.shipped >= vShippedFrom AND t.shipped <= vShippedTo + AND c.id IS NULL + AND clt.isActive != 0 + AND ic.merchandise != 0 + GROUP BY s.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET v_done = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.coste; + + DROP TEMPORARY TABLE IF EXISTS tmp.coste; + CREATE TEMPORARY TABLE tmp.coste + (primary key (id)) ENGINE = MEMORY + SELECT s.id + FROM ticket t + JOIN client clt ON clt.id = t.clientFk + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + JOIN itemType tp ON tp.id = i.typeFk + JOIN itemCategory ic ON ic.id = tp.categoryFk + JOIN saleComponent sc ON sc.saleFk = s.id + JOIN component c ON c.id = sc.componentFk + JOIN componentType ct ON ct.id = c.typeFk AND ct.id = 1 + WHERE t.shipped >= vShippedFrom + AND ic.merchandise != 0; + + OPEN vCur; + + l: LOOP + SET v_done = FALSE; + FETCH vCur INTO vSaleFk; + + IF v_done THEN + LEAVE l; + END IF; + + CALL sale_calculateComponent(vSaleFk, 1); + END LOOP; + + CLOSE vCur; + DROP TEMPORARY TABLE tmp.coste; + END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_Clone` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_Clone`(vOriginalTicket INT, OUT vNewTicket INT) +BEGIN +/** + * Clona el contenido de un ticket en otro + * + * @param vOriginalTicket ticket Original + * @param vNewTicket ticket creado + */ + DECLARE vStateFk INT; + + INSERT INTO ticket ( + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk, + priority, + hasPriority + ) + SELECT + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus, + routeFk, + priority, + hasPriority + FROM ticket + WHERE id = vOriginalTicket; + + SET vNewTicket = LAST_INSERT_ID(); + + INSERT INTO ticketObservation(ticketFk, observationTypeFk, description) + SELECT vNewTicket, ao.observationTypeFk, ao.description + FROM addressObservation ao + JOIN ticket t ON t.addressFk = ao.addressFk + WHERE t.id = vNewTicket; + + INSERT INTO ticketLog + SET originFk = vNewTicket, userFk = account.myUser_getId(), `action` = 'insert', + description = CONCAT('Ha creado el ticket:', ' ', vNewTicket, ' clonando el ', vOriginalTicket); + + INSERT INTO ticketLog + SET originFk = vOriginalTicket, userFk = account.myUser_getId(), `action` = 'insert', + description = CONCAT('Ha creado el ticket:', ' ', vNewTicket, ' clonando el ', vOriginalTicket); + + INSERT INTO vncontrol.inter(Id_Ticket, state_id, Id_Trabajador, odbc_date) + SELECT vNewTicket, state_id, Id_Trabajador , odbc_date + FROM vncontrol.inter + WHERE Id_Ticket = vOriginalTicket + ORDER BY odbc_date; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_cloneWeekly` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_cloneWeekly`(IN vWeek INT) +BEGIN + DECLARE vIsDone BOOL; + DECLARE vLanding DATE; + DECLARE vShipment DATE; + DECLARE vWarehouseFk INT; + DECLARE vTicketFk INT; + DECLARE vWeekDay INT; + DECLARE vClientFk INT; + DECLARE vCompanyFk INT; + DECLARE vAddressFk INT; + DECLARE vAgencyModeFk INT; + DECLARE vNewTicket INT; + DECLARE vYear INT; + + DECLARE rsTicket CURSOR FOR + SELECT tt.ticketFk, tt.weekDay, t.clientFk, t.warehouseFk, t.companyFk, t.addressFk, tt.agencyModeFk + FROM vn.ticketWeekly tt + JOIN vn.ticket t ON tt.ticketFk = t.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; + + SET vYear = YEAR(CURDATE()) + IF(vWeek < WEEK(CURDATE()),1, 0); + + OPEN rsTicket; + myLoop: LOOP + BEGIN + DECLARE vSalesPersonEmail VARCHAR(150); + DECLARE vMailSent BOOL; + DECLARE vSubject VARCHAR(150); + DECLARE vMessage TEXT; + + SET vIsDone = FALSE; + FETCH rsTicket INTO vTicketFk, vWeekDay, vClientFk, vWarehouseFk, vCompanyFk, vAddressFk, vAgencyModeFk; + + IF vIsDone THEN + + LEAVE myLoop; + END IF; + SELECT dated INTO vShipment + FROM `time` + WHERE `year` = vYear AND `week` = vWeek + AND WEEKDAY(dated) = vWeekDay; + + -- busca si el ticket ya ha sido clonado + IF (SELECT COUNT(*) FROM vn.ticket tOrig + JOIN vn.sale saleOrig ON tOrig.id = saleOrig.ticketFk + JOIN vn.saleCloned sc ON sc.saleOriginalFk = saleOrig.id + JOIN vn.sale saleClon ON saleClon.id = sc.saleClonedFk + JOIN vn.ticket tClon ON tClon.id = saleClon.ticketFk + WHERE tOrig.id = vTicketFk AND tClon.isDeleted = FALSE AND DATE(tClon.shipped) = vShipment) > 0 + THEN + ITERATE myLoop; + END IF; + + IF vAgencyModeFk IS NULL THEN + SELECT agencyModeFk INTO vAgencyModeFk + FROM address + WHERE clientFk = vClientFk AND isDefaultAddress; + END IF; + + CALL vn.zone_getLanded(vShipment, vAddressFk, vAgencyModeFk, vWarehouseFk,FALSE); + SET vLanding = NULL; + SELECT landed INTO vLanding from tmp.zoneGetLanded LIMIT 1; + + CALL ticket_add( + vClientFk, + vShipment, + vWarehouseFk, + vCompanyFk, + vAddressFk, + vAgencyModeFk, + NULL, + vLanding, + account.userGetId(), + FALSE, + vNewTicket); + + IF (vLanding IS NULL) THEN + + SELECT e.email INTO vSalesPersonEmail + FROM vn.client c + JOIN vn.worker sp ON sp.id = c.salesPersonFk + JOIN account.emailUser e ON e.userFk = sp.userFk + WHERE c.id = vClientFk; + + SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', vTicketFk, + ' para el dia: ', vShipment); + SET vMessage = CONCAT('No se ha podido clonar el ticket ', vTicketFk, + ' para el dia: ', vShipment, + ' porque no hay una zona de envío disponible. Se ha creado el ticket: ', vNewTicket, + ' pero ha que revisar las fechas y la agencia'); + + SELECT COUNT(*) INTO vMailSent + FROM vn.mail + WHERE receiver = vSalesPersonEmail + AND subject = vSubject; + + IF NOT vMailSent THEN + CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage); + END IF; + CALL vn.ticketStateUpdate (vNewTicket, 'FIXING'); + END IF; + + INSERT INTO vn.sale (ticketFk, itemFk, concept, quantity, price, discount, priceFixed, isPriceFixed) + SELECT vNewTicket, saleOrig.itemFk , saleOrig.concept , saleOrig.quantity, saleOrig.price , saleOrig.discount, saleOrig.priceFixed, saleOrig.isPriceFixed + FROM vn.sale saleOrig + WHERE saleOrig.ticketFk = vTicketFk; + + INSERT IGNORE INTO vn.saleCloned(saleOriginalFk, saleClonedFk) + SELECT saleOriginal.id, saleClon.id + FROM vn.sale saleOriginal + JOIN vn.sale saleClon ON saleOriginal.itemFk = saleClon.itemFk AND saleOriginal.quantity = saleClon.quantity + WHERE saleOriginal.ticketFk = vTicketFk AND saleClon.ticketFk = vNewTicket; + + INSERT INTO ticketRequest (description,ordered,shipped,quantity,price,itemFk,clientFk,response, + total,buyed,requesterFk,attenderFk,ticketFk) + SELECT description,ordered,shipped,quantity,price,itemFk,clientFk,response, + total,buyed,requesterFk,attenderFk,vNewTicket + FROM ticketRequest + WHERE ticketFk =vTicketFk; + + INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) VALUES(vNewTicket,4,CONCAT('turno desde ticket: ',vTicketFk)) + ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); + + INSERT INTO ticketObservation(ticketFk,observationTypeFk,description) VALUES(vNewTicket,1,'ATENCION: Contiene lineas de TURNO') + ON DUPLICATE KEY UPDATE description = CONCAT(ticketObservation.description,VALUES(description),' '); + + CALL vn.ticketCalculateClon(vNewTicket, vTicketFk); + END; + END LOOP; + + CLOSE rsTicket; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_close` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_close`() +BEGIN +/** + * Realiza el cierre de todos los + * tickets de la tabla tmp.ticket_close. + * + * @table tmp.ticket_close(ticketFk) Identificadores de los tickets a cerrar + */ + DECLARE vDone BOOL; + DECLARE vClientFk INT; + DECLARE vCurTicketFk INT; + DECLARE vIsTaxDataChecked BOOL; + DECLARE vCompanyFk INT; + DECLARE vShipped DATE; + DECLARE vNewInvoiceId INT; + DECLARE vHasDailyInvoice BOOL; + DECLARE vWithPackage BOOL; + DECLARE vHasToInvoice BOOL; + + DECLARE cur CURSOR FOR + SELECT ticketFk FROM tmp.ticket_close; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN + RESIGNAL; + END; + + OPEN cur; + + proc: LOOP + SET vDone = FALSE; + + FETCH cur INTO vCurTicketFk; + + IF vDone THEN + LEAVE proc; + END IF; + + -- Fetch ticket data + SELECT + c.id, + c.isTaxDataChecked, + t.companyFk, + t.shipped, + co.hasDailyInvoice, + w.isManaged, + c.hasToInvoice + INTO vClientFk, + vIsTaxDataChecked, + vCompanyFk, + vShipped, + vHasDailyInvoice, + vWithPackage, + vHasToInvoice + FROM ticket t + JOIN `client` c ON c.id = t.clientFk + JOIN province p ON p.id = c.provinceFk + JOIN country co ON co.id = p.countryFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.id = vCurTicketFk; + + INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) + (SELECT vCurTicketFk, p.id, COUNT(*) + FROM expedition e + JOIN packaging p ON p.itemFk = e.itemFk + WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable + AND vWithPackage + GROUP BY p.itemFk); + + -- No retornables o no catalogados + INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed) + (SELECT e.itemFk, vCurTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 + FROM expedition e + JOIN item i ON i.id = e.itemFk + LEFT JOIN packaging p ON p.itemFk = i.id + WHERE e.ticketFk = vCurTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 + AND getSpecialPrice(e.itemFk, vClientFk) > 0 + GROUP BY e.itemFk); + + IF(vHasDailyInvoice) AND vHasToInvoice THEN + + -- Facturacion rapida + CALL ticketTrackingAdd(vCurTicketFk, 'DELIVERED', NULL); + -- Facturar si está contabilizado + IF vIsTaxDataChecked THEN + CALL invoiceOut_newFromClient( + vClientFk, + (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), + vShipped, + vCompanyFk, + NULL, + NULL, + vNewInvoiceId); + END IF; + ELSE + CALL ticketTrackingAdd(vCurTicketFk, (SELECT vn.getAlert3State(vCurTicketFk)), NULL); + END IF; + END LOOP; + + CLOSE cur; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_closeAll__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_closeAll__`() +BEGIN +/** + * Realiza el cierre de todos los + * tickets de la tabla tmp.ticketClosure. + * + * @param vTicketFk Id del ticket + */ + DECLARE vDone BOOL; + DECLARE vClientFk INT; + DECLARE vCurTicketFk INT; + DECLARE vIsTaxDataChecked BOOL; + DECLARE vCompanyFk INT; + DECLARE vShipped DATE; + DECLARE vNewInvoiceId INT; + DECLARE vHasDailyInvoice BOOL; + DECLARE vWithPackage BOOL; + 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; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure2; + CREATE TEMPORARY TABLE tmp.ticketClosure2 + SELECT ticketFk FROM tmp.ticketClosure; + + INSERT INTO tmp.ticketClosure + SELECT id FROM stowaway s + JOIN tmp.ticketClosure2 tc ON s.shipFk = tc.ticketFk; + OPEN cur; + + proc: LOOP + SET vDone = FALSE; + + FETCH cur INTO vCurTicketFk; + + IF vDone THEN + LEAVE proc; + END IF; + + -- ticketClosure start + SELECT + c.id, + c.isTaxDataChecked, + t.companyFk, + t.shipped, + co.hasDailyInvoice, + w.isManaged, + c.hasToInvoice + INTO vClientFk, + vIsTaxDataChecked, + vCompanyFk, + vShipped, + vHasDailyInvoice, + vWithPackage, + vHasToInvoice + FROM ticket t + JOIN `client` c ON c.id = t.clientFk + JOIN province p ON p.id = c.provinceFk + JOIN country co ON co.id = p.countryFk + JOIN warehouse w ON w.id = t.warehouseFk + WHERE t.id = vCurTicketFk; + + INSERT INTO ticketPackaging (ticketFk, packagingFk, quantity) + (SELECT vCurTicketFk, p.id, COUNT(*) + FROM expedition e + JOIN packaging p ON p.itemFk = e.itemFk + WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable + AND vWithPackage + GROUP BY p.itemFk); + + -- No retornables o no catalogados + INSERT INTO sale (itemFk, ticketFk, concept, quantity, price, isPriceFixed) + (SELECT e.itemFk, vCurTicketFk, i.name, COUNT(*) AS amount, getSpecialPrice(e.itemFk, vClientFk), 1 + FROM expedition e + JOIN item i ON i.id = e.itemFk + LEFT JOIN packaging p ON p.itemFk = i.id + WHERE e.ticketFk = vCurTicketFk AND IFNULL(p.isPackageReturnable, 0) = 0 + AND getSpecialPrice(e.itemFk, vClientFk) > 0 + GROUP BY e.itemFk); + + CALL vn.zonePromo_Make(); + + IF(vHasDailyInvoice) AND vHasToInvoice THEN + + -- Facturacion rapida + CALL ticketTrackingAdd(vCurTicketFk, 'DELIVERED', NULL); + -- Facturar si está contabilizado + IF vIsTaxDataChecked THEN + CALL invoiceOut_newFromClient( + vClientFk, + (SELECT invoiceSerial(vClientFk, vCompanyFk, 'M')), + vShipped, + vCompanyFk, + NULL, + NULL, + vNewInvoiceId); + END IF; + ELSE + CALL ticketTrackingAdd(vCurTicketFk, (SELECT vn.getAlert3State(vCurTicketFk)), NULL); + END IF; + END LOOP; + + CLOSE cur; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketClosure; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_closeByTicket` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_closeByTicket`(IN vTicketFk int) +BEGIN + +/** + * Inserta el ticket en la tabla temporal + * para ser cerrado. + * + * @param vTicketFk Id del ticket + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_close; + CREATE TEMPORARY TABLE tmp.ticket_close ENGINE = MEMORY ( + SELECT + t.id AS ticketFk + FROM expedition e + INNER JOIN ticket t ON t.id = e.ticketFk + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + JOIN alertLevel al ON al.id = ts.alertLevel + WHERE + al.code = 'PACKED' + AND t.id = vTicketFk + AND t.refFk IS NULL + GROUP BY e.ticketFk); + + CALL ticket_close(); + + DROP TEMPORARY TABLE tmp.ticket_close; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_componentMakeUpdate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentMakeUpdate`(IN vTicketFk INT, IN vClientFk INT, + IN vNickname VARCHAR(50), IN vAgencyModeFk INT, + IN vAddressFk INT, IN vZoneFk INT, IN vWarehouseFk TINYINT, + IN vCompanyFk SMALLINT, IN vShipped DATETIME, + IN vLanded DATE, IN vIsDeleted TINYINT(1), + IN vHasToBeUnrouted TINYINT(1), IN vOption INT) +BEGIN + + /** + * Modifica en el ticket los campos que se le pasan por parámetro + * y cambia sus componentes + * + * @param vTicketFk Id del ticket a modificar + * @param vClientFk nuevo cliente + * @param vNickname nuevo alias + * @param vAgencyModeFk nueva agencia + * @param vAddressFk nuevo consignatario + * @param vZoneFk nueva zona + * @param vWarehouseFk nuevo almacen + * @param vCompanyFk nueva empresa + * @param vShipped nueva fecha del envio de mercancia + * @param vLanded nueva fecha de recepcion de mercancia + * @param vIsDeleted si se borra el ticket + * @param vHasToBeUnrouted si se le elimina la ruta al ticket + * @param vOption opcion para el case del proc ticketComponentUpdateSale + */ + + DECLARE vPrice DECIMAL(10,2); + DECLARE vBonus DECIMAL(10,2); + + CALL ticket_componentPreview (vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk); + + IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN + + UPDATE ticket t + JOIN address a ON a.id = vAddressFk + SET t.nickname = a.nickname + WHERE t.id = vTicketFk; + + END IF; + + CALL zone_getShipped(vLanded, vAddressFk, vAgencyModeFk, TRUE); + + SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus + FROM tmp.zoneGetShipped + WHERE shipped BETWEEN DATE(vShipped) AND util.dayEnd(vShipped) AND warehouseFk = vWarehouseFk LIMIT 1; + + UPDATE ticket t + SET + t.clientFk = vClientFk, + t.nickname = vNickname, + t.agencyModeFk = vAgencyModeFk, + t.addressFk = vAddressFk, + t.zoneFk = vZoneFk, + t.zonePrice = vPrice, + t.zoneBonus = vBonus, + t.warehouseFk = vWarehouseFk, + t.companyFk = vCompanyFk, + t.landed = vLanded, + t.shipped = vShipped, + t.isDeleted = vIsDeleted + WHERE + t.id = vTicketFk; + + IF vHasToBeUnrouted THEN + UPDATE ticket t SET t.routeFk = NULL + WHERE t.id = vTicketFk; + END IF; + + IF vOption <> 8 THEN + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) + ENGINE = MEMORY + SELECT id AS saleFk, vWarehouseFk warehouseFk + FROM sale s WHERE s.ticketFk = vTicketFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent; + CREATE TEMPORARY TABLE tmp.ticketComponent + SELECT * FROM tmp.ticketComponentPreview; + + CALL ticketComponentUpdateSale (vOption); + + DROP TEMPORARY TABLE tmp.sale; + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponent; + END IF; + + DROP TEMPORARY TABLE tmp.zoneGetShipped, tmp.ticketComponentPreview; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_componentPreview` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentPreview`( + vTicketFk INT, + vLanded DATE, + vAddressFk INT, + vZoneFk INT, + vWarehouseFk SMALLINT) +BEGIN +/** + * Calcula los componentes de los articulos de un ticket + * + * @param vTicketFk id del ticket + * @param vLanded nueva fecha de entrega + * @param vAddressFk nuevo consignatario + * @param vZoneFk nueva zona + * @param vWarehouseFk nuevo warehouse + * + * @return tmp.ticketComponentPreview (warehouseFk, itemFk, componentFk, cost) + */ + DECLARE vHasDataChanged BOOL DEFAULT FALSE; + DECLARE vHasAddressChanged BOOL; + DECLARE vHasZoneChanged BOOL DEFAULT FALSE; + DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE; + + DECLARE vShipped DATE; + DECLARE vAddressTypeRateFk INT DEFAULT NULL; + DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL; + + DECLARE vHasChangeAll BOOL DEFAULT FALSE; + + SELECT DATE(landed) <> vLanded, + addressFk <> vAddressFk, + zoneFk <> vZoneFk, + warehouseFk <> vWarehouseFk + INTO + vHasDataChanged, + vHasAddressChanged, + vHasZoneChanged, + vHasWarehouseChanged + FROM vn.ticket t + WHERE t.id = vTicketFk; + + IF vHasDataChanged OR vHasWarehouseChanged THEN + SET vHasChangeAll = TRUE; + END IF; + + IF vHasAddressChanged THEN + SET vAddressTypeRateFk = 5; + END IF; + + IF vHasZoneChanged THEN + SET vAgencyModeTypeRateFk = 6; + END IF; + + SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped + FROM zone + WHERE id = vZoneFk; + + CALL buyUltimate(vWarehouseFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY ( + SELECT + vWarehouseFk AS warehouseFk, + NULL AS available, + s.itemFk, + bu.buyFk, + vZoneFk zoneFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketFk + GROUP BY bu.warehouseFk, bu.itemFk); + + CALL catalog_componentPrepare(); + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); + + REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) + SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value + FROM saleComponent sc + JOIN sale s ON s.id = sc.saleFk + JOIN ticket t ON t.id = s.ticketFk + JOIN `component` c ON c.id = sc.componentFk + WHERE s.ticketFk = vTicketFk + AND (c.isRenewable = FALSE + OR + (NOT vHasChangeAll + AND (NOT (c.typeFk <=> vAddressTypeRateFk + OR c.typeFk <=> vAgencyModeTypeRateFk)))); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketComponentPreview; + CREATE TEMPORARY TABLE tmp.ticketComponentPreview + SELECT * FROM tmp.ticketComponent; + + CALL catalog_componentPurge(); + DROP TEMPORARY TABLE tmp.buyUltimate; + + IF vShipped IS NULL THEN + CALL util.throw('NO_ZONE_AVAILABLE'); + 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_componentPreview__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentPreview__`( + vTicketFk INT, + vLanded DATE, + vAddressFk INT, + vZoneFk INT, + vWarehouseFk SMALLINT) +BEGIN +/** + * Calcula los componentes de los articulos de un ticket + * + * @param vTicketFk id del ticket + * @param vLanded nueva fecha de entrega + * @param vAddressFk nuevo consignatario + * @param vZoneFk nueva zona + * @param vWarehouseFk nuevo warehouse + * + * @return tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) + */ + DECLARE vShipped DATE; + DECLARE vBuyOrderItem INT DEFAULT 100; + + DECLARE vHasDataChanged BOOL DEFAULT FALSE; + DECLARE vHasAddressChanged BOOL; + DECLARE vHasZoneChanged BOOL DEFAULT FALSE; + DECLARE vHasWarehouseChanged BOOL DEFAULT FALSE; + + DECLARE vAddressTypeRateFk INT DEFAULT NULL; + DECLARE vAgencyModeTypeRateFk INT DEFAULT NULL; + + DECLARE vHasChangeAll BOOL DEFAULT FALSE; + + SELECT DATE(landed) <> vLanded, + addressFk <> vAddressFk, + zoneFk <> vZoneFk, + warehouseFk <> vWarehouseFk + INTO + vHasDataChanged, + vHasAddressChanged, + vHasZoneChanged, + vHasWarehouseChanged + FROM vn.ticket t + WHERE t.id = vTicketFk; + + IF vHasDataChanged OR vHasWarehouseChanged THEN + SET vHasChangeAll = TRUE; + END IF; + + IF vHasAddressChanged THEN + SET vAddressTypeRateFk = 5; + END IF; + + IF vHasZoneChanged THEN + SET vAgencyModeTypeRateFk = 6; + END IF; + + SELECT TIMESTAMPADD(DAY, -travelingDays, vLanded) INTO vShipped + FROM zone + WHERE id = vZoneFk; + + CALL buyUltimate(vWarehouseFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot ENGINE = MEMORY ( + SELECT + vWarehouseFk AS warehouseFk, + NULL AS available, + s.itemFk, + bu.buyFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketFk + AND s.itemFk != vBuyOrderItem + GROUP BY bu.warehouseFk, bu.itemFk); + + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); + + REPLACE INTO tmp.ticketComponent (warehouseFk, itemFk, componentFk, cost) + SELECT t.warehouseFk, s.itemFk, sc.componentFk, sc.value + FROM saleComponent sc + JOIN sale s ON s.id = sc.saleFk + JOIN ticket t ON t.id = s.ticketFk + JOIN `component` c ON c.id = sc.componentFk + WHERE s.ticketFk = vTicketFk + AND (c.isRenewable = FALSE + OR + (NOT vHasChangeAll + AND (NOT (c.typeFk <=> vAddressTypeRateFk + OR c.typeFk <=> vAgencyModeTypeRateFk)))); + + SET @shipped = vShipped; + + DROP TEMPORARY TABLE + tmp.buyUltimate, + tmp.ticketLot; + + IF vShipped IS NULL THEN + CALL util.throw('NO_ZONE_AVAILABLE'); + END IF; + + IF vShipped < CURDATE() THEN + CALL util.throw('ERROR_PAST_SHIPMENT'); + 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_componentUpdate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_componentUpdate__`( + vTicketFk INT, + vClientFk INT, + vAgencyModeFk INT, + vAddressFk INT, + vZoneFk INT, + vWarehouseFk TINYINT, + vCompanyFk SMALLINT, + vShipped DATETIME, + vLanded DATE, + vIsDeleted BOOLEAN, + vHasToBeUnrouted BOOLEAN, + vOption INT) +BEGIN + DECLARE vPrice DECIMAL(10,2); + DECLARE vBonus DECIMAL(10,2); + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + IF (SELECT addressFk FROM ticket WHERE id = vTicketFk) <> vAddressFk THEN + + UPDATE ticket t + JOIN address a ON a.id = vAddressFk + SET t.nickname = a.nickname + WHERE t.id = vTicketFk; + + END IF; + + CALL vn.zone_getShippedWarehouse(vlanded, vAddressFk, vAgencyModeFk); + + SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus + FROM tmp.zoneGetShipped + WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; + + UPDATE ticket t + SET + t.clientFk = vClientFk, + t.agencyModeFk = vAgencyModeFk, + t.addressFk = vAddressFk, + t.zoneFk = vZoneFk, + t.zonePrice = vPrice, + t.zoneBonus = vBonus, + t.warehouseFk = vWarehouseFk, + t.companyFk = vCompanyFk, + t.landed = vLanded, + t.shipped = vShipped, + t.isDeleted = vIsDeleted + WHERE + t.id = vTicketFk; + + IF vHasToBeUnrouted THEN + UPDATE ticket t SET t.routeFk = NULL + WHERE t.id = vTicketFk; + END IF; + + IF vOption <> 8 THEN + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) + ENGINE = MEMORY + SELECT id AS saleFk, vWarehouseFk warehouseFk + FROM sale s WHERE s.ticketFk = vTicketFk; + + CALL ticketComponentUpdateSale (vOption); + + DROP TEMPORARY TABLE tmp.sale; + 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 `ticket_DelayTruck` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT) +BEGIN + + DECLARE done INT DEFAULT FALSE; + DECLARE vTicketFk INT; + DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tmp.ticket; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + CALL vn.productionControl(vWarehouserFk,0) ; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT ticketFk + FROM tmp.productionBuffer + WHERE shipped = curdate() + AND problem LIKE '%I:%' + AND (HH <= vHour OR HH = vHour AND mm < vMinute) + AND alertLevel = 0; + + OPEN cur1; + + read_loop: LOOP + + FETCH cur1 INTO vTicketFk; + + IF done THEN + LEAVE read_loop; + END IF; + + CALL vn.ticket_DelayTruckSplit(vTicketFk); + + END LOOP; + + CLOSE cur1; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_DelayTruckSplit` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruckSplit`(vTicketFk INT) +BEGIN + + /* + * Splita las lineas de ticket que no estan ubicadas + * + */ + + DECLARE vNewTicketFk INT; + DECLARE vTotalLines INT; + DECLARE vLinesToSplit INT; + + DROP TEMPORARY TABLE IF EXISTS tmp.SalesToSplit; + + SELECT COUNT(*) INTO vTotalLines + FROM vn.sale + WHERE ticketFk = vTicketFk; + + CREATE TEMPORARY TABLE tmp.SalesToSplit + SELECT s.id saleFk + FROM vn.ticket t + JOIN vn.sale s ON t.id = s.ticketFk + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = s.itemFk AND issw.warehouseFk = t.warehouseFk + WHERE s.quantity > IFNULL(issw.visible, 0) + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND t.id = vTicketFk; + + SELECT COUNT(*) INTO vLinesToSplit + FROM tmp.SalesToSplit; + + IF vLinesToSplit = vTotalLines AND vLinesToSplit > 0 THEN + + SET vNewTicketFk = vTicketFk; + + ELSE + + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); + + UPDATE vn.sale s + JOIN tmp.SalesToSplit sts ON sts.saleFk = s.id + SET s.ticketFk = vNewTicketFk; + + END IF; + + CALL vn.ticketStateUpdate(vNewTicketFk, 'FIXING'); + + DROP TEMPORARY TABLE tmp.SalesToSplit; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_doRecalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_doRecalc`() +proc: BEGIN +/** + * Recalculates modified ticket. + */ + + DECLARE vDone BOOL; + DECLARE vTicketFk INT; + DECLARE vError INT; + + DECLARE cCur CURSOR FOR + SELECT ticketFk FROM ticketRecalc; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('vn.ticket_doRecalc'); + ROLLBACK; + GET DIAGNOSTICS CONDITION 2 @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; + SET vError = IFNULL(@errno, 0) ; + IF NOT(vError = 1105 OR vError = 1751) THEN + CALL `vn`.`mail_insert`('cau@verdnatura.es', + NULL, + 'Problema al recalcular el total de ticket', + CONCAT('Se ha detectado un problema en ticket_doRecalc al calcular el total del ticket : ', + vTicketFk,' el error es el: ', + CONCAT('ERROR ', IFNULL(@errno, 0), ': ', ifnull(@text, ''))) + ); + END IF; + RESIGNAL; + END; + + IF !GET_LOCK('vn.ticket_doRecalc', 0) THEN + LEAVE proc; + END IF; + + OPEN cCur; + + myLoop: LOOP + SET vDone = FALSE; + FETCH cCur INTO vTicketFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT vTicketFk ticketFk; + + CALL ticketGetTotal; + + START TRANSACTION; + UPDATE ticket t + JOIN tmp.ticketTotal tt ON tt.ticketFk = t.id + SET t.totalWithVat = tt.total, + t.totalWithoutVat = tt.totalWithoutVat; + DELETE FROM ticketRecalc WHERE ticketFk = vTicketFk; + COMMIT; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTotal; + END LOOP; + + CLOSE cCur; + DO RELEASE_LOCK('vn.ticket_doRecalc'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_doRefund` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `ticket_doRefund`(IN vOriginTicket INT, OUT vNewTicket INT) +BEGIN + + DECLARE vDone BIT DEFAULT 0; + DECLARE vCustomer MEDIUMINT; + DECLARE vWarehouse TINYINT; + DECLARE vCompany MEDIUMINT; + DECLARE vAddress MEDIUMINT; + DECLARE vRefundAgencyMode INT; + DECLARE vItemFk INT; + DECLARE vQuantity DECIMAL (10,2); + DECLARE vConcept VARCHAR(50); + DECLARE vPrice DECIMAL (10,2); + DECLARE vDiscount TINYINT; + DECLARE vSaleNew INT; + DECLARE vSaleMain INT; + DECLARE vZoneFk INT; + + DECLARE vRsMainTicket CURSOR FOR + SELECT * + FROM tmp.sale; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1; + + SELECT id INTO vRefundAgencyMode + FROM agencyMode WHERE `name` = 'ABONO'; + + SELECT clientFk, warehouseFk, companyFk, addressFk + INTO vCustomer, vWarehouse, vCompany, vAddress + FROM ticket + WHERE id = vOriginTicket; + + SELECT id INTO vZoneFk + FROM zone WHERE agencyModeFk = vRefundAgencyMode + LIMIT 1; + + INSERT INTO vn.ticket ( + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + companyFk, + landed, + zoneFk + ) + SELECT + vCustomer, + CURDATE(), + vAddress, + vRefundAgencyMode, + a.nickname, + vWarehouse, + vCompany, + CURDATE(), + vZoneFk + FROM address a + WHERE a.id = vAddress; + + SET vNewTicket = LAST_INSERT_ID(); + + SET vDone := 0; + OPEN vRsMainTicket ; + FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; + + WHILE NOT vDone DO + + INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount) + VALUES( vNewTicket, vItemFk, vQuantity, vConcept, vPrice, vDiscount ); + + SET vSaleNew = LAST_INSERT_ID(); + + INSERT INTO vn.saleComponent(saleFk,componentFk,`value`) + SELECT vSaleNew,componentFk,`value` + FROM vn.saleComponent + WHERE saleFk = vSaleMain; + + FETCH vRsMainTicket INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount; + + END WHILE; + CLOSE vRsMainTicket; + + INSERT INTO vn.ticketRefund(refundTicketFk, originalTicketFk) + VALUES(vNewTicket, vOriginTicket); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getFromFloramondo` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `ticket_getFromFloramondo`(vDateFrom DATE, vDateTo DATE) +BEGIN + +/** + * Genera una tabla con la lista de tickets de Floramondo para una fecha determinada + * @param vDated Fecha de preparación de los pedidos + * @return tmp.ticketFloramondo(ticketFk, clientName, agencyName, freight, expeditionCount, margin, trolleys, pallets) + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketFloramondo; + CREATE TEMPORARY TABLE tmp.ticketFloramondo + (ticketFk INT PRIMARY KEY, + clientName VARCHAR(50), + agencyName VARCHAR(50), + freight DECIMAL(10,2) DEFAULT 0, + expeditionCount INT, + margin DECIMAL(10,3) DEFAULT 0, + trolleys INT DEFAULT 0, + shipped DATE, + pallets INT DEFAULT 0) + ENGINE = MEMORY; + + INSERT INTO tmp.ticketFloramondo(ticketFk, clientName, agencyName, shipped) + SELECT t.id ticketFk, t.nickname , am.name, t.shipped + FROM vn.ticket t + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.warehouse w ON w.id = t.warehouseFk AND w.code IN ('VNH','FLM') + AND t.shipped BETWEEN vDateFrom AND TIMESTAMPADD(HOUR, 23, vDateTo); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (ticketFk INT(11) PRIMARY KEY) + SELECT ticketFk + FROM tmp.ticketFloramondo; + + -- Freight + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(sc.value * s.quantity) freight, t.ticketFk + FROM vn.saleComponent sc + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + JOIN vn.sale s ON s.id = sc.saleFk + JOIN tmp.ticket t ON t.ticketFk = s.ticketFk + WHERE ct.code = 'FREIGHT' + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.freight = sb.freight; + + -- Freight service + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(ts.price * ts.quantity) service, t.ticketFk + FROM vn.ticketService ts + JOIN tmp.ticket t ON t.ticketFk = ts.ticketFk + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.freight = tf.freight + sb.service; + + -- Expedition Count + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT COUNT(e.id) expeditionCount, t.ticketFk + FROM vn.expedition e + RIGHT JOIN tmp.ticket t ON t.ticketFk = e.ticketFk + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.expeditionCount = sb.expeditionCount; + + -- Margin + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(IF(ct.code = 'COST',sc.value, 0)) cost, + SUM(IF(ct.isMargin, sc.value, 0)) margin, + t.ticketFk + FROM vn.saleComponent sc + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + JOIN vn.sale s ON s.id = sc.saleFk + JOIN tmp.ticket t ON t.ticketFk = s.ticketFk + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.margin = sb.margin / sb.cost; + + -- Trolleys + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(tp.quantity) trolleys, t.ticketFk + FROM vn.ticketPackaging tp + JOIN tmp.ticket t ON t.ticketFk = tp.ticketFk + JOIN vn.packaging p ON p.id = tp.packagingFk + WHERE p.isTrolley + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.trolleys = sb.trolleys; + + -- Pallets + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(tp.quantity) pallets, t.ticketFk + FROM vn.ticketPackaging tp + JOIN tmp.ticket t ON t.ticketFk = tp.ticketFk + JOIN vn.packaging p ON p.id = tp.packagingFk + WHERE p.isPallet + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.pallets = sb.pallets; + + SELECT * FROM tmp.ticketFloramondo; + + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketFloramondo; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getMovable` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getMovable`(vTicketFk INT, vDatedNew DATETIME, vWarehouseFk INT) +BEGIN +/** + * Cálcula el stock movible para los artículos de un ticket + * vDatedNew debe ser menor que vDatedOld, en los otros casos se + * asume que siempre es posible + * + * @param vTicketFk -> Ticket + * @param vDatedNew -> Nueva fecha + * @return Sales con Movible +*/ + DECLARE vDatedOld DATETIME; + SET vDatedNew = DATE_ADD(vDatedNew, INTERVAL 1 DAY); + + SELECT t.shipped INTO vDatedOld + FROM ticket t + WHERE t.id = vTicketFk; + + CALL itemStock(vWarehouseFk, vDatedNew, NULL); + CALL item_getMinacum(vWarehouseFk, vDatedNew, DATEDIFF(DATE_SUB(vDatedOld, INTERVAL 1 DAY), vDatedNew), NULL); + + SELECT s.id, + s.itemFk, + s.quantity, + s.concept, + s.price, + s.reserved, + s.discount, + i.image, + i.subName, + il.stock + IFNULL(im.amount, 0) AS movable + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + LEFT JOIN tmp.itemMinacum im ON im.itemFk = s.itemFk AND im.warehouseFk = vWarehouseFk + LEFT JOIN tmp.itemList il ON il.itemFk = s.itemFk + WHERE t.id = vTicketFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemList; + DROP TEMPORARY TABLE IF EXISTS tmp.itemMinacum; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getProblems` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getProblems`(IN vIsTodayRelative tinyint(1)) +BEGIN +/** + * Calcula los problemas para un conjunto de tickets. + * Agrupados por ticket + * + * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular + * @return tmp.ticket_problems + */ + CALL sale_getProblems(vIsTodayRelative); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems; + CREATE TEMPORARY TABLE tmp.ticket_problems + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT + ticketFk, + MAX(p.isFreezed) AS isFreezed, + MAX(p.risk) AS risk, + MAX(p.hasHighRisk) AS hasHighRisk, + MAX(p.hasTicketRequest) AS hasTicketRequest, + MIN(p.isAvailable) AS isAvailable, + MAX(p.itemShortage) AS itemShortage, + MIN(p.isTaxDataChecked) AS isTaxDataChecked, + MAX(p.hasComponentLack) AS hasComponentLack, + MAX(p.isTooLittle) AS isTooLittle, + MAX(p.itemDelay) AS itemDelay, + MAX(p.itemLost) AS itemLost, + 0 AS totalProblems + FROM tmp.sale_problems p + GROUP BY ticketFk; + + UPDATE tmp.ticket_problems tp + SET tp.totalProblems = + ( + (tp.isFreezed) + + IF(tp.risk, TRUE, FALSE) + + (tp.hasTicketRequest) + + (tp.isAvailable = 0) + + (tp.isTaxDataChecked = 0) + + (tp.hasComponentLack) + + (tp.itemDelay) + + (tp.isTooLittle) + + (tp.itemLost) + + (tp.itemShortage) + ); + + DROP TEMPORARY TABLE + tmp.sale_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 `ticket_getProblems__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getProblems__`(IN vIsTodayRelative tinyint(1)) +BEGIN +/** + * Calcula los problemas para un conjunto de tickets. + * Agrupados por ticket + * + * @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular + * @return tmp.ticket_problems + */ + CALL sale_getProblems(vIsTodayRelative); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_problems; + CREATE TEMPORARY TABLE tmp.ticket_problems + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT + ticketFk, + MAX(p.isFreezed) AS isFreezed, + MAX(p.risk) AS risk, + MAX(p.hasHighRisk) AS hasHighRisk, + MAX(p.hasTicketRequest) AS hasTicketRequest, + MIN(p.isAvailable) AS isAvailable, + MAX(p.itemShortage) AS itemShortage, + MIN(p.isTaxDataChecked) AS isTaxDataChecked, + MAX(p.hasComponentLack) AS hasComponentLack, + MAX(p.isTooLittle) AS isTooLittle, + 0 AS totalProblems + FROM tmp.sale_problems p + GROUP BY ticketFk; + + UPDATE tmp.ticket_problems tp + SET tp.totalProblems = ( + (tp.isFreezed) + + IF(tp.risk, TRUE, FALSE) + + (tp.hasTicketRequest) + + (tp.isAvailable = 0) + + (tp.isTaxDataChecked = 0) + + (tp.hasComponentLack) + + (tp.isTooLittle) + ); + + DROP TEMPORARY TABLE + tmp.sale_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 `ticket_getShip` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getShip`(vTicketFk INT) +BEGIN + SELECT s.shipFk FROM vn.stowaway s + WHERE s.id = vTicketFk; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getSplitList` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getSplitList`(vDated DATE, vHour TIME, vWarehouseFk INT) +BEGIN +/** + * Devuelve un listado con los tickets posibles para splitar HOY. + * + * @param vDated Fecha a estudiar + * @param vHour Hora a partir de la cual todavía se puede enviar, si la fecha es la de hoy + * @param vWarehouseFk Almacén + */ + DECLARE vAvailableCache INT; + DECLARE vVisibleCache INT; + + CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, CURDATE()); + CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk); + CALL `vn`.`zoneClosure_recalc`(); + + DROP TEMPORARY TABLE IF EXISTS tmp.salesToSplit; + + CREATE TEMPORARY TABLE tmp.salesToSplit + (saleFk INT PRIMARY KEY, + ticketFk INT, + problem VARCHAR(1)) ENGINE = MEMORY; + + INSERT INTO tmp.salesToSplit(saleFk, ticketFk, problem) + SELECT s.id, s.ticketFk, 'F' + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = i.id AND v.calc_id = vVisibleCache + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) < s.quantity + AND IFNULL(av.available ,0) < s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND NOT i.generic + AND t.warehouseFk = vWarehouseFk; + + INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem) + SELECT s.id, s.ticketFk, 'I' + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) >= s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND NOT i.generic + AND t.warehouseFk = vWarehouseFk; + + INSERT IGNORE INTO tmp.salesToSplit(saleFk, ticketFk, problem) + SELECT s.id, s.ticketFk, 'R' + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it on it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vVisibleCache + LEFT JOIN cache.available av ON av.item_id = i.id AND av.calc_id = vAvailableCache + LEFT JOIN vn.itemShelvingStock_byWarehouse issw ON issw.itemFk = i.id AND issw.warehouseFk = t.warehouseFk + WHERE IFNULL(v.visible,0) < s.quantity + AND IFNULL(av.available ,0) >= s.quantity + AND IFNULL(issw.visible, 0) < s.quantity + AND s.quantity > 0 + AND s.isPicked = FALSE + AND s.reserved = FALSE + AND ic.merchandise = TRUE + AND t.shipped BETWEEN CURDATE() AND util.dayend(CURDATE()) + AND NOT i.generic + AND t.warehouseFk = vWarehouseFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketsToSplit; + + CREATE TEMPORARY TABLE tmp.ticketsToSplit + (ticketFk INT PRIMARY KEY, + problems VARCHAR(100), + addressFk INT, + ipt VARCHAR(10), + etd TIME) ENGINE = MEMORY; + + INSERT INTO tmp.ticketsToSplit + SELECT + ss.ticketFk, + GROUP_CONCAT(DISTINCT ss.problem ORDER BY ss.problem) problems, + t.addressFk, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, + zc.`hour` etd + FROM tmp.salesToSplit ss + JOIN vn.ticket t ON t.id = ss.ticketFk + JOIN vn.sale s ON s.id = ss.saleFk + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk + GROUP BY ss.ticketFk; + + SELECT + ts.*, + t.id ticketFuture, + st.name state, + zc.`hour` tfEtd, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) tfIpt, + st2.name tfState + FROM tmp.ticketsToSplit ts + LEFT JOIN vn.ticketState ts2 ON ts2.ticketFk = ts.ticketFk + LEFT JOIN vn.state st ON st.id = ts2.stateFk + LEFT JOIN vn.ticket t + ON t.id != ts.ticketFk + AND t.addressFk = ts.addressFk + AND t.shipped BETWEEN vDated AND util.dayend(vDated) + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND zc.dated = vDated + LEFT JOIN vn.sale s ON s.ticketFk = t.id + LEFT JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.ticketState tst ON tst.ticketFk = t.id + LEFT JOIN vn.state st2 ON st2.id = tst.stateFk + WHERE (t.id IS NULL + OR (vDated > CURDATE()) + OR (vDated = CURDATE() AND vHour >= zc.`hour`)) + AND ts.etd <= vHour + GROUP BY ts.ticketFk, t.id + ORDER BY ts.etd, ts.ticketFk; + + DROP TEMPORARY TABLE + tmp.ticketsToSplit; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getTax` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getTax`(IN vTaxArea VARCHAR(25)) +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 + * @return tmp.ticketAmount (ticketFk, taxableBase, tax, code) + * @return tmp.ticketTax (ticketFk, pgcFk, taxableBase, rate, code) Impuesto desglosado para cada ticket. + */ + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT t.addressFk, t.companyFk + FROM tmp.ticket tmpTicket + JOIN ticket t ON t.id = tmpTicket.ticketFk; + + CALL addressTaxArea (); + + IF vTaxArea > '' THEN + UPDATE tmp.addressTaxArea + SET areaFk = vTaxArea; + END IF; + /* Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente + * No se debería cambiar el sistema por problemas con los decimales + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; + CREATE TEMPORARY TABLE tmp.ticketTax + (PRIMARY KEY (ticketFk, code, rate)) + ENGINE = MEMORY + SELECT * FROM ( + SELECT tmpTicket.ticketFk, + bp.pgcFk, + SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, + pgc.rate, + tc.code, + bp.priority + FROM tmp.ticket tmpTicket + 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 tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = 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 = ata.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, pgc.rate + HAVING taxableBase != 0) t3 + ORDER BY priority; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; + CREATE TEMPORARY TABLE tmp.ticketServiceTax + (PRIMARY KEY (ticketFk, code, rate)) + ENGINE = MEMORY + SELECT tt.ticketFk, + pgc.code pgcFk, + SUM(ts.quantity * ts.price) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticket tt + JOIN ticketService ts ON ts.ticketFk = tt.ticketFk + JOIN ticket t ON t.id = tt.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = ts.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tt.ticketFk, pgc.code + HAVING taxableBase != 0; + + INSERT INTO tmp.ticketTax (ticketFk, pgcFk, taxableBase, rate, code) + SELECT ts.ticketFk, ts.pgcFk, ts.taxableBase, ts.rate, ts.code + FROM tmp.ticketServiceTax ts + ON DUPLICATE KEY UPDATE ticketTax.taxableBase = VALUES (taxableBase) + ticketTax.taxableBase ; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; + CREATE TEMPORARY TABLE tmp.ticketAmount + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, + taxableBase, + SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax, + code + FROM tmp.ticketTax + GROUP BY ticketFk, code; + + DROP TEMPORARY TABLE tmp.addressCompany; + DROP TEMPORARY TABLE tmp.addressTaxArea; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_getTax__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getTax__`(vTaxArea VARCHAR(25)) + 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 + * @return tmp.ticketAmount + * @return tmp.ticketTax Impuesto desglosado para cada ticket. + */ + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + CREATE TEMPORARY TABLE tmp.addressCompany + (INDEX (addressFk, companyFk)) + ENGINE = MEMORY + SELECT DISTINCT t.addressFk, t.companyFk + FROM tmp.ticket tmpTicket + JOIN ticket t ON t.id = tmpTicket.ticketFk; + + CALL addressTaxArea (); + + IF vTaxArea > '' THEN + UPDATE tmp.addressTaxArea + SET areaFk = vTaxArea; + END IF; + /** Solo se calcula la base imponible (taxableBase) y el impuesto se calculará posteriormente + * No se debería cambiar el sistema por problemas con los decimales + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketTax; + CREATE TEMPORARY TABLE tmp.ticketTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT * FROM ( + SELECT tmpTicket.ticketFk, + bp.pgcFk, + SUM(s.quantity * s.price * (100 - s.discount)/100 ) AS taxableBase, + pgc.rate, + tc.code, + bp.priority + FROM tmp.ticket tmpTicket + 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 tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = 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 = ata.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,pgc.rate + HAVING taxableBase != 0) t + ORDER BY priority; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketServiceTax; + CREATE TEMPORARY TABLE tmp.ticketServiceTax + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk, + SUM(ts.quantity * ts.price) AS taxableBase, + pgc.rate, + tc.code + FROM tmp.ticketTax tt + JOIN ticketService ts ON ts.ticketFk = tt.ticketFk + JOIN ticket t ON t.id = tt.ticketFk + JOIN supplier su ON su.id = t.companyFk + JOIN tmp.addressTaxArea ata + ON ata.addressFk = t.addressFk AND ata.companyFk = t.companyFk + JOIN bookingPlanner bp + ON bp.countryFk = su.countryFk + AND bp.taxAreaFk = ata.areaFk + AND bp.taxClassFk = ts.taxClassFk + JOIN pgc ON pgc.code = bp.pgcFk AND pgc.rate = tt.rate + JOIN taxClass tc ON tc.id = bp.taxClassFk + GROUP BY tt.ticketFk, tt.code,tt.rate + HAVING taxableBase != 0; + + UPDATE tmp.ticketTax tt + JOIN tmp.ticketServiceTax ts ON tt.ticketFk = ts.ticketFk AND tt.code = ts.code AND tt.rate = ts.rate + SET tt.taxableBase = tt.taxableBase + ts.taxableBase; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketAmount; + CREATE TEMPORARY TABLE tmp.ticketAmount + (INDEX (ticketFk)) + ENGINE = MEMORY + SELECT ticketFk, taxableBase, SUM(CAST(taxableBase * rate / 100 AS DECIMAL(10, 2))) tax,code + FROM tmp.ticketTax + GROUP BY ticketFk, code; + + DROP TEMPORARY TABLE IF EXISTS tmp.addressCompany; + DROP TEMPORARY TABLE IF EXISTS tmp.addressTaxArea; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_insertZone` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_insertZone`() +BEGIN + DECLARE vDone INT DEFAULT 0; + DECLARE vFechedTicket INT; + DECLARE vLanded DATE; + DECLARE vAddressFk INT; + DECLARE vAgencyModeFk INT; + DECLARE vWarehouseFk INT; + DECLARE vCursor CURSOR FOR + SELECT id, landed, addressFk, agencyModeFk, warehouseFk + FROM vn.ticket WHERE shipped > '2020-01-01' AND zoneFk is null; + DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET vDone = 1; + + OPEN vCursor; + REPEAT + FETCH vCursor INTO vFechedTicket, vLanded, vAddressFk, vAgencyModeFk, vWarehouseFk; + CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE); + + UPDATE vn.ticket t + JOIN tmp.zoneGetShipped zgs ON zgs.warehouseFk = vWarehouseFk + SET t.zoneFk = zgs.zoneFk + WHERE t.id = vFechedTicket; + + UNTIL vDone END REPEAT; + DROP TEMPORARY TABLE tmp.zoneGetShipped; + + CLOSE vCursor; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_merge` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_merge`(vSelf INT, vTicketTargetFk INT) +BEGIN + + /** + * Fusiona el primer ticket al segundo + * + * @param vSelf Número de ticket a fusionar + * @param vTicketTargetFk Ticket destino + * + */ + + UPDATE vn.sale s + SET s.ticketFk = vTicketTargetFk + WHERE s.ticketFk = vSelf; + + UPDATE vn.ticket t + SET t.shipped = TIMESTAMPADD(YEAR, - YEAR(NOW()) MOD 2000, t.shipped ) + WHERE t.id = vSelf; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticket_priceDifference` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_priceDifference`( + vTicketFk INT, + vLanded DATE, + vAddressFk INT, + vZoneFk INT, + vWarehouseFk INT) +BEGIN +/** + * Devuelve las diferencias de precio de los movimientos de un ticket. + * + * @param vTicketFk Id del ticket + * @param vLanded Fecha de recepcion + * @param vAddressFk Id del consignatario + * @param vZoneFk Id de la zona + * @param vWarehouseFk Id del almacén + */ + CALL vn.ticket_componentPreview(vTicketFk, vLanded, vAddressFk, vZoneFk, vWarehouseFk); + + SELECT s.itemFk, + i.name, + i.size, + i.category, + IFNULL(s.quantity, 0) AS quantity, + IFNULL(s.price, 0) AS price, + ROUND(SUM(tc.cost), 2) AS newPrice, + s.quantity * (s.price - ROUND(SUM(tc.cost), 2)) difference, + s.id AS saleFk + FROM sale s + JOIN item i ON i.id = s.itemFk + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN tmp.ticketComponentPreview tc ON tc.itemFk = s.itemFk + AND tc.warehouseFk = vWarehouseFk + LEFT JOIN saleComponent sc ON sc.saleFk = s.id + AND sc.componentFk = tc.componentFk + LEFT JOIN `component` c ON c.id = tc.componentFk + WHERE t.id = vTicketFk + AND IF(sc.componentFk IS NULL + AND c.classRate IS NOT NULL, FALSE, TRUE) + GROUP BY s.id ORDER BY s.id; + + DROP TEMPORARY TABLE tmp.ticketComponentPreview; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_recalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalc`(vTicketId INT) +BEGIN +/** + * Calcula y guarda el total con/sin IVA en un ticket. + * + * @param vTicketId Identificador del ticket + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT vTicketId ticketFk; + + CALL ticketGetTotal; + + UPDATE ticket t + JOIN tmp.ticketTotal tt ON tt.ticketFk = t.id + SET t.totalWithVat = tt.total, + t.totalWithoutVat = tt.totalWithoutVat; + + 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 `ticket_recalcComponents` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN) +proc: BEGIN + +/** + * Este procedimiento recalcula los componentes de un ticket, + * eliminando los componentes existentes e insertandolos de nuevo + * + * @param vTicketFk Id del ticket + * @param vIsTicketEditable si no se quiere forzar llamar con NULL + */ + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAgencyModeFk INT; + DECLARE vAddressFk INT; + DECLARE vLanded DATE; + DECLARE vZoneFk INTEGER; + + IF vIsTicketEditable IS NULL THEN + SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = '' + INTO vIsTicketEditable + FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket + WHERE id = vTicketFk; + END IF; + + SELECT t.warehouseFk, + t.shipped, + t.addressFk, + t.agencyModeFk, + t.landed, + t.zoneFk + INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk + FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket + WHERE t.id = vTicketFk; + + CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); + + IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN + CALL util.throw('There is no zone for these parameters'); + END IF; + + IF vLanded IS NULL OR vZoneFk IS NULL THEN + + UPDATE ticket t + SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) + WHERE t.id = vTicketFk AND t.landed IS NULL; + + IF vZoneFk IS NULL THEN + SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; + UPDATE ticket t + SET t.zoneFk = vZoneFk + WHERE t.id = vTicketFk AND t.zoneFk IS NULL; + END IF; + + END IF; + + DROP TEMPORARY TABLE tmp.zoneGetLanded; + + -- rellena la tabla buyUltimate con la ultima compra + CALL buyUltimate (vWarehouseFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, + s.itemFk, bu.buyFk, vZoneFk zoneFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketFk + GROUP BY s.itemFk; + + CALL catalog_componentPrepare(); + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT id saleFk, vWarehouseFk warehouseFk + FROM sale s + WHERE s.ticketFk = vTicketFk; + + -- si el ticket esta facturado, respeta los precios + CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6)); + + CALL catalog_componentPurge(); + DROP TEMPORARY TABLE + tmp.buyUltimate, + tmp.sale; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_recalcComponentsForcePrice__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponentsForcePrice__`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN ) +proc: BEGIN + +/** + * Este procedimiento trata de "rebionizar" un ticket, + * eliminando los componentes existentes e insertandolos de nuevo + * + * @param vTicketFk Id del ticket + * @return tmp.buyUltimate + */ + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAgencyModeFk INT; + DECLARE vAddressFk INT; + DECLARE vLanded DATE; + DECLARE vZoneFk INTEGER; + + IF vIsTicketEditable IS NULL THEN + SELECT (IFNULL(ts.alertLevel,0) >0 or IFNULL(t.refFk,"") != "") = FALSE, t.zoneFk + INTO vIsTicketEditable, vZoneFk + FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket + WHERE id = vTicketFk; + END IF; + SELECT warehouseFk, date(shipped), addressFk, agencyModeFk, landed + INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded + FROM ticket + WHERE id = vTicketFk; + + CALL vn.zone_getShipped (vLanded, vAddressFk, vAgencyModeFk, TRUE); + + CALL vn.buyUltimate (vWarehouseFk, vShipped); -- rellena la tabla buyUltimate con la ultima compra + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, + s.itemFk, bu.buyFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketFk + GROUP BY s.itemFk; + + CALL vn.catalog_componentCalculate(vZoneFk, vAddressFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT id saleFk, vWarehouseFk warehouseFk + FROM sale s + WHERE s.ticketFk = vTicketFk; + + CALL vn.ticketComponentUpdateSale(IF(vIsTicketEditable,1,6)); -- si el ticket esta facturado, respeta los precios + + IF vLanded IS NULL THEN + + CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk); + + UPDATE vn2008.Tickets t + SET t.landing = (SELECT landed FROM tmp.zoneGetLanded) + WHERE Id_Ticket = vTicketFk; + + DROP TEMPORARY TABLE tmp.zoneGetLanded; + + END IF; + + DROP TEMPORARY TABLE tmp.buyUltimate; + DROP TEMPORARY TABLE tmp.ticketComponentPrice; + DROP TEMPORARY TABLE tmp.ticketComponent; + DROP TEMPORARY TABLE tmp.sale; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_recalcComponents__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponents__`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN) +proc: BEGIN + +/** + * Este procedimiento recalcula los componentes de un ticket, + * eliminando los componentes existentes e insertandolos de nuevo + * + * @param vTicketFk Id del ticket + * @param vIsTicketEditable si no se quiere forzar llamar con NULL + */ + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAgencyModeFk INT; + DECLARE vAddressFk INT; + DECLARE vLanded DATE; + DECLARE vZoneFk INTEGER; + + -- Santos 2021, borrar a partir del dia 31 PAK + IF (SELECT COUNT(*) + FROM tmp.routeDayMove ra + JOIN vn.ticket t ON t.routeFk = ra.routeFk + WHERE t.id = vTicketFk) THEN + + LEAVE proc; + + END IF; + + IF vIsTicketEditable IS NULL THEN + SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = '' + INTO vIsTicketEditable + FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket + WHERE id = vTicketFk; + END IF; + + SELECT t.warehouseFk, + t.shipped, + t.addressFk, + t.agencyModeFk, + t.landed, + t.zoneFk + INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk + FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket + WHERE t.id = vTicketFk; + + IF vLanded IS NULL OR vZoneFk IS NULL THEN + + CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); + + IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN + CALL util.throw('There is no zone for these parameters'); + END IF; + + UPDATE ticket t + SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) + WHERE t.id = vTicketFk AND t.landed IS NULL; + + IF vZoneFk IS NULL THEN + SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; + UPDATE ticket t + SET t.zoneFk = vZoneFk + WHERE t.id = vTicketFk AND t.zoneFk IS NULL; + END IF; + DROP TEMPORARY TABLE tmp.zoneGetLanded; + + END IF; + + -- rellena la tabla buyUltimate con la ultima compra + CALL buyUltimate (vWarehouseFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, + s.itemFk, bu.buyFk, vZoneFk zoneFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketFk + GROUP BY s.itemFk; + + CALL catalog_componentPrepare(); + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT id saleFk, vWarehouseFk warehouseFk + FROM sale s + WHERE s.ticketFk = vTicketFk; + + -- si el ticket esta facturado, respeta los precios + CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6)); + + CALL catalog_componentPurge(); + DROP TEMPORARY TABLE + tmp.buyUltimate, + tmp.sale; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_requestRecalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `ticket_requestRecalc`(vSelf INT) +proc: BEGIN +/** + * Adds a request to recalculate the ticket total. + * + * @param vSelf The ticket identifier + */ + IF vSelf IS NULL THEN + LEAVE proc; + END IF; + + INSERT IGNORE INTO ticketRecalc SET ticketFk = vSelf; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `ticket_setNextState` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setNextState`(vSelf INT) +BEGIN +/** + * Cambia el estado del ticket al siguiente estado según la tabla state + * + * @param vSelf id dle ticket + */ + DECLARE vStateFk INT; + DECLARE vNewStateFk INT; + + SELECT stateFk INTO vStateFk + FROM ticketState + WHERE ticketFk = vSelf; + + SELECT nextStateFk INTO vNewStateFk + FROM state + WHERE id = vStateFk; + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + VALUES (vNewStateFk, vSelf, account.myUser_getId()); + + SELECT TRUE AS IsUpdated; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_setPreviousState` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setPreviousState`(vTicketFk INT) +BEGIN + + DECLARE vControlFk INT; + + SELECT MAX(inter_id) INTO vControlFk + FROM vncontrol.inter + WHERE Id_Ticket = vTicketFk; + + IF (SELECT s.code + FROM vn.state s + JOIN vncontrol.inter i ON i.state_id = s.id + WHERE i.inter_id = vControlFk) + = 'PREVIOUS_PREPARATION' THEN + + SELECT inter_id + INTO vControlFk + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE Id_Ticket = vTicketFk + AND inter_id < vControlFk + AND s.code != 'PREVIOUS_PREPARATION' + ORDER BY inter_id DESC + LIMIT 1; + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT s.nextStateFk, i.Id_Ticket, account.myUser_getId() + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE inter_id = vControlFk; + + END IF; + + SELECT TRUE AS IsUpdated; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_setState` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`(vTicketFk INT, vStateCode VARCHAR(45)) +BEGIN + + /* Modifica el estado de un ticket + * + * @param vTicketFk el id del ticket + * @param vStateCode estado a modificar del ticket + * + */ + + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM vn.state s + JOIN vn.ticketState ts ON ts.stateFk = s.id + WHERE ts.ticketFk = vTicketFk; + + IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, vTicketFk, account.myUser_getId() + FROM vn.state + WHERE `code` = vStateCode collate utf8_unicode_ci; + + 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_split` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE) +proc:BEGIN +/** + * Mueve las lineas con problemas a otro ticket existente o a uno nuevo. + * + * @param vTicketFk Identificador del ticket a splittar + * @param vTicketFutureFk Identificador del ticket al que se quieren mover las lineas + * @param vDate Fecha a la que se va a mover + * @table tmp.salesToSplit(saleFk, ticketFk, problem) + */ + DECLARE vHasFullProblem BOOL; + DECLARE vProblemLines INT; + DECLARE vTotalLines INT; + + SELECT COUNT(*) INTO vProblemLines + FROM tmp.salesToSplit + WHERE ticketFk = vTicketFk; + + SELECT count(*) INTO vTotalLines + FROM vn.sale s + WHERE s.ticketFk = vTicketFk; + + SET vHasFullProblem = (vTotalLines = vProblemLines); + + -- Ticket completo + IF vHasFullProblem THEN + + UPDATE vn.ticket + SET landed = vDated + 1, + shipped = vDated, + nickname = CONCAT('(',DAY(curdate()),') ', nickname ) + WHERE id = vTicketFk; + + SELECT CONCAT("Se ha cambiado el ticket ", vTicketFk, " al dia ", vDated); + LEAVE proc; + + END IF; + + -- Ticket a futuro existe + IF vTicketFutureFk THEN + + UPDATE vn.sale s + JOIN tmp.salesToSplit ss ON s.id = ss.saleFk + SET s.ticketFk = vTicketFutureFk, + s.concept = CONCAT('(s) ', s.concept) + WHERE ss.ticketFk = vTicketFk; + + SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, + " al ticket existente ", vTicketFutureFk,"(", vDated,")"); + LEAVE proc; + + END IF; + + -- Ticket nuevo + CALL vn.ticket_Clone(vTicketFk, vTicketFutureFk); + + UPDATE vn.ticket t + JOIN vn.productionConfig pc + SET t.landed = vDated + 1, + t.shipped = vDated, + t.agencyModeFk = pc.defautlAgencyMode, + t.zoneFk = pc.defaultZone + WHERE t.id = vTicketFutureFk; + + UPDATE vn.sale s + JOIN tmp.salesToSplit sts ON sts.saleFk = s.id + SET s.ticketFk = vTicketFutureFk, + s.concept = CONCAT('(s) ', s.concept) + WHERE sts.ticketFk = vTicketFk; + + CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING'); + + SELECT CONCAT("Se han movido lineas del ticket ", vTicketFk, + " al nuevo ticket ", vTicketFutureFk,"(", vDated,")"); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_splitItemPackingType` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitItemPackingType`(vTicketFk INT) +proc:BEGIN + + /* + * Clona y reparte las ventas de un ticket en funcion del tipo de empaquetado + * + * @param vTicketFk Identificador de vn.ticket + * @return table tmp.ticketIPT(ticketFk, itemPackingTypeFk) + */ + + + DECLARE vItemPackingTypeFk VARCHAR(1); + + DECLARE vNewTicketFk INT; + + DECLARE vPackingTypesToSplit INT; + + DECLARE vDone INT DEFAULT FALSE; + + DECLARE cur1 CURSOR FOR + SELECT itemPackingTypeFk + FROM tmp.saleGroup + WHERE itemPackingTypeFk IS NOT NULL; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (id)) + SELECT s.id, i.itemPackingTypeFk , sv.litros + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.saleVolume sv ON sv.saleFk = s.id + LEFT JOIN vn.saleTracking st ON st.saleFk = s.id + WHERE s.ticketFk = vTicketFk + AND ISNULL(st.id); + + DROP TEMPORARY TABLE IF EXISTS tmp.saleGroup; + CREATE TEMPORARY TABLE tmp.saleGroup + SELECT itemPackingTypeFk , sum(litros) AS totalLitros + FROM tmp.sale + GROUP BY itemPackingTypeFk; + + SELECT COUNT(*) INTO vPackingTypesToSplit + FROM tmp.saleGroup + WHERE itemPackingTypeFk IS NOT NULL; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketIPT; + CREATE TEMPORARY TABLE tmp.ticketIPT + (ticketFk INT, + itemPackingTypeFk VARCHAR(1)); + + CASE vPackingTypesToSplit + + WHEN 0 THEN + + INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) + VALUES(vTicketFk, 'H'); + + WHEN 1 THEN + + INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) + SELECT vTicketFk, itemPackingTypeFk + FROM tmp.saleGroup + WHERE itemPackingTypeFk IS NOT NULL; + ELSE + + OPEN cur1; + + FETCH cur1 INTO vItemPackingTypeFk; + + INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) + VALUES(vTicketFk, vItemPackingTypeFk); + + read_loop: LOOP + + FETCH cur1 INTO vItemPackingTypeFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); + + INSERT INTO tmp.ticketIPT(ticketFk, itemPackingTypeFk) + VALUES(vNewTicketFk, vItemPackingTypeFk); + + END LOOP; + + CLOSE cur1; + + UPDATE vn.sale s + JOIN tmp.sale ts ON ts.id = s.id + JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = ts.itemPackingTypeFk + SET s.ticketFk = t.ticketFk; + + SELECT itemPackingTypeFk INTO vItemPackingTypeFk + FROM tmp.saleGroup sg + WHERE NOT ISNULL(sg.itemPackingTypeFk) + ORDER BY sg.totalLitros + LIMIT 1; + + UPDATE vn.sale s + JOIN tmp.sale ts ON ts.id = s.id + JOIN tmp.ticketIPT t ON t.itemPackingTypeFk = vItemPackingTypeFk + SET s.ticketFk = t.ticketFk + WHERE ISNULL(ts.itemPackingTypeFk); + + END CASE; + + DROP TEMPORARY TABLE tmp.sale; + DROP TEMPORARY TABLE tmp.saleGroup; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_splitPackingComplete` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_splitPackingComplete`(vTicketFk INT, vSectorFk INT) +BEGIN + + DECLARE vNeedToSplit BOOLEAN; + DECLARE vNewTicketFk INT; + + DROP TEMPORARY TABLE IF EXISTS tmpSale; + + CREATE TEMPORARY TABLE tmpSale + SELECT DISTINCT s.id + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = s.itemFk AND iss.sectorFk = vSectorFk + JOIN vn.packagingConfig pc + WHERE t.id = vTicketFk + AND ( s.quantity MOD IFNULL(iss.packing,1) != 0 + OR + IFNULL(iss.packing,1) = 1 + OR + i.`size` <= pc.previousPreparationMinimumSize + ); + + SELECT COUNT(*) + INTO vNeedToSplit + FROM tmpSale; + + IF vNeedToSplit THEN + + CALL vn.ticket_Clone(vTicketFk, vNewTicketFk); + + UPDATE vn.sale s + JOIN vn.tmpSale ts ON ts.id = s.id + SET s.ticketFk = vNewTicketFk; + + END IF; + + DROP TEMPORARY TABLE tmpSale; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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_WeightDeclaration` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_WeightDeclaration`(vClientFk INT, vDated DATE) +BEGIN + + DECLARE vTheorycalWeight DECIMAL(10,2); + DECLARE vRealWeight DECIMAL(10,2); + DECLARE vRatio DOUBLE; + + SELECT IFNULL(sum(tob.description),0) INTO vRealWeight + FROM vn.ticketObservation tob + JOIN vn.observationType ot ON ot.id = tob.observationTypeFk + JOIN vn.ticket t ON t.id = tob.ticketFk + WHERE ot.description = 'Peso Aduana' + AND t.clientFk = vClientFk + AND t.shipped BETWEEN vDated AND util.dayend(vDated); + + SELECT sum(IF(sv.physicalWeight = 0, sv.weight, sv.physicalWeight)) INTO vTheorycalWeight + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.saleVolume sv ON sv.saleFk = s.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + WHERE t.clientFk = vClientFk + AND t.shipped BETWEEN vDated AND util.dayend(vDated); + + SET vRatio = vRealWeight / vTheorycalWeight; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketWeight; + + CREATE TEMPORARY TABLE tmp.ticketWeight + ENGINE = MEMORY + SELECT i.intrastatFk, + ib.ediBotanic, + FLOOR(sum(s.quantity)) as quantity, + CAST(vRatio * SUM(IF(sv.physicalWeight = 0, sv.weight, sv.physicalWeight) ) AS DECIMAL(10,2)) physicalWeight, + o.code as countryCode, + vDated as Dated + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.saleVolume sv ON sv.saleFk = s.id + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.itemBotanicalWithGenus ib ON ib.itemFk = i.id + LEFT JOIN vn.origin o ON o.id = i.originFk + WHERE t.clientFk = vClientFk + AND t.shipped BETWEEN vDated AND util.dayend(vDated) + GROUP BY ib.ediBotanic, o.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 */ ; +/*!50003 DROP PROCEDURE IF EXISTS `timeBusiness_calculate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * Horas que debe trabajar un empleado según contrato y día. + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + * @table tmp.user(userFk) + * @return tmp.timeBusinessCalculate + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate; + + CREATE TEMPORARY TABLE tmp.timeBusinessCalculate + SELECT dated, + businessFk, + userFk, + departmentFk, + hourStart, + hourEnd, + timeTable, + timeWorkSeconds, + SEC_TO_TIME(timeWorkSeconds) timeWorkSexagesimal, + timeWorkSeconds / 3600 timeWorkDecimal, + timeWorkSeconds timeBusinessSeconds, + SEC_TO_TIME(timeWorkSeconds) timeBusinessSexagesimal, + timeWorkSeconds / 3600 timeBusinessDecimal, + type, + permissionRate, + hoursWeek, + discountRate, + isAllowedToWork + FROM(SELECT t.dated, + b.business_id businessFk, + w.userFk, + bl.department_id departmentFk, + IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart , + IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd, + IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5), " - ", LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) timeTable, + IF(j.start = NULL, 0, IFNULL(SUM(TIME_TO_SEC(j.end)) - SUM(TIME_TO_SEC(j.start)),0)) timeWorkSeconds, + cs.type, + cs.permissionRate, + cs.discountRate, + cl.hours_week hoursWeek, + cs.isAllowedToWork + FROM vn.time t + LEFT JOIN postgresql.business b ON t.dated BETWEEN b.date_start AND ifnull(b.date_end, vDatedTo ) + LEFT JOIN postgresql.profile AS pr ON b.client_id = pr.profile_id + LEFT JOIN postgresql.person AS p ON pr.person_id = p.person_id + LEFT JOIN vn.worker AS w ON p.id_trabajador = w.id + JOIN tmp.`user` u ON u.userFK = w.userFK + JOIN postgresql.business_labour AS bl ON b.business_id = bl.business_id + LEFT JOIN postgresql.business_labour_payroll AS bp ON bl.business_id = bp.business_id + LEFT JOIN postgresql.professional_category AS pc ON bl.professional_category_id = pc.professional_category_id + LEFT JOIN postgresql.workcenter AS wc ON bl.workcenter_id = wc.workcenter_id + LEFT JOIN postgresql.calendar_labour_type AS cl ON bl.calendar_labour_type_id = cl.calendar_labour_type_id + LEFT JOIN postgresql.journey AS j ON j.business_id = b.business_id and j.day_id=WEEKDAY(t.dated)+1 + LEFT JOIN postgresql.calendar_employee ce ON ce.business_id=b.business_id and ce.date = t.dated + LEFT JOIN postgresql.calendar_state cs ON cs.calendar_state_id = ce.calendar_state_id + WHERE t.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY w.userFk,dated + )sub; + + UPDATE tmp.timeBusinessCalculate t + LEFT JOIN postgresql.journey j ON j.business_id = t.businessFk + SET t.timeWorkSeconds = t.hoursWeek / 5 * 3600, + t.timeWorkSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), + t.timeWorkDecimal = t.hoursWeek / 5, + t.timeBusinessSeconds = t.hoursWeek / 5 * 3600, + t.timeBusinessSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), + t.timeBusinessDecimal = t.hoursWeek / 5 + WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND j.journey_id IS NULL ; + + UPDATE tmp.timeBusinessCalculate t + SET t.timeWorkSeconds = t.timeWorkSeconds - (t.timeWorkSeconds * permissionRate) , + t.timeWorkSexagesimal = SEC_TO_TIME ((t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)) * 3600), + t.timeWorkDecimal = t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate) + WHERE permissionRate <> 0; + + UPDATE tmp.timeBusinessCalculate t + JOIN vn.calendarHolidays ch ON ch.dated = t.dated + JOIN postgresql.business_labour bl ON bl.business_id = t.businessFk AND bl.workcenter_id = ch.workcenterFk + SET t.timeWorkSeconds = 0, + t.timeWorkSexagesimal = 0, + t.timeWorkDecimal = 0, + t.permissionrate = 1, + t.type = 'Festivo' + WHERE t.type 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 `timeBusiness_calculateAll` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` + SELECT userFk + FROM vn.worker w + JOIN vn.`user` u ON u.id = w.userFk + WHERE userFk IS NOT NULL; + + CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeBusiness_calculateByDepartment` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * @param vDepartmentFk + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE tmp.`user` + SELECT DISTINCT w.userFk + FROM postgresql.business AS b + LEFT JOIN postgresql.profile AS pr ON pr.profile_id = b.client_id + LEFT JOIN postgresql.person AS p ON p.person_id = pr.person_id + LEFT JOIN postgresql.business_labour AS bl ON b.business_id = bl.business_id + LEFT JOIN vn.worker AS w ON p.id_trabajador = w.id + LEFT JOIN vn.department AS d ON bl.department_id = d.id + WHERE ((b.date_start BETWEEN vDatedFrom AND vDatedTo OR b.date_end BETWEEN vDatedFrom AND vDatedTo) OR + (b.date_end IS NULL AND b.date_start <= vDatedTo) OR + (b.date_start <= vDatedFrom AND b.date_end >= vDatedTo) + ) AND bl.department_id = vDepartmentFk + ORDER BY b.date_end DESC; + + CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeBusiness_calculateByUser` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * @param vUserFk + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE tmp.`user` + SELECT id userFk + FROM user + WHERE id = vUserFk; + CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeBusiness_calculateByWorker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * @param vWorkerFk + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE tmp.`user` + SELECT u.id userFk + FROM vn.user u + JOIN vn.worker w ON w.userFk = u.id + WHERE w.id = vWorkerFk; + + CALL vn.timeBusiness_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeBusiness_calculate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeBusiness_calculate__`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * Horas que debe trabajar un empleado según contrato y día. + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + * @table tmp.user(userFk) + * @return tmp.timeBusinessCalculate + */ + + DROP TABLE IF EXISTS tmp.timeBusinessCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.businessFullTime; + + CALL rangeDateInfo(vDatedFrom, vDatedTo); + + CREATE TABLE tmp.timeBusinessCalculate + SELECT dated, + businessFk, + userFk, + departmentFk, + hourStart, + hourEnd, + timeTable, + timeWorkSeconds, + SEC_TO_TIME(timeWorkSeconds) timeWorkSexagesimal, + timeWorkSeconds / 3600 timeWorkDecimal, + timeWorkSeconds timeBusinessSeconds, + SEC_TO_TIME(timeWorkSeconds) timeBusinessSexagesimal, + timeWorkSeconds / 3600 timeBusinessDecimal, + type, + permissionRate, + hoursWeek, + discountRate + FROM(SELECT rd.dated, + b.business_id businessFk, + w.userFk, + bl.department_id departmentFk, + IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart , + IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd, + IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5), " - ", LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) timeTable, + IF(j.start = NULL, 0, IFNULL(SUM(TIME_TO_SEC(j.end)) - SUM(TIME_TO_SEC(j.start)),0)) timeWorkSeconds, + cs.type, + cs.permissionRate, + cs.discountRate, + cl.hours_week hoursWeek + FROM tmp.rangeDate rd + LEFT JOIN postgresql.business b ON rd.dated BETWEEN b.date_start AND ifnull(b.date_end, vDatedTo ) + LEFT JOIN postgresql.profile AS pr ON b.client_id = pr.profile_id + LEFT JOIN postgresql.person AS p ON pr.person_id = p.person_id + LEFT JOIN vn.worker AS w ON p.id_trabajador = w.id + JOIN tmp.`user` u ON u.userFK = w.userFK + JOIN postgresql.business_labour AS bl ON b.business_id = bl.business_id + LEFT JOIN postgresql.business_labour_payroll AS bp ON bl.business_id = bp.business_id + LEFT JOIN postgresql.professional_category AS pc ON bl.professional_category_id = pc.professional_category_id + LEFT JOIN postgresql.workcenter AS wc ON bl.workcenter_id = wc.workcenter_id + LEFT JOIN postgresql.calendar_labour_type AS cl ON bl.calendar_labour_type_id = cl.calendar_labour_type_id + LEFT JOIN postgresql.journey AS j ON j.business_id = b.business_id and j.day_id=WEEKDAY(rd.dated)+1 + LEFT JOIN postgresql.calendar_employee ce ON ce.business_id=b.business_id and ce.date = rd.dated + LEFT JOIN postgresql.calendar_state cs ON cs.calendar_state_id = ce.calendar_state_id + WHERE rd.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY w.userFk,dated + )sub; + + + UPDATE tmp.timeBusinessCalculate t + LEFT JOIN postgresql.journey j ON j.business_id = t.businessFk + SET t.timeWorkSeconds = t.hoursWeek / 5 * 3600, + t.timeWorkSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), + t.timeWorkDecimal = t.hoursWeek / 5, + t.timeBusinessSeconds = t.hoursWeek / 5 * 3600, + t.timeBusinessSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600), + t.timeBusinessDecimal = t.hoursWeek / 5 + WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND j.journey_id IS NULL ; + + UPDATE tmp.timeBusinessCalculate t + SET t.timeWorkSeconds = t.timeWorkSeconds - (t.timeWorkSeconds * permissionRate) , + t.timeWorkSexagesimal = SEC_TO_TIME ((t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)) * 3600), + t.timeWorkDecimal = t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate) + WHERE permissionRate <> 0; + +UPDATE tmp.timeBusinessCalculate t + JOIN vn.calendarHolidays ch ON ch.dated = t.dated + JOIN postgresql.business_labour bl ON bl.business_id = t.businessFk AND bl.workcenter_id = ch.workcenterFk + SET t.timeWorkSeconds = 0, + t.timeWorkSexagesimal = 0, + t.timeWorkDecimal = 0, + t.permissionrate = 1, + t.type = 'Festivo' + WHERE t.type IS NULL; + +DROP TEMPORARY TABLE IF EXISTS tmp.rangeDate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeControl_calculate` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `timeControl_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN +/* + * @param vDatedFrom + * @param vDatedTo + * Calculo de horas trabajadas por empleado y dia, sin tener encuenta los dias con fichadas incorrectas + * segun la tabla tmp.timeControlError + * @return tmp.timeControlCalculate (workerFk, dated, timeWorkSeconds, timeWorkSexagesimal, timeWorkDecimal, timed) + */ + DECLARE vHourToSeconds INTEGER; + DECLARE vDatedFromYesterday DATETIME; + DECLARE vDatedToTomorrow DATETIME; + DECLARE vTimeToBreakTime INT; + DECLARE vBreakTime INT; + + SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) + INTO vDatedFromYesterday, vDatedToTomorrow; + + SELECT timeToBreakTime, breakTime INTO vTimeToBreakTime, vBreakTime + FROM workerTimeControlConfig LIMIT 1; + + CALL timeControl_getError(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControl; + CREATE TEMPORARY TABLE tmp.workerTimeControl + (INDEX (userFk), INDEX (timed)) + ENGINE = MEMORY + SELECT DISTINCT(wtc.id), + wtc.userFk, + wtc.timed, + wtc.direction, + TRUE isReal + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id + WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow + AND tce.id IS NULL + ORDER BY wtc.userFk, wtc.timed ASC; + + SELECT MAX(id) INTO @vCont + FROM tmp.workerTimeControl; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; + CREATE TEMPORARY TABLE tmp.workerTimeControlAux ( + `id` int(11) , + `userFk` int(10) unsigned , + `timed` datetime, + `direction` enum('in', 'out','middle') + ) ENGINE=MEMORY; + + + SET @counter := 0; + SET @vIsOdd := FALSE; + + -- Cambio de dia en medio de un descanso + INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) + SELECT @vCont:= @vCont + 1 id, userFk, util.dayEnd(dated) timed, 'middle' direction + FROM(SELECT wtc.userFk, + DATE(@lastTimed) dated, + (@vIsOdd := NOT @vIsOdd) isOdd, + IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, + @lastTimed := wtc.timed + FROM tmp.workerTimeControl wtc + ORDER BY wtc.userFk, wtc.timed + )sub + WHERE hasBreak; + + SET @counter := 0; + SET @vIsOdd := FALSE; + + INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) + SELECT @vCont:= @vCont + 1, userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'middle' + FROM(SELECT wtc.userFk, + DATE(@lastTimed) dated, + (@vIsOdd := NOT @vIsOdd) isOdd, + IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, + @lastTimed := wtc.timed + FROM tmp.workerTimeControl wtc + ORDER BY wtc.userFk, wtc.timed + )sub + WHERE hasBreak; + + -- Cambio de dia + INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) + SELECT @vCont:= @vCont + 1 id, sub.userFk, util.dayEnd(sub.dated) timed, 'out' direction + FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id + WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow + AND tce.id IS NULL + GROUP BY wtc.userFk, DATE(wtc.timed) + ) sub + JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk + WHERE wtc.direction <> 'out'; + + INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) + SELECT @vCont:= @vCont + 1, sub.userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'in' + FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id + WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow + AND tce.id IS NULL + GROUP BY wtc.userFk, DATE(wtc.timed) + ) sub + JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk + WHERE wtc.direction <> 'out'; + + INSERT INTO tmp.workerTimeControl (id, userFk, timed, direction, isReal) + SELECT id, userFk, timed, direction, FALSE FROM tmp.workerTimeControlAux; + + SET vHourToSeconds = 3600; + SET @vIsOdd := TRUE; + SET @vDated := 0; + SET @vLastTimed := 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerBreakDays; + CREATE TEMPORARY TABLE tmp.workerBreakDays + (INDEX (userFk), INDEX (dated)) + ENGINE = MEMORY + SELECT sub.userFk, sub.dated + FROM (SELECT (@vIsOdd := NOT @vIsOdd), + IF(wtc.direction = 'in', @vIsOdd := TRUE, NULL), + IF(@vIsOdd, @vLastTimed := UNIX_TIMESTAMP(wtc.timed), NULL), + IF(@vIsOdd, 0, UNIX_TIMESTAMP(wtc.timed) - @vLastTimed) timeWork, + IF(direction='in', @vDated := DATE(wtc.timed), @vDated) dated, + wtc.userFk + FROM tmp.workerTimeControl wtc + ORDER BY wtc.userFk, wtc.timed, wtc.id + )sub + GROUP BY sub.userFk, sub.dated + HAVING SUM(sub.timeWork) >= vTimeToBreakTime; + + SET @vIsOdd := TRUE; + SET @vDated := 0; + SET @vLastTimed := 0; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + + CREATE TEMPORARY TABLE tmp.timeControlCalculate + (INDEX (userFk, dated)) + ENGINE = MEMORY + SELECT sub.userFk, + sub.dated, + IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork) timeWorkSeconds, + SEC_TO_TIME(IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork)) timeWorkSexagesimal, + (IF(wb.userFk, vBreakTime, 0) + SUM(sub.timeWork)) / vHourToSeconds timeWorkDecimal, + CAST(GROUP_CONCAT(DATE_FORMAT(sub.realTimed, "%H:%i") ORDER BY sub.timed ASC SEPARATOR ' - ') AS CHAR(256)) timed + FROM (SELECT (@vIsOdd := NOT @vIsOdd), + IF(direction='in', @vIsOdd := TRUE, 0), + IF(@vIsOdd, @vLastTimed := UNIX_TIMESTAMP(timed), 0), + IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed) - @vLastTimed) timeWork, + timed, + userFk, + DATE(timed) dated, + IF(isReal, timed, NULL) realTimed + FROM tmp.workerTimeControl + WHERE timed BETWEEN vDatedFromYesterday AND vDatedTo + ORDER BY userFk, timed, id + )sub + LEFT JOIN tmp.workerBreakDays wb ON wb.userFk = sub.userFk AND wb.dated = sub.dated + WHERE sub.timed BETWEEN vDatedFrom AND vDatedTo + GROUP BY sub.userFk, sub.dated; + + DROP TEMPORARY TABLE tmp.workerBreakDays; + DROP TEMPORARY TABLE tmp.timeControlError; + DROP TEMPORARY TABLE tmp.workerTimeControlAux; + DROP TEMPORARY TABLE tmp.workerTimeControl; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeControl_calculateAll` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateAll`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` + SELECT userFk + FROM vn.worker w + JOIN vn.`user` u ON u.id = w.userFk + WHERE userFk IS NOT NULL; + + CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeControl_calculateByDepartment` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByDepartment`(vDepartmentFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * @param vDepartmentFk + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE tmp.`user` + SELECT DISTINCT w.userFk + FROM postgresql.business AS b + LEFT JOIN postgresql.profile AS pr ON pr.profile_id = b.client_id + LEFT JOIN postgresql.person AS p ON p.person_id = pr.person_id + LEFT JOIN postgresql.business_labour AS bl ON b.business_id = bl.business_id + LEFT JOIN vn.worker AS w ON p.id_trabajador = w.id + LEFT JOIN vn.department AS d ON bl.department_id = d.id + WHERE ((b.date_start BETWEEN vDatedFrom AND vDatedTo OR b.date_end BETWEEN vDatedFrom AND vDatedTo) OR + (b.date_end IS NULL AND b.date_start <= vDatedTo) OR + (b.date_start <= vDatedFrom AND b.date_end >= vDatedTo) + ) AND bl.department_id = vDepartmentFk + ORDER BY b.date_end DESC; + + CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeControl_calculateByUser` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByUser`(vUserFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * @param vUserFk + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE tmp.`user` + SELECT id userFk + FROM user + WHERE id = vUserFk; + CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeControl_calculateByWorker` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeControl_calculateByWorker`(vWorkerFk INT, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + +/** + * @param vWorkerFk + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + CREATE TEMPORARY TABLE tmp.`user` + SELECT u.id userFk + FROM vn.user u + JOIN vn.worker w ON w.userFk = u.id + WHERE w.id = vWorkerFk; + + CALL vn.timeControl_calculate(vDatedFrom, vDatedTo); + + DROP TEMPORARY TABLE tmp.`user`; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeControl_calculate__` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `timeControl_calculate__`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + SET @vIsOdd := TRUE; + SET @vUser := NULL; + SET @vDated := NULL; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + + CREATE TEMPORARY TABLE tmp.timeControlCalculate + SELECT + userFk, + dated, + IF( timeWork >= 18000, @timeWork:=timeWork + 1200, @timeWork:=timeWork) timeWorkSeconds, + SEC_TO_TIME(@timeWork ) timeWorkSexagesimal, + @timeWork / 3600 timeWorkDecimal, + timed + FROM (SELECT SUM(timeWork) timeWork, + userFk, + dated, + GROUP_CONCAT(DATE_FORMAT(sub.timed,"%H:%i") ORDER BY sub.timed ASC SEPARATOR ' - ') timed + FROM (SELECT IF(@vUser = wtc.userFk, @vUser :=@vUser, @vUser := wtc.userFk), + IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE), + IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd), + IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed), + IF(@vIsOdd, 0, UNIX_TIMESTAMP(timed)-@vLastTimed) timeWork, + IF(direction='in', @vDated := DATE(wtc.timed), @vDated) dated, + wtc.timed timed, + wtc.userFk, + direction + FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo + ORDER BY userFk, timed ASC + ) wtc + WHERE wtc.timed BETWEEN vDatedFrom AND vDatedTo + ) sub + GROUP BY userFk, dated + )sub2; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `timeControl_getError` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN +/* + * @param vDatedFrom + * @param vDatedTo + * @table tmp.`user`(userFk) + * Fichadas incorrectas de las cuales no se puede calcular horas trabajadas + * @return tmp.timeControlError (id) + */ + DECLARE vDayMaxTime INTEGER; + + SET @journeyCounter := 0; + SET @lastUserFk := NULL; + + SELECT dayMaxTime INTO vDayMaxTime + FROM workerTimeControlConfig LIMIT 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; + CREATE TEMPORARY TABLE tmp.timeControl + (INDEX(id), INDEX(journeyCounter)) + ENGINE = MEMORY + SELECT sub.id, + sub.direction, + sub.timed, + IF(sub.direction = 'in' OR @hasOut OR sub.userFk <> @lastUserFk, @journeyCounter := @journeyCounter + 1, @journeyCounter) journeyCounter, + @lastUserFk := sub.userFk workerFk, + IF(sub.direction = 'out', @hasOut:= TRUE, @hasOut:= FALSE) + FROM ( + SELECT DISTINCT wtc.id, + wtc.direction, + wtc.timed, + wtc.userFk + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + WHERE wtc.timed BETWEEN DATE_SUB(vDatedFrom, INTERVAL 1 DAY) AND DATE_ADD(vDatedTo, INTERVAL 1 DAY) + ORDER BY wtc.userFk, wtc.timed + ) sub; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; + CREATE TEMPORARY TABLE tmp.timeControlAux + (INDEX(id), INDEX(journeyCounter)) + ENGINE = MEMORY + SELECT * FROM tmp.timeControl; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlError; + CREATE TEMPORARY TABLE tmp.timeControlError + (INDEX(id)) + ENGINE = MEMORY + SELECT id + FROM tmp.timeControlAux tca + JOIN (SELECT journeyCounter, + UNIX_TIMESTAMP(MAX(timed)) - UNIX_TIMESTAMP(MIN(timed)) timeWork, + SUM(direction = 'in') totalIn, + SUM(direction = 'out') totalOut, + timed + FROM tmp.timeControl + GROUP BY journeyCounter + HAVING COUNT(*) MOD 2 = 1 + OR totalIn <> 1 + OR totalOut <> 1 + OR timeWork >= vDayMaxTime + )sub ON sub.journeyCounter = tca.journeyCounter + WHERE sub.timed BETWEEN vDatedFrom AND vDatedTo; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `timeWorkerControl_check` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `timeWorkerControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) +proc: BEGIN +/** + * deprecated call workerTimeControl_check + */ +CALL vn.workerTimeControl_check(vUserFk,vDated,vTabletFk); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `tpvTransaction_checkStatus` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_checkStatus`() +BEGIN +/** + * + * Envia mail con los cobros web no + * trasladados a la ficha del cliente. + * + */ + INSERT INTO mail (receiver,replyTo,subject,body) + SELECT 'administracion@verdnatura.es', + 'noreply@verdnatura.es', + CONCAT('Cobro web no trasladado a la ficha del cliente ', t.clientFk), + CONCAT('Hay un importe de ', t.amount/100, '€ del cliente ', t.clientFk, ' con fecha ', t.created, + ', que no se ha trasladado a recibos. Si nos ha llegado el importe al banco confirme el pago en + + https://salix.verdnatura.es/#!/client/',t.clientFk,'/web-payment') + FROM hedera.tpvTransaction t + WHERE t.receiptFk IS NULL + AND t.status = 'ok' + AND t.created < DATE_ADD(NOW(),INTERVAL - 2 DAY) + GROUP BY t.clientFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `travelVolume` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume`(vTravelFk INT) +BEGIN + + SELECT w1.name AS ORI, + w2.name AS DES, + tr.shipped shipment, + tr.landed landing, + a.name Agencia, + s.name Proveedor, + e.id Id_Entrada, + e.REF Referencia, + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.trolleyM3 / 1000000 ,1) AS DECIMAL(10,2)) AS CC, + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.palletM3 / 1000000,1) AS DECIMAL(10,2)) AS espais + FROM vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.supplier s ON s.id = e.supplierFk + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.agencyMode a ON a.id = tr.agencyFk + JOIN vn.warehouse w1 ON w1.id = tr.warehouseInFk + JOIN vn.warehouse w2 ON w2.id = tr.warehouseOutFk + JOIN vn.volumeConfig vc + JOIN vn.item i ON i.id = b.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + WHERE tr.id = vTravelFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `travelVolume_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT) +BEGIN + + SELECT tr.landed Fecha, + a.name Agencia, + count(DISTINCT e.id) numEntradas, + FLOOR(sum(item_getVolume(b.itemFk, b.packageFk) * b.stickers / 1000000 )) AS m3 + FROM vn.travel tr + JOIN vn.agencyMode a ON a.id = tr.agencyFk + JOIN vn.entry e ON e.travelFk = tr.id + JOIN vn.buy b ON b.entryFk = e.id + WHERE tr.landed BETWEEN vFromDated AND vToDated + AND e.isRaid = FALSE + AND tr.warehouseInFk = vWarehouseFk + GROUP BY tr.landed , a.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 `travel_checkDates` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_checkDates`(vShipped DATE, vLanded DATE) +BEGIN +/** + * Checks the landing/shipment dates of travel, throws an error + * ir they are not correct. + * + * @param vShipped The shipment date + * @param vLanded The landing date + */ + + IF vLanded < vShipped THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Landing cannot be lesser than shipment'; + 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 `travel_clone` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `travel_clone`(vSelf INT, vDays INT, OUT vNewTravelFk INT) +BEGIN + + /** + * Clona un travel el número de dias indicado y devuelve su Id + * + * @param vSelf Identificador de vn.travel + * @param vDays Número de dias a futuro + * + * @return vNewTravelFk Nuevo número de travel + */ + + SELECT tr.id INTO vNewTravelFk + FROM vn.travel tr + JOIN vn.travel tr2 USING(shipped, warehouseInFk, warehouseOutFk, agencyFk, `ref`) + WHERE tr2.id = vSelf + AND tr.landed = TIMESTAMPADD(DAY, vDays, tr2.landed); + + IF ISNULL(vNewTravelFk) THEN + + START TRANSACTION; + + INSERT INTO vn.travel( shipped, + shipmentHour, + landed, + landingHour, + warehouseInFk, + warehouseOutFk, + agencyFk, + `ref`, + cargoSupplierFk) + SELECT shipped, + shipmentHour, + TIMESTAMPADD(DAY, vDays, landed), + landingHour, + warehouseInFk, + warehouseOutFk, + agencyFk, + `ref`, + cargoSupplierFk + FROM vn.travel + WHERE id = vSelf; + + SELECT LAST_INSERT_ID() INTO vNewTravelFk; + + COMMIT; + + END IF; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `travel_cloneWithEntries` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`( + IN vTravelFk INT, + IN vDateStart DATE, + IN vDateEnd DATE, + IN vWarehouseOutFk INT, + IN vWarehouseInFk INT, + IN vRef VARCHAR(255), + IN vAgencyModeFk INT, + OUT vNewTravelFk INT) +BEGIN +/** + * Clona un travel junto con sus entradas y compras + * + * @param vTravelFk travel plantilla a clonar + * @param vDateStart fecha del shipment del nuevo travel + * @param vDateEnd fecha del landing del nuevo travel + * @param vWarehouseOutFk fecha del salida del nuevo travel + * @param vWarehouseInFk warehouse de landing del nuevo travel + * @param vRef referencia del nuevo travel + * @param vAgencyModeFk del nuevo travel + * @param vNewTravelFk id del nuevo travel + */ + DECLARE vEntryNew INT; + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vAuxEntryFk INT; + DECLARE vRsEntry CURSOR FOR + SELECT e.id + FROM entry e + JOIN travel t + ON t.id = e.travelFk + WHERE e.travelFk = vTravelFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION/*, 1062 Duplicate key*/ + BEGIN + ROLLBACK; + + END; + + START TRANSACTION; + INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyFk, `ref`, isDelivered, isReceived, m3, kg) + SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3, kg + FROM travel + WHERE id = vTravelFk; + + SET vNewTravelFk = LAST_INSERT_ID(); + CALL logAdd(vNewTravelFk, 'insert', 'travel', CONCAT('clona travel ',vTravelFk)); + SET vDone = FALSE; + SET @isModeInventory = TRUE; + OPEN vRsEntry ; + FETCH vRsEntry INTO vAuxEntryFk; + + WHILE NOT vDone DO + INSERT INTO entry ( + supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + travelFk, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk) + SELECT supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + vNewTravelFk, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk + FROM entry + WHERE id = vAuxEntryFk; + + SET vEntryNew = LAST_INSERT_ID(); + + CALL logAdd(vEntryNew, 'insert', 'entry', CONCAT('clona entrada ',vAuxEntryFk)); + INSERT INTO buy ( + entryFk, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight) + SELECT vEntryNew, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight + FROM buy + WHERE entryFk = vAuxEntryFk; + + FETCH vRsEntry INTO vAuxEntryFk; + END WHILE; + SET @isModeInventory = FALSE; + CLOSE vRsEntry; + 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 `travel_cloneWithEntries__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries__`(IN vTravelFk INT, IN vDateStart DATE, IN vDateEnd DATE, + IN vRef VARCHAR(255), OUT vNewTravelFk INT) +BEGIN + DECLARE vEntryNew INT; + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vAuxEntryFk INT; + DECLARE vRsEntry CURSOR FOR + SELECT e.id + FROM entry e + JOIN travel t + ON t.id = e.travelFk + WHERE e.travelFk = vTravelFk; + + DECLARE vRsBuy CURSOR FOR + SELECT b.* + FROM buy b + JOIN entry e + ON b.entryFk = e.id + WHERE e.travelFk = vNewTravelFk and b.entryFk=vNewTravelFk + ORDER BY e.id; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + INSERT INTO travel (shipped,landed, warehouseInFk, warehouseOutFk, agencyFk, ref, isDelivered, isReceived, m3, kg) + SELECT vDateStart, vDateEnd,warehouseInFk, warehouseOutFk, agencyFk, vRef, isDelivered, isReceived, m3, kg + FROM travel + WHERE id = vTravelFk; + + SET vNewTravelFk = LAST_INSERT_ID(); + SET vDone = FALSE; + OPEN vRsEntry ; + FETCH vRsEntry INTO vAuxEntryFk; + + WHILE NOT vDone DO + INSERT INTO entry (supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + travelFk, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk) + SELECT supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + vNewTravelFk, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk + FROM entry + WHERE id = vAuxEntryFk; + + SET vEntryNew = LAST_INSERT_ID(); + + + INSERT INTO buy (entryFk, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight) + SELECT vEntryNew, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight + FROM buy + WHERE entryFk = vAuxEntryFk; + + + FETCH vRsEntry INTO vAuxEntryFk; + END WHILE; + CLOSE vRsEntry; + 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 `travel_doRecalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_doRecalc`() +BEGIN +/** + * Recounts the number of entries of changed travels. + */ + DECLARE vDone BOOL; + DECLARE vTravelFk INT; + DECLARE vTotalEntries INT; + + DECLARE cCur CURSOR FOR + SELECT travelFk FROM travelRecalc; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + OPEN cCur; + + myLoop: LOOP + SET vDone = FALSE; + FETCH cCur INTO vTravelFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + SELECT COUNT(*) INTO vTotalEntries + FROM entry + WHERE travelFk = vTravelFk; + + UPDATE travel + SET totalEntries = vTotalEntries + WHERE id = vTravelFk; + + DELETE FROM travelRecalc WHERE travelFk = vTravelFk; + END LOOP; + + CLOSE cCur; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `travel_moveRaids` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_moveRaids`() +BEGIN + +/* + * Desplaza al dia siguiente los travels que contengan redadas y avisa a los compradores + * + */ + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vWorkerName VARCHAR(50); + DECLARE vRaid TEXT; + DECLARE vWorker VARCHAR(50) DEFAULT ''; + DECLARE vMailBody TEXT DEFAULT ''; + + DECLARE vCur CURSOR FOR + SELECT GROUP_CONCAT( DISTINCT CONCAT('https://salix.verdnatura.es/#!/travel/', ttr.id, '/summary ') ORDER BY ttr.id SEPARATOR '\n\r'), + u.name + FROM tmp.travel ttr + JOIN entry e ON e.travelFk = ttr.id + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN account.user u ON u.id = it.workerFk + GROUP BY u.name; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + DROP TEMPORARY TABLE IF EXISTS tmp.travel; + CREATE TEMPORARY TABLE tmp.travel + SELECT tr.id,tr.landed + FROM travel tr + JOIN entry e ON e.travelFk = tr.id + WHERE tr.landed = util.tomorrow() + AND e.isRaid + GROUP BY tr.id; + + START TRANSACTION; + + UPDATE travel tr + JOIN tmp.travel ttr ON ttr.id = tr.id + SET tr.landed = TIMESTAMPADD(DAY, 1, tr.landed); + + INSERT INTO travelLog (originFk, userFk , action, description) + SELECT ttr.id, account.userGetId(), 'update', CONCAT('Se ha cambiado la fecha del travel al dia ', util.tomorrow()) + FROM tmp.travel ttr; + + OPEN vCur; + + l: LOOP + SET vDone = FALSE; + FETCH vCur INTO vRaid, vWorkerName; + + IF vDone THEN + LEAVE l; + END IF; + + CALL `vn`.`mail_insert`(CONCAT(vWorkerName, '@verdnatura.es'), + 'noreply@verdnatura.es', + 'Cambio de fecha en Redadas', + CONCAT('Se ha movido las siguientes redadas: \n\r ', vRaid) + ); + + END LOOP; + CLOSE vCur; + COMMIT; + DROP TEMPORARY TABLE tmp.travel; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `travel_requestRecalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_requestRecalc`(vSelf INT) +proc: BEGIN +/** + * Adds a request to recount the number of entries for the travel. + * + * @param vSelf The travel reference + */ + IF vSelf IS NULL THEN + LEAVE proc; + END IF; + + INSERT IGNORE INTO travelRecalc SET travelFk = vSelf; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `travel_weeklyClone` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_weeklyClone`(vSinceWeek INT, vToWeek INT) +BEGIN +/** + * Clona los travels plantilla para las semanas pasadas por parámetros + * + * @param vSinceWeek Número de semanas en el futuro para empezar a clonar + * @param vToWeek Número de semenas en el futuro hasta donde clonar + */ + + DECLARE vCounter INT; + DECLARE vCurrentTravelFk INT; + DECLARE vShipped DATE; + DECLARE vLanded DATE; + DECLARE vWarehouseInFk INT; + DECLARE vWarehouseOutFk INT; + DECLARE vAgencyModeFk INT; + DECLARE vRef VARCHAR(255); + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vRsTravel CURSOR FOR + SELECT travelFk, + @a := TIMESTAMPADD(DAY,vCounter * 7 - WEEKDAY(CURDATE()) - 1 + weekDay,CURDATE()), + @a := TIMESTAMPADD(DAY,duration,@a), + warehouseOutFk, + warehouseInFk, + `ref`, + agencyModeFk + FROM travelClonedWeekly + WHERE travelFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SET vCounter = vSinceWeek; + vWeekLoop :LOOP + INSERT IGNORE INTO travel (shipped, landed, warehouseOutFk, warehouseInFk, agencyFk, ref, cargoSupplierFk, kg) + SELECT @a := TIMESTAMPADD(DAY, vCounter * 7 - WEEKDAY(CURDATE()) - 1 + weekDay,CURDATE()), + @a := TIMESTAMPADD(DAY, duration, @a), + warehouseOutFk, + warehouseInFk, + agencyModeFk, + ref, + supplierFk, + kg + FROM travelClonedWeekly + WHERE travelFk IS NULL; + OPEN vRsTravel; + FETCH vRsTravel INTO vCurrentTravelFk, vShipped, vLanded, vWarehouseOutFk, vWarehouseInFk, vRef, vAgencyModeFk; + SET vDone = FALSE; + WHILE NOT vDone DO + CALL travel_cloneWithEntries(vCurrentTravelFk, vShipped, vLanded, vWarehouseOutFk, vWarehouseInFk, vRef, vAgencyModeFk, @newTravel); + FETCH vRsTravel INTO vCurrentTravelFk, vShipped, vLanded, vWarehouseOutFk, vWarehouseInFk, vRef, vAgencyModeFk; + END WHILE; + CLOSE vRsTravel; + + IF vCounter = vToWeek THEN + LEAVE vWeekLoop; + END IF; + SET vCounter = vCounter + 1; + + END LOOP vWeekLoop; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `typeTagMake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `typeTagMake`(vTypeFk INT) +BEGIN +/* + * Plantilla para modificar reemplazar todos los tags + * por los valores que tienen los articulos + * + * @param vTypeFk tipo a modificar + * + */ + DELETE it.* + FROM itemTag it + JOIN item i ON i.id = it.itemFk + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, CONCAT(i.size,' cm'), 1 + FROM item i + JOIN tag t ON t.name = 'Longitud' COLLATE utf8_general_ci + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, i.category, 5 + FROM item i + JOIN tag t ON t.name = 'Categoria' COLLATE utf8_general_ci + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, ink.name, 2 + FROM item i + JOIN tag t ON t.name = 'Color' COLLATE utf8_general_ci + JOIN ink ON ink.id = i.inkFk + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, p.name, 3 + FROM item i + JOIN tag t ON t.name = 'Productor' COLLATE utf8_general_ci + JOIN producer p ON p.id = i.producerFk + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, o.name, 4 + FROM item i + JOIN tag t ON t.name = 'Origen' COLLATE utf8_general_ci + JOIN origin o ON o.id = i.originFk + WHERE i.typeFk = vTypeFk; + /* + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, i.stems, 6 + FROM item i + JOIN tag t ON t.name = 'Tallos' COLLATE utf8_general_ci + WHERE i.typeFk = vTypeFk; + */ +-- CALL itemTagArrangedUpdate(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 `updatePedidosInternos` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `updatePedidosInternos`(vItemFk INT) +BEGIN + + UPDATE vn.item SET upToDown = 0 WHERE item.id = vItemFk; + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `visible_getMisfit` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `visible_getMisfit`(vSectorFk INT) +BEGIN + + /* Devuelve una tabla temporal con los descuadres entre el visible teórico y lo ubicado en la práctica + * + * @param vSectorFk Identificador de vn.sector + * + * @return tmp.stockMisfit(itemFk, visible, parked) + */ + + DECLARE vCalcVisibleFk INT; + DECLARE vWarehouseFk INT; + + SELECT warehouseFk INTO vWarehouseFk + FROM vn.sector s + WHERE s.id = vSectorFk; + + CALL cache.visible_refresh(vCalcVisibleFk, FALSE, vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.stockMisfit; + + CREATE TEMPORARY TABLE tmp.stockMisfit( + itemFk INT PRIMARY KEY, + visible INT NOT NULL DEFAULT 0, + parked INT NOT NULL DEFAULT 0) + ENGINE = MEMORY; + + INSERT INTO tmp.stockMisfit(itemFk, parked) + SELECT iss.itemFk , sum(iss.visible ) + FROM vn.itemShelvingStock iss + JOIN vn.sector s ON s.id = iss.sectorFk + WHERE vSectorFk IN (s.id, s.sonFk) + GROUP BY iss.itemFk; + + INSERT INTO tmp.stockMisfit(itemFk, visible) + SELECT v.item_id , v.visible + FROM cache.visible v + WHERE v.calc_id = vCalcVisibleFk + ON DUPLICATE KEY UPDATE visible = v.visible; + + DELETE FROM tmp.stockMisfit + WHERE visible = parked; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `warehouseFitting` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting`(IN vWhOrigin INT , IN vWhDestiny INT) +BEGIN + DECLARE vCacheVisibleOriginFk INT; + DECLARE vCacheVisibleDestinyFk INT; + + CALL cache.visible_refresh(vCacheVisibleOriginFk, FALSE, vWhOrigin); + CALL cache.visible_refresh(vCacheVisibleDestinyFk, FALSE, vWhDestiny); + + SELECT i.id itemFk, + i.longName, + i.size, + i.subName, + vOrigin.visible AS Origen, + vDestiny.visible Destino + + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + LEFT JOIN cache.visible vOrigin ON vOrigin.calc_id = vCacheVisibleOriginFk AND vOrigin.item_id = i.id + LEFT JOIN cache.visible vDestiny ON vDestiny.calc_id = vCacheVisibleDestinyFk AND vDestiny.item_id = i.id + WHERE (vOrigin.visible OR vDestiny.visible) + AND it.categoryFk < 6 + ORDER BY IF(vOrigin.visible,0,1), longName, size, subName; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `warehouseFitting_byTravel` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `warehouseFitting_byTravel`(IN vTravelFk INT) +BEGIN + + DECLARE vWhOrigin INT; + DECLARE vWhDestiny INT; + + SELECT warehouseInFk, warehouseOutFk INTO vWhDestiny, vWhOrigin + FROM vn.travel + WHERE id = vTravelFk; + + CALL vn.warehouseFitting(vWhOrigin, vWhDestiny); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerCalculateBoss` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalculateBoss`(vWorker INT) +BEGIN +/** +* Actualiza la tabla workerBosses +* vWorker: id del trabajador +* +*/ + DECLARE vBoss INT; + DECLARE vWorkerCompare INT DEFAULT vWorker; + + l: LOOP + SELECT bossFk INTO vBoss + FROM vn.worker + WHERE id=vWorkerCompare; + + IF vBoss=0 OR vWorkerCompare=vBoss THEN + LEAVE l; + END IF; + + REPLACE INTO vn.workerBosses(workerFk,bossFk) + VALUES(vWorker,vBoss); + + SET vWorkerCompare = vBoss; + + 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 `workerCalendar_calculateBusiness` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateBusiness`(vYear INT, vBusinessFk INT) +BEGIN + +/** + * Calcula los días y horas de vacaciones en función de un contrato y año + * + * @param vYear + * @param vBusinessFk + * @return tmp.workerCalendarCalculateBusiness (days, hours, daysEnjoyed, hoursEnjoyed) + */ + + DECLARE vStarted DATE; + DECLARE vEnded DATE; + DECLARE vDaysHoliday DECIMAL(5,2); + DECLARE vHoursWeek DECIMAL(5,2); + DECLARE vDaysToSubtract DECIMAL(5,2); + DECLARE vDaysHolidayEnjoyed DECIMAL(5,2); + DECLARE vDifDays INT; + + SELECT IF(b.date_start < CONCAT(vYear,"-01-01"), CONCAT(vYear,"-01-01"),b.date_start), + IF(b.date_end IS NULL OR YEAR(b.date_end)>vYear , CONCAT(vYear,"-12-31"), b.date_end), + IF(wbt.hasHolidayEntitlement, w.days, 0), + c.hours_week + INTO vStarted, + vEnded, + vDaysHoliday, + vHoursWeek + FROM postgresql.business b + JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id + JOIN workerBusinessType wbt ON wbt.id = cod_contrato + JOIN postgresql.business_labour bl ON bl.business_id = b.business_id + JOIN workCenterHoliday w ON w.workcenterFk = bl.workcenter_id + LEFT JOIN postgresql.calendar_labour_type c ON c.calendar_labour_type_id=bl.calendar_labour_type_id + WHERE b.business_id = vBusinessFk + AND w.year = vYear; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateBusiness; + + IF vStarted < vEnded THEN + SET vDifDays = DAYOFYEAR(vEnded) - DAYOFYEAR(vStarted) + 1; + + SELECT IFNULL(SUM(holidayEntitlementRate), 0) , + SUM(-(discountRate - 1)) + INTO vDaysToSubtract, + vDaysHolidayEnjoyed + FROM workerCalendar w + JOIN absenceType a ON a.id = w.absenceTypeFk + WHERE w.businessFk = vBusinessFk + AND YEAR(dated) = vYear; + END IF; + + CREATE TEMPORARY TABLE tmp.workerCalendarCalculateBusiness + ENGINE = MEMORY + SELECT @days := IFNULL(ROUND((vDaysHoliday * (vDifDays - vDaysToSubtract) / IF(util.isLeapYear(vYear) , 366, 365)), 1), 0) days, + @days * (vHoursWeek / 5) hours, + @daysEnjoyed := IFNULL(ROUND(vDaysHolidayEnjoyed, 1), 0) daysEnjoyed, + @daysEnjoyed * (vHoursWeek / 5) hoursEnjoyed; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerCalendar_calculateBusiness__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateBusiness__`(vYear INT, vBusinessFk INT) +BEGIN + +/** + * Calcula los días y horas de vacaciones en función de un contrato y año + * + * @param vYear + * @param vBusinessFk + * @return tmp.workerCalendarCalculateBusiness (days, hours, daysEnjoyed, hoursEnjoyed) + */ + + DECLARE vStarted DATE; + DECLARE vEnded DATE; + DECLARE vDaysHoliday DECIMAL(5,2); + DECLARE vHoursWeek DECIMAL(5,2); + DECLARE vDaysToSubtract DECIMAL(5,2); + DECLARE vDaysHolidayEnjoyed DECIMAL(5,2); + DECLARE vDifDays INT; + + SELECT IF(b.date_start < CONCAT(vYear,"-01-01"), CONCAT(vYear,"-01-01"),b.date_start), + IF(b.date_end IS NULL OR YEAR(b.date_end)>vYear , CONCAT(vYear,"-12-31"), b.date_end), + IF(hasHolidayEntilement, w.days, 0), + c.hours_week + INTO vStarted, + vEnded, + vDaysHoliday, + vHoursWeek + FROM postgresql.business b + JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id + JOIN vn2008.payroll_contratos p ON p.CodContrato = cod_contrato + JOIN postgresql.business_labour bl ON bl.business_id = b.business_id + JOIN workCenterHoliday w ON w.workcenterFk = bl.workcenter_id + LEFT JOIN postgresql.calendar_labour_type c ON c.calendar_labour_type_id=bl.calendar_labour_type_id + WHERE b.business_id= vBusinessFk + AND w.year = vYear; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateBusiness; + + IF vStarted < vEnded THEN + SET vDifDays = DAYOFYEAR(vEnded) - DAYOFYEAR(vStarted) + 1; + + SELECT IFNULL(SUM(holidayEntitlementRate), 0) , + SUM(-(discountRate - 1)) + INTO vDaysToSubtract, + vDaysHolidayEnjoyed + FROM workerCalendar w + JOIN absenceType a ON a.id = w.absenceTypeFk + WHERE w.businessFk = vBusinessFk + AND YEAR(dated) = vYear; + END IF; + + CREATE TEMPORARY TABLE tmp.workerCalendarCalculateBusiness + ENGINE = MEMORY + SELECT @days := IFNULL(ROUND((vDaysHoliday * (vDifDays - vDaysToSubtract) / IF(util.isLeapYear(vYear) , 366, 365)), 1), 0) days, + @days * (vHoursWeek / 5) hours, + @daysEnjoyed := IFNULL(ROUND(vDaysHolidayEnjoyed, 1), 0) daysEnjoyed, + @daysEnjoyed * (vHoursWeek / 5) hoursEnjoyed; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerCalendar_calculateYear` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCalendar_calculateYear`(vYear INT, vWorkerFk INT) +BEGIN + +/** + * Calcula los días y horas de vacaciones en función de un trabajador y año + * + * @param vYear + * @param vWorkerFk + * @return tmp.workerCalendarCalculateYear (days, hours, daysEnjoyed, hoursEnjoyed) + */ + + DECLARE vDone BOOL; + DECLARE vBusinessFk INT; + + DECLARE cur CURSOR FOR + SELECT b.business_id + FROM postgresql.business b + LEFT JOIN postgresql.profile AS pr ON pr.profile_id = b.client_id + LEFT JOIN postgresql.person AS p ON p.person_id = pr.person_id + WHERE vYear BETWEEN YEAR(b.date_start) AND IFNULL(YEAR(b.date_end), vYear ) + AND p.id_trabajador = vWorkerFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerCalendarCalculateYear; + + CREATE TEMPORARY TABLE tmp.workerCalendarCalculateYear + (days DEC(5,2), + hours DEC(5,2), + daysEnjoyed DEC(5,2), + hoursEnjoyed DEC(5,2)) + ENGINE = MEMORY; + INSERT INTO tmp.workerCalendarCalculateYear VALUES(0, 0, 0, 0); + + OPEN cur; + + l: LOOP + SET vDone = FALSE; + FETCH cur INTO vBusinessFk; + + IF vDone THEN + LEAVE l; + END IF; + + CALL workerCalendar_calculateBusiness(vYear, vBusinessFk); + UPDATE tmp.workerCalendarCalculateYear w + JOIN tmp.workerCalendarCalculateBusiness wc + SET w.days = w.days + wc.days, + w.hours = w.hours + wc.hours, + w.daysEnjoyed = w.daysEnjoyed + wc.daysEnjoyed, + w.hoursEnjoyed = w.hoursEnjoyed + wc.hoursEnjoyed; + + DROP TEMPORARY TABLE tmp.workerCalendarCalculateBusiness; + + END LOOP; + + CLOSE cur; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerCreate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCreate`( + vFirstname VARCHAR(50), + vSurnames VARCHAR(50), + vWorkerCode CHAR(3), + vBossFk INT, + vUserFk INT +) +BEGIN +/** + * Create new worker + * + */ + INSERT INTO worker(id, code, firstName, lastName, userFk, bossFk) + VALUES (vUserFk, vWorkerCode, vFirstname, vSurnames, vUserFk, vBossFk); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` 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,lastName,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 `workerCreate__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerCreate__`( + vFirstname VARCHAR(50), + vSurnames VARCHAR(50), + vFi VARCHAR(9), + vWorkerCode CHAR(3), + vBossFk INT, + vUserFk INT +) +BEGIN +/** + * Create new worker + * + */ + INSERT INTO worker(code, firstName, lastName, fi, userFk, bossFk) + VALUES (vWorkerCode, vFirstname, vSurnames, vFi, vUserFk, vBossFk); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerDepartmentByDate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDepartmentByDate`(vDate DATE) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.workerDepartmentByDate; + CREATE TEMPORARY TABLE tmp.workerDepartmentByDate + ENGINE = MEMORY + SELECT + w.userFk, + p.name, + p.firstname, + d.name AS department, + d.id as departmentFk, + b.date_start, + d.isProduction, + CAST(12 * blp.importepactado / clt.hours_week / 52 AS DECIMAL(10,2)) as costeHora , + p.nif + + FROM postgresql.person p + JOIN postgresql.profile pr ON p.person_id = pr.person_id + JOIN postgresql.business b ON b.client_id = pr.profile_id + JOIN postgresql.business_labour bl ON bl.business_id = b.business_id + JOIN postgresql.calendar_labour_type clt ON clt.calendar_labour_type_id = bl.calendar_labour_type_id + JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id + JOIN vn.department d ON d.id = bl.department_id + JOIN vn.worker w ON w.id = p.id_trabajador + WHERE b.date_start <= vDate AND IFNULL(b.date_end,'3000-01-01') > vDate + ; + + -- SELECT * FROM tmp.workerDepartmentByDate; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_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`@`localhost` PROCEDURE `workerDisable`(vUserId int) +mainLabel:BEGIN + + IF (SELECT COUNT(*) FROM workerDisableExcluded WHERE workerFk = vUserId AND (dated > CURDATE() OR dated IS NULL)) > 0 THEN + LEAVE mainLabel; + END IF; + DELETE FROM account.account + WHERE id = vUserId; + + UPDATE account.user + SET role = 2 + WHERE id = vUserId; + + DELETE FROM pbx.sip + WHERE user_id = vUserId; + + UPDATE `client` c + JOIN payMethod p ON p.name = 'CONTADO' + SET c.credit = 0, c.payMethodFk = p.id, hasCoreVnl = FALSE + WHERE c.id = vUserId; + + UPDATE `client` c + SET c.salesPersonFk = null + WHERE c.salesPersonFk = 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 `workerDisableAll` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerDisableAll`() +BEGIN + DECLARE done BOOL DEFAULT FALSE; + DECLARE vUserFk INT; + + DECLARE rs CURSOR FOR + SELECT a.id + FROM ((SELECT * FROM (select date_end,date_start,business_id, client_id + FROM postgresql.business + ORDER BY client_id, date_end IS NULL DESC , date_end DESC) + c GROUP BY client_id) c + INNER JOIN postgresql.business b ON c.client_id = b.client_id AND c.business_id = b.business_id + INNER JOIN postgresql.profile pr ON b.client_id = pr.profile_id + INNER JOIN postgresql.person p ON pr.person_id = p.person_id + + INNER JOIN vn.worker w ON p.id_trabajador = w.id) + INNER JOIN account.account a ON w.userFk = a.id + WHERE ((b.date_end) IS NOT NULL + AND (b.date_end) < CURDATE() + AND (b.date_end) > TIMESTAMPADD(DAY, -70,CURDATE()) ); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + OPEN rs; + + FETCH rs INTO vUserFk; + + WHILE NOT done DO + CALL workerDisable(vUserFk); + FETCH rs INTO vUserFk; + + END WHILE; + + CLOSE rs; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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__` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `workerDisable__`(vUserId int) +mainLabel:BEGIN + + IF vUserId = 14255 THEN + LEAVE mainLabel; + END IF; + DELETE FROM account.account + WHERE id = vUserId; + + UPDATE account.user + SET role = 2 + WHERE id = vUserId; + + DELETE FROM pbx.sip + WHERE user_id = vUserId; + + UPDATE `client` c + JOIN payMethod p ON p.name = 'CONTADO' + SET c.credit = 0, c.payMethodFk = p.id, hasCoreVnl = FALSE + WHERE c.id = 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 `workerForAllCalculateBoss` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerForAllCalculateBoss`() +BEGIN +/** +* Actualiza la tabla workerBosses utilizando el procedimiento +* vn.workerCalculateBoss(), actualiza todos los trabajadores en esa tabla +* +*/ + DECLARE vWorker INT; + DECLARE vDone BOOL; + + DECLARE cur CURSOR FOR + SELECT id FROM worker; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + OPEN cur; + + l: LOOP + SET vDone = FALSE; + FETCH cur INTO vWorker; + + IF vDone THEN + LEAVE l; + END IF; + + CALL workerCalculateBoss(vWorker); + END LOOP; + + CLOSE cur; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerJourneyReplaceLauncher__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerJourneyReplaceLauncher__`() +BEGIN + + DECLARE vDateStart DATE; + DECLARE vDateEnd DATE; + + SET vDateStart = TIMESTAMPADD(MONTH,-1,CURDATE()); + SET vDateEnd = util.yesterday(); + + CALL vn.workerJourneyReplace(vDateStart,vDateEnd,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 `workerJourneyReplace__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerJourneyReplace__`(vFromDate DATE, vToDate DATE, vUserFk INT) +BEGIN + + /* Actualiza la tabla workerJourney para que actue como caché permanente revisable de las jornadas laborales. + * vUserFk es opcional. El valor 0 indica que se tenga en cuenta a todos los usuarios. + * + * PAK Julio '18 + */ + + DELETE + FROM workerJourney + WHERE dated BETWEEN vFromDate AND vToDate + AND isPaid = FALSE + AND isUpdated = FALSE + AND vUserFk IN (0,userFk); + + + -- Se inicia la tabla con todas las fechas posibles para cada uno de los trabajadores que han fichado en el rango de fechas. + INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) + SELECT w.userFk, tm.dated, b.business_id + FROM vn.worker w + JOIN postgresql.person pe ON pe.id_trabajador = w.id + JOIN postgresql.profile p ON p.person_id = pe.person_id + JOIN postgresql.business b ON b.client_id = p.profile_id + JOIN postgresql.business_labour bl ON bl.business_id = b.business_id + JOIN vn.time tm ON tm.dated BETWEEN b.date_start AND IFNULL(b.date_end,CURDATE()) + WHERE b.date_start <= vToDate + AND IFNULL(b.date_end, CURDATE()) >= vFromDate + -- AND bl.porhoras + AND vUserFk IN (0,w.userFk); + + + + + + -- Se actualiza la cantidad total de horas prácticas, así como el tiempo de almuerzo remunerado, si corresponde + + /*UPDATE workerJourney wj + JOIN workerTimeControl_Journey j ON wj.dated = j.dated AND wj.userFk = j.userFk + SET wj.total = j.Journey, + wj.lunch = IF(j.Journey < 5,0,0.33) + WHERE wj.dated BETWEEN vFromDate AND vToDate + AND wj.isPaid = FALSE + AND wj.isUpdated = FALSE + AND vUserFk IN (0,wj.userFk); */ + + + IF vUserFk = 0 THEN + CALL vn.timeControl_calculateAll( vFromDate , CONCAT(REPLACE(vToDate, '00:00:00', ''), ' 23:59:59')); + ELSE + CALL vn.timeControl_calculateByUser( vUserFk, vFromDate , CONCAT(REPLACE(vToDate, '00:00:00', ''), ' 23:59:59')); + END IF; + + UPDATE workerJourney wj + JOIN tmp.timeControlCalculate t ON wj.dated = t.dated AND wj.userFk = t.userFk + SET wj.total = CAST(IF(t.timeWorkDecimal >= 5.33,t.timeWorkDecimal-0.33,t.timeWorkDecimal) AS DECIMAL (10,2)), + wj.lunch = IF(t.timeWorkDecimal >= 5.33,0.33,0) + WHERE wj.dated BETWEEN vFromDate AND vToDate + AND wj.isPaid = FALSE + AND wj.isUpdated = FALSE + AND vUserFk IN (0,wj.userFk); + + DROP TEMPORARY TABLE tmp.timeControlCalculate; + + + + /********** NOCTURNIDAD ************/ + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControl; + + CREATE TEMPORARY TABLE tmp.workerTimeControl + SELECT w.*, 0 as Non + FROM vn.workerTimeControl w + WHERE timed BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,userFk) + ORDER BY userFk, timed; + + -- Regalamos un segundo para evitar que hayan fichadas en las horas claves de inicio y fin de la nocturnidad. + UPDATE tmp.workerTimeControl + SET timed = TIMESTAMPADD(SECOND,-1,timed) + WHERE TIME(timed) IN ('06:00:00','22:00:00'); + + -- Fichada virtual a las 6:00 h, hora en que empieza la jornada diurna + INSERT INTO tmp.workerTimeControl(userFk, timed) + SELECT userFk, TIMESTAMPADD(HOUR, 6, DATE(timed)) + FROM vn.workerTimeControl + WHERE vUserFk IN (0,userFk) + GROUP BY userFk, DATE(timed); + + -- Fichada virtual a las 22:00 h, momento en que empieza la jornada nocturna. + INSERT INTO tmp.workerTimeControl(userFk, timed) + SELECT userFk, TIMESTAMPADD(HOUR, 22, DATE(timed)) + FROM vn.workerTimeControl + WHERE vUserFk IN (0,userFk) + GROUP BY userFk, DATE(timed); + + -- Establece el orden en que se han de leer las fichadas + CALL vn.workerTimeControlSetOrder; + + -- Marca los impares para facilitar la consulta siguiente + UPDATE tmp.workerTimeControl + SET Non = 1 + WHERE `order` mod 2; + + -- Actualizamos la nocturnidad + UPDATE workerJourney wj + JOIN + ( SELECT userFk, Dia, sum(Nocturnidad) as Nocturnidad FROM + ( + SELECT userFk, + date(timed) as Dia, + (( + IF( TIME(timed) < '06:00:00' OR (TIME(timed) = '06:00:00' AND Non = FALSE ) , IF(Non,-1,1),0) + + + IF(TIME(timed) > '22:00:00' OR (TIME(timed) = '22:00:00' AND Non = TRUE), If(Non,-1,1),0) + ) + * (HOUR(`timed`) + MINUTE(`timed`) / 60) + ) as Nocturnidad + FROM tmp.workerTimeControl + ) sub + GROUP BY Dia, userFk + HAVING Nocturnidad + ) night ON night.userFk = wj.userFk AND night.Dia = wj.dated + SET wj.nocturn = night.Nocturnidad + WHERE wj.isPaid = FALSE AND isUpdated = FALSE; + + -- Horas téoricas y precio de la hora ordinaria + UPDATE vn.workerJourney wj + JOIN postgresql.business_labour_payroll blp ON blp.business_id = wj.businessFk + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + JOIN postgresql.calendar_labour_type pclt ON pclt.calendar_labour_type_id = bl.calendar_labour_type_id + SET wj.priceOrdinaryHour = (12 * blp.importepactado) / (52 * pclt.hours_week), + wj.contractJourney = pclt.hours_week/5 + WHERE wj.dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,wj.userFk) + AND wj.isPaid = FALSE + AND isUpdated = FALSE; + + -- Precio Extras, Vacaciones y Nocturnas + UPDATE vn.workerJourney wj + JOIN + ( + SELECT dated, hollidayInc, nightInc, extraInc + FROM ( + SELECT tm.dated , hollidayInc, nightInc, extraInc + FROM vn.time tm + JOIN vn.workerHourPrice whp ON tm.dated >= whp.dated + ORDER BY tm.dated, whp.dated DESC + ) sub + GROUP BY dated + ) conv ON conv.dated = wj.dated + SET wj.priceHollydayHour = wj.priceOrdinaryHour * conv.hollidayInc, + wj.priceNocturnHour = wj.priceOrdinaryHour * conv.nightInc, + wj.priceExtraHour = wj.priceOrdinaryHour * conv.extraInc + WHERE wj.dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,wj.userFk) + AND wj.isPaid = FALSE + AND wj.isUpdated = FALSE; + + -- Elimina el precio de las horas extras para los contratos parciales. + UPDATE vn.workerJourney wj + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + JOIN postgresql.calendar_labour_type clt ON clt.calendar_labour_type_id = bl.calendar_labour_type_id + SET wj.priceExtraHour = 0 + WHERE clt.isPartial + AND wj.dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,wj.userFk) + AND wj.isPaid = FALSE + AND wj.isUpdated = FALSE; + + -- Bajas, vacaciones y festivos personales + /* UPDATE vn.workerJourney wj + JOIN postgresql.calendar_employee pce ON pce.date = wj.dated AND pce.business_id = wj.businessFk + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + SET wj.permission = IF(pce.calendar_state_id = 6, 0.5, 1) * wj.contractJourney, + wj.contractJourney = IF(pce.calendar_state_id = 6, 0.5, 0) * wj.contractJourney,-- Vacaciones medio dia + wj.hollyday = wj.total - IF(pce.calendar_state_id = 6, 0.5, 0) * wj.contractJourney + WHERE wj.dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,wj.userFk) + AND wj.isPaid = FALSE + AND wj.isUpdated = FALSE;*/ + + UPDATE vn.workerJourney wj + JOIN postgresql.calendar_employee pce ON pce.date = wj.dated AND pce.business_id = wj.businessFk + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + JOIN postgresql.calendar_state cs ON cs.calendar_state_id = pce.calendar_state_id + SET wj.permission = cs.permissionRate * wj.contractJourney, + wj.contractJourney = IF(cs.permissionRate = 1, 0, cs.permissionRate) * wj.contractJourney, + wj.hollyday = wj.total - IF(cs.permissionRate = 1, 0, cs.permissionRate) * wj.contractJourney + WHERE cs.permissionRate > 0 + AND wj.dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,wj.userFk) + AND wj.isPaid = FALSE + AND wj.isUpdated = FALSE; + + + + + -- Festivos por centro de trabajo +UPDATE vn.workerJourney wj + JOIN vn.calendarHolidays ch ON ch.dated = wj.dated + JOIN postgresql.business_labour pbl ON wj.businessFk = pbl.business_id AND pbl.workcenter_id = ch.workcenterFk + SET wj.hollyday = wj.total, + wj.permission = wj.contractJourney, + wj.contractJourney = 0 + WHERE wj.dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,wj.userFk) + AND wj.isPaid = FALSE + AND wj.isUpdated = FALSE; + + -- Domingos + UPDATE vn.workerJourney + SET hollyday = total, + contractJourney = 0 + WHERE weekday(dated) = 6 + AND dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,userFk) + AND isPaid = FALSE + AND isUpdated = FALSE; + + -- Sábados + UPDATE vn.workerJourney + SET contractJourney = 0 + WHERE weekday(dated) = 5 + AND dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,userFk) + AND isPaid = FALSE + AND isUpdated = FALSE; + + + -- Horas extras + UPDATE workerJourney + SET extra = lunch + total - contractJourney + WHERE dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,userFk) + AND isPaid = FALSE + AND isUpdated = FALSE; + + -- Contratos NO por horas + INSERT IGNORE INTO workerJourney( userFk, + dated, + businessFk, + priceOrdinaryHour, + contractJourney, + total) + SELECT w.userFk, + tm.dated, + b.business_id, + (12 * blp.importepactado) / (52 * pclt.hours_week) as priceOrdinaryHour, + IF(weekday(tm.dated) IN (5,6),0, pclt.hours_week/5) as contractJourney, + IF(weekday(tm.dated) IN (5,6),0, pclt.hours_week/5) as total + FROM vn.worker w + JOIN postgresql.person pe ON pe.id_trabajador = w.id + JOIN postgresql.profile p ON p.person_id = pe.person_id + JOIN postgresql.business b ON b.client_id = p.profile_id + JOIN postgresql.business_labour bl ON bl.business_id = b.business_id + JOIN postgresql.calendar_labour_type pclt ON pclt.calendar_labour_type_id = bl.calendar_labour_type_id + JOIN postgresql.business_labour_payroll blp ON blp.business_id = b.business_id + JOIN vn.time tm ON tm.dated BETWEEN b.date_start AND IFNULL(b.date_end,CURDATE()) + WHERE b.date_start <= vToDate + AND IFNULL(b.date_end, CURDATE()) >= vFromDate + AND bl.porhoras = FALSE + AND vUserFk IN (0,w.userFk); + + -- Elimina dias sin fichadas ni contrato + /* DELETE FROM workerJourney + WHERE contractJourney = 0 + AND total = 0 + AND permission = 0 + AND dated BETWEEN vFromDate AND vToDate + AND vUserFk IN (0,userFk) + AND isPaid = FALSE + AND isUpdated = 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 `workerJourney_replace` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerJourney_replace`(vDatedFrom DATE, vDatedTo DATE, vWorkerFk INT) +BEGIN +/** + * Actualiza la tabla workerJourney para que actue como caché permanente revisable de las jornadas laborales. + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + * @param vWorkerFk, en caso de pasar 0 ó NULL se aplica a todos + */ + + DECLARE vDatedTimeTo DATETIME; + DECLARE vMaxTimePerDay INT; + DECLARE vMinHoursToBreak DECIMAL(10,2); + DECLARE vBreakHours DECIMAL(10,2); + DECLARE vMonthByYear INT; + DECLARE vWeeksByYear INT DEFAULT 52; + DECLARE vMonthsByYear INT DEFAULT 12; + DECLARE vDaysByWeek INT DEFAULT 5; + DECLARE vDatedFromYesterday DATETIME; + DECLARE vDatedToTomorrow DATETIME; + + SELECT DATE_SUB(vDatedFrom, INTERVAL 1 DAY), DATE_ADD(vDatedTo, INTERVAL 1 DAY) + INTO vDatedFromYesterday, vDatedToTomorrow; + + SET vDatedTimeTo = util.dayEnd(vDatedTo); + + SELECT minHoursToBreak, breakHours, maxTimePerDay + INTO vMinHoursToBreak, vBreakHours, vMaxTimePerDay + FROM workerTimeControlConfig; + + DELETE FROM workerJourney + WHERE dated BETWEEN vDatedFrom AND vDatedTo + AND NOT isPaid + AND NOT isUpdated + AND (vWorkerFk IS NULL OR userFK = vWorkerFk); + + -- Se inserta todos los días del periodo por worker y business en el rango de fechas. + INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) + SELECT w.workerFk, t.dated, w.businessFk + FROM workerLabour w + JOIN time t ON t.dated BETWEEN w.started AND IFNULL(w.ended,CURDATE()) + WHERE t.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR w.workerFk = vWorkerFk) + ORDER BY w.workerFk, t.dated, w.businessFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.`user`; + + IF vWorkerFk THEN + CALL timeControl_calculateByUser(vWorkerFk, vDatedFrom , vDatedTimeTo); + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` + SELECT vWorkerFk userFk; + ELSE + CALL timeControl_calculateAll(vDatedFrom, vDatedTimeTo); + CREATE TEMPORARY TABLE IF NOT EXISTS tmp.`user` + SELECT id userFk + FROM vn.worker w; + END IF; + + UPDATE workerJourney wj + JOIN tmp.timeControlCalculate t ON wj.dated = t.dated AND wj.userFk = t.userFk + SET wj.total = CAST(IF(t.timeWorkDecimal >= vMinHoursToBreak, t.timeWorkDecimal - vBreakHours, t.timeWorkDecimal) AS DECIMAL (10,2)), + wj.lunch = IF(t.timeWorkDecimal >= vMinHoursToBreak , vBreakHours , 0) + WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo + AND NOT wj.isPaid + AND NOT wj.isUpdated + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk); + + -- NOCTURNIDAD + CALL vn.timeControl_getError(vDatedFrom, vDatedTimeTo); + + SET @vIsOdd := TRUE; + SET @vDated := NULL; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControl; + CREATE TEMPORARY TABLE tmp.workerTimeControl + (INDEX (userFk), INDEX (timed)) + ENGINE = MEMORY + SELECT DISTINCT(wtc.id), + wtc.userFk, + wtc.timed, + wtc.direction + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id + WHERE wtc.timed BETWEEN vDatedFrom AND vDatedToTomorrow + AND tce.id IS NULL + AND (vWorkerFk IS NULL OR wtc.userFk = vWorkerFk) + ORDER BY wtc.userFk, wtc.timed ASC; + + SELECT MAX(id) INTO @vCont + FROM tmp.workerTimeControl; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlAux; + CREATE TEMPORARY TABLE tmp.workerTimeControlAux ( + `id` int(11) , + `userFk` int(10) unsigned , + `timed` datetime, + `direction` enum('in', 'out','middle') + ) ENGINE=MEMORY; + + SET @counter := 0; + SET @vIsOdd := FALSE; + + -- Cambio de dia en medio de un descanso + INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) + SELECT @vCont:= @vCont + 1 id, userFk, util.dayEnd(dated) timed, 'middle' direction + FROM(SELECT wtc.userFk, + DATE(@lastTimed) dated, + (@vIsOdd := NOT @vIsOdd) isOdd, + IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, + @lastTimed := wtc.timed + FROM tmp.workerTimeControl wtc + ORDER BY wtc.userFk, wtc.timed + )sub + WHERE hasBreak; + + SET @counter := 0; + SET @vIsOdd := FALSE; + + INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) + SELECT @vCont:= @vCont + 1, userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'middle' + FROM(SELECT wtc.userFk, + DATE(@lastTimed) dated, + (@vIsOdd := NOT @vIsOdd) isOdd, + IF(@vIsOdd AND wtc.direction = 'middle' AND DATE(timed) <> DATE(@lastTimed), TRUE, FALSE) hasBreak, + @lastTimed := wtc.timed + FROM tmp.workerTimeControl wtc + ORDER BY wtc.userFk, wtc.timed + )sub + WHERE hasBreak; + + -- Cambio de dia + INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) + SELECT @vCont:= @vCont + 1 id, sub.userFk, util.dayEnd(sub.dated) timed, 'out' direction + FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id + WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow + AND tce.id IS NULL + GROUP BY wtc.userFk, DATE(wtc.timed) + ) sub + JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk + WHERE wtc.direction <> 'out'; + + INSERT INTO tmp.workerTimeControlAux (id, userFk, timed, direction) + SELECT @vCont:= @vCont + 1, sub.userFk, DATE_ADD(sub.dated, INTERVAL 1 DAY), 'in' + FROM (SELECT MAX(wtc.timed) timed, wtc.userFk, date(wtc.timed) dated + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id + WHERE wtc.timed BETWEEN vDatedFromYesterday AND vDatedToTomorrow + AND tce.id IS NULL + GROUP BY wtc.userFk, DATE(wtc.timed) + ) sub + JOIN tmp.workerTimeControl wtc ON wtc.timed = sub.timed AND wtc.userFk = sub.userFk + WHERE wtc.direction <> 'out'; + + INSERT INTO tmp.workerTimeControl (id, userFk, timed, direction) + SELECT id, userFk, timed, direction + FROM tmp.workerTimeControlAux; + + UPDATE workerJourney wj + JOIN (SELECT sub.dated, userFk, SUM(NigthlyHours) NigthlyHours + FROM(SELECT (@vIsOdd := NOT @vIsOdd) isOdd, + IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd), + IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed), + IF(direction='in', @vDated := DATE(wtc.timed), @vDated ) dated, + wtc.userFk, + IF(UNIX_TIMESTAMP(timed)- @vLastTimed < vMaxTimePerDay, + vn.workerNigthlyHours_calculate(FROM_UNIXTIME(@vLastTimed), wtc.timed), + 0) NigthlyHours + FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction + FROM tmp.workerTimeControl wtc + LEFT JOIN tmp.timeControlError tce ON tce.id = wtc.id + WHERE wtc.timed BETWEEN vDatedFrom AND util.dayEnd(vDatedToTomorrow) + AND tce.id IS NULL + ORDER BY userFk, timed ASC + ) wtc + )sub + WHERE sub.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY userFk, sub.dated + )night ON night.userFk = wj.userFk AND night.dated = wj.dated + SET wj.nocturn = night.NigthlyHours + WHERE NOT wj.isPaid + AND NOT isUpdated + AND night.NigthlyHours <> 0; + + -- Horas téoricas y precio de la hora ordinaria + UPDATE workerJourney wj + JOIN postgresql.business_labour_payroll blp ON blp.business_id = wj.businessFk + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + SET wj.priceOrdinaryHour = (vMonthsByYear * blp.importepactado) / (vWeeksByYear * cl.hours_week), + wj.contractJourney = cl.hours_week / vDaysByWeek + WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT isUpdated; + + -- Precio Extras, Vacaciones y Nocturnas + UPDATE workerJourney wj + JOIN(SELECT MAX(w.dated), t.dated, w.holidayInc, w.nightInc, w.extraInc + FROM time t + JOIN workerHourPrice w ON w.dated <= t.dated + WHERE t.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY t.dated + ) sub ON sub.dated = wj.dated + SET wj.priceHolidayHour = wj.priceOrdinaryHour * sub.holidayInc, + wj.priceNocturnHour = wj.priceOrdinaryHour * sub.nightInc, + wj.priceExtraHour = wj.priceOrdinaryHour * sub.extraInc + WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT wj.isUpdated; + + -- Elimina el precio de las horas extras para los contratos parciales. + UPDATE workerJourney wj + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + SET wj.priceExtraHour = 0 + WHERE cl.isPartial + AND wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT wj.isUpdated; + + -- Ausencias + UPDATE workerJourney wj + JOIN businessCalendar bc ON bc.businessFk = wj.businessFk AND bc.dated = wj.dated + JOIN absenceType ab ON ab.id = bc.absenceTypeFk + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + SET wj.permission = ab.permissionRate * wj.contractJourney, + wj.contractJourney = IF(ab.permissionRate = 1, 0, ab.permissionRate) * wj.contractJourney + WHERE ab.permissionRate > 0 + AND wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT wj.isUpdated; + + -- Sábados / Domingos + UPDATE workerJourney + SET holiday = IF(DAYNAME(dated)='sábado', 0, total), + contractJourney = 0 + WHERE DAYNAME(dated) IN ('sábado', 'domingo') + AND dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR userFk = vWorkerFk) + AND NOT isPaid + AND NOT isUpdated; + + -- Festivos por centro de trabajo + UPDATE workerJourney wj + JOIN calendarHolidays ch ON ch.dated = wj.dated + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + AND bl.workcenter_id = ch.workcenterFk + SET wj.holiday = wj.total, + wj.permission = wj.contractJourney, + wj.contractJourney = 0 + WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT wj.isUpdated; + + -- Horas extras + UPDATE workerJourney + SET extra = lunch + total - contractJourney + WHERE dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR userFk = vWorkerFk) + AND NOT isPaid + AND NOT isUpdated; + + DROP TEMPORARY TABLE tmp.timeControlCalculate; + DROP TEMPORARY TABLE tmp.`user`; + DROP TEMPORARY TABLE tmp.timeControlError; + DROP TEMPORARY TABLE tmp.workerTimeControlAux; + DROP TEMPORARY TABLE tmp.workerTimeControl; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerJourney_replace__` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `workerJourney_replace__`(vDatedFrom DATE, vDatedTo DATE, vWorkerFk INT) +BEGIN +/** + * Actualiza la tabla workerJourney para que actue como caché permanente revisable de las jornadas laborales. + * @param vDatedFrom workerTimeControl + * @param vDatedTo workerTimeControl + * @param vWorkerFk, en caso de pasar 0 ó NULL se aplica a todos + */ + + DECLARE vDatedTimeTo DATETIME; + DECLARE vMaxTimePerDay INT; + DECLARE vMinHoursToBreak DECIMAL(10,2); + DECLARE vBreakHours DECIMAL(10,2); + DECLARE vMonthByYear INT; + DECLARE vWeeksByYear INT DEFAULT 52; + DECLARE vMonthsByYear INT DEFAULT 12; + DECLARE vDaysByWeek INT DEFAULT 5; + + SET vDatedTimeTo = util.dayEnd(vDatedTo); + + SELECT minHoursToBreak, breakHours, maxTimePerDay + INTO vMinHoursToBreak, vBreakHours, vMaxTimePerDay + FROM workerTimeControlConfig; + + DELETE FROM workerJourney + WHERE dated BETWEEN vDatedFrom AND vDatedTo + AND NOT isPaid + AND NOT isUpdated + AND (vWorkerFk IS NULL OR userFK = vWorkerFk); + + -- Se inserta todos los días del periodo por worker y business en el rango de fechas. + INSERT IGNORE INTO workerJourney(userFk, dated, businessFk) + SELECT w.workerFk, t.dated, w.businessFk + FROM workerLabour w + JOIN time t ON t.dated BETWEEN w.started AND IFNULL(w.ended,CURDATE()) + WHERE t.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR w.workerFk = vWorkerFk) + ORDER BY w.workerFk, t.dated, w.businessFk; + + IF vWorkerFk THEN + CALL timeControl_calculateByUser(vWorkerFk, vDatedFrom , vDatedTimeTo); + ELSE + CALL timeControl_calculateAll(vDatedFrom, vDatedTimeTo); + END IF; + + UPDATE workerJourney wj + JOIN tmp.timeControlCalculate t ON wj.dated = t.dated AND wj.userFk = t.userFk + SET wj.total = CAST(IF(t.timeWorkDecimal >= vMinHoursToBreak, t.timeWorkDecimal - vBreakHours, t.timeWorkDecimal) AS DECIMAL (10,2)), + wj.lunch = IF(t.timeWorkDecimal >= vMinHoursToBreak , vBreakHours , 0) + WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo + AND NOT wj.isPaid + AND NOT wj.isUpdated + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk); + + -- NOCTURNIDAD + + SET @vIsOdd := TRUE; + SET @vDated := NULL; + CALL vn.workerTimeControl_calculateOddDays(); + + UPDATE workerJourney wj + JOIN (SELECT sub.dated, userFk, SUM(NigthlyHours) NigthlyHours + FROM(SELECT IF(@vIsOdd, @vIsOdd := FALSE, @vIsOdd := TRUE), + IF(direction='in', @vIsOdd := TRUE, @vIsOdd := @vIsOdd), + IF(@vIsOdd, @vLastTimed:=UNIX_TIMESTAMP(timed),@vLastTimed:=@vLastTimed), + IF(direction='in', @vDated := DATE(wtc.timed), @vDated :=@vDated) dated, + wtc.userFk, + IF(UNIX_TIMESTAMP(timed)- @vLastTimed < vMaxTimePerDay, + vn.workerNigthlyHours_calculate(FROM_UNIXTIME(@vLastTimed), wtc.timed), + 0) NigthlyHours + FROM (SELECT DISTINCT(wtc.id), wtc.userFk, wtc.timed, wtc.direction + FROM workerTimeControl wtc + WHERE wtc.timed BETWEEN vDatedFrom AND util.dayEnd(DATE_ADD(vDatedTo, INTERVAL 1 DAY)) + ORDER BY userFk, timed ASC + ) wtc + )sub + LEFT JOIN tmp.workerTimeControlOddDays wo ON wo.workerFk = sub.userFk + AND wo.dated = sub.dated + WHERE sub.dated BETWEEN vDatedFrom AND vDatedTo + AND wo.workerFk IS NULL + GROUP BY userFk, sub.dated + )night ON night.userFk = wj.userFk AND night.dated = wj.dated + SET wj.nocturn = night.NigthlyHours + WHERE NOT wj.isPaid + AND NOT isUpdated + AND night.NigthlyHours <> 0; + + -- Horas téoricas y precio de la hora ordinaria + UPDATE workerJourney wj + JOIN postgresql.business_labour_payroll blp ON blp.business_id = wj.businessFk + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + SET wj.priceOrdinaryHour = (vMonthsByYear * blp.importepactado) / (vWeeksByYear * cl.hours_week), + wj.contractJourney = cl.hours_week / vDaysByWeek + WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT isUpdated; + + -- Precio Extras, Vacaciones y Nocturnas + UPDATE workerJourney wj + JOIN(SELECT MAX(w.dated), t.dated, w.holidayInc, w.nightInc, w.extraInc + FROM time t + JOIN workerHourPrice w ON w.dated <= t.dated + WHERE t.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY t.dated + ) sub ON sub.dated = wj.dated + SET wj.priceHolidayHour = wj.priceOrdinaryHour * sub.holidayInc, + wj.priceNocturnHour = wj.priceOrdinaryHour * sub.nightInc, + wj.priceExtraHour = wj.priceOrdinaryHour * sub.extraInc + WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT wj.isUpdated; + + -- Elimina el precio de las horas extras para los contratos parciales. + UPDATE workerJourney wj + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = bl.calendar_labour_type_id + SET wj.priceExtraHour = 0 + WHERE cl.isPartial + AND wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT wj.isUpdated; + + -- Ausencias + UPDATE workerJourney wj + JOIN businessCalendar bc ON bc.businessFk = wj.businessFk AND bc.dated = wj.dated + JOIN absenceType ab ON ab.id = bc.absenceTypeFk + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + SET wj.permission = ab.permissionRate * wj.contractJourney, + wj.contractJourney = IF(ab.permissionRate = 1, 0, ab.permissionRate) * wj.contractJourney + WHERE ab.permissionRate > 0 + AND wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT wj.isUpdated; + + -- Sábados / Domingos + UPDATE workerJourney + SET holiday = IF(DAYNAME(dated)='sábado', 0, total), + contractJourney = 0 + WHERE DAYNAME(dated) IN ('sábado', 'domingo') + AND dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR userFk = vWorkerFk) + AND NOT isPaid + AND NOT isUpdated; + + -- Festivos por centro de trabajo + UPDATE workerJourney wj + JOIN calendarHolidays ch ON ch.dated = wj.dated + JOIN postgresql.business_labour bl ON bl.business_id = wj.businessFk + AND bl.workcenter_id = ch.workcenterFk + SET wj.holiday = wj.total, + wj.permission = wj.contractJourney, + wj.contractJourney = 0 + WHERE wj.dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR wj.userFk = vWorkerFk) + AND NOT wj.isPaid + AND NOT wj.isUpdated; + + -- Horas extras + UPDATE workerJourney + SET extra = lunch + total - contractJourney + WHERE dated BETWEEN vDatedFrom AND vDatedTo + AND (vWorkerFk IS NULL OR userFk = vWorkerFk) + AND NOT isPaid + AND NOT isUpdated; + + DROP TEMPORARY TABLE tmp.timeControlCalculate; + DROP TEMPORARY TABLE tmp.workerTimeControlOddDays; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerMistakeType_get` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistakeType_get`() +BEGIN + +/** + * Obtiene los tipos de error para los trabajadores + */ + + SELECT code, description + FROM workerMistakeType + ORDER BY description; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerMistake_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10), vUserFk INT ) +BEGIN + +/** + * Añade error al trabajador + * + * @param vWorkerFk id del trabajador al cual se le va a añadir error + * @param vWorkerMistakeTypeFk code del tipo de error + * @param vUserFk id del usuario que pone el error + * + */ + DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vUserFk); + + IF(account.user_hasRole(vWorkerName,'coolerBoss')) + THEN + INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk) + VALUES(vWorkerFk, vWorkerMistakeTypeFk); + ELSE + CALL util.throw('No tienes permisos para realizar la acción'); + + 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 `workerShelving_Add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerShelving_Add`(vWorkerFk INT, vBarcode VARCHAR(12)) +BEGIN +/* + * Inserta en workerShelving asociando los carros al trabajador + * @Param vWorkerFk es id del trabajador + * @Param vBarcode se puede pasar tanto el smarttag como el shelving + */ + DECLARE vIsShelvingFk BOOL; + + SELECT COUNT(*) > 0 INTO vIsShelvingFk + FROM vn.shelving s + WHERE s.code = vBarcode COLLATE utf8_general_ci; + + IF NOT vIsShelvingFk THEN + + SELECT st.shelvingFk INTO vBarcode + FROM vn.smartTag st + WHERE st.code = vBarcode COLLATE utf8_general_ci; + + END IF; + + INSERT INTO vn.workerShelving (workerFk, shelvingFk) + VALUES(vWorkerFk, vBarcode); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerShelving_delete` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerShelving_delete`(vWorkerFk INT, vBarcode VARCHAR(12)) +BEGIN +/* + * Borra de workerShelving el carro o etiqueta insertado por el trabajador + * @param vWorkerFk es id del trabajador + * @param vBarcode se puede pasar tanto el smarttag como el shelving + */ + DECLARE vIsShelvingFk BOOL; + + + SELECT COUNT(*) > 0 INTO vIsShelvingFk + FROM vn.shelving s + WHERE s.code = vBarcode COLLATE utf8_general_ci; + + + IF NOT vIsShelvingFk THEN + + SELECT st.shelvingFk INTO vBarcode + FROM vn.smartTag st + WHERE st.code = vBarcode COLLATE utf8_general_ci; + + END IF; + + DELETE FROM vn.workerShelving + WHERE shelvingFk = vBarcode COLLATE utf8_general_ci + AND workerFk = vWorkerFk ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControlAdd` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlAdd`(IN vUserFk INT, IN vWarehouseFk INT, IN vDated DATETIME) +BEGIN + + /*INSERT INTO workerTimeControl(userFk, timed, manual, warehouseFk) + VALUES(vUserFk, vDated, FALSE, vWarehouseFk); + + CALL vn.workerTimeControlSOWP(vUserFk , vDated);*/ + + CALL vn.workerTimeControl_add(vUserFk,vWarehouseFk,NOW(),FALSE); + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlNonDays__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlNonDays__`() +BEGIN + SET @cont := 0; + SELECT sub2.userFk, sub2.dated Fecha, CONCAT (w.firstName," ", w.lastName) worker, au.name Boss, d.name + FROM (SELECT userFk, + dated, + COUNT(*) cont2 + FROM (SELECT DATE(wtc.timed) dated, + userFk, + IFNULL(@cont, @cont := 0 ), + IF(direction = 'in', @cont:=@cont+1, TRUE), + @cont cont + FROM vn.workerTimeControl wtc + WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND CURDATE() + ORDER BY userFk, timed)sub + GROUP BY cont + HAVING cont2 MOD 2 = 1)sub2 + JOIN worker w ON w.userFk = sub2.userFk + LEFT JOIN worker wb ON wb.id = w.bossFk + LEFT JOIN account.user au ON au.id = wb.userFK + LEFT JOIN workerDepartment wd ON wd.workerFk = w.id + LEFT JOIN department d ON d.id = wd.departmentFk + ORDER BY Boss ASC; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControlPinGenerate` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlPinGenerate`( + vWorkerFk INT) +BEGIN +/** + * Create new pin for workerFk or new pin for all workers if vWorkerFk is null + * + */ + + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSetOrder` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSetOrder`() +BEGIN + + SET @order := 1; + SET @userFk := 0; + SET @day := 0; + + UPDATE tmp.workerTimeControl + SET `order` = IF(userFk = @userFk AND day(timed) = @day, @order := @order + 1, @order := 1), + userFk = @userFk := userFk, + manual = manual + (0 * @day := day(timed)) + ORDER BY userFk, timed; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControlSetOrder_by_User_and_dateRange` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSetOrder_by_User_and_dateRange`(vUserFk INT, vStarted DATE, vFinished DATE) +BEGIN + + SET @order := 0; + SET @day := '2000-01-01'; + + UPDATE vn.workerTimeControl w + SET w.`order` = @order := IF(@day = @day := date(timed), @order, 0) + 1 + WHERE w.userFk = vUserFk + AND w.timed BETWEEN vStarted AND util.dayend(vFinished) + ORDER BY w.timed; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControlSOWP` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControlSOWP`(IN vUserFk INT, IN vDated DATE) +BEGIN + SET @order := 0; + + UPDATE workerTimeControl + SET `order` = @order := @order + 1 + WHERE vUserFk =userFk + AND vDated = DATE(timed) + ORDER BY timed; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_add` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_add`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL) +BEGIN + + + SELECT workerTimeControl_add(vUserFk,vWarehouseFk,vTimed,vIsManual); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_add__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_add__`(IN vUserFk INT, IN vWarehouseFk INT, IN vTimed DATETIME, IN vIsManual BOOL) +BEGIN + + DECLARE vDirection VARCHAR(6); + DECLARE vLastIn DATETIME; + DECLARE vDayStayMax INT; + DECLARE vHasDirectionOut INT; + + SELECT dayStayMax INTO vDayStayMax + FROM vn.workerTimeControlParams; + + SELECT vn.timeWorkerControl_getDirection(vUserFk,vTimed) INTO vDirection; + + IF vDirection = 'out' THEN + + SELECT MAX(timed) INTO vLastIn + FROM vn.workerTimeControl + WHERE userFk = vUserFk + AND direction = 'in' + AND timed < vTimed; + + UPDATE vn.workerTimeControl wtc + SET wtc.direction = 'middle' + WHERE userFk = vUserFk + AND direction = 'out' + AND timed BETWEEN vLastIn AND vTimed; + + ELSE IF vDirection = 'in' THEN + + SELECT COUNT(*) INTO vHasDirectionOut + FROM vn.workerTimeControl wtc + WHERE userFk = vUserFk + AND direction = 'out' + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + + UPDATE vn.workerTimeControl wtc + SET wtc.direction = IF (vHasDirectionOut,'middle','out') + WHERE userFk = vUserFk + AND direction = 'in' + AND timed BETWEEN vTimed AND TIMESTAMPADD(SECOND, 50400, vTimed); + + END IF; + END IF; + + INSERT INTO workerTimeControl(userFk, timed, warehouseFk, direction, manual) + VALUES(vUserFk, vTimed, vWarehouseFk, vDirection, vIsManual); + + CALL vn.workerTimeControlSOWP(vUserFk, vTimed); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_calculateOddDays` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_calculateOddDays`() +BEGIN +/* + * Calculo de las fichadas impares por empleado y dia + * @return tmp.workerTimeControlOddDays (userFk, dated) + */ + SET @cont := FALSE; + SET @lastUserFk:= NULL; + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlOddDays; + CREATE TEMPORARY TABLE tmp.workerTimeControlOddDays + SELECT sub2.userFk workerFk, sub2.dated + FROM (SELECT userFk, + dated, + COUNT(*) cont2 + FROM (SELECT DATE(wtc.timed) dated, + userFk, + IFNULL(@cont, @cont := TRUE ), + IF(direction = 'in' OR userFk <> @lastUserFk, @cont := @cont+1, TRUE), + @cont cont, + @lastUserFk := userFk + FROM workerTimeControl wtc + WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND util.dayEnd(CURDATE()) + ORDER BY userFk, timed)sub + GROUP BY cont + HAVING cont2 MOD 2 = 1)sub2 + JOIN worker w ON w.userFk = sub2.userFk; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControl_check` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_check`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) +proc: BEGIN +/** + * Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a workerTimeControlAdd + * + * @param vUserFk Identificador del trabajador + * @return Retorna si encuentra un problema 'odd','maxTimeWork','breakDay','breakWeek' ; + * En caso de tener algun problema retorna el primero que encuentra + */ + DECLARE vLastIn DATETIME ; + DECLARE vLastOut DATETIME ; + DECLARE vDayWorkMax INT; + DECLARE vDayBreak INT; + DECLARE vWeekBreak INT ; + DECLARE vWeekScope INT; + DECLARE vDayStayMax INT; + DECLARE vProblem VARCHAR(20) DEFAULT NULL; + DECLARE vTimedWorked INT; + DECLARE vCalendarStateType VARCHAR(20) DEFAULT NULL; + DECLARE vDepartmentFk INT; + DECLARE vTo VARCHAR(50) DEFAULT NULL; + DECLARE vUserName VARCHAR(50) DEFAULT NULL; + DECLARE vBody VARCHAR(255) DEFAULT NULL; + + SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax + INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax + FROM workerTimeControlParams; + + SELECT MAX(timed) INTO vLastIn + FROM workerTimeControl + WHERE userFk = vUserFk + AND direction = 'in'; + + SELECT MAX(timed) INTO vLastOut + FROM workerTimeControl + WHERE userFk = vUserFk + AND direction = 'out'; + + SELECT CONCAT(u.name,'@verdnatura.es') INTO vTo + FROM account.user u + WHERE u.id = (SELECT bossFk FROM worker WHERE id = vUserFk); + + SELECT CONCAT(firstName,' ',lastName) INTO vUserName + FROM worker w + WHERE w.id = vUserFk; + + + IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA + + -- VERIFICAR DESCANSO DIARIO + IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN + SELECT "Descansos 12 h" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + END IF; + + -- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ + IF (SELECT MOD(COUNT(*),2) -- <>0 + FROM workerTimeControl + WHERE userFk = vUserFk + AND timed >= vLastIn + ) THEN + SELECT "Dias con fichadas impares" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + END IF; + + -- VERIFICAR VACACIONES + SELECT cs.type INTO vCalendarStateType + FROM postgresql.calendar_employee ce + JOIN postgresql.business b USING(business_id) + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN postgresql.calendar_state cs USING(calendar_state_id) + JOIN worker w ON w.id = p.id_trabajador + WHERE ce.date = CURDATE() + AND cs.isAllowedToWork = FALSE + AND w.userFk = vUserFk + LIMIT 1; + + IF(LENGTH(vCalendarStateType)) THEN + SELECT vCalendarStateType AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + + END IF; + + + -- VERIFICAR CONTRATO EN VIGOR + IF (SELECT COUNT(*) + FROM postgresql.business b + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN worker w ON w.id = p.id_trabajador + WHERE w.userFk = vUserFk + AND b.date_start <= vDated + AND IFNULL(b.date_end,vDated) >= vDated + ) = 0 THEN + SELECT "No hay un contrato en vigor" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + + END IF; + + -- VERIFICAR DESCANSO SEMANAL + SET @vHasBreakWeek:= FALSE; + SET @vLastTimed:= UNIX_TIMESTAMP((NOW() - INTERVAL vWeekScope SECOND)); + + DROP TEMPORARY TABLE IF EXISTS tmp.trash; + CREATE TEMPORARY TABLE tmp.trash + SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, + @vLastTimed:= UNIX_TIMESTAMP(timed) + FROM workerTimeControl + WHERE timed>= (NOW() - INTERVAL vWeekScope SECOND) + AND userFk= vUserFk + AND direction IN ('in','out') + ORDER BY timed ASC; + + IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA + SELECT "Descansos 36 h" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + END IF; + + DROP TEMPORARY TABLE tmp.trash; + + ELSE -- DIA ACTUAL + + -- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO + SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(NOW()), 0) INTO vTimedWorked + FROM workerTimeControl wtc + WHERE userFk = vUserFk + AND timed >= vLastIn + ORDER BY timed; + + IF vTimedWorked > vDayWorkMax THEN + SELECT "Jornadas" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Jornadas") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + END IF; + + END IF; + + -- VERIFICAR DEPARTAMENTO + /* IF vTabletFk IS NOT NULL THEN + SELECT wtcu.departmentFk INTO vDepartmentFk + FROM workerTimeControlUserInfo wtcu + WHERE wtcu.userFk = vUserFk; + IF (SELECT COUNT(td.tabletFk) + FROM tabletDepartment td + WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk + ) = 0 THEN + SELECT "No perteneces a este departamento." AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + 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 DROP PROCEDURE IF EXISTS `workerTimeControl_checkTest` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_checkTest`(vUserFk INT, vTimed DATETIME, vTabletFk VARCHAR(100)) +BEGIN + +/** + * Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a vn.workerTimeControlAdd + * @param vUserFk Identificador del trabajador + * @return Retorna si encuentra un problema 'odd','maxTimeWork','breakDay','breakWeek' ; + * En caso de tener algun problema retorna el primero que encuentra + */ + DECLARE vLastIn DATETIME ; + DECLARE vLastOut DATETIME ; + DECLARE vDayWorkMax INT; + DECLARE vDayBreak INT; + DECLARE vWeekBreak INT ; + DECLARE vWeekMaxBreak INT; + DECLARE vWeekScope INT; + DECLARE vWeekMaxScope INT; + DECLARE vDayStayMax INT; + DECLARE vAskInOut INT; + DECLARE vTimedWorked INT; + DECLARE vCalendarStateType VARCHAR(20) DEFAULT NULL; + DECLARE vDepartmentFk INT; + DECLARE vTo VARCHAR(50) DEFAULT NULL; + DECLARE vUserName VARCHAR(50) DEFAULT NULL; + DECLARE vBody VARCHAR(255) DEFAULT NULL; + + IF (vTimed IS NULL) THEN + SET vTimed = NOW(); + END IF; + + SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax, weekMaxBreak, weekMaxScope, askInOut + INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax, vWeekMaxBreak, vWeekMaxScope, vAskInOut + FROM vn.workerTimeControlParams; + + SELECT MAX(timed) INTO vLastIn + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND + direction = 'in'; + + SELECT MAX(timed) INTO vLastOut + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND + direction = 'out'; + + + SELECT email INTO vTo + FROM account.user w + WHERE w.id = (SELECT bossFk FROM vn.worker WHERE id = vUserFk); + + SELECT CONCAT(firstName,' ',lastName) INTO vUserName + FROM vn.worker w + WHERE w.id = vUserFk; + + -- VERIFICAR CONTRATO EN VIGOR + IF (SELECT COUNT(*) + FROM postgresql.business b + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN vn.worker w ON w.id = p.id_trabajador + WHERE w.userFk = vUserFk AND + b.date_start <= CURDATE() AND + IFNULL(b.date_end,CURDATE()) >= CURDATE() + ) = 0 THEN + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody; + CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); + CALL util.throw("No hay un contrato en vigor"); + END IF; + + -- VERIFICAR DEPARTAMENTO + /*IF vTabletFk IS NOT NULL THEN + IF ( SELECT COUNT(*) + FROM vn.tabletDepartment td + JOIN vn.workerTimeControlUserInfo wtcu ON wtcu.departmentFk = td.departmentFk + WHERE td.tabletFk = vTabletFk AND wtcu.userFk = vUserFk + ) = 0 THEN + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody; + CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); + CALL util.throw("No perteneces a este departamento."); + END IF; + END IF;*/ + + SELECT IFNULL(dayBreak, vDayBreak) INTO vDayBreak + FROM postgresql.business b + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN postgresql. business_labour bl ON b.business_id = bl.business_id + JOIN postgresql.professional_category pc ON bl.professional_category_id = pc.professional_category_id + WHERE p.id_trabajador = vUserFk AND + b.date_start <= DATE(vTimed) AND + IFNULL(b.date_end, DATE(vTimed)) >= DATE(vTimed); + -- VERIFICAR DESCANSO DIARIO + -- 12 / 9 horas dependiendo del valor de vDayBreak + IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos ", FORMAT(vDayBreak/3600,0) ," h") INTO vBody; + CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); + CALL util.throw(CONCAT("Descansos ", FORMAT(vDayBreak/3600,0) ," h")); + END IF; + + -- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ + IF (SELECT MOD(COUNT(*),2) -- <>0 + FROM vn.workerTimeControl + WHERE userFk = vUserFk AND + timed >= vLastIn + ) THEN + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody; + CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); + CALL util.throw("Dias con fichadas impares"); + END IF; + -- VERIFICAR VACACIONES + SELECT cs.type INTO vCalendarStateType + FROM postgresql.calendar_employee ce + JOIN postgresql.business b USING(business_id) + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN postgresql.calendar_state cs USING(calendar_state_id) + JOIN vn.worker w ON w.id = p.id_trabajador + WHERE ce.date = CURDATE() AND + cs.isAllowedToWork = FALSE AND + w.userFk = vUserFk + LIMIT 1; + + IF(LENGTH(vCalendarStateType)) THEN + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody; + CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); + CALL util.throw(vCalendarStateType); + END IF; + + -- VERIFICAR DESCANSO SEMANAL + SET @vHasBreakWeek:= FALSE; + SET @vLastTimed:= UNIX_TIMESTAMP((vTimed - INTERVAL vWeekScope SECOND)); + + DROP TEMPORARY TABLE IF EXISTS tmp.trash; + CREATE TEMPORARY TABLE tmp.trash + SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, + @vLastTimed:= UNIX_TIMESTAMP(timed) + FROM workerTimeControl + WHERE timed>= (vTimed - INTERVAL vWeekScope SECOND) AND + userFk= vUserFk AND + direction IN ('in','out') + ORDER BY timed ASC; + + IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA + SET @vHasBreakWeek:= FALSE; + SET @vLastTimed:= UNIX_TIMESTAMP((vTimed - INTERVAL vWeekMaxScope SECOND)); + DROP TEMPORARY TABLE tmp.trash; + CREATE TEMPORARY TABLE tmp.trash + SELECT IF(vWeekMaxBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, + @vLastTimed:= UNIX_TIMESTAMP(timed) + FROM workerTimeControl + WHERE timed>= (vTimed - INTERVAL vWeekMaxScope SECOND) AND + userFk= vUserFk AND + direction IN ('in','out') + ORDER BY timed ASC; + IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) < vWeekMaxBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos ", FORMAT(vWeekMaxBreak/3600,0) ," h") INTO vBody; + CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); + CALL util.throw(CONCAT( "Descansos ", FORMAT(vWeekMaxBreak/3600,0) ," h")); + END IF; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No ha podido fichar por el siguiente problema: ',"Descansos ", FORMAT(vWeekBreak/3600,0) ," h") INTO vBody; + CALL vn.mail_insert(vTo,vTo,'error al fichar',vBody); + CALL util.warn(CONCAT( "Descansos ", FORMAT(vWeekBreak/3600,0) ," h")); + END IF; + DROP TEMPORARY TABLE tmp.trash; + + -- Preguntar dirección de la fichada + IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastIn) >= vAskInOut AND (SELECT MOD(COUNT(*),2) + FROM vn.workerTimeControl WHERE userFk = vUserFk AND timed >= vLastIn) THEN + CALL util.warn("AskInOut"); + 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 `workerTimeControl_check__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_check__`(vUserFk INT, vDated DATE,vTabletFk VARCHAR(100)) +proc: BEGIN +/** + * Verifica si el empleado puede fichar en el momento actual, si puede fichar llama a workerTimeControlAdd + * + * @param vUserFk Identificador del trabajador + * @return Retorna si encuentra un problema 'odd','maxTimeWork','breakDay','breakWeek' ; + * En caso de tener algun problema retorna el primero que encuentra + */ + DECLARE vLastIn DATETIME ; + DECLARE vLastOut DATETIME ; + DECLARE vDayWorkMax INT; + DECLARE vDayBreak INT; + DECLARE vWeekBreak INT ; + DECLARE vWeekScope INT; + DECLARE vDayStayMax INT; + DECLARE vProblem VARCHAR(20) DEFAULT NULL; + DECLARE vTimedWorked INT; + DECLARE vCalendarStateType VARCHAR(20) DEFAULT NULL; + DECLARE vDepartmentFk INT; + DECLARE vTo VARCHAR(50) DEFAULT NULL; + DECLARE vUserName VARCHAR(50) DEFAULT NULL; + DECLARE vBody VARCHAR(255) DEFAULT NULL; + + SELECT dayBreak, weekBreak, weekScope, dayWorkMax, dayStayMax + INTO vDayBreak, vWeekBreak, vWeekScope, vDayWorkMax, vDayStayMax + FROM workerTimeControlParams; + + SELECT MAX(timed) INTO vLastIn + FROM workerTimeControl + WHERE userFk = vUserFk + AND direction = 'in'; + + SELECT MAX(timed) INTO vLastOut + FROM workerTimeControl + WHERE userFk = vUserFk + AND direction = 'out'; + + SELECT CONCAT(u.name,'@verdnatura.es') INTO vTo + FROM account.user u + WHERE u.id = (SELECT bossFk FROM worker WHERE id = vUserFk); + + SELECT CONCAT(firstName,' ',lastName) INTO vUserName + FROM worker w + WHERE w.id = vUserFk; + + + IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastIn) > vDayStayMax THEN -- NUEVA JORNADA + + -- VERIFICAR DESCANSO DIARIO + IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vDayBreak THEN + SELECT "Descansos 12 h" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Descansos 12 h") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + END IF; + + -- VERIFICAR FICHADAS IMPARES DEL ÚLTIMO DÍA QUE SE FICHÓ + IF (SELECT MOD(COUNT(*),2) -- <>0 + FROM workerTimeControl + WHERE userFk = vUserFk + AND timed >= vLastIn + ) THEN + SELECT "Dias con fichadas impares" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Dias con fichadas impares") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + END IF; + + -- VERIFICAR VACACIONES + SELECT cs.type INTO vCalendarStateType + FROM postgresql.calendar_employee ce + JOIN postgresql.business b USING(business_id) + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN postgresql.calendar_state cs USING(calendar_state_id) + JOIN worker w ON w.id = p.id_trabajador + WHERE ce.date = CURDATE() + AND cs.isAllowedToWork = FALSE + AND w.userFk = vUserFk + LIMIT 1; + + IF(LENGTH(vCalendarStateType)) THEN + SELECT vCalendarStateType AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Vacaciones") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + + END IF; + + + -- VERIFICAR CONTRATO EN VIGOR + IF (SELECT COUNT(*) + FROM postgresql.business b + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN worker w ON w.id = p.id_trabajador + WHERE w.userFk = vUserFk + AND b.date_start <= vDated + AND IFNULL(b.date_end,vDated) >= vDated + ) = 0 THEN + SELECT "No hay un contrato en vigor" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No hay un contrato en vigor") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + + END IF; + + -- VERIFICAR DESCANSO SEMANAL + SET @vHasBreakWeek:= FALSE; + SET @vLastTimed:= UNIX_TIMESTAMP((NOW() - INTERVAL vWeekScope SECOND)); + + DROP TEMPORARY TABLE IF EXISTS tmp.trash; + CREATE TEMPORARY TABLE tmp.trash + SELECT IF(vWeekBreak-(UNIX_TIMESTAMP(timed)-@vLastTimed) <= 0, @vHasBreakWeek:=TRUE, TRUE) alias, + @vLastTimed:= UNIX_TIMESTAMP(timed) + FROM workerTimeControl + WHERE timed>= (NOW() - INTERVAL vWeekScope SECOND) + AND userFk= vUserFk + AND direction IN ('in','out') + ORDER BY timed ASC; + + IF UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(vLastOut) < vWeekBreak AND @vHasBreakWeek = FALSE THEN -- REVISA SI EL DESCANSO SE HA REALIZADO DESPUÉS DE LA ÚLTIMA FICHADA + SELECT "Descansos 36 h" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Descansos 36 h") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + END IF; + + DROP TEMPORARY TABLE tmp.trash; + + ELSE -- DIA ACTUAL + + -- VERIFICA QUE EL TIEMPO EFECTIVO NO SUPERE EL MÁXIMO + SELECT IFNULL(SUM(if( mod(wtc.order,2)=1, -UNIX_TIMESTAMP(timed), UNIX_TIMESTAMP(timed))),0) - IF( MOD(COUNT(*),2), UNIX_TIMESTAMP(NOW()), 0) INTO vTimedWorked + FROM workerTimeControl wtc + WHERE userFk = vUserFk + AND timed >= vLastIn + ORDER BY timed; + + IF vTimedWorked > vDayWorkMax THEN + SELECT "Jornadas" AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"Jornadas") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + END IF; + + END IF; + + -- VERIFICAR DEPARTAMENTO + IF vTabletFk IS NOT NULL THEN + SELECT wtcu.departmentFk INTO vDepartmentFk + FROM workerTimeControlUserInfo wtcu + WHERE wtcu.userFk = vUserFk; + IF (SELECT COUNT(td.tabletFk) + FROM tabletDepartment td + WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk + ) = 0 THEN + SELECT "No perteneces a este departamento." AS problem; + -- ENVIAMOS CORREO AL BOSSFK + SELECT CONCAT(vUserName,' No a podido fichar por el siguiente problema: ',"No perteneces a este departamento.") INTO vBody; + CALL mail_insert(vTo,vTo,'error al fichar',vBody); + LEAVE proc; + 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 DROP PROCEDURE IF EXISTS `workerTimeControl_clockIn` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`(vWorker INT, vTimed DATETIME, vDirection VARCHAR(10)) +BEGIN +/** + * Verifica si el empleado puede fichar + * @param vWorker Identificador del trabajador + * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW() + * @param vDirection solo se pueden pasa los valores del campo workerTimeControl.direction ENUM('in', 'out', 'middle') + * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. Si hay algún problema, devuelve el mesaje a que se debe mostrar al usuario + * Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá fichada a la tabla vn.workerTimeControl + */ + DECLARE vLastIn DATETIME; + DECLARE vLastOut DATETIME; + DECLARE vNextIn DATETIME; + DECLARE vLastDirection VARCHAR(6); + DECLARE vNextDirection VARCHAR(6); + DECLARE vDayBreak INT; + DECLARE vShortWeekBreak INT; + DECLARE vLongWeekBreak INT; + DECLARE vWeekScope INT; + DECLARE vGap INT; + DECLARE vMailTo VARCHAR(50) DEFAULT NULL; + DECLARE vUserName VARCHAR(50) DEFAULT NULL; + DECLARE vIsError BOOLEAN DEFAULT FALSE; + DECLARE vErrorMessage VARCHAR(255) DEFAULT NULL; + DECLARE vErrorCode VARCHAR(50); + DECLARE vDated DATE; + DECLARE vIsAllowedToWork VARCHAR(50); + DECLARE vDepartmentFk INT; + DECLARE vTimedLoop INT; + DECLARE vTimedLoopPrevious INT; + DECLARE vHasBreakWeek BOOLEAN DEFAULT FALSE; + DECLARE vManual BOOLEAN DEFAULT TRUE; + DECLARE vDone INT DEFAULT FALSE; + + DECLARE vCursor CURSOR FOR + SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) + UNION + SELECT UNIX_TIMESTAMP(NOW()) + UNION + (SELECT UNIX_TIMESTAMP(timed) + FROM workerTimeControl + WHERE timed BETWEEN (vTimed - INTERVAL vGap SECOND) AND vTimed AND + userFk = vWorker AND + direction IN ('in', 'out') + ORDER BY timed ASC); + + DECLARE vCursor2 CURSOR FOR + SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) + UNION + SELECT UNIX_TIMESTAMP(NOW()) + UNION + SELECT UNIX_TIMESTAMP(timed) + FROM workerTimeControl + WHERE timed BETWEEN vTimed AND (vTimed - INTERVAL vGap SECOND) AND + userFk = vWorker AND + direction IN ('in', 'out') + ORDER BY timed ASC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLSTATE '45000' + BEGIN + + SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT(w.firstName, ' ', w.lastName) + INTO vMailTo, vUserName + FROM account.user u + JOIN worker w ON w.bossFk = u.id + WHERE w.id = vWorker; + + CASE vErrorCode + WHEN 'IS_NOT_ALLOWED_FUTURE' THEN + SELECT 'No se permite fichar a futuro' INTO vErrorMessage; + WHEN 'INACTIVE_BUSINESS' THEN + SELECT 'No hay un contrato en vigor' INTO vErrorMessage; + WHEN 'IS_NOT_ALLOWED_WORK' THEN + SELECT 'No está permitido trabajar' INTO vErrorMessage; + WHEN 'ODD_WORKERTIMECONTROL' THEN + SELECT 'Fichadas impares' INTO vErrorMessage; + WHEN 'BREAK_DAY' THEN + SELECT CONCAT('Descanso diario ', FORMAT(vDayBreak/3600, 0) , 'h.') INTO vErrorMessage; + WHEN 'BREAK_WEEK' THEN + SELECT CONCAT('Descanso semanal ', + FORMAT(vShortWeekBreak / 3600,0) ,'h. / ', + FORMAT(vLongWeekBreak / 3600, 0) ,'h.') INTO vErrorMessage; + WHEN 'WRONG_DIRECTION' THEN + SELECT 'Dirección incorrecta' INTO vErrorMessage; + ELSE + SELECT 'Error sin definir'INTO vErrorMessage; + END CASE; + + SELECT vErrorMessage `error`; + SELECT CONCAT(vUserName, ' no ha podido fichar por el siguiente problema: ', vErrorMessage) INTO vErrorMessage; + CALL mail_insert( vMailTo, vMailTo, 'Error al fichar', vErrorMessage); + + END; + + IF (vTimed IS NULL) THEN + SET vTimed = NOW(); + SET vManual = FALSE; + END IF; + + SET vDated = DATE(vTimed); + + SELECT IF(pc.category_name = 'Conductor +3500kg', wc.dayBreakDriver, wc.dayBreak), + wc.shortWeekBreak, + wc.longWeekBreak, + wc.weekScope + INTO vDayBreak, + vShortWeekBreak, + vLongWeekBreak, + vWeekScope + FROM workerLabour w + JOIN postgresql.business_labour bl ON bl.business_id = w.businessFk + JOIN postgresql.professional_category pc ON pc.professional_category_id = bl.professional_category_id + JOIN workerTimeControlConfig wc ON TRUE + WHERE w.workerFk = vWorker + AND vDated BETWEEN w.started AND IFNULL(w.ended, vDated); + + SELECT timed INTO vLastIn + FROM workerTimeControl + WHERE userFk = vWorker + AND direction = 'in' + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + SELECT timed INTO vLastOut + FROM workerTimeControl + WHERE userFk = vWorker + AND direction = 'out' + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + SELECT timed INTO vNextIn + FROM workerTimeControl + WHERE userFk = vWorker + AND direction = 'in' + AND timed > vTimed + ORDER BY timed ASC + LIMIT 1; + + SELECT direction INTO vNextDirection + FROM workerTimeControl + WHERE userFk = vWorker + AND timed > vTimed + ORDER BY timed ASC + LIMIT 1; + + SELECT direction INTO vLastDirection + FROM workerTimeControl + WHERE userFk = vWorker + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + -- FICHADAS A FUTURO + IF vTimed > DATE_ADD(NOW(), INTERVAL 60 SECOND) THEN + SET vErrorCode = 'IS_NOT_ALLOWED_FUTURE'; + CALL util.throw(vErrorCode); + END IF; + + -- CONTRATO EN VIGOR + IF vDayBreak IS NULL THEN + SET vErrorCode = 'INACTIVE_BUSINESS'; + CALL util.throw(vErrorCode); + END IF; + + -- VERIFICAR SI ESTÁ PERMITIDO TRABAJAR + CALL timeBusiness_calculateByWorker(vWorker, vDated, vDated); + SELECT isAllowedToWork INTO vIsAllowedToWork + FROM tmp.timeBusinessCalculate; + DROP TEMPORARY TABLE tmp.timeBusinessCalculate; + + IF NOT vIsAllowedToWork THEN + SET vErrorCode = 'IS_NOT_ALLOWED_WORK'; + CALL util.throw(vErrorCode); + END IF; + + -- DIRECCION CORRECTA + CALL vn.workerTimeControl_direction(vWorker, vTimed); + IF (SELECT IF(IF(option1 IN ('inMiddle', 'outMiddle'), 'middle', option1) <> vDirection + AND IF(option2 IN ('inMiddle', 'outMiddle'), 'middle', IFNULL(option2, '')) <> vDirection, TRUE , FALSE) + FROM tmp.workerTimeControlDirection) THEN + SET vIsError = TRUE; + END IF; + + DROP TEMPORARY TABLE tmp.workerTimeControlDirection; + IF vIsError = TRUE THEN + SET vErrorCode = 'WRONG_DIRECTION'; + CALL util.throw(vErrorCode); + END IF; + + -- FICHADAS IMPARES + IF (SELECT IF(vDirection = 'in', MOD(COUNT(*), 2) , IF (vDirection = 'out', NOT MOD(COUNT(*), 2), FALSE)) + FROM workerTimeControl + WHERE userFk = vWorker + AND timed BETWEEN vLastIn AND vTimed + ) THEN + SET vErrorCode = 'ODD_WORKERTIMECONTROL'; + CALL util.throw(vErrorCode); + END IF; + + -- DESCANSO DIARIO + CASE vDirection + WHEN 'in' THEN + IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) <= vDayBreak THEN + SET vIsError = TRUE; + END IF; + WHEN 'out' THEN + IF UNIX_TIMESTAMP(vNextIn) - UNIX_TIMESTAMP(vTimed) <= vDayBreak THEN + SET vIsError = TRUE; + END IF; + ELSE BEGIN END; + END CASE; + + IF vIsError THEN + SET vErrorCode = 'BREAK_DAY'; + CALL util.throw(vErrorCode); + END IF; + + -- VERIFICAR DESCANSO SEMANAL + IF (vDirection IN('in', 'out')) THEN + -- VERIFICA DESCANSO CORTO EN LA ÚLTIMA SEMANA + SET vGap = vWeekScope; + SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND)); + SET vDone = FALSE; + OPEN vCursor; + l:LOOP + FETCH vCursor INTO vTimedLoop; + IF vDone THEN + LEAVE l; + END IF; + IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + SET vHasBreakWeek = TRUE; + LEAVE l; + END IF; + SET vTimedLoopPrevious = vTimedLoop; + END LOOP l; + CLOSE vCursor; + -- VERIFICA DESCANSO LARGO EN LA ÚLTIMAS 2 SEMANAS + IF NOT vHasBreakWeek THEN + SET vGap = vWeekScope * 2; + SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND)); + SET vDone = FALSE; + OPEN vCursor; + l:LOOP + FETCH vCursor INTO vTimedLoop; + IF vDone THEN + LEAVE l; + END IF; + IF vLongWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + SET vHasBreakWeek = TRUE; + LEAVE l; + END IF; + SET vTimedLoopPrevious = vTimedLoop; + END LOOP l; + CLOSE vCursor; + END IF; + + IF vManual THEN + -- VERIFICA DESCANSO CORTO EN LA PRÓXIMA SEMANA + SET vGap = vWeekScope; + SET vTimedLoopPrevious = vTimed; + SET vDone = FALSE; + OPEN vCursor; + l:LOOP + FETCH vCursor INTO vTimedLoop; + IF vDone THEN + LEAVE l; + END IF; + IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + SET vHasBreakWeek = TRUE; + LEAVE l; + END IF; + SET vTimedLoopPrevious = vTimedLoop; + END LOOP l; + CLOSE vCursor; + -- VERIFICA DESCANSO LARGO EN LAS PRÓXIMAS 2 SEMANAS + IF NOT vHasBreakWeek THEN + SET vGap = vWeekScope * 2; + SET vTimedLoopPrevious = vTimed; + SET vDone = FALSE; + OPEN vCursor; + l:LOOP + FETCH vCursor INTO vTimedLoop; + IF vDone THEN + LEAVE l; + END IF; + IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + SET vHasBreakWeek = TRUE; + LEAVE l; + END IF; + SET vTimedLoopPrevious = vTimedLoop; + END LOOP l; + CLOSE vCursor; + END IF; + END IF; + IF NOT vHasBreakWeek THEN + SET vErrorCode = 'BREAK_WEEK'; + CALL util.throw(vErrorCode); + END IF; + END IF; + + -- SE PERMITE FICHAR + INSERT INTO workerTimeControl(userFk, timed, direction, manual) + VALUES(vWorker, vTimed, vDirection, vManual); + + 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 `workerTimeControl_direction` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `workerTimeControl_direction`(vWorkerFk VARCHAR(10), vTimed DATETIME) +BEGIN +/** + * Devuelve que direcciones de fichadas son lógicas a partir de la anterior fichada + * @param vWorkerFk Identificador del trabajador + * @return (option1, option2) + * Los valores posibles de retorno son ('in', 'inMiddle', 'outMiddle', 'out') + */ + DECLARE vLastIn DATETIME ; + DECLARE vIsMiddleOdd BOOLEAN ; + + IF (vTimed IS NULL) THEN + SET vTimed = NOW(); + END IF; + + SELECT timed INTO vLastIn + FROM workerTimeControl + WHERE userFk = vWorkerFk + AND direction = 'in' + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + SELECT (COUNT(*)mod 2 = 1) INTO vIsMiddleOdd + FROM workerTimeControl + WHERE userFk = vWorkerFk + AND direction = 'middle' + AND timed BETWEEN vLastIn AND NOW(); + + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection; + CREATE TEMPORARY TABLE tmp.workerTimeControlDirection + SELECT IF(isCorrect, option1, NULL) option1, + IF(isCorrect, option2, NULL) option2 + FROM( SELECT IF(w.direction <> 'out' AND (UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(w.timed) > wc.dayBreak), FALSE, TRUE) isCorrect, + CASE WHEN w.direction ='in' THEN 'inMiddle' + WHEN w.direction = 'out' THEN 'in' + WHEN w.direction = 'middle' AND vIsMiddleOdd THEN 'outMiddle' + WHEN w.direction IS NULL THEN 'in' + ELSE 'inMiddle' + END option1, + CASE WHEN w.direction ='in' THEN 'out' + WHEN w.direction = 'out' THEN NULL + WHEN w.direction = 'middle' AND vIsMiddleOdd THEN NULL + WHEN w.direction IS NULL THEN NULL + ELSE 'out' + END option2 + FROM workerTimeControl w + JOIN workerTimeControlConfig wc ON TRUE + WHERE w.timed <= vTimed + AND w.userFk = vWorkerFk + ORDER BY w.timed DESC + LIMIT 1)sub; + + IF (SELECT IF(COUNT(*)=0, TRUE, FALSE) FROM tmp.workerTimeControlDirection ) THEN + INSERT INTO tmp.workerTimeControlDirection (option1, option2) + VALUES('in', 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 */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_direction__` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `workerTimeControl_direction__`(vWorkerFk VARCHAR(10), vTimed DATETIME) +BEGIN +/** + * Devuelve que direcciones de fichadas son lógicas a partir de la anterior fichada + * @param vWorkerFk Identificador del trabajador + * @return (option1, option2) + * Los valores posibles de retorno son ('in', 'inMiddle', 'outMiddle', 'out') + */ + DECLARE vLastIn DATETIME ; + DECLARE vIsMiddleOdd BOOLEAN ; + + IF (vTimed IS NULL) THEN + SET vTimed = NOW(); + END IF; + + SELECT timed INTO vLastIn + FROM workerTimeControl + WHERE userFk = vWorkerFk + AND direction = 'in' + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + SELECT (COUNT(*)mod 2 = 1) INTO vIsMiddleOdd + FROM workerTimeControl + WHERE userFk = vWorkerFk + AND direction = 'middle' + AND timed BETWEEN vLastIn AND NOW(); + + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlDirection; + + CREATE TEMPORARY TABLE tmp.workerTimeControlDirection + SELECT CASE WHEN w.direction ='in' THEN 'inMiddle' + WHEN w.direction = 'out' THEN 'in' + WHEN w.direction = 'middle' AND vIsMiddleOdd THEN 'outMiddle' + WHEN w.direction IS NULL THEN 'in' + ELSE 'inMiddle' + END option1, + CASE WHEN w.direction ='in' THEN 'out' + WHEN w.direction = 'out' THEN NULL + WHEN w.direction = 'middle' AND vIsMiddleOdd THEN NULL + WHEN w.direction IS NULL THEN NULL + ELSE 'out' + END option2 + FROM workerTimeControl w + WHERE w.timed <= vTimed + AND w.userFk = vWorkerFk + ORDER BY w.timed DESC + LIMIT 1; + + IF (SELECT IF(COUNT(*)=0, TRUE, FALSE) FROM tmp.workerTimeControlDirection ) THEN + INSERT INTO tmp.workerTimeControlDirection (option1, option2) + VALUES('in', 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 */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_getClockIn` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_getClockIn`(vUserFk INT, vDated DATE) +BEGIN + +/** + * Muestra una tabla con los 7 días inmediatamente anteriores a la fecha proporcionada + * y las fichadas de cada dia, en columnas por día + * + */ + + CALL workerTimeControl_setOrder(vUserFk,TIMESTAMPADD(DAY,-8,vDated),vDated); + + DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming; + CREATE TEMPORARY TABLE tmp.workerWeekTiming + SELECT orden `orden`, + max(hace7dias) 7_dias_antes, + max(hace6dias) 6_dias_antes, + max(hace5dias) 5_dias_antes, + max(hace4dias) 4_dias_antes, + max(hace3dias) 3_dias_antes, + max(antesdeayer) 2_dias_antes, + max(ayer) 1_dia_antes, + max(hoy) mismo_dia + FROM + ( + SELECT IF(dias = 7, fichada, '') as hace7dias, + IF(dias = 6, fichada, '') as hace6dias, + IF(dias = 5, fichada, '') as hace5dias, + IF(dias = 4, fichada, '') as hace4dias, + IF(dias = 3, fichada, '') as hace3dias, + IF(dias = 2, fichada, '') as antesdeayer, + IF(dias = 1, fichada, '') as ayer, + IF(dias = 0, fichada, '') as hoy, + orden + + FROM + ( + SELECT `order` as orden, datediff(vDated, timed) as dias, date(timed) as fecha, TIME_FORMAT(timed,'%H:%i') as fichada + FROM vn.workerTimeControl wtc + WHERE userFk = vUserFk + AND timed >= TIMESTAMPADD(DAY, -7, vDated) + ) sub + )sub2 + GROUP BY orden; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming_Aux; + CREATE TEMPORARY TABLE tmp.workerWeekTiming_Aux + SELECT * FROM tmp.workerWeekTiming; + + INSERT INTO tmp.workerWeekTiming( 7_dias_antes, 6_dias_antes, 5_dias_antes, 4_dias_antes, 3_dias_antes, 2_dias_antes, 1_dia_antes, mismo_dia) + VALUES('total','','','','','','',''); + + INSERT INTO tmp.workerWeekTiming( orden, 7_dias_antes, 6_dias_antes, 5_dias_antes, 4_dias_antes, 3_dias_antes, 2_dias_antes, 1_dia_antes, mismo_dia) + SELECT 0, + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(7_dias_antes), TIME_TO_SEC(7_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(6_dias_antes), TIME_TO_SEC(6_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(5_dias_antes), TIME_TO_SEC(5_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(4_dias_antes), TIME_TO_SEC(4_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(3_dias_antes), TIME_TO_SEC(3_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(2_dias_antes), TIME_TO_SEC(2_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(1_dia_antes), TIME_TO_SEC(1_dia_antes)))),'%H:%i'),''), + '' + FROM tmp.workerWeekTiming_Aux; + + INSERT INTO tmp.workerWeekTiming_Aux( orden, 1_dia_antes) + SELECT 0, ROUND(( + IFNULL(TIME_TO_SEC(7_dias_antes),0) + + IFNULL(TIME_TO_SEC(6_dias_antes),0) + + IFNULL(TIME_TO_SEC(5_dias_antes),0) + + IFNULL(TIME_TO_SEC(4_dias_antes),0) + + IFNULL(TIME_TO_SEC(3_dias_antes),0) + + IFNULL(TIME_TO_SEC(2_dias_antes),0) + + IFNULL(TIME_TO_SEC(1_dia_antes),0) + ) / 3600,1) + FROM tmp.workerWeekTiming + WHERE orden = 0; + + + INSERT INTO tmp.workerWeekTiming( 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes,mismo_dia) + SELECT '','','','','','',1_dia_antes,'' + FROM tmp.workerWeekTiming_Aux + WHERE orden = 0; + + SELECT 7_dias_antes, 6_dias_antes, 5_dias_antes, 4_dias_antes, 3_dias_antes, 2_dias_antes, 1_dia_antes, mismo_dia FROM tmp.workerWeekTiming; + + DROP TEMPORARY TABLE tmp.workerWeekTiming; + DROP TEMPORARY TABLE tmp.workerWeekTiming_Aux; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControl_login` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_login`(vWorkerFk VARCHAR(10)) +BEGIN +/** + * Consulta la información del usuario y los botones que tiene que activar en la tablet tras hacer login + * Solo retornará 1 ó 2 opciones de las 4 posibles + * @param vWorkerFk Identificador del trabajador + * @return (name, surname, userFk, departmentFk, button1, button2) + * Los valores posibles para button son ('in', 'inMiddle', 'outMiddle', 'out') + */ + CALL vn.workerTimeControl_direction(vWorkerFk, NOW()); + + SELECT wi.name, + wi.surname, + wi.userFk, + wi.departmentFk, + w.option1 button1, + w.option2 button2 + FROM workerTimeControlUserInfo wi + JOIN tmp.workerTimeControlDirection w + WHERE wi.userFk = vWorkerFk + LIMIT 1; + + DROP TEMPORARY TABLE tmp.workerTimeControlDirection; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControl_remove` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_remove`(IN vUserFk INT, IN vTimed DATETIME) +BEGIN + + DECLARE vDirectionRemove VARCHAR(6); + DECLARE vDirectionPrevious VARCHAR(6); + DECLARE vTimedPrevious DATETIME; + + SELECT direction INTO vDirectionRemove + FROM vn.workerTimeControl + WHERE userFk = vUserFk + AND timed = vTimed ; + + IF vDirectionRemove = 'out' THEN + + SELECT timed, direction INTO vTimedPrevious, vDirectionPrevious + FROM vn.workerTimeControl + WHERE userFk = vUserFk + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + IF vDirectionPrevious = "middle" THEN + UPDATE vn.workerTimeControl + SET direction = "out" + WHERE userFk = vUserFk + AND timed = vTimedPrevious; + END IF; + + ELSE IF vDirectionRemove = 'in' THEN + + UPDATE vn.workerTimeControl + SET direction = "in" + WHERE userFk = vUserFk + AND timed > vTimed + ORDER BY timed ASC + LIMIT 1; + END IF; + + END IF; + + DELETE FROM vn.workerTimeControl + WHERE userFk = vUserFk + AND timed = vTimed; + + CALL vn.workerTimeControlSOWP(vUserFk, vTimed); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_repair` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_repair`() +proc: BEGIN +/** + * Corrige las fichadas + * + */ + +/*1- poner todos a middle*/ +UPDATE vn.workerTimeControl SET direction = 'middle'; + +/*2- poner los out*/ +UPDATE vn.workerTimeControl wtc + JOIN + (SELECT userFk,MAX(timed) maxTimed FROM + (SELECT id, userFk, timed, date(timed) dated + FROM vn.workerTimeControl + ) sub + GROUP BY userFk,dated + )sub + SET direction = "out" + WHERE wtc.userFk = sub.userFk + AND wtc.timed = sub.maxTimed; + + /*3- poner los in*/ +UPDATE vn.workerTimeControl wtc + JOIN + (SELECT userFk,MIN(timed) maxTimed FROM + (SELECT id, userFk, timed, date(timed) dated + FROM vn.workerTimeControl + ) sub + GROUP BY userFk,dated + )sub + SET direction = "in" + WHERE wtc.userFk = sub.userFk + AND wtc.timed = sub.maxTimed ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControl_sendMail` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMail`(vWeek INT, vYear INT, vWorkerFk INT) +BEGIN +/** + * Inserta en la tabla vn.mail para notificar a los empleados que teletrabajan de las jornadas que se han registrado. + * Inserta fichadas en el casos que se determina que el empleado está realizando teletrabajo + * + * @param vWeek + * @param vYear + * @param vWorkerFk -> En el caso de querer generarlo para todos los empleados deberá de informarse como NULL + */ + DECLARE vStarted VARCHAR(25); + DECLARE vEnded VARCHAR(25); + DECLARE vDone BOOL; + DECLARE vReceiver VARCHAR(255); + DECLARE vReceiverOld VARCHAR(255); + DECLARE vDated DATE; + DECLARE vTimeWorkDecimal DECIMAL(5,2); + DECLARE vTimeWorkSexagesimal VARCHAR(5); + DECLARE vTimeWorkedDecimal DECIMAL(5,2); + DECLARE vTimeWorkedSexagesimal VARCHAR(5); + DECLARE vTimeWorkDecimalTotal DECIMAL(5,2); + DECLARE vTimeTable VARCHAR(100); + DECLARE vTimeTableDecimal DECIMAL(5,2); + DECLARE vWorkerFkOld INTEGER; + DECLARE vBusinessFk INTEGER; + DECLARE vHeader TEXT; + DECLARE vBody TEXT; + DECLARE vFooter TEXT; + DECLARE vReturn INTEGER; + DECLARE vAbsenceType VARCHAR(50); + DECLARE vWorkerInfo VARCHAR(90); + DECLARE vPermissionRate DECIMAL(5,2); + DECLARE vIsTeleworking BOOL; + DECLARE vIsTeleworkingOld BOOL; + + DECLARE vCursor CURSOR FOR + SELECT CONCAT(u.name, '@verdnatura.es'), u.id, tb.dated, tb.timeWorkDecimal, LEFT(tb.timeWorkSexagesimal,5) timeWorkSexagesimal, + tb.timeTable, tc.timeWorkDecimal timeWorkedDecimal, LEFT(tc.timeWorkSexagesimal,5) timeWorkedSexagesimal, tb.type, tb.businessFk,tb.permissionRate, d.isTeleworking + FROM tmp.timeBusinessCalculate tb + JOIN user u ON u.id = tb.userFk + JOIN department d ON d.id = tb.departmentFk + JOIN postgresql.business b ON b.business_id = tb.businessFk + JOIN company c ON c.id = b.provider_id + LEFT JOIN tmp.timeControlCalculate tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated + JOIN (SELECT tb.userFk, + SUM(IF(tb.type IS NULL, + IF(tc.timeWorkDecimal > 0, FALSE, IF(tb.timeWorkDecimal > 0, TRUE, FALSE)), + TRUE))isTeleworkingWeek + FROM tmp.timeBusinessCalculate1 tb + LEFT JOIN tmp.timeControlCalculate1 tc ON tc.userFk = tb.userFk AND tc.dated = tb.dated + GROUP BY tb.userFk + HAVING isTeleworkingWeek > 0 + )sub ON sub.userFk = u.id + WHERE d.hasToRefill AND + IFNULL(vWorkerFk,u.id) = u.id AND + c.code = 'VNL' + ORDER BY u.id, tb.dated; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DROP TABLE IF EXISTS tmp.timeControlCalculate; + DROP TABLE IF EXISTS tmp.timeBusinessCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate1; + DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate1; + + SELECT CONCAT (MIN(dated), ' 00:00:00'), CONCAT (MAX(dated), ' 23:59:59') INTO vStarted, vEnded + FROM time + WHERE year = vYear AND + week = vWeek; + + DELETE FROM workerTimeControl + WHERE IFNULL(vWorkerFk, userFk) = userFk AND + timed BETWEEN vStarted AND vEnded AND + isSendMail; + + UPDATE workerTimeControlMail + SET updated = NOW(), state = 'SENDED' + WHERE year = vYear AND + week = vWeek AND + IFNULL(vWorkerFk, workerFk) = workerFk ; + + IF vWorkerFk IS NULL THEN + CALL timeControl_calculateAll(vStarted,vEnded); + CALL timeBusiness_calculateAll(vStarted,vEnded); + ELSE + CALL timeControl_calculateByUser(vWorkerFk,vStarted,vEnded); + CALL timeBusiness_calculateByUser(vWorkerFk,vStarted,vEnded); + END IF; + + CREATE TEMPORARY TABLE tmp.timeControlCalculate1 + SELECT * FROM tmp.timeControlCalculate; + CREATE TEMPORARY TABLE tmp.timeBusinessCalculate1 + SELECT * FROM tmp.timeBusinessCalculate; + + SET vTimeWorkDecimalTotal = 0; + SET vBody= ''; + OPEN vCursor; + FETCH vCursor INTO vReceiver, vWorkerFk, vDated, vTimeWorkDecimal, vTimeWorkSexagesimal, vTimeTable, vTimeWorkedDecimal, vTimeWorkedSexagesimal, vAbsenceType, vBusinessFk, vPermissionRate, vIsTeleworking ; + SET vWorkerFkOld = vWorkerFk ; + SET vReceiverOld = vReceiver; + SET vIsTeleworkingOld = vIsTeleworking; +proc: LOOP + IF vDone THEN + LEAVE proc; + END IF; + + IF vTimeWorkDecimal>0 AND vTimeWorkedDecimal IS NULL AND IFNULL(vPermissionRate, TRUE) THEN + IF vTimeTable IS NULL THEN + INSERT INTO workerTimeControl (userFk, timed, manual, direction, isSendMail) + SELECT vWorkerFk, CONCAT(vDated,' 08:00'), TRUE, 'in', TRUE; + IF vTimeWorkDecimal >= 5 THEN + INSERT INTO workerTimeControl (userFk, timed, manual, direction, isSendMail) + SELECT vWorkerFk, CONCAT(vDated,' 09:00'), TRUE, 'middle', TRUE; + INSERT INTO workerTimeControl (userFk, timed, manual, direction, isSendMail) + SELECT vWorkerFk, CONCAT(vDated,' 09:20'), TRUE, 'middle', TRUE; + END IF; + INSERT INTO workerTimeControl (userFk, timed, manual, direction, isSendMail) + SELECT vWorkerFk,CONCAT(vDated,' ', LEFT (SEC_TO_TIME(28800 + (vTimeWorkDecimal * 3600)), 5)), TRUE, 'out', TRUE; + ELSE + SELECT SUM(TIME_TO_SEC(j.end)-TIME_TO_SEC(j.start))/3600 INTO vTimeTableDecimal + FROM postgresql.journey j + WHERE j.business_id = vBusinessFk AND + j.day_id = WEEKDAY(vDated)+1; + IF vTimeWorkDecimal = vTimeTableDecimal THEN + INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) + SELECT vWorkerFk, CONCAT(vDated, ' ', j.start), TRUE, TRUE + FROM postgresql.journey j + WHERE j.business_id = vBusinessFk AND + j.day_id = WEEKDAY(vDated)+1; + + INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) + SELECT vWorkerFk, CONCAT(vDated, ' ', j.end), TRUE, TRUE + FROM postgresql.journey j + WHERE j.business_id = vBusinessFk AND + j.day_id = WEEKDAY(vDated)+1; + ELSE + INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) + SELECT vWorkerFk, CONCAT(vDated, ' ', MIN(j.start)), TRUE, TRUE + FROM postgresql.journey j + WHERE j.business_id = vBusinessFk AND + j.day_id = WEEKDAY(vDated)+1; + INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) + SELECT vWorkerFk, CONCAT(vDated, ' ', SEC_TO_TIME(TIME_TO_SEC(MIN(j.start)) + (vTimeWorkDecimal * 3600))), TRUE, TRUE + FROM postgresql.journey j + WHERE j.business_id = vBusinessFk AND + j.day_id = WEEKDAY(vDated)+1; + END IF; + + IF vTimeWorkDecimal >= 5 THEN + INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) + SELECT vWorkerFk, CONCAT(vDated, ' ', SEC_TO_TIME(TIME_TO_SEC(MIN(j.start)) + 3600)), TRUE, TRUE + FROM postgresql.journey j + WHERE j.business_id = vBusinessFk AND + j.day_id = WEEKDAY(vDated)+1; + INSERT INTO workerTimeControl (userFk, timed, manual, isSendMail) + SELECT vWorkerFk, CONCAT(vDated, ' ', SEC_TO_TIME(TIME_TO_SEC(MIN(j.start)) + 4800)), TRUE, TRUE + FROM postgresql.journey j + WHERE j.business_id = vBusinessFk AND + j.day_id = WEEKDAY(vDated)+1; + END IF; + + UPDATE workerTimeControl wtc + JOIN (SELECT id FROM workerTimeControl + WHERE userFk = vWorkerFk AND + timed BETWEEN vDated AND CONCAT(vDated, ' 23:59:59') + ORDER BY timed ASC + LIMIT 1)sub on sub.id= wtc.id + SET direction = 'in' ; + + UPDATE workerTimeControl wtc + JOIN (SELECT id FROM workerTimeControl + WHERE userFk = vWorkerFk AND + timed BETWEEN vDated AND CONCAT(vDated, ' 23:59:59') + ORDER BY timed DESC + LIMIT 1)sub on sub.id= wtc.id + SET direction = 'out' ; + + END IF; + END IF; + + SELECT CONCAT(IFNULL(vBody,""), " + ", DATE_FORMAT(vDated, "%d/%m/%Y"), " + ", CASE WEEKDAY(vDated)+1 + WHEN 1 THEN 'Lunes' + WHEN 2 THEN 'Martes' + WHEN 3 THEN 'Miércoles' + WHEN 4 THEN 'Jueves' + WHEN 5 THEN 'Viernes' + WHEN 6 THEN 'Sábado' + WHEN 7 THEN 'Domingo' + END , " + ", IFNULL(GROUP_CONCAT(MID(timed, 12, 5) ORDER BY timed ASC SEPARATOR ' - '), " - ")," + ", IFNULL(vAbsenceType, IF (vTimeWorkedDecimal>0, "Presencial", IF(vTimeWorkDecimal>0, "Teletrabajo", " - "))), " + ", IFNULL(vTimeWorkedSexagesimal,IF(IFNULL(vPermissionRate, TRUE), vTimeWorkDecimal, 0)), " + ") INTO vBody + FROM workerTimeControl + WHERE userFk = vWorkerFk AND + timed BETWEEN vDated AND CONCAT(vDated," 23:59:59"); + SET vTimeWorkDecimalTotal = vTimeWorkDecimalTotal + IFNULL(vTimeWorkedDecimal, IF( IFNULL(vPermissionRate, TRUE), vTimeWorkDecimal, 0)); + SET vDone = FALSE; + FETCH vCursor INTO vReceiver, vWorkerFk, vDated, vTimeWorkDecimal, vTimeWorkSexagesimal, vTimeTable, vTimeWorkedDecimal, vTimeWorkedSexagesimal, vAbsenceType, vBusinessFk, vPermissionRate, vIsTeleworking; + + IF vWorkerFk <> vWorkerFkOld OR vDone THEN + SELECT CONCAT( IFNULL(nif, ''), ' - ', firstName, ' ', name ) INTO vWorkerInfo + FROM postgresql.person + WHERE id_trabajador = vWorkerFkOld; + SET vHeader = CONCAT("


+
+

", vWorkerInfo , "

+ + + + + + + + + + + + "); + + SET vFooter = CONCAT(" + + + + +
+ Según la información recogida en el sistema adjuntamos la tabla con los registros de las horas trabajadas en el período indicado. + Si está conforme tiene que contestar indicando únicamente la palabra OK, en caso contrario puede contestar detallando la causa de la disconformidad. + Rogamos nos conteste lo antes posible. +

+
FechaDíaFichadasDescripciónHoras
TOTAL", IFNULL(LEFT (SEC_TO_TIME(vTimeWorkDecimalTotal * 3600), 5), 0), "
+
"); + + IF vIsTeleworkingOld THEN + CALL mail_insert( + vReceiverOld, + 'timecontrol@verdnatura.es', + CONCAT('Registro de horas semana ', vWeek, ' año ', vYear) , + CONCAT(vHeader, ' ' , vBody, ' ', vFooter) + ); + + INSERT IGNORE INTO workerTimeControlMail (workerFk, year, week) + VALUES(vWorkerFkOld, vYear, vWeek); + END IF; + + SET vBody = ''; + SET vTimeWorkDecimalTotal = 0; + SET vWorkerFkOld = vWorkerFk; + SET vIsTeleworkingOld = vIsTeleworking; + SET vReceiverOld = vReceiver; + END IF; + END LOOP; + CLOSE vCursor; + + DROP TABLE tmp.timeControlCalculate; + DROP TABLE tmp.timeBusinessCalculate; + DROP TABLE tmp.timeControlCalculate1; + DROP TABLE tmp.timeBusinessCalculate1; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControl_sendMailByDepartment` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartment`(IN vDatedFrom DATETIME, IN vDatedTo DATETIME, IN vWorkerFk INT) +BEGIN +/** + * Inserta el registro de horario semanalmente de PRODUCCION, CAMARA, REPARTO, TALLER NATURAL y TALLER ARTIFICIAL en vn.mail. + * + * @param vDatedFrom + * @param vDatedTo + * @param vWorkerFk -> En el caso de querer generarlo para todos los empleados deberá de pasarse = NULL + */ + SET session group_concat_max_len = 15000; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate; + DROP TEMPORARY TABLE IF EXISTS tmp.reportHours; + + IF vWorkerFk IS NULL THEN + CALL timeControl_calculateAll(vDatedFrom,vDatedTo); + CALL timeBusiness_calculateAll(vDatedFrom,vDatedTo); + ELSE + CALL timeControl_calculateByUser(vWorkerFk,vDatedFrom,vDatedTo); + CALL timeBusiness_calculateByUser(vWorkerFk,vDatedFrom,vDatedTo); + END IF; + + CREATE TEMPORARY TABLE tmp.reportHours + SELECT t.dated, + IF (tm.hoursWeek IS NULL,'', GROUP_CONCAT(DATE_FORMAT(wtc.timed,'%H:%i') ORDER BY wtc.timed ASC SEPARATOR ' ') ) timeWorkDay, + SEC_TO_TIME(IFNULL(tm.timeWorkSeconds, 0)) tm, + SEC_TO_TIME(IFNULL(tc.timeWorkSeconds, 0)) tc, + SEC_TO_TIME(IFNULL(tc.timeWorkSeconds, 0) - IFNULL(tm.timeWorkSeconds, 0)) balance, + w.lastName, + w.firstname, + c.fi, + w.id, + MONTHNAME(t.dated) mes, + YEAR(t.dated) año, + w.userFk, + tm.hoursWeek, + tm.type, + wl.started, + wl.ended, + d.name, + tm.businessFk + FROM time t + LEFT JOIN tmp.timeBusinessCalculate tm ON tm.dated = t.dated + LEFT JOIN tmp.timeControlCalculate tc ON tc.dated = tm.dated AND tc.userFk = tm.userFk + LEFT JOIN vn.workerTimeControl wtc ON wtc.userFk = tm.userFk AND DATE(wtc.timed) = t.dated + LEFT JOIN workerLabour wl ON wl.workerFk = tm.userFk AND wl.businessFk = tm.businessFk + LEFT JOIN workCenter wc ON wc.id = wl.workCenterFk + LEFT JOIN department d ON d.id = wl.departmentFk + LEFT JOIN worker w ON w.id = tm.userFk + LEFT JOIN client c ON c.id = w.id + WHERE wc.name NOT IN ('VNH') + AND d.hasToSendMail + GROUP BY tm.userFk,t.dated + ORDER BY tm.userFk,t.dated; + + INSERT INTO vn.mail (receiver, replyTo, subject, body) + SELECT eu.email, 'laboral@verdnatura.es', CONCAT('Registro de horas semana ', WEEK(vDatedFrom), ' año ', YEAR(vDatedFrom)) , + CONCAT(' + + + + + + +
+

REGISTRO DE LA JORNADA DE LOS TRABAJADORES

+ + + + + + + + + + + + + + + + +
+ Según la información recogida en el sistema, adjuntamos la tabla con los registros. Cualquier incidencia rogamos la comunique a laboral@verdnatura.es. +
De no recibir incidencia por su parte, se entenderá que el registro es correcto.
+
Empresa: Verdnatura Levante SL
Trabajador: ',rh.firstname,' ',rh.lastName, ' NIF: ',rh.fi, '
AÑO: ',rh.año, ' MES: ',UPPER(rh.mes), ' Calendario Laboral: ',rh.hoursWeek,' horas semanales
+
+ + + + + + + + + ', + GROUP_CONCAT(DISTINCT '' ORDER BY rh.dated SEPARATOR ''), + ' + + + + + + +
Fecha:Día:Fichadas:Horas a trabajar:Horas trabajadas:Balance:
', DATE_FORMAT( rh.dated, '%d-%m-%y'), + ' ', CONCAT(UCASE(LEFT(DAYNAME(rh.dated), 1)), SUBSTRING(DAYNAME(rh.dated), 2)), + ' ', IFNULL(rh.timeWorkDay,' '),' ', IFNULL(rh.type,' '), + ' ', rh.tm, + ' ', SUBSTRING_INDEX(rh.tc, '.', 1), + ' ', SUBSTRING_INDEX(rh.balance, '.', 1), '
Total horas trabajadas: ', SUBSTRING_INDEX(SEC_TO_TIME(SUM(TIME_TO_SEC(rh.tc))), '.', 1),'', SUBSTRING_INDEX(SEC_TO_TIME(SUM(TIME_TO_SEC(rh.balance))), '.', 1),'
+ ') + FROM tmp.reportHours rh + JOIN account.emailUser eu ON rh.id = eu.userFk + GROUP BY rh.id; + + DROP TEMPORARY TABLE tmp.timeControlCalculate; + DROP TEMPORARY TABLE tmp.timeBusinessCalculate; + DROP TEMPORARY TABLE tmp.reportHours; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workerTimeControl_sendMailByDepartmentLauncher` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_sendMailByDepartmentLauncher`() +BEGIN + DECLARE vDatedFrom, vDatedTo DATETIME; + + IF (DAYNAME(CURDATE()) = 'miércoles') THEN + SELECT DATE_SUB(CURDATE(), INTERVAL 9 DAY), CONCAT(DATE_SUB(CURDATE(), INTERVAL 3 DAY), ' 23:59:59') INTO vDatedFrom, vDatedTo; + + CALL vn.workerTimeControl_sendMailByDepartment(vDatedFrom, vDatedTo, 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 */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerTimeControl_setOrder` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_setOrder`(vUserFk INT, vStarted DATE, vFinished DATE) +BEGIN + + SET @order := 0; + SET @day := '2000-01-01'; + + UPDATE vn.workerTimeControl w + SET w.`order` = @order := IF(@day = @day := date(timed), @order, 0) + 1 + WHERE w.userFk = vUserFk + AND w.timed BETWEEN vStarted AND util.dayend(vFinished) + ORDER BY w.timed; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `workerWeekControl` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerWeekControl`(vUserFk INT, vDated DATE, vTabletFk VARCHAR(100)) +BEGIN + +/* Devuelve la cantidad de descansos de 12h y de 36 horas que ha disfrutado el trabajador +* en la semana inmediatamente anterior a la fecha que pasa como parámetro. +* +* UPDATED PAK 2019/09/02 +* PENDING REVIEW +*/ + +DECLARE vDescansos12h INT; +DECLARE vDescansos36h INT; +DECLARE vJornadas INT; +DECLARE vImpares INT; +DECLARE vHasSignedToday BOOLEAN; +DECLARE v12hoursInMinutes INT DEFAULT 719; +DECLARE v36hoursInMinutes INT DEFAULT 2159; +DECLARE vCantWork VARCHAR(50) DEFAULT ''; +DECLARE vDepartmentFk INT; +DECLARE isEnabled BOOLEAN DEFAULT TRUE; + + +SELECT COUNT(*) INTO vHasSignedToday + FROM vn.workerTimeControl WHERE timed >= vDated AND userFk = vUserFk; + +SET @day := 0; +SET @lastTimed := NOW(); + +SELECT SUM(IF(interval_in_minutes >= v12hoursInMinutes,1,0)), SUM(FLOOR(interval_in_minutes/ v36hoursInMinutes)) , SUM(jornadas) + INTO vDescansos12h, vDescansos36h, vJornadas + FROM + ( + SELECT fichada_anterior, fichada_actual, interval_in_minutes, jornadas + FROM + ( + SELECT @lastTimed fichada_anterior, + timed, + CAST(time_to_sec(timediff(timed,@lastTimed )) / 60 AS UNSIGNED) as interval_in_minutes, + IF(day(timed) != @day, 1, 0) as jornadas, + @day := day(timed) dia_del_mes, + @lastTimed := timed fichada_actual + FROM + ( + SELECT day(timed) as dayNumber, dayname(timed) as dayName, timed + FROM + (SELECT TIMESTAMPADD(DAY, -11, NOW()) as timed, vUserFk as userFk -- Fichada virtual para los en los que no se ha trabajado la semana anterior + UNION ALL + SELECT timed, userFk + FROM vn.workerTimeControl wtc + WHERE userFk = vUserFk + AND timed >= TIMESTAMPADD(DAY, -10,vDated) + UNION ALL + SELECT IF(vHasSignedToday, '2000-01-01 00:00', NOW()) as timed, vUserFk + ) sub4 + ORDER BY timed + ) sub + + ) sub2 + WHERE fichada_actual >= TIMESTAMPADD(WEEK, -1, vDated) + ) sub3 ; + +SELECT IFNULL(SUM(impar),0) into vImpares +FROM ( + SELECT day(timed) as dayNumber, + count(*) mod 2 as impar + FROM vn.workerTimeControl wtc + WHERE userFk = vUserFk + AND timed >= TIMESTAMPADD(WEEK, -1,vDated) AND timed < vDated + GROUP BY dayNumber + ) sub; + +-- Vacaciones +SELECT cs.type INTO vCantWork + FROM postgresql.calendar_employee ce + JOIN postgresql.business b USING(business_id) + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN postgresql.calendar_state cs USING(calendar_state_id) + JOIN vn.worker w ON w.id = p.id_trabajador + WHERE ce.date = CURDATE() + AND cs.isAllowedToWork = FALSE + AND w.userFk = vUserFk + LIMIT 1; + +-- Contrato en vigor +SELECT IF(COUNT(*),vCantWork,'Sin contrato') INTO vCantWork + FROM postgresql.business b + JOIN postgresql.profile pr ON pr.profile_id = b.client_id + JOIN postgresql.person p ON p.person_id = pr.person_id + JOIN vn.worker w ON w.id = p.id_trabajador + WHERE w.userFk = vUserFk + AND b.date_start <= vDated + AND IFNULL(b.date_end,vDated) >= vDated; + +-- Departamento si vTabletFk es 0 no hacemos comprobacion (Madrid y Vilassar) +IF vTabletFk <> '0' THEN +-- 1 Obtener el departamento del usuario + SELECT wtcu.departmentFk INTO vDepartmentFk + FROM vn.workerTimeControlUserInfo wtcu + WHERE wtcu.userFk = vUserFk; +-- 2 Comprobar si la tablet pertenece al departamento + SELECT COUNT(td.tabletFk) INTO isEnabled + FROM vn.tabletDepartment td + WHERE td.tabletFk = vTabletFk AND td.departmentFk = vDepartmentFk; + +END IF; + + + +IF vJornadas IS NOT NULL THEN + + SELECT 'Jornadas' as Item, vJornadas as Cantidad, 'Correcto' AS Análisis + + UNION ALL + + SELECT 'Descansos 12 h' as Item, vDescansos12h as Cantidad, IF(vDescansos12h >= vJornadas, 'Correcto','Error: 1 por jornada') as Análisis + + UNION ALL + + SELECT 'Descansos 36 h' as Item, vDescansos36h as Cantidad, IF(vDescansos36h / 2 >= FLOOR(vJornadas/10), 'Correcto','Error: mínimo 2 cada 14 dias') as Análisis + + UNION ALL + + SELECT 'Dias con fichadas impares' as Item, vImpares as Cantidad, IF(vImpares = 0, 'Correcto','Error') as Análisis + + UNION ALL + + SELECT IF (LENGTH(vCantWork),CONCAT('Dia no laborable: ', vCantWork),'Dia laborable') as Item, + '' as Cantidad, + IF(LENGTH(vCantWork),'Error', 'Correcto') as Análisis + + UNION ALL + + SELECT 'El fichador no pertenece a tu departamento.' as Item, '' as Cantidad, IF(isEnabled, 'Correcto','Error') as Análisis + + ; + +ELSE + + + SELECT 'Jornadas' as Item, vJornadas as Cantidad, 'Correcto' AS Análisis + + UNION ALL + + SELECT 'Descansos 12 h' as Item, vDescansos12h as Cantidad, 'Correcto' as Análisis + + UNION ALL + + SELECT 'Descansos 36 h' as Item, vDescansos36h as Cantidad, 'Correcto' as Análisis + + UNION ALL + + SELECT 'Dias con fichadas impares' as Item, vImpares as Cantidad, 'Correcto' as Análisis + + UNION ALL + + SELECT IF (LENGTH(vCantWork),CONCAT('Dia no laborable: ', vCantWork),'Dia laborable') as Item, + '' as Cantidad, IF(LENGTH(vCantWork),'Error', 'Correcto') as Análisis + + UNION ALL + + SELECT 'El fichador no pertenece a tu departamento.' as Item, '' as Cantidad, IF(isEnabled, 'Correcto','Error') as Análisis + ; + +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 `workerWeekTiming` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workerWeekTiming`(vUserFk INT, vDated DATE) +BEGIN + +/* +* Muestra una tabla con los 7 dias inmediatamente anteriores a la fecha proporcionada +* y las fichadas de cada dia, en columnas por dia +* +*/ + +CALL vn.workerTimeControlSetOrder_by_User_and_dateRange(vUserFk,TIMESTAMPADD(DAY,-8,vDated),vDated); + +DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming; +CREATE TEMPORARY TABLE tmp.workerWeekTiming +SELECT orden `orden`, + max(hace7dias) 7_dias_antes, + max(hace6dias) 6_dias_antes, + max(hace5dias) 5_dias_antes, + max(hace4dias) 4_dias_antes, + max(hace3dias) 3_dias_antes, + max(antesdeayer) 2_dias_antes, + max(ayer) 1_dia_antes, + max(hoy) mismo_dia + FROM + ( + SELECT IF(dias = 7, fichada, '') as hace7dias, + IF(dias = 6, fichada, '') as hace6dias, + IF(dias = 5, fichada, '') as hace5dias, + IF(dias = 4, fichada, '') as hace4dias, + IF(dias = 3, fichada, '') as hace3dias, + IF(dias = 2, fichada, '') as antesdeayer, + IF(dias = 1, fichada, '') as ayer, + IF(dias = 0, fichada, '') as hoy, + orden + + FROM + ( + SELECT `order` as orden, datediff(vDated, timed) as dias, date(timed) as fecha, TIME_FORMAT(timed,'%H:%i') as fichada + FROM vn.workerTimeControl wtc + WHERE userFk = vUserFk + AND timed >= TIMESTAMPADD(DAY, -7, vDated) + ) sub + )sub2 + GROUP BY orden + ; + +DROP TEMPORARY TABLE IF EXISTS tmp.workerWeekTiming_Aux; +CREATE TEMPORARY TABLE tmp.workerWeekTiming_Aux + SELECT * FROM tmp.workerWeekTiming; + +INSERT INTO tmp.workerWeekTiming( 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes,mismo_dia) + VALUES('total','','','','','','',''); + +INSERT INTO tmp.workerWeekTiming( orden, 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes, mismo_dia) +SELECT 0, + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(7_dias_antes), TIME_TO_SEC(7_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(6_dias_antes), TIME_TO_SEC(6_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(5_dias_antes), TIME_TO_SEC(5_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(4_dias_antes), TIME_TO_SEC(4_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(3_dias_antes), TIME_TO_SEC(3_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(2_dias_antes), TIME_TO_SEC(2_dias_antes)))),'%H:%i'),''), + IFNULL(DATE_FORMAT(SEC_TO_TIME(SUM(IF(orden MOD 2, - TIME_TO_SEC(1_dia_antes), TIME_TO_SEC(1_dia_antes)))),'%H:%i'),''), + '' + FROM tmp.workerWeekTiming_Aux; + +INSERT INTO tmp.workerWeekTiming_Aux( orden, 1_dia_antes) +SELECT 0, ROUND(( + IFNULL(TIME_TO_SEC(7_dias_antes),0) + + IFNULL(TIME_TO_SEC(6_dias_antes),0) + + IFNULL(TIME_TO_SEC(5_dias_antes),0) + + IFNULL(TIME_TO_SEC(4_dias_antes),0) + + IFNULL(TIME_TO_SEC(3_dias_antes),0) + + IFNULL(TIME_TO_SEC(2_dias_antes),0) + + IFNULL(TIME_TO_SEC(1_dia_antes),0) + ) / 3600,1) + FROM tmp.workerWeekTiming + WHERE orden = 0; + + +INSERT INTO tmp.workerWeekTiming( 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes,mismo_dia) + SELECT '','','','','','',1_dia_antes,'' + FROM tmp.workerWeekTiming_Aux + WHERE orden = 0; + +SELECT 7_dias_antes,6_dias_antes,5_dias_antes,4_dias_antes,3_dias_antes,2_dias_antes,1_dia_antes,mismo_dia FROM tmp.workerWeekTiming; + +DROP TEMPORARY TABLE tmp.workerWeekTiming; +DROP TEMPORARY TABLE tmp.workerWeekTiming_Aux; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_calculateCommission` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_calculateCommission`(vYear INT, vQuarter INT) +BEGIN + + DECLARE vPlusTeamAmount INT; + DECLARE vPlusNewBornAmount INT; + DECLARE vPlusSalesAmount INT; + DECLARE vMinimumSalesByQuarter INT; + DECLARE vPlusTeamRange INT; + DECLARE vPlusNewBornRange INT; + DECLARE vRankingSalesRange INT; + +/* + -- Jerarquia + DROP TEMPORARY TABLE IF EXISTS rankingHierarchy; + CREATE TEMPORARY TABLE rankingHierarchy + SELECT COUNT(*) - 1 teamMembers, wb.bossFk + FROM vn.worker ww + JOIN vn.worker wb ON ww.id = wb.bossFk + GROUP BY wb.bossFk; + */ + + SELECT plusTeamAmount, plusNewBornAmount, plusSalesAmount, minimumSalesByQuarter, plusTeamRange, plusNewBornRange, rankingSalesRange + INTO vPlusTeamAmount, vPlusNewBornAmount, vPlusSalesAmount, vMinimumSalesByQuarter, vPlusTeamRange, vPlusNewBornRange, vRankingSalesRange + FROM commissionConfig; + -- Ventas + DROP TEMPORARY TABLE IF EXISTS rankingSale; + CREATE TEMPORARY TABLE rankingSale + (PRIMARY KEY(workerFk)) ENGINE = MEMORY + SELECT IF(SUM(v.importe) > vMinimumSalesByQuarter, + SUM(IFNULL(v.comision,0)), + 0) as commission, + SUM(v.importe) sales, + v.Id_Trabajador workerFk + FROM bs.vendedores v + WHERE v.año = vYear AND CEIL(mes/3) = vQuarter + GROUP BY v.Id_Trabajador; + + -- Ranking ventas + SET @position:= 0; + DROP TEMPORARY TABLE IF EXISTS rankingSelling; + CREATE TEMPORARY TABLE rankingSelling + (PRIMARY KEY(userFk)) ENGINE = MEMORY + SELECT userFk, @position:= @position + 1 position + FROM ( + SELECT SUM(`v`.`importe`) AS `importe`, + `u`.`name` AS `name`, + `u`.`id` AS `userFk` + FROM + (`bs`.`vendedores` `v` + JOIN `account`.`user` `u` ON (`u`.`id` = `v`.`Id_Trabajador`)) + WHERE + `v`.`año` = vYear + AND CEIL(`v`.`mes` / 3) = vQuarter + AND `u`.`name` NOT IN ('ismaelalcolea' , 'ruben') + GROUP BY `v`.`Id_Trabajador` + ORDER BY SUM(`v`.`importe`) DESC + LIMIT vRankingSalesRange + ) t; + + CALL rankingTeamByQuarter(vYear, vQuarter); + + -- comerciales que computan / total integrantes + DROP TEMPORARY TABLE IF EXISTS teamNames; + CREATE TEMPORARY TABLE teamNames + (PRIMARY KEY(departmentFk)) ENGINE = MEMORY + SELECT DISTINCT departmentFk, teamPeople + FROM tmp.rankingTeam; + + -- Ranking por equipos + DROP TEMPORARY TABLE IF EXISTS rankingTeam; + CREATE TEMPORARY TABLE rankingTeam + (PRIMARY KEY(departmentFk)) ENGINE = MEMORY + SELECT DISTINCT departmentFk + FROM teamNames + LIMIT vPlusTeamRange; + + -- Ranking por nuevos clientes + SET @position:= 0; + DROP TEMPORARY TABLE IF EXISTS rankingNewBorn; + CREATE TEMPORARY TABLE rankingNewBorn + (PRIMARY KEY(userFk)) ENGINE = MEMORY + SELECT userFk, @position:= @position + 1 position + FROM ( + SELECT SUM(amount) AS total, + n.userFk + FROM newBornSales n + WHERE n.dated >= util.quarterFirstDay(vYear, vQuarter) + AND n.firstShipped >= util.quarterFirstDay(vYear -1, vQuarter) + GROUP BY userFk + ORDER BY SUM(amount) DESC + LIMIT vPlusNewBornRange + ) t; + + -- Sumatorio de ventas + SELECT uBoss.`name` as team, + u.`name`, + r.commission, + -- IF(rh.bossFk, 200 + (teamMembers * 30), 0) plusResponsibility, + @plusRankingSellers := ((vRankingSalesRange + 1) - rs.position) * 40 plusRankingSellers, + @plusRankingTeam := IF(rt.departmentFk, vPlusTeamAmount, 0) plusRankingTeam, + @plusRankingNewBorn := ((vPlusNewBornRange + 1) - rnb.position) * vPlusNewBornAmount plusRankingNewBorn, + IFNULL(r.commission,0) + IFNULL(@plusRankingSellers,0) + @plusRankingTeam + IFNULL(@plusRankingNewBorn, 0) total, + sales, rs.position, teamPeople, + vYear year, + vQuarter quarter + FROM rankingSale r + -- LEFT JOIN rankingHierarchy rh ON rh.bossFk = r.workerFk + JOIN account.user u ON u.id = r.workerFk + JOIN vn2008.jerarquia j ON j.worker_id = r.workerFk + LEFT JOIN `account`.`user` uBoss ON uBoss.id = j.boss_id + LEFT JOIN rankingSelling rs ON rs.userFk = r.workerFk + LEFT JOIN workerDepartment wd ON wd.workerFk = r.workerFk + LEFT JOIN rankingTeam rt ON rt.departmentFk = wd.departmentFk AND r.commission + LEFT JOIN teamNames tn ON tn.departmentFk = wd.departmentFk + LEFT JOIN vn.rankingNewBorn rnb ON rnb.userFk = r.workerFk; + + DROP TEMPORARY TABLE tmp.rankingTeam; + DROP TEMPORARY TABLE + rankingSelling, + rankingTeam, + teamNames, + rankingNewBorn, + rankingSale; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_calculateCommission__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_calculateCommission__`(vYear INT, vQuarter INT) +BEGIN + + DECLARE vQuarterFirstDayLastYear DATE; + DECLARE vQuarterFirstDay DATE; +/* + -- Jerarquia + DROP TEMPORARY TABLE IF EXISTS rankingHierarchy; + CREATE TEMPORARY TABLE rankingHierarchy + SELECT COUNT(*) - 1 teamMembers, wb.bossFk + FROM vn.worker ww + JOIN vn.worker wb ON ww.id = wb.bossFk + GROUP BY wb.bossFk; + */ + + -- Ranking ventas + SELECT MIN(dated) INTO vQuarterFirstDay + FROM `time` t + WHERE QUARTER(dated) = vQuarter AND t.`year` = vYear; + + SET vQuarterFirstDayLastYear = DATE_ADD(vQuarterFirstDay, INTERVAL -1 YEAR); + + SET @position:= 0; + DROP TEMPORARY TABLE IF EXISTS rankingSelling; + CREATE TEMPORARY TABLE rankingSelling + (PRIMARY KEY(userFk)) ENGINE = MEMORY + SELECT userFk, @position:= @position + 1 position + FROM ( + SELECT SUM(`v`.`importe`) AS `importe`, + `u`.`name` AS `name`, + `u`.`id` AS `userFk` + FROM + (`bs`.`vendedores` `v` + JOIN `account`.`user` `u` ON (`u`.`id` = `v`.`Id_Trabajador`)) + WHERE + `v`.`año` = vYear + AND CEIL(`v`.`mes` / 3) = vQuarter + AND `u`.`name` NOT IN ('ismaelalcolea' , 'ruben') + GROUP BY `v`.`Id_Trabajador` + ORDER BY SUM(`v`.`importe`) DESC + LIMIT 10 + ) t; + + CALL rankingTeamByQuarter(vYear, vQuarter); + + -- comerciales que computan / total integrantes + DROP TEMPORARY TABLE IF EXISTS teamNames; + CREATE TEMPORARY TABLE teamNames + (PRIMARY KEY(departmentFk)) ENGINE = MEMORY + SELECT DISTINCT departmentFk, teamPeople + FROM tmp.rankingTeam; + + -- Ranking por equipos + DROP TEMPORARY TABLE IF EXISTS rankingTeam; + CREATE TEMPORARY TABLE rankingTeam + (PRIMARY KEY(departmentFk)) ENGINE = MEMORY + SELECT DISTINCT departmentFk + FROM teamNames + LIMIT 3; + + -- Ranking por nuevos clientes + SET @position:= 0; + DROP TEMPORARY TABLE IF EXISTS rankingNewBorn; + CREATE TEMPORARY TABLE rankingNewBorn + (PRIMARY KEY(userFk)) ENGINE = MEMORY + SELECT userFk, @position:= @position + 1 position + FROM ( + SELECT SUM(amount) AS total, + n.userFk + FROM newBornSales n + WHERE n.dated >= vQuarterFirstDay + AND n.firstShipped >= vQuarterFirstDayLastYear + GROUP BY userFk + ORDER BY SUM(amount) DESC + LIMIT 10 + ) t; + + -- Ventas + DROP TEMPORARY TABLE IF EXISTS rankingSale; + CREATE TEMPORARY TABLE rankingSale + (PRIMARY KEY(workerFk)) ENGINE = MEMORY + SELECT IF(SUM(v.importe) > 120000, + SUM(IFNULL(v.comision,0)),0) as commission, + SUM(v.importe) sales, + v.Id_Trabajador workerFk + FROM bs.vendedores v + WHERE v.año = vYear AND CEIL(mes/3) = vQuarter + GROUP BY v.Id_Trabajador; + + -- Sumatorio de ventas + SELECT uBoss.`name` as team, + u.`name`, + r.commission, + -- IF(rh.bossFk, 200 + (teamMembers * 30), 0) plusResponsibility, + @plusRankingSellers := (11 - rs.position) * 40 plusRankingSellers, + @plusRankingTeam := IF(rt.departmentFk, 800, 0) plusRankingTeam, + @plusRankingNewBorn := (11 - rnb.position) * 40 plusRankingNewBorn, + IFNULL(r.commission,0) + IFNULL(@plusRankingSellers,0) + @plusRankingTeam + IFNULL(@plusRankingNewBorn, 0) total, + sales, rs.position, teamPeople, + vYear year, + vQuarter quarter + FROM rankingSale r + -- LEFT JOIN rankingHierarchy rh ON rh.bossFk = r.workerFk + JOIN account.user u ON u.id = r.workerFk + JOIN vn2008.jerarquia j ON j.worker_id = r.workerFk + LEFT JOIN `account`.`user` uBoss ON uBoss.id = j.boss_id + LEFT JOIN rankingSelling rs ON rs.userFk = r.workerFk + LEFT JOIN workerDepartment wd ON wd.workerFk = r.workerFk + LEFT JOIN rankingTeam rt ON rt.departmentFk = wd.departmentFk AND r.commission + LEFT JOIN teamNames tn ON tn.departmentFk = wd.departmentFk + LEFT JOIN vn.rankingNewBorn rnb ON rnb.userFk = r.workerFk; + + DROP TEMPORARY TABLE tmp.rankingTeam; + DROP TEMPORARY TABLE + rankingSelling, + rankingTeam, + teamNames, + rankingNewBorn, + rankingSale; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_calculateSalaryRoleDelivery` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_calculateSalaryRoleDelivery`(vWorkerFk INTEGER,vDateFrom DATE,vDateTo DATE) +BEGIN +/** + * Calcula el salario de trabajadores para los departamentos de reparto, paletizado + * + * @param vDateFrom + * @param vDateTo + * @param vWorkerFk + * @return tmp.workerSalaryRoleDelivery + */ + DROP TEMPORARY TABLE IF EXISTS tmp.workerSalaryRoleDelivery; + + CREATE TEMPORARY TABLE tmp.workerSalaryRoleDelivery + SELECT w.id workerFk, + r.created dated, + r.id, + SUM(t.packages) packages, + CAST(time_to_sec(TIMEDIFF( DATE_FORMAT(r.finished, '%H:%i:%s'),DATE_FORMAT(r.time, '%H:%i:%s'))) / (60 * 60) AS DECIMAL(10, 1)) hours , + r.kmEnd-r.kmStart km, + r.m3 m3Delivery, + CAST(r.m3/loadWorker AS DECIMAL(10,2)) m3Load, + CAST(rc.m3Distribution*r.m3 AS DECIMAL(10,2)) amountDelivery, + CASE loadWorker + WHEN 1 THEN CAST(r.m3/ loadWorker*rc.load1m3 AS DECIMAL(10,2)) + WHEN 2 THEN CAST(r.m3/ loadWorker*rc.load2m3 AS DECIMAL(10,2)) + WHEN 3 THEN CAST(r.m3/ loadWorker*rc.load3m3 AS DECIMAL(10,2)) + WHEN 4 THEN CAST(r.m3/ loadWorker*rc.load4m3 AS DECIMAL(10,2)) + WHEN 5 THEN CAST(r.m3/ loadWorker*rc.load5m3 AS DECIMAL(10,2)) + ELSE CAST(r.m3/ loadWorker*rc.load6m3 AS DECIMAL(10,2)) + END amountLoad, + IF(v.isKmTruckRate, rc.kmTruckRate, rc.kmRate)*(r.kmEnd-r.kmStart) amountKm, + CAST('' AS CHAR(45)) description, + CAST( 0 AS DECIMAL(10,2)) extra, + CAST( 0 AS DECIMAL(10,2)) maxSalary + FROM route r + LEFT JOIN ticket t ON t.routeFk = r.id + LEFT JOIN vehicle v ON v.id = r.vehicleFk + LEFT JOIN worker w ON w.id = r.workerFk + LEFT JOIN routeConfig rc ON TRUE + LEFT JOIN (SELECT rw.routeFk, COUNT(rw.workerFk) loadWorker + FROM routeLoadWorker rw + JOIN routeLoadWorker rw2 ON rw.routeFk = rw2.routeFk AND rw2.workerFk = vWorkerFk + GROUP BY rw2.routeFk + ) sub ON sub.routeFk=r.id + WHERE r.created BETWEEN vDateFrom AND vDateTo AND w.id = vWorkerFk + GROUP BY r.id; + + INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, + dated, + id, + packages, + km, + m3Load, + amountLoad) + SELECT w.id , + r.created , + r.id, + SUM(t.packages) , + r.kmEnd-r.kmStart , + CAST(r.m3/loadWorker AS DECIMAL(10,2)) , + CASE loadWorker + WHEN 1 THEN CAST(r.m3/ loadWorker*rc.load1m3 AS DECIMAL(10,2)) + WHEN 2 THEN CAST(r.m3/ loadWorker*rc.load2m3 AS DECIMAL(10,2)) + WHEN 3 THEN CAST(r.m3/ loadWorker*rc.load3m3 AS DECIMAL(10,2)) + WHEN 4 THEN CAST(r.m3/ loadWorker*rc.load4m3 AS DECIMAL(10,2)) + WHEN 5 THEN CAST(r.m3/ loadWorker*rc.load5m3 AS DECIMAL(10,2)) + ELSE CAST(r.m3/ loadWorker*rc.load6m3 AS DECIMAL(10,2)) + END + FROM (SELECT rw.routeFk, COUNT(rw.workerFk) loadWorker + FROM routeLoadWorker rw + JOIN routeLoadWorker rw2 ON rw.routeFk = rw2.routeFk AND rw2.workerFk = vWorkerFk + GROUP BY rw2.routeFk) sub + LEFT JOIN route r ON sub.routeFk = r.id + LEFT JOIN ticket t ON t.routeFk = r.id + LEFT JOIN worker w ON w.id = r.workerFk + LEFT JOIN routeConfig rc ON TRUE + WHERE r.created BETWEEN vDateFrom AND vDateTo AND w.id <> vWorkerFk + GROUP BY r.id; + + INSERT INTO tmp.workerSalaryRoleDelivery(workerFk, + dated, + description, + extra) + SELECT workerFk, + dated, + GROUP_CONCAT(ra.name) , + CAST(SUM(rc.price) AS DECIMAL(9,2)) + FROM routeComplement rc + JOIN routeAction ra ON rc.routeActionFk=ra.id + WHERE dated BETWEEN vDateFrom AND vDateTo AND workerFk=vWorkerFk + GROUP BY dated; + + CALL timeBusiness_calculateByWorker(vWorkerFk, vDateFrom, vDateTo); + + INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, + dated, + description, + extra) + SELECT w.id, + tb.dated, + tb.type COLLATE utf8_general_ci, + CASE + WHEN tb.type = 'Vacaciones 1/2 día' OR tb.type = 'Permiso retribuido 1/2 día' + THEN CAST(((12 * blp.importepactado) / (52 * tb.hoursWeek)) * 4 AS DECIMAL(10,2)) + WHEN tb.type = 'Vacaciones' OR tb.type = 'Baja enfermedad común' OR tb.type = 'Permiso retribuido' OR tb.type = 'Festivo' + THEN CAST(((12 * blp.importepactado) / (52 * tb.hoursWeek)) * 8 AS DECIMAL(10,2)) + WHEN tb.type = 'Maternidad/Paternidad' + THEN 0 + END + FROM worker w + JOIN tmp.timeBusinessCalculate tb ON tb.userFk = w.id + JOIN postgresql.business_labour_payroll blp ON blp.business_id = tb.businessFk + JOIN time tm ON tm.dated = tb.dated + WHERE tb.dated BETWEEN vDateFrom AND vDateTo AND + w.id = vWorkerFk AND + tb.type IN ('Vacaciones 1/2 día', 'Vacaciones', 'Baja enfermedad común','Festivo','Permiso retribuido 1/2 día','Permiso retribuido', 'Maternidad/Paternidad') + GROUP BY tb.dated; + + INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, + dated, + m3Delivery, + amountLoad, + description) + SELECT wdc.workerFk , + r.created, + SUM(r.m3) , + CASE + WHEN wdc.category = 1 + THEN CAST(SUM(r.m3) * rc.distributionM3Category1 AS DECIMAL (10,2)) + WHEN wdc.category = 2 + THEN CAST(SUM(r.m3) * rc.distributionM3Category2 AS DECIMAL (10,2)) + END amountLoad, + 'Gestión de la distribución' description + FROM route r + JOIN agencyMode am ON am.id= r.agencyModeFk + JOIN agency a ON a.id = am.agencyFk + JOIN workerDistributionCategory wdc ON wdc.workerFk = vWorkerFk + JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND wl.workerFk = wdc.workerFk AND a.workCenterFk = wl.workCenterFk + JOIN department v ON v.id = departmentFk + JOIN routeConfig rc + WHERE r.m3>0 AND created BETWEEN vDateFrom AND vDateTo AND + am.name NOT LIKE "REC_%" AND + v.name= "REPARTO" + GROUP BY r.created; + + INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, + dated, + m3Delivery, + amountLoad, + description) + SELECT sub.workerFk, + r.created, + SUM(r.m3), + CAST( (SUM(r.m3)*sub.percentage /100) * rc.m3Palletization AS DECIMAL (10,2) ), + 'Gestión de paletizado' + FROM route r + JOIN agencyMode am ON am.id= r.agencyModeFk + JOIN agency a ON a.id = am.agencyFk + JOIN (SELECT percentage,workerFk ,dated + FROM routeUserPercentage ru + WHERE workerFk = vWorkerFk AND ru.dated <= vDateTo + ORDER BY dated DESC LIMIT 1 + ) sub + JOIN routeConfig rc + JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND + wl.workerFk = sub.workerFk + JOIN department v ON v.id = departmentFk + WHERE r.m3>0 AND + r.created BETWEEN vDateFrom AND vDateTo AND + am.name NOT LIKE "REC_%" AND + v.name= "PALETIZADO" + GROUP BY r.created; + + DROP TEMPORARY TABLE IF EXISTS tmp.daysToRateHoliday; + CREATE TEMPORARY TABLE tmp.daysToRateHoliday + SELECT * + FROM tmp.workerSalaryRoleDelivery tb + WHERE (tb.description IN ('Festivo') OR dayofweek(tb.dated)=1) AND tb.extra = 0 ; + +/* INSERT INTO tmp.workerSalaryRoleDelivery (workerFk,dated,id,packages,hours,km,m3Delivery,m3Load,amountDelivery,amountLoad,AmountKm,description, extra) + SELECT workerFk, + dated, + d.id, + packages, + hours, + km, + m3Delivery, + m3Load, + amountDelivery * r.rateHoliday, + amountLoad * r.rateHoliday, + AmountKm * r.rateHoliday, + CONCAT('Plus festivo: ',description), + extra + FROM tmp.daysToRateHoliday d + LEFT JOIN routeConfig r ON TRUE;*/ + + DROP TEMPORARY TABLE IF EXISTS tmp.daysToDelete; + CREATE TEMPORARY TABLE tmp.daysToDelete + SELECT dated + FROM tmp.workerSalaryRoleDelivery d + WHERE d.description IN ('Baja enfermedad común', 'Maternidad/Paternidad'); + + DELETE d + FROM tmp.workerSalaryRoleDelivery d + JOIN tmp.daysToDelete dd on dd.dated = d.dated + WHERE d.description NOT IN ('Baja enfermedad común', 'Maternidad/Paternidad'); + + INSERT INTO tmp.workerSalaryRoleDelivery (workerFk, + dated, + description, + extra, + maxSalary) + SELECT wdc.workerFk , + CONCAT(YEAR(t.dated),'-', MONTH(t.dated),'-01') , + CASE + WHEN wdc.category = 1 + THEN rc.plusCategory1Concept + WHEN wdc.category = 2 + THEN rc.plusCategory2Concept + END, + CASE + WHEN wdc.category = 1 + THEN CAST(rc.plusCategory1 AS DECIMAL (10,2)) + WHEN wdc.category = 2 + THEN CAST(rc.plusCategory2 AS DECIMAL (10,2)) + END, + CASE + WHEN wdc.category = 1 + THEN CAST(rc.maxSalaryCategory1 AS DECIMAL (10,2)) + WHEN wdc.category = 2 + THEN CAST(rc.maxSalaryCategory2 AS DECIMAL (10,2)) + END + FROM worker w + JOIN workerDistributionCategory wdc ON wdc.workerFk = w.id + JOIN routeConfig rc + JOIN time t on t.dated BETWEEN vDateFrom AND vDateTo + WHERE w.id = vWorkerFk + GROUP BY MONTH(t.dated), YEAR(t.dated); + + DROP TEMPORARY TABLE tmp.daysToRateHoliday; + DROP TEMPORARY TABLE tmp.daysToDelete; + DROP TEMPORARY TABLE tmp.timeBusinessCalculate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_calculateSalaryRoleDelivery__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_calculateSalaryRoleDelivery__`(vWorkerFk INTEGER,vDateFrom DATE,vDateTo DATE) +BEGIN +/** + * Calcula el salario de trabajadores para los departamentos de reparto, paletizado + * + * @param vDateFrom + * @param vDateTo + * @param vWorkerFk + * @return tmp.workerSalaryRoleDelivery + */ + DROP TEMPORARY TABLE IF EXISTS tmp.workerSalaryRoleDelivery; + + CREATE TEMPORARY TABLE tmp.workerSalaryRoleDelivery + SELECT w.id workerFk, + r.created dated, + r.id, + SUM(t.packages) packages, + CAST(time_to_sec(TIMEDIFF( DATE_FORMAT(r.finished, '%H:%i:%s'),DATE_FORMAT(r.time, '%H:%i:%s'))) / (60 * 60) AS DECIMAL(10, 1)) hours , + r.kmEnd-r.kmStart km, + r.m3 m3Delivery, + CAST(r.m3/loadWorker AS DECIMAL(10,2)) m3Load, + CAST(rc.m3Distribution*m3 AS DECIMAL(10,2)) amountDelivery , + CASE loadWorker + WHEN 1 THEN CAST(r.m3/ loadWorker*rc.load1m3 AS DECIMAL(10,2)) + WHEN 2 THEN CAST(r.m3/ loadWorker*rc.load2m3 AS DECIMAL(10,2)) + WHEN 3 THEN CAST(r.m3/ loadWorker*rc.load3m3 AS DECIMAL(10,2)) + WHEN 4 THEN CAST(r.m3/ loadWorker*rc.load4m3 AS DECIMAL(10,2)) + WHEN 5 THEN CAST(r.m3/ loadWorker*rc.load5m3 AS DECIMAL(10,2)) + ELSE CAST(r.m3/ loadWorker*rc.load6m3 AS DECIMAL(10,2)) + END amountLoad, + rc.kmRate*(r.kmEnd-r.kmStart) amountKm, + w.code, + CAST('' AS CHAR(45)) description, + CAST( 0 AS DECIMAL(10,2)) extra + FROM ticket t + LEFT JOIN route r ON t.routeFk = r.id + LEFT JOIN worker w ON w.id = r.workerFk + LEFT JOIN routeConfig rc ON TRUE + LEFT JOIN (SELECT rw.routeFk, COUNT(rw.workerFk) loadWorker + FROM routeLoadWorker rw + JOIN routeLoadWorker rw2 ON rw.routeFk = rw2.routeFk AND rw2.workerFk = vWorkerFk + GROUP BY rw2.routeFk + ) sub ON sub.routeFk=r.id + WHERE r.created BETWEEN vDateFrom AND vDateTo AND w.id = vWorkerFk + GROUP BY r.id; + + INSERT INTO tmp.workerSalaryRoleDelivery + SELECT w.id workerFk, + r.created dated, + r.id, + SUM(t.packages) packages, + NULL hours, + r.kmEnd-r.kmStart km, + NULL m3Delivery, + CAST(r.m3/loadWorker AS DECIMAL(10,2)) m3Load, + NULL amountDelivery, + CASE loadWorker + WHEN 1 THEN CAST(r.m3/ loadWorker*rc.load1m3 AS DECIMAL(10,2)) + WHEN 2 THEN CAST(r.m3/ loadWorker*rc.load2m3 AS DECIMAL(10,2)) + WHEN 3 THEN CAST(r.m3/ loadWorker*rc.load3m3 AS DECIMAL(10,2)) + WHEN 4 THEN CAST(r.m3/ loadWorker*rc.load4m3 AS DECIMAL(10,2)) + WHEN 5 THEN CAST(r.m3/ loadWorker*rc.load5m3 AS DECIMAL(10,2)) + ELSE CAST(r.m3/ loadWorker*rc.load6m3 AS DECIMAL(10,2)) + END amountLoad, + NULL amountKm, + w.code, + NULL description, + NULL extra + FROM (SELECT rw.routeFk, COUNT(rw.workerFk) loadWorker + FROM routeLoadWorker rw + JOIN routeLoadWorker rw2 ON rw.routeFk = rw2.routeFk AND rw2.workerFk = vWorkerFk + GROUP BY rw2.routeFk) sub + LEFT JOIN route r ON sub.routeFk = r.id + LEFT JOIN ticket t ON t.routeFk = r.id + LEFT JOIN worker w ON w.id = r.workerFk + LEFT JOIN routeConfig rc ON TRUE + WHERE r.created BETWEEN vDateFrom AND vDateTo AND w.id <> vWorkerFk + GROUP BY r.id; + + INSERT INTO tmp.workerSalaryRoleDelivery + SELECT workerFk, + dated, + NULL id, + NULL packages, + NULL hours, + NULL km, + NULL m3Delivery, + NULL m3Load, + NULL amountDelivery, + NULL amountLoad, + NULL amountKm, + NULL workerCode, + GROUP_CONCAT(ra.name) description, + CAST(SUM(rc.price) AS DECIMAL(9,2)) extra + FROM routeComplement rc + JOIN routeAction ra ON rc.routeActionFk=ra.id + WHERE dated BETWEEN vDateFrom AND vDateTo AND workerFk=vWorkerFk + GROUP BY dated; + + CALL timeBusiness_calculateByWorker(vWorkerFk, vDateFrom, vDateTo); + + INSERT INTO tmp.workerSalaryRoleDelivery + SELECT w.id workerFk, + tb.dated, + NULL id, + NULL packages, + NULL hours, + NULL km, + NULL m3Delivery, + NULL m3Load, + NULL amountDelivery, + NULL amountLoad, + NULL amountKm, + NULL workerCode, + tb.type COLLATE utf8_general_ci description, + CASE + WHEN tb.type = 'Vacaciones 1/2 día' OR tb.type = 'Permiso retribuido 1/2 día' + THEN CAST(((12 * blp.importepactado) / (52 * tb.hoursWeek)) * 4 AS DECIMAL(10,2)) + WHEN tb.type = 'Vacaciones' OR tb.type = 'Baja enfermedad común' OR tb.type = 'Permiso retribuido' OR tb.type = 'Festivo' + THEN CAST(((12 * blp.importepactado) / (52 * tb.hoursWeek)) * 8 AS DECIMAL(10,2)) + END extra + FROM worker w + JOIN tmp.timeBusinessCalculate tb ON tb.userFk = w.id + JOIN postgresql.business_labour_payroll blp ON blp.business_id = tb.businessFk + JOIN time tm ON tm.dated = tb.dated + WHERE tb.dated BETWEEN vDateFrom AND vDateTo AND + w.id = vWorkerFk AND + tb.type IN ('Vacaciones 1/2 día', 'Vacaciones', 'Baja enfermedad común','Festivo','Permiso retribuido 1/2 día','Permiso retribuido') + GROUP BY tb.dated; + + INSERT INTO tmp.workerSalaryRoleDelivery + SELECT sub.workerFk workerFk, + r.created dated, + NULL id, + NULL packages, + NULL hours, + NULL km, + SUM(r.m3) m3Delivery, + NULL m3Load, + NULL amountDelivery, + CAST( (SUM(r.m3)*sub.percentage /100) * rc.m3Management AS DECIMAL (10,2) ) amountLoad, + NULL amountKm, + NULL workerCode, + 'Gestión de la distribución' description, + NULL extra + FROM route r + JOIN agencyMode am ON am.id= r.agencyModeFk + JOIN agency a ON a.id = am.agencyFk + JOIN (SELECT percentage,workerFk ,dated + FROM routeUserPercentage ru + WHERE workerFk = vWorkerFk AND ru.dated <= vDateTo + ORDER BY dated DESC LIMIT 1 + ) sub + JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND wl.workerFk = sub.workerFk AND a.workCenterFk = wl.workCenterFk + JOIN department v ON v.id = departmentFk + JOIN routeConfig rc + WHERE r.m3>0 AND created BETWEEN vDateFrom AND vDateTo AND + am.name NOT LIKE "REC_%" AND + v.name= "REPARTO" + GROUP BY r.created; + + INSERT INTO tmp.workerSalaryRoleDelivery + SELECT sub.workerFk workerFk, + r.created dated, + NULL id, + NULL packages, + NULL hours, + NULL km, + SUM(r.m3) m3Delivery, + NULL m3Load, + NULL amountDelivery, + CAST( (SUM(r.m3)*sub.percentage /100) * rc.m3Palletization AS DECIMAL (10,2) ) amountLoad, + NULL amountKm, + NULL workerCode, + 'Gestión de paletizado' description, + NULL extra + FROM route r + JOIN agencyMode am ON am.id= r.agencyModeFk + JOIN agency a ON a.id = am.agencyFk + JOIN (SELECT percentage,workerFk ,dated + FROM routeUserPercentage ru + WHERE workerFk = vWorkerFk AND ru.dated <= vDateTo + ORDER BY dated DESC LIMIT 1 + ) sub + JOIN routeConfig rc + JOIN workerLabour wl ON r.created BETWEEN wl.started AND IFNULL(wl.ended, CURDATE()) AND + wl.workerFk = sub.workerFk + JOIN department v ON v.id = departmentFk + WHERE r.m3>0 AND + r.created BETWEEN vDateFrom AND vDateTo AND + am.name NOT LIKE "REC_%" AND + v.name= "PALETIZADO" + GROUP BY r.created; + + DROP TEMPORARY TABLE IF EXISTS tmp.daysToRateHoliday; + CREATE TEMPORARY TABLE tmp.daysToRateHoliday + SELECT * + FROM tmp.workerSalaryRoleDelivery tb + WHERE (tb.description IN ('Festivo') OR dayofweek(tb.dated)=1) AND tb.extra = 0 ; + + INSERT INTO tmp.workerSalaryRoleDelivery (workerFk,dated,id,packages,hours,km,m3Delivery,m3Load,amountDelivery,amountLoad,AmountKm,code,description, extra) + SELECT workerFk, + dated, + d.id, + packages, + hours, + km, + m3Delivery, + m3Load, + amountDelivery * r.rateHoliday, + amountLoad * r.rateHoliday, + AmountKm * r.rateHoliday, + code, + CONCAT('Plus festivo: ',description), + extra + FROM tmp.daysToRateHoliday d + LEFT JOIN routeConfig r ON TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.daysToDelete; + CREATE TEMPORARY TABLE tmp.daysToDelete + SELECT dated + FROM tmp.workerSalaryRoleDelivery d + WHERE d.description IN ('Baja enfermedad común'); + + DELETE d + FROM tmp.workerSalaryRoleDelivery d + JOIN tmp.daysToDelete dd on dd.dated = d.dated + WHERE d.description NOT IN ('Baja enfermedad común'); + + DROP TEMPORARY TABLE tmp.daysToRateHoliday; + DROP TEMPORARY TABLE tmp.daysToDelete; + DROP TEMPORARY TABLE tmp.timeBusinessCalculate; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_getFromHasMistake` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getFromHasMistake`(vDepartmentFk INT) +BEGIN + +/** + * Obtiene los trabajadores de los departamentos que se les puede poner error + * @param vDepartmentFk id del departamento + * + */ + + SELECT w.id,w.firstName, w.lastName,d.name + FROM worker w + JOIN workerDepartment wd ON wd.workerFk = w.id + JOIN department d ON d.id = wd.departmentFk + WHERE d.id = vDepartmentFk + ORDER BY firstName; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_getHierarchy` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getHierarchy`(vBoss INT) +BEGIN + DECLARE EXIT HANDLER FOR 1062 BEGIN + CALL util.throw('INFINITE_LOOP'); + END; + + DROP TEMPORARY TABLE IF EXISTS workerHierarchy; + CREATE TEMPORARY TABLE workerHierarchy + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBoss AS workerFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchyList; + CREATE TEMPORARY TABLE tmp.workerHierarchyList + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBoss AS workerFk, 0 AS isChecked; + + + WHILE (SELECT COUNT(*) FROM tmp.workerHierarchyList WHERE NOT isChecked) > 0 DO + + INSERT INTO tmp.workerHierarchyList + SELECT w.id, 0 + FROM worker w + JOIN workerHierarchy wh ON wh.workerFk = w.bossFk; + + UPDATE tmp.workerHierarchyList whl + JOIN workerHierarchy wh ON wh.workerFk = whl.workerFk + SET whl.isChecked = 1; + + TRUNCATE workerHierarchy; + + INSERT INTO workerHierarchy + SELECT workerFk + FROM tmp.workerHierarchyList + WHERE NOT isChecked; + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS workerHierarchy; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_getHierarch__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getHierarch__`(vBoss INT) +BEGIN +-- eliminar no se usa + -- usar worker_getHierarchy + DECLARE EXIT HANDLER FOR 1062 BEGIN + CALL util.throw('INFINITE_LOOP'); + END; + + DROP TEMPORARY TABLE IF EXISTS workerHierarch; + CREATE TEMPORARY TABLE workerHierarch + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBoss AS workerFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchList; + CREATE TEMPORARY TABLE tmp.workerHierarchList + (PRIMARY KEY (workerFk)) + ENGINE = MEMORY + SELECT vBoss AS workerFk, 0 AS isChecked; + + + WHILE (SELECT COUNT(*) FROM tmp.workerHierarchList WHERE NOT isChecked) > 0 DO + + INSERT INTO tmp.workerHierarchList + SELECT w.id, 0 + FROM worker w + JOIN workerHierarch wh ON wh.workerFk = w.bossFk; + + UPDATE tmp.workerHierarchList whl + JOIN workerHierarch wh ON wh.workerFk = whl.workerFk + SET whl.isChecked = 1; + + TRUNCATE workerHierarch; + + INSERT INTO workerHierarch + SELECT workerFk + FROM tmp.workerHierarchList + WHERE NOT isChecked; + + END WHILE; + + DROP TEMPORARY TABLE IF EXISTS workerHierarch; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_getProductionErrors__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getProductionErrors__`(vAction VARCHAR(25), vDepartment VARCHAR(25), vStateCode VARCHAR(25) CHARSET utf8, vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.total; + + IF (vDepartment = 'Encajadores') + THEN + CREATE TEMPORARY TABLE tmp.total + ENGINE = MEMORY + SELECT e.workerFk, Count(DISTINCT t.id) AS ticketCount + FROM expedition e + JOIN ticket t ON e.ticketFk = t.id + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo + GROUP BY e.workerFk; + ELSE + CREATE TEMPORARY TABLE tmp.total + ENGINE = MEMORY + SELECT st.workerFk, Count(DISTINCT t.id) AS ticketCount + FROM state ss + JOIN vn.saleTracking st ON st.stateFk = ss.id + JOIN vn.sale s ON s.id = st.saleFk + JOIN ticket t ON s.ticketFk = t.id + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND ss.code = vStateCode + GROUP BY st.workerFk; + END IF; + + SELECT sub1.id, sub1.firstName, sub1.lastName, CAST(sub1.totalTickets AS DECIMAL(10,0)) AS totalTickets, CAST(IFNULL(sub1.errors,0) + IFNULL(sub2.errors,0) AS DECIMAL(10,0)) AS errors, (IFNULL(sub1.errors,0) + IFNULL(sub2.errors,0))/sub1.totalTickets AS ratio, IF(vDepartment = 'Revisadores', NULL, volume) AS volume + FROM( + SELECT w.id, w.code, w.firstName, w.lastName, t.ticketCount AS totalTickets, sub.errors, sub2.volume + FROM tmp.total AS t + JOIN worker w ON w.id = t.workerFk + LEFT JOIN ( + SELECT COUNT(c.ticketFk) AS errors, cd.workerFk + FROM claimDevelopment cd + JOIN claim c ON cd.claimFk = c.id + JOIN ticket t ON c.ticketFk = t.id + JOIN claimResponsible cr ON cd.claimResponsibleFk = cr.id + WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo AND cr.description = vDepartment + GROUP BY cd.workerFk + )sub ON t.workerFk = sub.workerFk + LEFT JOIN ( -- Añadir volume + SELECT SUM(w.volume) AS volume, w.workerFk + FROM bs.workerProductivity w + INNER JOIN vn.`role` r ON r.id=w.roleFk + WHERE IF(vDepartment = 'Encajadores', r.name='packager', r.name='itemPicker') AND w.dated BETWEEN vDatedFrom AND vDatedTo + GROUP BY w.workerFk) sub2 ON w.id = sub2.workerFk + GROUP BY w.code) sub1 + LEFT JOIN( + SELECT sub1.workerFk, COUNT(id) AS errors + FROM ( + SELECT st.workerFk, t.id + FROM vn.saleMistake sm + JOIN vn.saleTracking st ON sm.saleFk = st.saleFk + JOIN state ss ON ss.id = st.stateFk + JOIN vncontrol.accion a ON a.accion_id = st.actionFk + JOIN vn.sale s ON s.id = sm.saleFk + JOIN vn.ticket t on t.id = s.ticketFk + WHERE (t.shipped BETWEEN vDatedFrom AND vDatedTo) AND a.accion = vAction AND ss.code = vStateCode + GROUP BY s.ticketFk + ) sub1 + GROUP BY sub1.workerFk) sub2 ON sub2.workerFk = sub1.id; + + DROP TEMPORARY TABLE tmp.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 `worker_getSector` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `worker_getSector`() +BEGIN + +/** + * Obtiene el sector del usuario conectado +*/ + + SELECT s.id,s.description,s.warehouseFk + FROM sector s + JOIN worker w ON w.sectorFk = s.id + WHERE w.id = account.userGetId(); + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `worker_updateSector` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `worker_updateSector`(vSectorFk INT) +BEGIN + +/** + * ACtualiza el sector del usuario conectado + * + * @param vSectorFk id del sector +*/ + UPDATE worker + SET sectorFk = vSectorFk + WHERE id = account.userGetId(); + + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `workingHours` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHours`(username varchar(255), logon boolean) +BEGIN + DECLARE userid int(11); + + SELECT vn.getUserId(username) INTO userid; + SELECT username, userid; + IF userid IS NOT NULL THEN + IF (logon) THEN + CALL vn.workingHoursTimeIn(userid); + ELSE + CALL vn.workingHoursTimeOut(userid); + 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 DROP PROCEDURE IF EXISTS `workingHoursTimeIn` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeIn`(vUserId INT(11)) +BEGIN + INSERT INTO vn.workingHours (timeIn, userId) + VALUES (NOW(),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 `workingHoursTimeOut` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `workingHoursTimeOut`(vUserId INT(11)) +BEGIN + UPDATE vn.workingHours + SET timeOut = NOW() + WHERE userId = vUserId + AND DATE(timeIn) = 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 `wrongEqualizatedClient` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `wrongEqualizatedClient`() +BEGIN + SELECT clientFk, c.name, c.isActive, c.isTaxDataChecked, count(ie) as num + FROM vn.client c + JOIN + ( + SELECT DISTINCT + `a`.`clientFk` , + a.isEqualizated = 0 as ie + + FROM + `vn`.`address` `a` + ) sub ON sub.clientFk = c.id + WHERE c.hasToInvoiceByAddress = FALSE + + GROUP BY clientFk + HAVING num > 1 + UNION ALL + SELECT DISTINCT c.id, c.name, c.isActive, c.isTaxDataChecked,1 + FROM + `vn`.`address` `a` + JOIN `vn`.`client` `c` ON `c`.`id` = `a`.`clientFk` + WHERE ABS(a.isEqualizated) <> ABS(c.isEqualizated) + AND c.hasToInvoiceByAddress = 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 `xdiarioNextId__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `xdiarioNextId__`() +BEGIN +/** + * @deprecated Use ledger_next + */ + DECLARE vNewAsien INT; + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + ROLLBACK; + RESIGNAL; + END; + + START TRANSACTION; + + SELECT bookFk + 1 INTO vNewAsien FROM config FOR UPDATE; + UPDATE config SET bookFk = vNewAsien; + COMMIT; + + SELECT vNewAsien; + + DROP TEMPORARY TABLE IF EXISTS tmp.xdiarioNextId; + CREATE TEMPORARY TABLE tmp.xdiarioNextId AS + SELECT vNewAsien ; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zoneClosure_recalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneClosure_recalc`() +proc: BEGIN +/** + * Recalculates the delivery time (hour) for every zone in days + scope in future + */ + DECLARE vScope INT; + DECLARE vCounter INT DEFAULT 0; + DECLARE vShipped DATE DEFAULT CURDATE(); + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('vn.zoneClosure_recalc'); + RESIGNAL; + END; + + IF NOT GET_LOCK('vn.zoneClosure_recalc', 0) THEN + LEAVE proc; + END IF; + + SELECT scope INTO vScope + FROM zoneConfig; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + (INDEX (id)) + ENGINE = MEMORY + SELECT id FROM zone; + + TRUNCATE TABLE zoneClosure; + + WHILE vCounter <= vScope DO + + CALL zone_getOptionsForShipment(vShipped, TRUE); + + REPLACE zoneClosure(zoneFk, dated, `hour`) + SELECT zoneFk, vShipped, `hour` + FROM tmp.zoneOption; + + SET vCounter = vCounter + 1; + SET vShipped = TIMESTAMPADD(DAY, 1, vShipped); + END WHILE; + + -- DROP TEMPORARY TABLE tmp.zone; + DO RELEASE_LOCK('vn.zoneClosure_recalc'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zoneClosure_recalc_beta__` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneClosure_recalc_beta__`() +proc: BEGIN +/** + * Recalculates the delivery time (hour) for every zone in days + scope in future + */ + DECLARE vScope INT; + DECLARE vCounter INT DEFAULT 0; + DECLARE vShipped DATE DEFAULT CURDATE(); + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('vn.zoneClosure_recalc'); + RESIGNAL; + END; + + IF NOT GET_LOCK('vn.zoneClosure_recalc', 0) THEN + LEAVE proc; + END IF; + + SELECT scope INTO vScope + FROM zoneConfig; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + (INDEX (id)) + ENGINE = MEMORY + SELECT id FROM zone; + + WHILE vCounter <= vScope DO + + DELETE FROM zoneClosure + WHERE dated = vShipped; + + SELECT vShipped; + + CALL zone_getOptionsForShipment_beta(vShipped, TRUE); + + REPLACE zoneClosure(zoneFk, dated, `hour`) + SELECT zoneFk, vShipped, `hour` + FROM tmp.zoneOption; + + SET vCounter = vCounter + 1; + SET vShipped = TIMESTAMPADD(DAY, 1, vShipped); + END WHILE; + + SELECT * + FROM tmp.zoneOption; + + -- DROP TEMPORARY TABLE tmp.zone; + DO RELEASE_LOCK('vn.zoneClosure_recalc'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zoneGeo_calcTree` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_calcTree`() +BEGIN +/** + * Calculates the #path, #lft, #rgt, #sons and #depth columns of + * the #zoneGeo table. To build the tree, it uses the #parentFk + * column. + */ + DECLARE vIndex INT DEFAULT 0; + DECLARE vSons INT; + + DROP TEMPORARY TABLE IF EXISTS tNestedTree; + CREATE TEMPORARY TABLE tNestedTree + SELECT id, path, lft, rgt, depth, sons + FROM zoneGeo LIMIT 0; + + SET max_sp_recursion_depth = 5; + CALL zoneGeo_calcTreeRec(NULL, '/', 0, vIndex, vSons); + SET max_sp_recursion_depth = 0; + + UPDATE zoneGeo z + JOIN tNestedTree t ON t.id = z.id + SET z.path = t.path, + z.lft = t.lft, + z.rgt = t.rgt, + z.depth = t.depth, + z.sons = t.sons; + + DROP TEMPORARY TABLE tNestedTree; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zoneGeo_calcTreeRec` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_calcTreeRec`( + vSelf INT, + vPath VARCHAR(255), + vDepth INT, + INOUT vIndex INT, + OUT vSons INT +) +BEGIN +/** + * Calculates and sets the #path, #lft, #rgt, #sons and #depth + * columns for all children of the passed node. Once calculated + * the last node rgt index and the number of sons are returned. + * To update it's children, this procedure calls itself recursively + * for each one. + * + * @vSelf The node identifier + * @vPath The initial path + * @vDepth The initial depth + * @vIndex The initial lft index + * @vSons The number of direct sons + */ + DECLARE vChildFk INT; + DECLARE vLft INT; + DECLARE vMySons INT; + DECLARE vDone BOOL; + DECLARE vChildren CURSOR FOR + SELECT id FROM zoneGeo + WHERE (vSelf IS NULL AND parentFk IS NULL) + OR (vSelf IS NOT NULL AND parentFk = vSelf); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + SET vSons = 0; + + OPEN vChildren; + myLoop: LOOP + SET vDone = FALSE; + FETCH vChildren INTO vChildFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + SET vIndex = vIndex + 1; + SET vLft = vIndex; + SET vSons = vSons + 1; + + CALL zoneGeo_calcTreeRec( + vChildFk, + CONCAT(vPath, vChildFk, '/'), + vDepth + 1, + vIndex, + vMySons + ); + + SET vIndex = vIndex + 1; + + INSERT INTO tNestedTree + SET id = vChildFk, + path = vPath, + lft = vLft, + rgt = vIndex, + depth = vDepth, + sons = vMySons; + END LOOP; + CLOSE vChildren; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zoneGeo_checkName` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_checkName`(vName VARCHAR(255)) +BEGIN + IF vName = '' THEN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Column `name` cannot be empty'; + 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 `zoneGeo_delete` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_delete`(vSelf INT) +BEGIN +/** + * Deletes a node from the #zoneGeo table. Also sets a mark + * to force the tree recalculation. + * + * @vSelf The node identifier + */ + DELETE FROM zoneGeo WHERE id = vSelf; + UPDATE zoneGeoRecalc SET isChanged = 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 `zoneGeo_doCalc` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_doCalc`() +proc: BEGIN +/** + * Recalculates the zones tree. + */ + DECLARE vIsChanged BOOL; + + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION + BEGIN + DO RELEASE_LOCK('vn.zoneGeo_doCalc'); + RESIGNAL; + END; + + IF !GET_LOCK('vn.zoneGeo_doCalc', 0) THEN + LEAVE proc; + END IF; + + SELECT isChanged INTO vIsChanged + FROM zoneGeoRecalc; + + IF vIsChanged THEN + UPDATE zoneGeoRecalc SET isChanged = FALSE; + CALL vn.zoneGeo_calcTree; + END IF; + + DO RELEASE_LOCK('vn.zoneGeo_doCalc'); +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zoneGeo_setParent` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_setParent`(vSelf INT, vParentFk INT) +BEGIN +/** + * Updates the parent of a node. Also sets a mark + * to force the tree recalculation. + * + * @vSelf The node identifier + * @vParentFk The new parent identifier + */ + UPDATE zoneGeo SET parentFk = vParentFk + WHERE id = vSelf; + + UPDATE zoneGeoRecalc SET isChanged = 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 `zoneGeo_throwNotEditable` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zoneGeo_throwNotEditable`() +BEGIN + SIGNAL SQLSTATE '45000' + SET MESSAGE_TEXT = 'Column `geoFk` cannot be modified'; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_doCalcInitialize` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_doCalcInitialize`() +proc: BEGIN +/** + * Initialize ticket + */ + DECLARE vDone BOOL; + DECLARE vLanded DATE; + DECLARE vZoneFk INT; + + DECLARE cCur CURSOR FOR + SELECT t.landed, t.zoneFk + FROM ticket t + WHERE shipped >= '2020-03-01' + AND zoneFk IS NOT NULL and zonePrice IS NULL + GROUP BY zoneFk, shipped; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + OPEN cCur; + + myLoop: LOOP + SET vDone = FALSE; + FETCH cCur INTO vLanded, vZoneFk; + + IF vDone THEN + LEAVE myLoop; + END IF; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + (INDEX (id)) + ENGINE = MEMORY + SELECT vZoneFk id; + + CALL zone_getOptionsForLanding(vLanded, TRUE); + + UPDATE ticket t + LEFT JOIN tmp.zoneOption zo ON TRUE + SET zonePrice = zo.price, zoneBonus = zo.bonus + WHERE t.zoneFk = vZoneFk AND t.landed = vLanded + AND t.zonePrice IS NULL; + + END LOOP; + + CLOSE cCur; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_ETD_byTime` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_ETD_byTime`() +BEGIN + + SET @m := 0; + + DROP TEMPORARY TABLE IF EXISTS tmpZone; + CREATE TEMPORARY TABLE tmpZone + SELECT remainingVolume, + hourTheoretical, + @m := @m + minutesLess totalMinutes + FROM zoneEstimatedDelivery ze + WHERE ze.remainingVolume + ORDER BY ze.hourTheoretical DESC; + + SELECT * FROM tmpZone; + + DROP TABLE tmpZone; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getAgency` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAgency`(vAddress INT, vLanded DATE) +BEGIN +/** + * Devuelve el listado de agencias disponibles para la fecha + * y dirección pasadas. + * + * @param vAddress Id de dirección de envío, %NULL si es recogida + * @param vLanded Fecha de recogida + * @return tmp.zoneGetAgency Listado de agencias disponibles + */ + CALL zone_getFromGeo(address_getGeo(vAddress)); + CALL zone_getOptionsForLanding(vLanded, FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetAgency; + CREATE TEMPORARY TABLE tmp.zoneGetAgency + (INDEX (agencyModeFk)) ENGINE = MEMORY + SELECT am.name agencyMode, + am.description, + z.agencyModeFk, + am.deliveryMethodFk, + TIMESTAMPADD(DAY,-zo.travelingDays, vLanded) shipped, + TRUE isIncluded, + zo.zoneFk, + am.web AS isVisible + FROM tmp.zoneOption zo + JOIN zone z ON z.id = zo.zoneFk + JOIN agencyMode am ON am.id = z.agencyModeFk + GROUP BY agencyModeFk; + + DROP TEMPORARY TABLE + tmp.zone, + tmp.zoneOption; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getAvailable` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getAvailable`(vAddress INT, vLanded DATE) +BEGIN + CALL zone_getFromGeo(address_getGeo(vAddress)); + CALL zone_getOptionsForLanding(vLanded, FALSE); + + SELECT * FROM tmp.zoneOption; + + DROP TEMPORARY TABLE + tmp.zone, + tmp.zoneOption; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getClosed` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getClosed`() +proc:BEGIN +/** + * Devuelve una tabla con las zonas cerradas para hoy + * + * @table tmp.closedZones(zoneFk, warehouseFk); + */ + DROP TEMPORARY TABLE IF EXISTS tmp.closedZones; + + CREATE TEMPORARY TABLE tmp.closedZones ( + `zoneFk` int(11) NOT NULL, + `warehouseFk` smallint(6) unsigned NOT NULL, + PRIMARY KEY `zoneFk` (`zoneFk`,`warehouseFk`), + KEY `warehouseFk` (`warehouseFk`)) + ENGINE=MEMORY DEFAULT CHARSET=utf8; + + INSERT INTO tmp.closedZones(zoneFk, warehouseFk) + SELECT zoneFk, warehouseFk + FROM ( + SELECT t.zoneFk, t.warehouseFk, count(DISTINCT t.id) numTickets, pc.minTicketsToCloseZone + FROM vn.ticket t + JOIN vn.expedition e ON e.ticketFk = t.id + JOIN vn.`zone`z on z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + JOIN vn.agency a ON a.id = am.agencyFk + JOIN vn.productionConfig pc + WHERE a.isOwn + AND pc.isZoneClosedByExpeditionActivated + AND e.created >= CURDATE() + GROUP BY t.zoneFk, t.warehouseFk + HAVING numTickets >= minTicketsToCloseZone) sub; + END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getCollisions` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getCollisions`() +BEGIN +/** + * Calcula si para un mismo codigo postal y dia + * hay mas de una zona configurada y manda correo + * + */ + DECLARE vGeoFk INT DEFAULT NULL; + DECLARE vZoneFk INT; + DECLARE vIsDone INT DEFAULT FALSE; + DECLARE vTableCollisions TEXT; + DECLARE cur1 CURSOR FOR SELECT zoneFk from tmp.zoneOption; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + SELECT z.id + FROM zone z + JOIN agencyMode am ON am.id = z.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + WHERE dm.code IN ('AGENCY','DELIVERY'); + + CALL zone_getOptionsForShipment(CURDATE(),FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneNodes; + CREATE TEMPORARY TABLE tmp.zoneNodes ( + geoFk INT, + name VARCHAR(100), + parentFk INT, + sons INT, + isChecked BOOL DEFAULT 0, + zoneFk INT, + PRIMARY KEY zoneFkk (zoneFk, geoFk), + INDEX(geoFk)) + ENGINE = MEMORY; + + OPEN cur1; + cur1Loop: LOOP + SET vIsDone = FALSE; + FETCH cur1 INTO vZoneFk; + IF vIsDone THEN + LEAVE cur1Loop; + END IF; + + CALL zone_getLeaves2(vZoneFk, NULL, NULL); + + myLoop: LOOP + SET vGeoFk = NULL; + SELECT geoFk INTO vGeoFk + FROM tmp.zoneNodes zn + WHERE NOT isChecked + LIMIT 1; + + IF vGeoFk IS NULL THEN + LEAVE myLoop; + END IF; + + CALL zone_getLeaves2(vZoneFk, vGeoFk, NULL); + UPDATE tmp.zoneNodes + SET isChecked = TRUE + WHERE geoFk = vGeoFk; + END LOOP; + + END LOOP; + CLOSE cur1; + DELETE FROM tmp.zoneNodes + WHERE sons > 0; + + DROP TEMPORARY TABLE IF EXISTS geoCollision; + CREATE TEMPORARY TABLE geoCollision + SELECT z.agencyModeFk, zn.geoFk, zw.warehouseFk + FROM tmp.zoneNodes zn + JOIN zone z ON z.id = zn.zoneFk + JOIN zoneWarehouse zw ON z.id = zw.zoneFk + GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk + HAVING count(*) > 1; + + SELECT ' + + + + + + + + ' INTO vTableCollisions; + + INSERT INTO mail (receiver,replyTo,subject,body) + SELECT 'pepe@verdnatura.es' receiver, + 'noreply@verdnatura.es' replyTo, + CONCAT('Colisiones en zonas ', CURDATE()) subject, + CONCAT(vTableCollisions, + GROUP_CONCAT(sub.td SEPARATOR ''), + '
C.PostalNúmero de zonaPrecioZonaAlmacénSalix
') body + FROM(SELECT + CONCAT(' + ', zn.name, ' + ', zoneFk,' + ', z.price,' + ', z.name,' + ', w.name, ' + ', CONCAT('' + 'https://salix.verdnatura.es/#!/zone/', + zoneFk, + '/location?q=%7B%22search%22:%22', + zn.name, + '%22%7D'),' + ') td + FROM tmp.zoneNodes zn + JOIN zone z ON z.id = zn.zoneFk + JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk + JOIN warehouse w ON w.id = gc.warehouseFk) sub; + + DROP TEMPORARY TABLE + geoCollision, + tmp.zone, + tmp.zoneNodes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getEvents` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getEvents`( + vGeoFk INT, + vAgencyModeFk INT) +BEGIN +/** + * Returns available events for the passed province/postcode and agency. + * + * @param vGeoFk The geo id + * @param vAgencyModeFk The agency mode id + */ + DECLARE vDeliveryMethodFk VARCHAR(255); + + DROP TEMPORARY TABLE IF EXISTS tZone; + CREATE TEMPORARY TABLE tZone + (id INT PRIMARY KEY) + ENGINE = MEMORY; + + SELECT dm.`code` INTO vDeliveryMethodFk + FROM agencyMode am + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + WHERE am.id = vAgencyModeFk; + + IF vDeliveryMethodFk = 'PICKUP' THEN + INSERT INTO tZone + SELECT id + FROM zone + WHERE agencyModeFk = vAgencyModeFk; + ELSE + CALL zone_getFromGeo(vGeoFk); + + IF vAgencyModeFk IS NOT NULL THEN + INSERT INTO tZone + SELECT t.id + FROM tmp.zone t + JOIN zone z ON z.id = t.id + WHERE z.agencyModeFk = vAgencyModeFk; + ELSE + INSERT INTO tZone + SELECT t.id + FROM tmp.zone t + JOIN zone z ON z.id = t.id + JOIN agencyMode am ON am.id = z.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + WHERE dm.`code` IN ('AGENCY', 'DELIVERY'); + END IF; + DROP TEMPORARY TABLE tmp.zone; + END IF; + + SELECT e.zoneFk, e.`type`, e.dated, e.`started`, e.`ended`, e.weekDays + FROM tZone t + JOIN zoneEvent e ON e.zoneFk = t.id; + + SELECT e.zoneFk, e.dated + FROM tZone t + JOIN zoneExclusion e ON e.zoneFk = t.id; + + DROP TEMPORARY TABLE tZone; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getFromGeo` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getFromGeo`(vGeoFk INT) +BEGIN +/** + * Returns all zones which have the passed geo included. + * + * @param vGeoFk The geo id + * @return tmp.zone(id) The list of zones + */ + DECLARE vChildFk INT DEFAULT vGeoFk; + DECLARE vParentFk INT; + DECLARE vLevel INT DEFAULT 1; + + DROP TEMPORARY TABLE IF EXISTS tNodes; + CREATE TEMPORARY TABLE tNodes + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT vGeoFk id, vLevel `level`; + + myLoop: LOOP + SELECT parentFk INTO vParentFk + FROM zoneGeo + WHERE id = vChildFk; + + SET vChildFk = vParentFk; + SET vLevel = vLevel + 1; + + INSERT IGNORE INTO tNodes + SELECT vChildFk, vLevel + FROM DUAL + WHERE vChildFk IS NOT NULL; + + IF ROW_COUNT() = 0 THEN + LEAVE myLoop; + END IF; + END LOOP; + + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + CREATE TEMPORARY TABLE tmp.zone + (INDEX (id)) + ENGINE = MEMORY + SELECT id FROM ( + SELECT zoneFk id, isIncluded + FROM ( + SELECT i.zoneFk, i.isIncluded + FROM tNodes n + JOIN zoneIncluded i ON i.geoFk = n.id + ORDER BY zoneFk, n.`level` + ) t + GROUP BY id HAVING isIncluded + ) t; + + DROP TEMPORARY TABLE tNodes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getLanded` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLanded`(vShipped DATE, vAddressFk INT, vAgencyModeFk INT, vWarehouseFk INT, vShowExpiredZones BOOLEAN) +BEGIN +/** + * Devuelve una tabla temporal con el dia de recepcion para vShipped. + * Excluye las que tengan cajas preparadas + * + * @param vShipped Fecha de preparacion de mercancia + * @param vAddressFk Id de consignatario, %NULL para recogida + * @param vAgencyModeFk Id agencia + * @param vWarehouseFk vWarehouseFk + * @table tmp.zoneGetLanded Datos de recepción + */ + CALL vn.zone_getFromGeo(address_getGeo(vAddressFk)); + + CALL vn.zone_getOptionsForShipment(vShipped, vShowExpiredZones); + + CALL vn.zone_getClosed(); + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetLanded; + CREATE TEMPORARY TABLE tmp.zoneGetLanded + ENGINE = MEMORY + SELECT vWarehouseFk warehouseFk, + TIMESTAMPADD(DAY,zo.travelingDays, vShipped) landed, + zo.zoneFk + FROM tmp.zoneOption zo + JOIN vn.`zone` z ON z.id = zo.zoneFk + JOIN vn.zoneWarehouse zw ON zw.zoneFk = z.id + LEFT JOIN tmp.closedZones cz + ON cz.warehouseFk = zw.warehouseFk + AND cz.zoneFk = zw.zoneFk + AND zo.shipped = CURDATE() + WHERE z.agencyModeFk = vAgencyModeFk + AND zw.warehouseFk = vWarehouseFk + AND (ISNULL(cz.zoneFk) OR vShowExpiredZones); + + DROP TEMPORARY TABLE + tmp.`zone`, + tmp.zoneOption, + tmp.closedZones; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getLeaves` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves`(vSelf INT, vParentFk INT, vSearch VARCHAR(255)) +BEGIN +/** + * Devuelve las ubicaciones incluidas en la ruta y que sean hijos de parentFk. + * @param vSelf Id de la zona + * @param vParentFk Id del geo a calcular + * @param vSearch cadena a buscar + */ + DECLARE vIsNumber BOOL; + DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; + + DROP TEMPORARY TABLE IF EXISTS tNodes; + CREATE TEMPORARY TABLE tNodes + (UNIQUE (id)) + ENGINE = MEMORY + SELECT id + FROM zoneGeo + LIMIT 0; + + IF vIsSearch THEN + SET vIsNumber = vSearch REGEXP '^[0-9]+$'; + + INSERT INTO tNodes + SELECT id + FROM zoneGeo + WHERE (vIsNumber AND `name` = vSearch) + OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) + LIMIT 1000; + + ELSEIF vParentFk IS NULL THEN + INSERT INTO tNodes + SELECT geoFk + FROM zoneIncluded + WHERE zoneFk = vSelf; + END IF; + + IF vParentFk IS NULL THEN + DROP TEMPORARY TABLE IF EXISTS tChilds; + CREATE TEMPORARY TABLE tChilds + ENGINE = MEMORY + SELECT id + FROM tNodes; + + DROP TEMPORARY TABLE IF EXISTS tParents; + CREATE TEMPORARY TABLE tParents + ENGINE = MEMORY + SELECT id + FROM zoneGeo + LIMIT 0; + + myLoop: LOOP + DELETE FROM tParents; + INSERT INTO tParents + SELECT parentFk id + FROM zoneGeo g + JOIN tChilds c ON c.id = g.id + WHERE g.parentFk IS NOT NULL; + + INSERT IGNORE INTO tNodes + SELECT id + FROM tParents; + + IF ROW_COUNT() = 0 THEN + LEAVE myLoop; + END IF; + + DELETE FROM tChilds; + INSERT INTO tChilds + SELECT id + FROM tParents; + END LOOP; + + DROP TEMPORARY TABLE tChilds, tParents; + END IF; + + IF !vIsSearch THEN + INSERT IGNORE INTO tNodes + SELECT id + FROM zoneGeo + WHERE parentFk <=> vParentFk; + END IF; + + SELECT g.id, + g.name, + g.parentFk, + g.sons, + isIncluded selected + FROM zoneGeo g + JOIN tNodes n ON n.id = g.id + LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf + ORDER BY `depth`, selected DESC, name; + + DROP TEMPORARY TABLE tNodes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getLeaves2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves2`(vSelf INT, vParentFk INT, vSearch VARCHAR(255)) +BEGIN +/** + * Devuelve los geoFk incluidos en la ruta y que sean hijos de parentFk + * @param vSelf Id de la zona + * @param vParentFk Id del geo a calcular + * @param vSearch cadena a buscar + * + * @return tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + * + */ + DECLARE vIsNumber BOOL; + DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; + + DROP TEMPORARY TABLE IF EXISTS tNodes; + CREATE TEMPORARY TABLE tNodes + (UNIQUE (id)) + ENGINE = MEMORY + SELECT id + FROM zoneGeo + LIMIT 0; + + IF vIsSearch THEN + SET vIsNumber = vSearch REGEXP '^[0-9]+$'; + + INSERT INTO tNodes + SELECT id + FROM zoneGeo + WHERE (vIsNumber AND `name` = vSearch) + OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) + LIMIT 1000; + + ELSEIF vParentFk IS NULL THEN + INSERT INTO tNodes + SELECT geoFk + FROM zoneIncluded + WHERE zoneFk = vSelf; + END IF; + + IF vParentFk IS NULL THEN + DROP TEMPORARY TABLE IF EXISTS tChilds; + CREATE TEMPORARY TABLE tChilds + (INDEX(id)) + ENGINE = MEMORY + SELECT id + FROM tNodes; + + DROP TEMPORARY TABLE IF EXISTS tParents; + CREATE TEMPORARY TABLE tParents + (INDEX(id)) + ENGINE = MEMORY + SELECT id + FROM zoneGeo + LIMIT 0; + + myLoop: LOOP + DELETE FROM tParents; + INSERT INTO tParents + SELECT parentFk id + FROM zoneGeo g + JOIN tChilds c ON c.id = g.id + WHERE g.parentFk IS NOT NULL; + + INSERT IGNORE INTO tNodes + SELECT id + FROM tParents; + + IF ROW_COUNT() = 0 THEN + LEAVE myLoop; + END IF; + + DELETE FROM tChilds; + INSERT INTO tChilds + SELECT id + FROM tParents; + END LOOP; + + DROP TEMPORARY TABLE tChilds, tParents; + END IF; + + IF !vIsSearch THEN + INSERT IGNORE INTO tNodes + SELECT id + FROM zoneGeo + WHERE parentFk <=> vParentFk; + END IF; + + INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + SELECT g.id, + g.`name`, + g.parentFk, + g.sons, + NOT g.sons OR type = 'country', + vSelf + FROM zoneGeo g + JOIN tNodes n ON n.id = g.id + LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf + WHERE i.isIncluded = TRUE + OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL); + + DROP TEMPORARY TABLE tNodes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getLeaves___` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves___`( + vSelf INT, + vParentFk INT, + vSearch VARCHAR(255) +) +BEGIN + DECLARE vIsNumber BOOL; + DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; + + DROP TEMPORARY TABLE IF EXISTS tNodes; + CREATE TEMPORARY TABLE tNodes + (UNIQUE (id)) + ENGINE = MEMORY + SELECT id FROM zoneGeo LIMIT 0; + + IF vIsSearch THEN + SET vIsNumber = vSearch REGEXP '^[0-9]+$'; + + INSERT INTO tNodes + SELECT id FROM zoneGeo + WHERE (vIsNumber AND `name` = vSearch) + OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) + LIMIT 1000; + ELSEIF vParentFk IS NULL THEN + INSERT INTO tNodes + SELECT geoFk FROM zoneIncluded + WHERE zoneFk = vSelf; + END IF; + + IF vParentFk IS NULL THEN + DROP TEMPORARY TABLE IF EXISTS tChilds; + CREATE TEMPORARY TABLE tChilds + ENGINE = MEMORY + SELECT id FROM tNodes; + + DROP TEMPORARY TABLE IF EXISTS tParents; + CREATE TEMPORARY TABLE tParents + ENGINE = MEMORY + SELECT id FROM zoneGeo LIMIT 0; + + myLoop: LOOP + DELETE FROM tParents; + INSERT INTO tParents + SELECT parentFk id + FROM zoneGeo g + JOIN tChilds c ON c.id = g.id + WHERE g.parentFk IS NOT NULL; + + INSERT IGNORE INTO tNodes + SELECT id FROM tParents; + + IF ROW_COUNT() = 0 THEN + LEAVE myLoop; + END IF; + + DELETE FROM tChilds; + INSERT INTO tChilds + SELECT id FROM tParents; + END LOOP; + + DROP TEMPORARY TABLE + tChilds, + tParents; + END IF; + + IF !vIsSearch THEN + INSERT IGNORE INTO tNodes + SELECT id FROM zoneGeo + WHERE parentFk <=> vParentFk; + END IF; + + + INSERT IGNORE INTO zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + SELECT g.id, + g.`name`, + g.parentFk, + g.sons, + NOT g.sons OR type = 'country', + vSelf + FROM zoneGeo g + JOIN tNodes n ON n.id = g.id + LEFT JOIN zoneIncluded i + ON i.geoFk = g.id AND i.zoneFk = vSelf + WHERE (i.isIncluded = TRUE + OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL)) + ; + + DROP TEMPORARY TABLE tNodes; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getOptionsForLanding` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForLanding`(vLanded DATE, vShowExpiredZones BOOLEAN) +BEGIN +/** + * Gets computed options for the passed zones and delivery date. + * + * @table tmp.zone(id) The zones ids + * @param vLanded The delivery date + * @return tmp.zoneOption The computed options + */ + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; + CREATE TEMPORARY TABLE tmp.zoneOption + ENGINE = MEMORY + SELECT + zoneFk, + `hour`, + travelingDays, + price, + bonus, + TIMESTAMPADD(DAY, -travelingDays, vLanded) shipped + FROM ( + SELECT t.id zoneFk, + TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, + IFNULL(e.travelingDays, z.travelingDays) travelingDays, + IFNULL(e.price, z.price) price, + IFNULL(e.bonus, z.bonus) bonus + FROM tmp.zone t + JOIN zone z ON z.id = t.id + JOIN zoneEvent e ON e.zoneFk = t.id + WHERE ( + e.`type` = 'day' + AND e.dated = vLanded + ) OR ( + e.`type` != 'day' + AND e.weekDays & (1 << WEEKDAY(vLanded)) + AND (e.`started` IS NULL OR vLanded >= e.`started`) + AND (e.`ended` IS NULL OR vLanded <= e.`ended`) + ) + ORDER BY + zoneFk, + CASE + WHEN e.`type` = 'day' + THEN 1 + WHEN e.`type` = 'range' + THEN 2 + ELSE 3 + END + ) t + GROUP BY zoneFk; + + DELETE t FROM tmp.zoneOption t + JOIN zoneExclusion e + ON e.zoneFk = t.zoneFk AND e.`dated` = vLanded; + + IF NOT vShowExpiredZones THEN + DELETE FROM tmp.zoneOption + WHERE shipped < CURDATE() + OR (shipped = CURDATE() AND CURTIME() > `hour`); + 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 `zone_getOptionsForShipment` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getOptionsForShipment`(vShipped DATE, vShowExpiredZones BOOLEAN) +BEGIN +/** + * Gets computed options for the passed zones and shipping date. + * + * @table tmp.zones(id) The zones ids + * @param vShipped The shipping date + * @return tmp.zoneOption(zoneFk, hour, travelingDays, price, bonus, specificity) The computed options + */ + DECLARE vHour TIME DEFAULT TIME(NOW()); + + DROP TEMPORARY TABLE IF EXISTS tLandings; + CREATE TEMPORARY TABLE tLandings + (INDEX (eventFk)) + ENGINE = MEMORY + SELECT e.id eventFk, + @travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays, + TIMESTAMPADD(DAY, @travelingDays, vShipped) landed + FROM tmp.zone t + JOIN zone z ON z.id = t.id + JOIN zoneEvent e ON e.zoneFk = t.id; + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; + CREATE TEMPORARY TABLE tmp.zoneOption + ENGINE = MEMORY + SELECT * + FROM ( + SELECT t.id zoneFk, + TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, + l.travelingDays, + IFNULL(e.price, z.price) price, + IFNULL(e.bonus, z.bonus) bonus, + l.landed, + vShipped shipped + FROM tmp.zone t + JOIN zone z ON z.id = t.id + JOIN zoneEvent e ON e.zoneFk = t.id + JOIN tLandings l ON l.eventFk = e.id + WHERE ( + e.`type` = 'day' + AND e.`dated` = l.landed + ) OR ( + e.`type` != 'day' + AND e.weekDays & (1 << WEEKDAY(l.landed)) + AND (e.`started` IS NULL OR l.landed >= e.`started`) + AND (e.`ended` IS NULL OR l.landed <= e.`ended`) + ) + ORDER BY + zoneFk, + CASE + WHEN e.`type` = 'day' + THEN 1 + WHEN e.`type` = 'range' + THEN 2 + ELSE 3 + END + ) t + GROUP BY zoneFk; + + DROP TEMPORARY TABLE tLandings; + + DELETE t FROM tmp.zoneOption t + JOIN zoneExclusion e + ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; + + IF NOT vShowExpiredZones THEN + DELETE FROM tmp.zoneOption + WHERE vShipped < CURDATE() + OR (vShipped = CURDATE() AND CURTIME() > `hour`); + 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 `zone_getShipped` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getShipped`(vLanded DATE, vAddressFk INT, vAgencyModeFk INT, vShowExpiredZones BOOLEAN) +BEGIN +/** + * Devuelve la mínima fecha de envío para cada warehouse + * Excluye aquellas zonas que ya tienen cajas preparadas en ese almacén + * + * @param vLanded La fecha de recepcion + * @param vAddressFk Id del consignatario + * @param vAgencyModeFk Id de la agencia + * @return tmp.zoneGetShipped + */ + CALL vn.zone_getFromGeo(address_getGeo(vAddressFk)); + CALL vn.zone_getOptionsForLanding(vLanded, vShowExpiredZones); + CALL vn.zone_getClosed(); + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneGetShipped; + CREATE TEMPORARY TABLE tmp.zoneGetShipped + ENGINE = MEMORY + SELECT * FROM ( + SELECT zo.zoneFk, + zo.shipped, + zo.`hour`, + zw.warehouseFk, + z.agencyModeFk, + zo.price, + zo.bonus + FROM tmp.zoneOption zo + JOIN vn.zoneWarehouse zw ON zw.zoneFk = zo.zoneFk + JOIN vn.`zone` z ON z.id = zo.zoneFk + LEFT JOIN tmp.closedZones cz + ON cz.warehouseFk = zw.warehouseFk + AND cz.zoneFk = zw.zoneFk + AND zo.shipped = CURDATE() + WHERE z.agencyModeFk = vAgencyModeFk + AND (ISNULL(cz.zoneFk) OR vShowExpiredZones) + ORDER BY shipped) t + GROUP BY warehouseFk; + + DROP TEMPORARY TABLE + tmp.`zone`, + tmp.zoneOption, + tmp.closedZones; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getState` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getState`(vDated DATE) +BEGIN +/** + * Devuelve las zonas y el estado para la fecha solicitada + * + * @param vDated Fecha en cuestión + */ + DROP TEMPORARY TABLE IF EXISTS tmp.zone; + + CREATE TEMPORARY TABLE tmp.zone ( + id INT PRIMARY KEY) + ENGINE=MEMORY; + + INSERT INTO tmp.zone(id) + SELECT id + FROM vn.zone; + + CALL vn.zone_getOptionsForShipment(vDated, TRUE); + + CALL vn.zone_getClosed(); + + SELECT zo.zoneFk, + zo.`hour`etd, + (zo.`hour` <= TIME(now())) isLate, + !ISNULL(cz.zoneFk) isFull, + zw.warehouseFk, + zo.landed + FROM tmp.zoneOption zo + JOIN vn.zone z ON z.id = zo.zoneFk + JOIN vn.zoneWarehouse zw ON zw.zoneFk = z.id + LEFT JOIN tmp.closedZones cz + ON cz.warehouseFk = zw.warehouseFk + AND cz.zoneFk = zo.zoneFk; + + DROP TEMPORARY TABLE + tmp.closedZones, + tmp.zoneOption, + tmp.zone; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_getWarehouse` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getWarehouse`(vAddress INT, vLanded DATE, vWarehouse INT) +BEGIN +/** + * Devuelve el listado de agencias disponibles para la fecha, + * dirección y almacén pasados. + * + * @param vAddress + * @param vWarehouse warehouse + * @param vLanded Fecha de recogida + * @select Listado de agencias disponibles + */ + + CALL zone_getFromGeo(address_getGeo(vAddress)); + CALL zone_getOptionsForLanding(vLanded, FALSE); + + SELECT am.id agencyModeFk, + am.name agencyMode, + am.description, + am.deliveryMethodFk, + TIMESTAMPADD(DAY, -zo.travelingDays, vLanded) shipped, + zw.warehouseFk, + z.id zoneFk + FROM tmp.zoneOption zo + JOIN zone z ON z.id = zo.zoneFk + JOIN agencyMode am ON am.id = z.agencyModeFk + JOIN zoneWarehouse zw ON zw.zoneFk = zo.zoneFk + WHERE zw.warehouseFk = vWarehouse + GROUP BY z.agencyModeFk + ORDER BY agencyMode; + + DROP TEMPORARY TABLE + tmp.zone, + tmp.zoneOption; + +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!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 `zone_upcomingDeliveries` */; +/*!50003 SET @saved_cs_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`@`localhost` PROCEDURE `zone_upcomingDeliveries`() +BEGIN + + DECLARE vForwardDays INT; + + SELECT forwardDays INTO vForwardDays FROM zoneConfig; + CALL util.time_createTable(CURDATE(), DATE_ADD(CURDATE(), INTERVAL vForwardDays DAY)); + + DROP TEMPORARY TABLE IF EXISTS tLandings; + CREATE TEMPORARY TABLE tLandings + (INDEX (eventFk)) + ENGINE = MEMORY + SELECT e.id eventFk, + @travelingDays := IFNULL(e.travelingDays, z.travelingDays) travelingDays, + TIMESTAMPADD(DAY, @travelingDays, ti.dated) landed, + ti.dated shipped + FROM zone z + JOIN zoneEvent e ON e.zoneFk = z.id + JOIN tmp.time ti ON ti.dated BETWEEN curdate() AND TIMESTAMPADD(DAY, vForwardDays, curdate()); + + DROP TEMPORARY TABLE IF EXISTS tmp.zoneOption; + CREATE TEMPORARY TABLE tmp.zoneOption + ENGINE = MEMORY + SELECT * + FROM ( + SELECT z.id zoneFk, + TIME(IFNULL(e.`hour`, z.`hour`)) `hour`, + l.travelingDays, + IFNULL(e.price, z.price) price, + IFNULL(e.bonus, z.bonus) bonus, + l.landed, + l.shipped + FROM zone z + JOIN zoneEvent e ON e.zoneFk = z.id + JOIN tLandings l ON l.eventFk = e.id + WHERE ( + e.`type` = 'day' + AND e.`dated` = l.landed + ) OR ( + e.`type` != 'day' + AND e.weekDays & (1 << WEEKDAY(l.landed)) + AND (e.`started` IS NULL OR l.landed >= e.`started`) + AND (e.`ended` IS NULL OR l.landed <= e.`ended`) + ) + ORDER BY + zoneFk, + CASE + WHEN e.`type` = 'day' + THEN 1 + WHEN e.`type` = 'range' + THEN 2 + ELSE 3 + END + ) t + GROUP BY zoneFk, landed; + + DELETE t FROM tmp.zoneOption t + JOIN zoneExclusion e + ON e.zoneFk = t.zoneFk AND e.`dated` = t.landed; + + SELECT MAX(zo.`hour`) `hour`, zg.`name`, zo.shipped, zo.zoneFk + FROM tmp.zoneOption zo + JOIN `zone` z ON z.id = zo.zoneFk + JOIN agencyMode am ON am.id = z.agencyModeFk + JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk + JOIN zoneIncluded zi ON zi.zoneFk = z.id + JOIN zoneGeo zg ON zg.id = zi.geoFk AND zg.type = 'province' + WHERE dm.code = 'DELIVERY' + GROUP BY shipped, zg.`name` + ORDER BY shipped, zg.`name`; + + DROP TEMPORARY TABLE tmp.time, tLandings; +END ;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_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: `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=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +/*!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(10) unsigned DEFAULT NULL, + PRIMARY KEY (`inter_id`), + KEY `currante` (`Id_Trabajador`), + KEY `responsable` (`Id_Supervisor`), + KEY `ticket` (`Id_Ticket`), + KEY `inter_state` (`state_id`), + KEY `inter_id` (`Id_Ticket`,`inter_id`) USING BTREE, + CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn`.`ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn`.`state` (`id`) ON UPDATE CASCADE, + CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn`.`worker` (`id`) ON UPDATE CASCADE +) ENGINE=InnoDBDEFAULT 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_beforeInsert` + BEFORE INSERT ON `inter` + FOR EACH ROW +BEGIN + DECLARE vState VARCHAR(15); + DECLARE vZoneFk INT; + DECLARE vHasStowAway BOOLEAN; + DECLARE vBoardingStateFk INT; + + SELECT s.code INTO vState + FROM vn.state s + WHERE s.id = NEW.state_id; + + SELECT t.zonefk INTO vZoneFk + FROM vn.ticket t + WHERE t.id = NEW.Id_Ticket; + + IF vState = 'OK' AND vZoneFk IS NULL THEN + CALL util.throw("ASSIGN_ZONE_FIRST"); + END IF; + +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_afterInsert` + AFTER INSERT ON `inter` + FOR EACH ROW +BEGIN + + DECLARE vNumTicketsPrepared INT; + + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) + SELECT NEW.Id_Ticket, NEW.inter_id, `name` + FROM vn.state + WHERE 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_afterUpdate` + AFTER UPDATE ON `inter` + FOR EACH ROW +BEGIN + DECLARE vTicketFk INT; + DECLARE vTicketTrackingFk INT; + DECLARE vStateName VARCHAR(15); + + IF NEW.state_id <> OLD.state_id THEN + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) + SELECT NEW.Id_Ticket, NEW.inter_id, `name` + FROM vn.state + WHERE id = NEW.state_id; + END IF; + + IF NEW.Id_Ticket <> OLD.Id_Ticket THEN + SELECT i.Id_Ticket, i.inter_id, s.`name` + INTO vTicketFk, vTicketTrackingFk, vStateName + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE Id_Ticket = NEW.Id_Ticket + ORDER BY odbc_date DESC + LIMIT 1; + + IF vTicketFk > 0 THEN + REPLACE INTO vn.ticketLastState(ticketFk, ticketTrackingFk,name) + VALUES(vTicketFk, vTicketTrackingFk, vStateName); + 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 = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_afterDelete` + AFTER DELETE ON `inter` + FOR EACH ROW +BEGIN + DECLARE vTicketFk INT; + DECLARE vTicketTrackingFk INT; + DECLARE vStateName VARCHAR(15); + + DECLARE CONTINUE HANDLER FOR SQLSTATE '23000' + BEGIN + DELETE FROM vn.ticketLastState + WHERE ticketFk = OLD.Id_Ticket; + END; + + SELECT i.Id_Ticket, i.inter_id, s.`name` + INTO vTicketFk, vTicketTrackingFk, vStateName + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE Id_Ticket = OLD.Id_Ticket + ORDER BY odbc_date DESC + LIMIT 1; + + IF vTicketFk > 0 THEN + REPLACE INTO vn.ticketLastState(ticketFk, ticketTrackingFk,name) + VALUES(vTicketFk, vTicketTrackingFk, vStateName); + 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 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 */ ; +/*!50003 SET character_set_client = utf8mb4 */ ; +/*!50003 SET character_set_results = utf8mb4 */ ; +/*!50003 SET collation_connection = utf8mb4_unicode_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; +DELIMITER ;; +CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() +BEGIN + DECLARE vDate DATETIME DEFAULT TIMESTAMPADD(MONTH, -2, CURDATE()); + DELETE i FROM inter i JOIN vn.ticket t ON i.Id_Ticket = t.id + WHERE t.shipped <= 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 */ ; + +-- +-- Current Database: `account` +-- + +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 */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `accountDovecot` AS select `u`.`name` AS `name`,`u`.`password` AS `password` from (`user` `u` join `account` `a` on((`a`.`id` = `u`.`id`))) where `u`.`active` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `emailUser` +-- + +/*!50001 DROP TABLE IF EXISTS `emailUser`*/; +/*!50001 DROP VIEW IF EXISTS `emailUser`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `emailUser` AS select `u`.`id` AS `userFk`,concat(`u`.`name`,'@',`mc`.`domain`) AS `email` from (`user` `u` join `mailConfig` `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 `myRole` +-- + +/*!50001 DROP TABLE IF EXISTS `myRole`*/; +/*!50001 DROP VIEW IF EXISTS `myRole`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myRole` AS select `r`.`inheritsFrom` AS `id` from (`roleRole` `r` join `user` `u` on((`u`.`role` = `r`.`role`))) where (`u`.`id` = `myUser_getId`()) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `myUser` +-- + +/*!50001 DROP TABLE IF EXISTS `myUser`*/; +/*!50001 DROP VIEW IF EXISTS `myUser`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myUser` 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` = `myUserGetName`()) */ +/*!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: `bs` +-- + +USE `bs`; + +-- +-- Final view structure for view `bajasLaborales` +-- + +/*!50001 DROP TABLE IF EXISTS `bajasLaborales`*/; +/*!50001 DROP VIEW IF EXISTS `bajasLaborales`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `bajasLaborales` AS select `p`.`firstname` AS `firstname`,`p`.`name` AS `name`,`b`.`business_id` AS `business_id`,max(`ce`.`date`) AS `lastDate`,max(ifnull(`b`.`date_end`,curdate())) AS `endContract`,`cs`.`type` AS `type`,cast(count(0) as decimal(10,0)) AS `dias`,`w`.`userFk` AS `userFk` from (((((`postgresql`.`calendar_employee` `ce` join `postgresql`.`business` `b` on((`b`.`business_id` = `ce`.`business_id`))) join `postgresql`.`profile` `pr` on((`pr`.`profile_id` = `b`.`client_id`))) join `postgresql`.`person` `p` on((`p`.`person_id` = `pr`.`person_id`))) join `postgresql`.`calendar_state` `cs` on((`cs`.`calendar_state_id` = `ce`.`calendar_state_id`))) join `vn`.`worker` `w` on((`w`.`id` = `p`.`id_trabajador`))) where ((`ce`.`date` >= (curdate() + interval -(1) year)) and (`cs`.`type` not in ('Vacaciones','Vacaciones 1/2 día','Compensar','Festivo'))) group by `p`.`firstname`,`p`.`name`,`cs`.`type` having (`endContract` >= 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 `lastIndicators` +-- + +/*!50001 DROP TABLE IF EXISTS `lastIndicators`*/; +/*!50001 DROP VIEW IF EXISTS `lastIndicators`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `lastIndicators` AS select `i`.`updated` AS `updated`,`i`.`lastYearSales` AS `lastYearSales`,(`i`.`lastYearSales` - `yi`.`lastYearSales`) AS `incLastYearSales`,`i`.`totalGreuge` AS `totalGreuge`,(`i`.`totalGreuge` - `yi`.`totalGreuge`) AS `incTotalGreuge`,`i`.`latePaymentRate` AS `latePaymentRate`,(`i`.`latePaymentRate` - `yi`.`latePaymentRate`) AS `incLatePaymentRate`,`i`.`countEmployee` AS `countEmployee`,(`i`.`countEmployee` - `yi`.`countEmployee`) AS `incCountEmployee`,`i`.`averageMana` AS `averageMana`,(`i`.`averageMana` - `yi`.`averageMana`) AS `incAverageMana`,`i`.`bankingPool` AS `bankingPool`,(`i`.`bankingPool` - `yi`.`bankingPool`) AS `incbankingPool`,`i`.`lastMonthActiveClients` AS `lastMonthActiveClients`,(`i`.`lastMonthActiveClients` - `yi`.`lastMonthActiveClients`) AS `incLastMonthActiveClients`,`i`.`lastMonthLostClients` AS `lastMonthLostClients`,(`i`.`lastMonthLostClients` - `yi`.`lastMonthLostClients`) AS `incLastMonthLostClients`,`i`.`lastMonthNewClients` AS `lastMonthNewClients`,(`i`.`lastMonthNewClients` - `yi`.`lastMonthNewClients`) AS `incLastMonthNewClients`,`i`.`lastMonthWebBuyingRate` AS `lastMonthWebBuyingRate`,(`i`.`lastMonthWebBuyingRate` - `yi`.`lastMonthWebBuyingRate`) AS `incLastMonthWebBuyingRate`,`i`.`productionHours__` AS `productionHours__`,`i`.`dailyWorkersCost__` AS `dailyWorkersCost__`,`i`.`volumeM3__` AS `volumeM3__`,`i`.`salesValue__` AS `salesValue__`,`i`.`valueM3__` AS `valueM3__`,`i`.`hoursM3__` AS `hoursM3__`,`i`.`workerCostM3__` AS `workerCostM3__`,`i`.`salesWorkersCostRate__` AS `salesWorkersCostRate__`,`i`.`thisWeekSales` AS `thisWeekSales`,`i`.`lastYearWeekSales` AS `lastYearWeekSales` from (`indicators` `i` join `indicators` `yi` on((`yi`.`updated` = (select (max(`indicators`.`updated`) + interval -(1) day) from `indicators`)))) where (`i`.`updated` = (select max(`indicators`.`updated`) from `indicators`)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `m3Silla__` +-- + +/*!50001 DROP TABLE IF EXISTS `m3Silla__`*/; +/*!50001 DROP VIEW IF EXISTS `m3Silla__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `m3Silla__` AS select `m3`.`fecha` AS `fecha`,`m3`.`year` AS `year`,`m3`.`month` AS `month`,`m3`.`week` AS `week`,`m3`.`day` AS `day`,`m3`.`dayName` AS `dayName`,cast(sum(`m3`.`m3`) as decimal(10,0)) AS `Volumen`,cast(sum(`m3`.`euros`) as decimal(10,0)) AS `Euros` from `m3` where (`m3`.`warehouseFk` in (1,44)) group by `m3`.`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 `manaCustomer` +-- + +/*!50001 DROP TABLE IF EXISTS `manaCustomer`*/; +/*!50001 DROP VIEW IF EXISTS `manaCustomer`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `manaCustomer` AS select `cmc`.`clientFk` AS `Id_Cliente`,`cmc`.`mana` AS `Mana`,`cmc`.`dated` AS `dated` from `vn`.`clientManaCache` `cmc` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `manaSpellersExcluded` +-- + +/*!50001 DROP TABLE IF EXISTS `manaSpellersExcluded`*/; +/*!50001 DROP VIEW IF EXISTS `manaSpellersExcluded`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `manaSpellersExcluded` AS select `m`.`Id_Trabajador` AS `workerFk` from `bs`.`mana_spellers_excluded` `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 `mana_spellers` +-- + +/*!50001 DROP TABLE IF EXISTS `mana_spellers`*/; +/*!50001 DROP VIEW IF EXISTS `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `mana_spellers` AS select `wm`.`workerFk` AS `Id_Trabajador`,`wm`.`size` AS `size`,`wm`.`amount` AS `used`,`wm`.`pricesModifierRate` AS `prices_modifier_rate`,`wm`.`isPricesModifierActivated` AS `prices_modifier_activated`,`wm`.`minRate` AS `minRate`,`wm`.`maxRate` AS `maxRate` from `vn`.`workerMana` `wm` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `mana_spellers_excluded` +-- + +/*!50001 DROP TABLE IF EXISTS `mana_spellers_excluded`*/; +/*!50001 DROP VIEW IF EXISTS `mana_spellers_excluded`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `mana_spellers_excluded` AS select `wme`.`workerFk` AS `Id_Trabajador` from `vn`.`workerManaExcluded` `wme` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `packingSpeed` +-- + +/*!50001 DROP TABLE IF EXISTS `packingSpeed`*/; +/*!50001 DROP VIEW IF EXISTS `packingSpeed`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `packingSpeed` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,((`p`.`width` * `p`.`height`) * `p`.`depth`)) AS `cm3`,`t`.`warehouseFk` AS `warehouse_id`,`e`.`created` AS `odbc_date` from ((`vn`.`expedition` `e` join `vn`.`packaging` `p` on((`p`.`id` = `e`.`packagingFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) where (`e`.`created` between curdate() and `util`.`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 `s1_ticketDetail` +-- + +/*!50001 DROP TABLE IF EXISTS `s1_ticketDetail`*/; +/*!50001 DROP VIEW IF EXISTS `s1_ticketDetail`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `s1_ticketDetail` AS select `s`.`ticketFk` AS `ticketFk`,cast(sum((`s`.`price` * `s`.`quantity`)) as decimal(10,2)) AS `ticketAmount`,count(`s`.`id`) AS `ticketLines`,cast(sum(`sv`.`volume`) as decimal(10,2)) AS `ticketM3`,cast(`t`.`shipped` as date) AS `shipped` from ((`vn`.`ticket` `t` join `vn`.`sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where (`t`.`shipped` between '2021-09-01' and '2021-10-31 23:59') group by `s`.`ticketFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `s21_saleDetail` +-- + +/*!50001 DROP TABLE IF EXISTS `s21_saleDetail`*/; +/*!50001 DROP VIEW IF EXISTS `s21_saleDetail`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `s21_saleDetail` AS select dayofmonth(`t`.`shipped`) AS `dia`,year(`t`.`shipped`) AS `año`,month(`t`.`shipped`) AS `mes`,`s`.`concept` AS `concepto`,`s`.`quantity` AS `unidades`,`s`.`price` AS `precio`,(`s`.`quantity` * `s`.`price`) AS `venta`,`it`.`name` AS `familia`,`w`.`code` AS `comprador`,`s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`sv`.`volume` AS `volume` from ((((((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `vn`.`worker` `w` on((`w`.`id` = `it`.`workerFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where (((`t`.`shipped` between '2020-10-21' and '2020-10-28') or (`t`.`shipped` between '2019-10-21' and '2019-10-28') or (`t`.`shipped` between '2021-09-1' and '2021-10-28')) and (`t`.`warehouseFk` in (1,60)) and `c`.`isRelevant` and (`s`.`quantity` > 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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `sale__` AS select `v`.`Id_Movimiento` AS `saleFk`,`v`.`importe` AS `amount`,`v`.`recargo` AS `surcharge`,`v`.`fecha` AS `dated`,`v`.`tipo_id` AS `typeFk`,`v`.`Id_Cliente` AS `clientFk`,`v`.`empresa_id` AS `companyFk`,`v`.`margen` AS `margin` from `ventas` `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 `salesPerson__` +-- + +/*!50001 DROP TABLE IF EXISTS `salesPerson__`*/; +/*!50001 DROP VIEW IF EXISTS `salesPerson__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `salesPerson__` AS select `v`.`Id_Trabajador` AS `workerFk`,`v`.`año` AS `year`,`v`.`mes` AS `month`,`v`.`importe` AS `amount`,`v`.`comision` AS `commission`,`v`.`comisionArrendada` AS `leasedCommission`,`v`.`comisionCedida` AS `cededCommission`,`v`.`comisionNuevos` AS `newCommission`,`v`.`sustitucionArrendada` AS `leasedReplacement`,`v`.`itemTypeBorrowed` AS `itemTypeBorrowed`,`v`.`portfolioWeight` AS `portfolioWeight`,`v`.`updated` AS `updated` from `vendedores` `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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v_ventas__` AS select (`ventas`.`importe` * `Movimientos`.`Cantidad`) AS `importe`,`ventas`.`recargo` AS `recargo`,`time`.`year` AS `year`,`time`.`month` AS `month`,`time`.`week` AS `week`,`time`.`day` AS `day` from ((`bs`.`ventas` join `vn2008`.`time` on((`time`.`date` = `ventas`.`fecha`))) join `vn2008`.`Movimientos` on((`ventas`.`Id_Movimiento` = `Movimientos`.`Id_Movimiento`))) group by `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 */; + +-- +-- Final view structure for view `vendedores` +-- + +/*!50001 DROP TABLE IF EXISTS `vendedores`*/; +/*!50001 DROP VIEW IF EXISTS `vendedores`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `vendedores` AS select `sp`.`workerFk` AS `Id_Trabajador`,`sp`.`year` AS `año`,`sp`.`month` AS `mes`,`sp`.`amount` AS `importe`,`sp`.`commission` AS `comision`,`sp`.`leasedCommission` AS `comisionArrendada`,`sp`.`cededCommission` AS `comisionCedida`,`sp`.`newCommission` AS `comisionNuevos`,`sp`.`leasedReplacement` AS `sustitucionArrendada`,`sp`.`itemTypeBorrowed` AS `itemTypeBorrowed`,`sp`.`portfolioWeight` AS `portfolioWeight`,`sp`.`updated` AS `updated` from `salesPerson` `sp` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `ventas` +-- + +/*!50001 DROP TABLE IF EXISTS `ventas`*/; +/*!50001 DROP VIEW IF EXISTS `ventas`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ventas` AS select `s`.`saleFk` AS `Id_Movimiento`,`s`.`amount` AS `importe`,`s`.`surcharge` AS `recargo`,`s`.`dated` AS `fecha`,`s`.`typeFk` AS `tipo_id`,`s`.`clientFk` AS `Id_Cliente`,`s`.`companyFk` AS `empresa_id`,`s`.`margin` AS `margen` from `sale` `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 `workerMana` +-- + +/*!50001 DROP TABLE IF EXISTS `workerMana`*/; +/*!50001 DROP VIEW IF EXISTS `workerMana`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerMana` AS select `m`.`Id_Trabajador` AS `workerFk`,`m`.`used` AS `amount` from `bs`.`mana_spellers` `m` */; +/*!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` +-- + +USE `cache`; + +-- +-- Current Database: `edi` +-- + +USE `edi`; + +-- +-- Final view structure for view `errorList` +-- + +/*!50001 DROP TABLE IF EXISTS `errorList`*/; +/*!50001 DROP VIEW IF EXISTS `errorList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `errorList` AS select `po`.`id` AS `id`,`c`.`name` AS `name`,`i`.`longName` AS `longName`,`po`.`quantity` AS `quantity`,left(`po`.`error`,4) AS `stock`,`po`.`error` AS `error`,`po`.`deliveryInformationID` AS `deliveryInformationID`,`po`.`supplyResponseID` AS `supplyResponseID`,`po`.`OrderTradeLineDateTime` AS `OrderTradeLineDateTime`,`po`.`EndUserPartyGLN` AS `EndUserPartyGLN` from ((`edi`.`putOrder` `po` left join `vn`.`client` `c` on((`c`.`id` = `po`.`EndUserPartyGLN`))) left join `vn`.`item` `i` on((`i`.`supplyResponseFk` = `po`.`supplyResponseID`))) where ((`po`.`OrderTradeLineDateTime` > (curdate() + interval -(12) hour)) and (`po`.`OrderStatus` = 3) and (left(`po`.`error`,4) <> '(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 `supplyOffer` +-- + +/*!50001 DROP TABLE IF EXISTS `supplyOffer`*/; +/*!50001 DROP VIEW IF EXISTS `supplyOffer`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `supplyOffer` AS select `sr`.`vmpID` AS `vmpID`,`di`.`ID` AS `diId`,`sr`.`ID` AS `srId`,`sr`.`Item_ArticleCode` AS `Item_ArticleCode`,`sr`.`VBNOmschrijving` AS `product_name`,`s`.`company_name` AS `company_name`,cast(`sr`.`Price` as decimal(10,3)) AS `Price`,`sr`.`Quality` AS `Quality`,`sr`.`s1` AS `s1`,`sr`.`s2` AS `s2`,`sr`.`s3` AS `s3`,`sr`.`s4` AS `s4`,`sr`.`s5` AS `s5`,`sr`.`s6` AS `s6`,`sr`.`NumberOfUnits` AS `NumberOfUnits`,least(if((`sr`.`EmbalageCode` = 800),((`sr`.`EmbalageCode` * 10) + `sr`.`NumberOfItemsPerCask`),`sr`.`EmbalageCode`),ifnull(`idt`.`bucket_id`,'999')) AS `EmbalageCode`,`di`.`LatestDeliveryDateTime` AS `LatestDeliveryDateTime`,`di`.`EarliestDespatchDateTime` AS `EarliestDespatchDateTime`,`di`.`FirstOrderDateTime` AS `FirstOrderDateTime`,`di`.`LatestOrderDateTime` AS `LatestOrderDateTime`,`sr`.`NumberOfItemsPerCask` AS `NumberOfItemsPerCask`,`sr`.`NumberOfLayersPerTrolley` AS `NumberOfLayersPerTrolley`,`sr`.`MinimumNumberToOrder` AS `MinimumNumberToOrder`,`sr`.`MaximumNumberToOrder` AS `MaximumNumberToOrder`,`sr`.`IncrementalOrderableQuantity` AS `IncrementalOrderableQuantity`,`sr`.`PackingPrice` AS `PackingPrice`,`sr`.`MarketPlaceID` AS `MarketPlaceID`,`sr`.`PictureReference` AS `PictureReference`,`sr`.`updated` AS `supplyResponseUpdated`,`i`.`group_id` AS `group_id`,`mp`.`name` AS `marketPlace`,`di`.`DeliveryPrice` AS `DeliveryPrice`,`di`.`ChargeAmount` AS `ChargeAmount`,`di`.`MinimumQuantity` AS `MinimumQuantity`,`di`.`MaximumQuantity Integer` AS `MaximumQuantity`,cast((`sr`.`MinimumNumberToOrder` * (case `sr`.`MinimumOrderUnitType` when 1 then 1 when 2 then (`sr`.`NumberOfItemsPerCask` / `sr`.`NumberBunchesPerCask`) when 3 then `sr`.`NumberOfItemsPerCask` when 4 then (floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) when 5 then ((floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) * `sr`.`NumberOfLayersPerTrolley`) end)) as decimal(10,0)) AS `OrderUnit`,cast((`sr`.`IncrementalOrderableQuantity` * (case `sr`.`IncrementalOrderableQuantityType` when 1 then 1 when 2 then (`sr`.`NumberOfItemsPerCask` / `sr`.`NumberBunchesPerCask`) when 3 then `sr`.`NumberOfItemsPerCask` when 4 then (floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) when 5 then ((floor(((128 * 56) / (`b`.`x_size` * `b`.`y_size`))) * `sr`.`NumberOfItemsPerCask`) * `sr`.`NumberOfLayersPerTrolley`) end)) as decimal(10,0)) AS `IncrementalOrderUnit`,`mp`.`isEarlyBird` AS `isEarlyBird`,`v`.`isVNHSupplier` AS `isVNHSupplier`,`igo`.`expenseFk` AS `expenseFk`,`igo`.`intrastatFk` AS `intrastatFk`,`igo`.`originFk` AS `originFk`,ifnull(`idt`.`itemTypeFk`,`igo`.`itemTypeFk`) AS `itemTypeFk` from (((((((((`edi`.`deliveryInformation` `di` join `edi`.`supplyResponse` `sr` on((`sr`.`ID` = `di`.`supplyResponseID`))) left join `edi`.`supplier` `s` on((`s`.`glnAddressCode` = `sr`.`SupplierGLN`))) join `edi`.`bucket` `b` on((`b`.`bucket_id` = `sr`.`EmbalageCode`))) join `edi`.`item` `i` on((`i`.`id` = `sr`.`Item_ArticleCode`))) join `edi`.`marketPlace` `mp` on((`mp`.`id` = `sr`.`MarketPlaceID`))) join `vn`.`floramondoConfig` `fm`) left join `edi`.`item_defaultType` `idt` on((`idt`.`item_id` = `i`.`id`))) join `edi`.`VMPSettings` `v` on((`v`.`VMPID` = `sr`.`vmpID`))) join `edi`.`item_groupToOffer` `igo` on((`igo`.`group_code` = `i`.`group_id`))) where ((`v`.`isBlocked` = 0) and (`s`.`isBanned` = 0) and (`sr`.`NumberOfUnits` > 0) and (now() between `di`.`FirstOrderDateTime` and `di`.`LatestOrderDateTime`) and (`mp`.`isOffered` = 1) and (`di`.`LatestDeliveryDateTime` between cast(`fm`.`nextLanded` as date) and concat(cast(`fm`.`nextLanded` as date),' ',`fm`.`MaxLatestDeliveryHour`))) group by `sr`.`ID` having (`EmbalageCode` <> 999) */; +/*!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: `hedera` +-- + +USE `hedera`; + +-- +-- Final view structure for view `mainAccountBank` +-- + +/*!50001 DROP TABLE IF EXISTS `mainAccountBank`*/; +/*!50001 DROP VIEW IF EXISTS `mainAccountBank`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `mainAccountBank` AS select `e`.`name` AS `name`,`a`.`iban` AS `iban` from ((`hedera`.`mainAccount` `c` join `vn`.`supplierAccount` `a` on((`a`.`id` = `c`.`accountFk`))) join `vn`.`bankEntity` `e` on((`e`.`id` = `a`.`bankEntityFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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`.`agencyModeFk` AS `agencyModeFk` from `vn`.`address` `t` where (`t`.`clientFk` = `account`.`myUser_getId`()) */ +/*!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 `myBasket` +-- + +/*!50001 DROP TABLE IF EXISTS `myBasket`*/; +/*!50001 DROP VIEW IF EXISTS `myBasket`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myBasket` AS select `o`.`id` AS `id`,`o`.`date_make` AS `made`,`o`.`date_send` AS `sent`,`o`.`customer_id` AS `clientFk`,`o`.`delivery_method_id` AS `deliveryMethodFk`,`o`.`agency_id` AS `agencyModeFk`,`o`.`address_id` AS `addressFk`,`o`.`company_id` AS `companyFk`,`o`.`note` AS `notes` from `hedera`.`order` `o` where (`o`.`id` = `MYBASKET_GETID`()) */ +/*!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 `myBasketDefaults` +-- + +/*!50001 DROP TABLE IF EXISTS `myBasketDefaults`*/; +/*!50001 DROP VIEW IF EXISTS `myBasketDefaults`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myBasketDefaults` AS select coalesce(`dm`.`code`,`cm`.`code`) AS `deliveryMethod`,coalesce(`ad`.`agencyModeFk`,`oc`.`defaultAgencyFk`) AS `agencyModeFk`,`c`.`defaultAddressFk` AS `addressFk`,`oc`.`defaultAgencyFk` AS `defaultAgencyFk` from ((((((`hedera`.`orderConfig` `oc` join `vn`.`agencyMode` `ca` on((`ca`.`id` = `oc`.`defaultAgencyFk`))) join `vn`.`deliveryMethod` `cm` on((`cm`.`id` = `ca`.`deliveryMethodFk`))) left join `vn`.`client` `c` on((`c`.`id` = `account`.`myUser_getId`()))) left join `vn`.`address` `ad` on((`ad`.`id` = `c`.`defaultAddressFk`))) left join `vn`.`agencyMode` `a` on((`a`.`id` = `ad`.`agencyModeFk`))) left join `vn`.`deliveryMethod` `dm` on((`dm`.`id` = `a`.`deliveryMethodFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `myBasketItem` +-- + +/*!50001 DROP TABLE IF EXISTS `myBasketItem`*/; +/*!50001 DROP VIEW IF EXISTS `myBasketItem`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myBasketItem` AS select `r`.`id` AS `id`,`r`.`orderFk` AS `orderFk`,`r`.`warehouseFk` AS `warehouseFk`,`r`.`itemFk` AS `itemFk`,`r`.`amount` AS `amount`,`r`.`price` AS `price` from `hedera`.`orderRow` `r` where (`r`.`orderFk` = `MYBASKET_GETID`()) */ +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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`.`myUser_getId`()) */ +/*!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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myInvoice` AS select `i`.`id` AS `id`,`i`.`ref` AS `ref`,`i`.`issued` AS `issued`,`i`.`amount` AS `amount`,`i`.`hasPdf` AS `hasPdf` from `vn`.`invoiceOut` `i` where (`i`.`clientFk` = `account`.`myUser_getId`()) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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`.`myRole` `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 `myOrder` +-- + +/*!50001 DROP TABLE IF EXISTS `myOrder`*/; +/*!50001 DROP VIEW IF EXISTS `myOrder`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myOrder` AS select `o`.`id` AS `id`,`o`.`date_send` AS `landed`,`o`.`customer_id` AS `clientFk`,`o`.`delivery_method_id` AS `deliveryMethodFk`,`o`.`agency_id` AS `agencyModeFk`,`o`.`address_id` AS `addressFk`,`o`.`company_id` AS `companyFk`,`o`.`note` AS `note`,`o`.`source_app` AS `sourceApp`,`o`.`confirmed` AS `isConfirmed`,`o`.`date_make` AS `created`,`o`.`first_row_stamp` AS `firstRowStamp`,`o`.`confirm_date` AS `confirmed` from `hedera`.`order` `o` where (`o`.`customer_id` = `account`.`myUser_getId`()) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `myOrderRow` +-- + +/*!50001 DROP TABLE IF EXISTS `myOrderRow`*/; +/*!50001 DROP VIEW IF EXISTS `myOrderRow`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myOrderRow` AS select `orw`.`id` AS `id`,`orw`.`order_id` AS `Fk`,`orw`.`item_id` AS `itemFk`,`orw`.`warehouse_id` AS `warehouseFk`,`orw`.`shipment` AS `shipped`,`orw`.`amount` AS `amount`,`orw`.`price` AS `price`,`orw`.`rate` AS `rate`,`orw`.`created` AS `created`,`orw`.`Id_Movimiento` AS `saleFk` from (`hedera`.`order_row` `orw` join `hedera`.`myOrder` `o` on((`o`.`id` = `orw`.`order_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 `myOrderTicket` +-- + +/*!50001 DROP TABLE IF EXISTS `myOrderTicket`*/; +/*!50001 DROP VIEW IF EXISTS `myOrderTicket`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myOrderTicket` AS select `o`.`id` AS `orderFk`,`ot`.`ticketFk` AS `ticketFk` from (`hedera`.`myOrder` `o` join `hedera`.`orderTicket` `ot` on((`ot`.`orderFk` = `o`.`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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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`.`myUser_getId`()) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `myTicketService` +-- + +/*!50001 DROP TABLE IF EXISTS `myTicketService`*/; +/*!50001 DROP VIEW IF EXISTS `myTicketService`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myTicketService` AS select `s`.`id` AS `id`,`s`.`description` AS `description`,`s`.`quantity` AS `quantity`,`s`.`price` AS `price`,`s`.`taxClassFk` AS `taxClassFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`ticketServiceTypeFk` AS `ticketServiceTypeFk` from (`vn`.`ticketService` `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 `myTicketState` +-- + +/*!50001 DROP TABLE IF EXISTS `myTicketState`*/; +/*!50001 DROP VIEW IF EXISTS `myTicketState`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `myTicketState` 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`,`ts`.`alertLevel` AS `alertLevel`,`ts`.`code` AS `code` from (`vn`.`ticket` `t` left join `vn`.`ticketState` `ts` on((`ts`.`ticketFk` = `t`.`id`))) where (`t`.`clientFk` = `account`.`myUser_getId`()) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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`.`myUser_getId`()) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `orderTicket` +-- + +/*!50001 DROP TABLE IF EXISTS `orderTicket`*/; +/*!50001 DROP VIEW IF EXISTS `orderTicket`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `orderTicket` AS select `b`.`orderFk` AS `orderFk`,`b`.`ticketFk` AS `ticketFk` from `vn`.`orderTicket` `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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `order_component` AS select `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_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `order_row` AS select `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 */; + +-- +-- Current Database: `nst` +-- + +USE `nst`; + +-- +-- Current Database: `pbx` +-- + +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 */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `cdrConf` 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 `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 `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 */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `followmeConf` AS select `f`.`extension` AS `name`,`c`.`music` AS `music`,`c`.`context` AS `context`,`c`.`takeCall` AS `takecall`,`c`.`declineCall` AS `declinecall` from (`followme` `f` join `followmeConfig` `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 `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 */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `followmeNumberConf` AS select `f`.`extension` AS `name`,1 AS `ordinal`,`f`.`phone` AS `phonenumber`,`c`.`timeout` AS `timeout` from (`followme` `f` join `followmeConfig` `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 `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 */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `queueConf` AS select `q`.`name` AS `name`,`c`.`strategy` AS `strategy`,`c`.`timeout` AS `timeout`,`c`.`retry` AS `retry`,`c`.`weight` AS `weight`,`c`.`maxLen` AS `maxlen`,`c`.`ringInUse` AS `ringinuse` from (`queue` `q` join `queueConfig` `c` on((`q`.`config` = `c`.`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 `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 */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `queueMemberConf` AS select `m`.`id` AS `uniqueid`,`m`.`queue` AS `queue_name`,concat('SIP/',`m`.`extension`) AS `interface`,0 AS `paused` from `queueMember` `m` union all select `p`.`id` AS `id`,`p`.`queue` AS `queue`,concat('Local/',`p`.`phone`,'@outgoing') AS `phone`,0 AS `paused` from `queuePhone` `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 `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 */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,NULL AS `callbackextension`,`s`.`md5Secret` AS `md5secret`,`u`.`nickname` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`careInvite` AS `careinvite`,`c`.`insecure` AS `insecure`,`c`.`transport` AS `transport`,`c`.`nat` AS `nat`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from (((`pbx`.`sip` `s` join `account`.`user` `u` on((`u`.`id` = `s`.`user_id`))) left join `pbx`.`sipReg` `r` on((`s`.`user_id` = `r`.`userId`))) join `pbx`.`sipConfig` `c`) */; +/*!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: `postgresql` +-- + +USE `postgresql`; + +-- +-- Final view structure for view `calendar_employee` +-- + +/*!50001 DROP TABLE IF EXISTS `calendar_employee`*/; +/*!50001 DROP VIEW IF EXISTS `calendar_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `calendar_employee` AS select `ce`.`id` AS `id`,`ce`.`businessFk` AS `business_id`,`ce`.`dayOffTypeFk` AS `calendar_state_id`,`ce`.`dated` AS `date` from `vn`.`calendar` `ce` */; +/*!50001 SET character_set_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` +-- + +/*!50001 DROP TABLE IF EXISTS `person`*/; +/*!50001 DROP VIEW IF EXISTS `person`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `person` AS select `p`.`id` AS `person_id`,`p`.`surnames` AS `name`,`p`.`nickname` AS `nickname`,`p`.`fi` AS `nif`,`p`.`birth` AS `birth`,`p`.`firstname` AS `firstname`,`p`.`p2` AS `p2`,`p`.`readerId` AS `nis`,`p`.`workerFk` AS `id_trabajador`,`p`.`isDisable` AS `isDisable`,`p`.`isFreelance` AS `isFreelance`,`p`.`isSsDiscounted` AS `isSsDiscounted`,`p`.`sex` AS `sex` from `vn`.`person` `p` */; +/*!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: `sage` +-- + +USE `sage`; + +-- +-- Final view structure for view `clientLastTwoMonths` +-- + +/*!50001 DROP TABLE IF EXISTS `clientLastTwoMonths`*/; +/*!50001 DROP VIEW IF EXISTS `clientLastTwoMonths`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientLastTwoMonths` AS select `vn`.`invoiceOut`.`clientFk` AS `clientFk`,`vn`.`invoiceOut`.`companyFk` AS `companyFk` from `vn`.`invoiceOut` where (`vn`.`invoiceOut`.`issued` > (curdate() - interval 2 month)) union select `vn`.`receipt`.`clientFk` AS `clientFk`,`vn`.`receipt`.`companyFk` AS `companyFk` from `vn`.`receipt` where (`vn`.`receipt`.`payed` > (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 `invoiceInList` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceInList`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceInList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceInList` AS select `vn`.`invoiceIn`.`id` AS `id`,`vn`.`invoiceIn`.`supplierRef` AS `supplierRef`,`vn`.`invoiceIn`.`serial` AS `serial`,`vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`issued` AS `issued`,if((`vn`.`invoiceIn`.`expenceFkDeductible` > 0),1,0) AS `isVatDeductible`,`vn`.`invoiceIn`.`serialNumber` AS `serialNumber` from `vn`.`invoiceIn` where (`vn`.`invoiceIn`.`issued` >= (date_format(curdate(),'%Y-01-01') + interval -(1) year)) union all select `vn`.`dua`.`id` AS `id`,`vn`.`dua`.`code` AS `code`,'D' AS `D`,`c`.`id` AS `supplierFk`,`vn`.`dua`.`issued` AS `issued`,0 AS `FALSE`,`vn`.`dua`.`id` AS `serialNumber` from (`vn`.`dua` join `vn`.`company` `c` on((`c`.`code` = 'VNL'))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `providerLastThreeMonths` +-- + +/*!50001 DROP TABLE IF EXISTS `providerLastThreeMonths`*/; +/*!50001 DROP VIEW IF EXISTS `providerLastThreeMonths`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `providerLastThreeMonths` AS select `vn`.`invoiceIn`.`supplierFk` AS `supplierFk`,`vn`.`invoiceIn`.`companyFk` AS `companyFk` from `vn`.`invoiceIn` where (`vn`.`invoiceIn`.`issued` > (curdate() - interval 3 month)) union select `vn`.`payment`.`supplierFk` AS `supplierFk`,`vn`.`payment`.`companyFk` AS `companyFk` from `vn`.`payment` where (`vn`.`payment`.`received` > (curdate() + interval -(3) 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: `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `Account` 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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `User` AS select `account`.`user`.`id` AS `id`,`account`.`user`.`realm` AS `realm`,`account`.`user`.`name` AS `username`,`account`.`user`.`bcryptPassword` AS `password`,`account`.`user`.`email` AS `email`,`account`.`user`.`emailVerified` AS `emailVerified`,`account`.`user`.`verificationToken` AS `verificationToken` 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 */; + +-- +-- Current Database: `stock` +-- + +USE `stock`; + +-- +-- Current Database: `util` +-- + +USE `util`; + +-- +-- Current Database: `vn` +-- + +USE `vn`; + +-- +-- Final view structure for view `NewView` +-- + +/*!50001 DROP TABLE IF EXISTS `NewView`*/; +/*!50001 DROP VIEW IF EXISTS `NewView`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `NewView` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(((`c`.`id` = `t`.`clientFk`) and (`t`.`shipped` < (curdate() + interval -(`pc`.`rookieDays`) day))))) group by `c`.`id` having (isnull(`lastShipped`) or (`lastShipped` < (curdate() + interval -(`notBuyingMonths`) 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 `__coolerPathDetail` +-- + +/*!50001 DROP TABLE IF EXISTS `__coolerPathDetail`*/; +/*!50001 DROP VIEW IF EXISTS `__coolerPathDetail`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `__coolerPathDetail` AS select `c`.`cooler_path_detail_id` AS `id`,`c`.`cooler_path_id` AS `coolerPathFk`,`c`.`pasillo` AS `hallway` from `vn2008`.`cooler_path_detail` `c` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `absenceType` +-- + +/*!50001 DROP TABLE IF EXISTS `absenceType`*/; +/*!50001 DROP VIEW IF EXISTS `absenceType`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `absenceType` AS select `cs`.`calendar_state_id` AS `id`,`cs`.`type` AS `name`,`cs`.`rgb` AS `rgb`,`cs`.`code` AS `code`,`cs`.`permissionRate` AS `permissionRate`,`cs`.`holidayEntitlementRate` AS `holidayEntitlementRate`,`cs`.`discountRate` AS `discountRate` from `postgresql`.`calendar_state` `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 `agencyProvince__` +-- + +/*!50001 DROP TABLE IF EXISTS `agencyProvince__`*/; +/*!50001 DROP VIEW IF EXISTS `agencyProvince__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `agencyProvince__` AS select `a`.`province_id` AS `provinceFk`,`a`.`agency_id` AS `agencyFk`,`a`.`zona` AS `zone`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`isVolumetric` AS `isVolumetric` from `vn2008`.`Agencias_province` `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 `agencyTerm` +-- + +/*!50001 DROP TABLE IF EXISTS `agencyTerm`*/; +/*!50001 DROP VIEW IF EXISTS `agencyTerm`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `agencyTerm` AS select `sat`.`agencyFk` AS `agencyFk`,`sat`.`minimumPackages` AS `minimumPackages`,`sat`.`kmPrice` AS `kmPrice`,`sat`.`packagePrice` AS `packagePrice`,`sat`.`routePrice` AS `routePrice`,`sat`.`minimumKm` AS `minimumKm`,`sat`.`minimumM3` AS `minimumM3`,`sat`.`m3Price` AS `m3Price` from `supplierAgencyTerm` `sat` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `annualAverageInvoiced` +-- + +/*!50001 DROP TABLE IF EXISTS `annualAverageInvoiced`*/; +/*!50001 DROP VIEW IF EXISTS `annualAverageInvoiced`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `annualAverageInvoiced` AS select `cec`.`clientFk` AS `clientFk`,`cec`.`invoiced` AS `invoiced` from `bs`.`clientAnnualConsumption` `cec` */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `awb__` 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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `bank` AS select `a`.`id` AS `id`,`a`.`bank` AS `bank`,`a`.`account` AS `account`,`a`.`accountingTypeFk` AS `cash`,`a`.`entityFk` AS `entityFk`,`a`.`isActive` AS `isActive`,`a`.`currencyFk` AS `currencyFk`,`a`.`code` AS `code` from `accounting` `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 `bankPolicy` +-- + +/*!50001 DROP TABLE IF EXISTS `bankPolicy`*/; +/*!50001 DROP VIEW IF EXISTS `bankPolicy`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `bankPolicy` AS select `bp`.`poliza_id` AS `id`,`bp`.`referencia` AS `ref`,`bp`.`importe` AS `amount`,`bp`.`com_dispuesto` AS `balanceInterestDrawn`,`bp`.`com_no_dispuesto` AS `commissionAvailableBalances`,`bp`.`com_anual` AS `openingCommission`,`bp`.`apertura` AS `started`,`bp`.`cierre` AS `ended`,`bp`.`Id_Banco` AS `bankFk`,`bp`.`empresa_id` AS `companyFk`,`bp`.`supplierFk` AS `supplierFk`,`bp`.`description` AS `description`,`bp`.`hasGuarantee` AS `hasGuarantee`,`bp`.`dmsFk` AS `dmsFk`,`bp`.`notaryFk` AS `notaryFk`,`bp`.`currencyFk` AS `currencyFk`,`bp`.`amortizationTypeFk` AS `amortizationTypeFk`,`bp`.`periodicityTypeFk` AS `periodicityTypeFk`,`bp`.`insuranceExpired` AS `insuranceExpired` from `vn2008`.`Bancos_poliza` `bp` order by `bp`.`poliza_id` desc */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `businessCalendar` +-- + +/*!50001 DROP TABLE IF EXISTS `businessCalendar`*/; +/*!50001 DROP VIEW IF EXISTS `businessCalendar`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `businessCalendar` AS select `ce`.`id` AS `id`,`ce`.`business_id` AS `businessFk`,`ce`.`calendar_state_id` AS `absenceTypeFk`,`ce`.`date` AS `dated` from `postgresql`.`calendar_employee` `ce` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `buyer` +-- + +/*!50001 DROP TABLE IF EXISTS `buyer`*/; +/*!50001 DROP VIEW IF EXISTS `buyer`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `buyer` AS select distinct `u`.`id` AS `userFk`,`u`.`nickname` AS `nickname` from (`account`.`user` `u` join `vn`.`itemType` `it` on((`it`.`workerFk` = `u`.`id`))) where `u`.`active` order by `u`.`nickname` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `buyerSales` +-- + +/*!50001 DROP TABLE IF EXISTS `buyerSales`*/; +/*!50001 DROP VIEW IF EXISTS `buyerSales`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `buyerSales` AS select `v`.`importe` AS `importe`,`w`.`code` AS `comprador`,`t`.`year` AS `año`,`t`.`week` AS `semana` from (((`bs`.`ventas` `v` join `vn`.`time` `t` on((`t`.`dated` = `v`.`fecha`))) join `vn`.`itemType` `it` on((`it`.`id` = `v`.`tipo_id`))) join `vn`.`worker` `w` on((`w`.`id` = `it`.`workerFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `calendar__` +-- + +/*!50001 DROP TABLE IF EXISTS `calendar__`*/; +/*!50001 DROP VIEW IF EXISTS `calendar__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `calendar__` AS select `ce`.`id` AS `id`,`ce`.`business_id` AS `businessFk`,`ce`.`calendar_state_id` AS `dayOffTypeFk`,`ce`.`date` AS `dated` from `postgresql`.`calendar_employee` `ce` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `claimRatio__` +-- + +/*!50001 DROP TABLE IF EXISTS `claimRatio__`*/; +/*!50001 DROP VIEW IF EXISTS `claimRatio__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `claimRatio__` AS select `claims_ratio`.`Id_Cliente` AS `clientFk`,`claims_ratio`.`Consumo` AS `yearSale`,`claims_ratio`.`Reclamaciones` AS `claimAmount`,`claims_ratio`.`Ratio` AS `claimingRate`,`claims_ratio`.`recobro` AS `priceIncreasing`,`claims_ratio`.`inflacion` AS `packingRate` from `bi`.`claims_ratio` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `clientLost` +-- + +/*!50001 DROP TABLE IF EXISTS `clientLost`*/; +/*!50001 DROP VIEW IF EXISTS `clientLost`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientLost` AS select `c`.`id` AS `clientFk`,max(`t`.`shipped`) AS `lastShipped`,`pc`.`notBuyingMonths` AS `notBuyingMonths` from ((`client` `c` join `productionConfig` `pc`) left join `ticket` `t` on(((`c`.`id` = `t`.`clientFk`) and (`t`.`shipped` < (curdate() + interval -(`pc`.`rookieDays`) day))))) group by `c`.`id` having (isnull(`lastShipped`) or (`lastShipped` < (curdate() + interval -(`notBuyingMonths`) 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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `clientPhoneBook` +-- + +/*!50001 DROP TABLE IF EXISTS `clientPhoneBook`*/; +/*!50001 DROP VIEW IF EXISTS `clientPhoneBook`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientPhoneBook` AS select `c`.`id` AS `clientFk`,trim(`c`.`phone`) AS `phone` from `client` `c` where (`c`.`phone` and `c`.`isActive`) union select `c`.`id` AS `clientFk`,trim(`c`.`mobile`) AS `phone` from `client` `c` where (`c`.`mobile` and `c`.`isActive`) union select `a`.`clientFk` AS `clientFk`,trim(`a`.`phone`) AS `phone` from (`address` `a` join `client` `c` on((`c`.`id` = `a`.`clientFk`))) where (`a`.`phone` and `c`.`isActive`) union select `a`.`clientFk` AS `clientFk`,trim(`a`.`mobile`) AS `phone` from (`address` `a` join `client` `c` on((`c`.`id` = `a`.`clientFk`))) where (`a`.`mobile` and `c`.`isActive`) union select `cc`.`clientFk` AS `clientFk`,trim(`cc`.`phone`) AS `phone` from (`clientContact` `cc` left join `client` `c` on((`c`.`id` = `cc`.`clientFk`))) where (`c`.`phone` and `c`.`isActive`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `clientRisk__` +-- + +/*!50001 DROP TABLE IF EXISTS `clientRisk__`*/; +/*!50001 DROP VIEW IF EXISTS `clientRisk__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `clientRisk__` AS select `c`.`customer_id` AS `clientFk`,`c`.`company_id` AS `companyFk`,`c`.`amount` AS `amount` from `bi`.`customer_risk__` `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 `cmr_list` +-- + +/*!50001 DROP TABLE IF EXISTS `cmr_list`*/; +/*!50001 DROP VIEW IF EXISTS `cmr_list`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `cmr_list` AS select `cmr`.`id` AS `cmrFk`,`cmr`.`ticketFk` AS `ticketFk`,`cmr`.`truckPlate` AS `truckPlate`,`cmr`.`observations` AS `observations`,`cmr`.`senderInstruccions` AS `senderInstruccions`,`cmr`.`paymentInstruccions` AS `paymentInstruccions`,`cmr`.`specialAgreements` AS `specialAgreements`,`cmr`.`created` AS `created`,`cmr`.`packagesList` AS `packagesList`,`aTo`.`nickname` AS `clientName`,`aTo`.`postalCode` AS `clientPostalCode`,`aTo`.`street` AS `clientStreet`,`aTo`.`city` AS `clientCity`,`pTo`.`name` AS `clientProvince`,`cTo`.`country` AS `clientCountry`,`su`.`name` AS `companyName`,`su`.`street` AS `companyStreet`,`su`.`postCode` AS `companyPostCode`,`su`.`city` AS `companyCity`,`cSu`.`country` AS `companyCountry`,concat(`aFrom`.`street`,' ',`aFrom`.`postalCode`,' ',`aFrom`.`city`,' (',`cFrom`.`country`,')') AS `warehouseAddress`,`cmr`.`created` AS `shipped`,`aTo`.`nickname` AS `clientOficialName`,`cmr`.`supplierFk` AS `supplierFk`,`aSu`.`name` AS `carrierName`,`aSu`.`street` AS `carrierStreet`,`aSu`.`postCode` AS `carrierPostCode`,`aSu`.`city` AS `carrierCity`,`cAs`.`country` AS `carrierCountry`,ifnull(`aTo`.`phone`,`client`.`phone`) AS `phone`,ifnull(`aTo`.`mobile`,`client`.`mobile`) AS `mobile`,`aTo`.`id` AS `addressFk`,`c`.`stamp` AS `stamp`,`cmr`.`merchandiseDetail` AS `merchandiseDetail` from ((((((((((((`cmr` left join `address` `aTo` on((`aTo`.`id` = `cmr`.`addressToFk`))) left join `province` `pTo` on((`pTo`.`id` = `aTo`.`provinceFk`))) left join `country` `cTo` on((`cTo`.`id` = `pTo`.`countryFk`))) left join `client` on((`client`.`id` = `aTo`.`clientFk`))) left join `supplier` `su` on((`su`.`id` = `cmr`.`companyFk`))) left join `country` `cSu` on((`cSu`.`id` = `su`.`countryFk`))) left join `address` `aFrom` on((`aFrom`.`id` = `cmr`.`addressFromFk`))) left join `province` `pFrom` on((`pFrom`.`id` = `aFrom`.`provinceFk`))) left join `country` `cFrom` on((`cFrom`.`id` = `pFrom`.`countryFk`))) left join `supplier` `aSu` on((`aSu`.`id` = `cmr`.`supplierFk`))) left join `country` `cAs` on((`cAs`.`id` = `aSu`.`countryFk`))) join `company` `c` on((`c`.`id` = `cmr`.`companyFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `collectionReportSource` +-- + +/*!50001 DROP TABLE IF EXISTS `collectionReportSource`*/; +/*!50001 DROP VIEW IF EXISTS `collectionReportSource`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `collectionReportSource` AS select `tc`.`collectionFk` AS `collectionFk`,`tc`.`ticketFk` AS `ticketFk`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`s`.`quantity` AS `quantity`,`ip`.`code` AS `nicho`,`tc`.`level` AS `level` from (((((`collection` `c` join `ticketCollection` `tc` on((`tc`.`collectionFk` = `c`.`id`))) join `ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) left join `itemPlacement` `ip` on(((`ip`.`itemFk` = `s`.`itemFk`) and (`ip`.`warehouseFk` = `t`.`warehouseFk`)))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `collectionSmartTag` +-- + +/*!50001 DROP TABLE IF EXISTS `collectionSmartTag`*/; +/*!50001 DROP VIEW IF EXISTS `collectionSmartTag`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `collectionSmartTag` AS select `st`.`code` AS `code`,`tc`.`ticketFk` AS `ticketFk`,`tc`.`level` AS `level`,`tc`.`wagon` AS `wagon`,`st`.`shelvingFk` AS `shelvingFk`,`tc`.`collectionFk` AS `collectionFk`,`am`.`name` AS `agencyFk`,`t`.`clientFk` AS `clientFk` from (((((`ticketCollection` `tc` join `smartTag` `st` on((`st`.`code` = (`tc`.`smartTagFk` collate utf8_general_ci)))) join `ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `collection` `c` on((`c`.`id` = `tc`.`collectionFk`))) join `worker` `w` on((`w`.`id` = `c`.`workerFk`))) join `agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `collectionSmartTag2` +-- + +/*!50001 DROP TABLE IF EXISTS `collectionSmartTag2`*/; +/*!50001 DROP VIEW IF EXISTS `collectionSmartTag2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `collectionSmartTag2` AS select `st`.`code` AS `code`,`tc`.`ticketFk` AS `ticketFk`,`tc`.`level` AS `level`,`tc`.`wagon` AS `wagon`,`st`.`shelvingFk` AS `shelvingFk`,`tc`.`collectionFk` AS `collectionFk`,`am`.`name` AS `agencyFk`,`t`.`clientFk` AS `clientFk`,`u`.`name` AS `worker`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed` from ((((((`vn`.`ticketCollection` `tc` join `vn`.`smartTag` `st` on((`st`.`code` = (`tc`.`smartTagFk` collate utf8_general_ci)))) join `vn`.`ticket` `t` on((`t`.`id` = `tc`.`ticketFk`))) join `vn`.`collection` `c` on((`c`.`id` = `tc`.`collectionFk`))) join `vn`.`worker` `w` on((`w`.`id` = `c`.`workerFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `account`.`user` `u` on((`u`.`id` = `w`.`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 `componentRate__` +-- + +/*!50001 DROP TABLE IF EXISTS `componentRate__`*/; +/*!50001 DROP VIEW IF EXISTS `componentRate__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `componentRate__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `componentTypeRate`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `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 `componentTypeRate__` +-- + +/*!50001 DROP TABLE IF EXISTS `componentTypeRate__`*/; +/*!50001 DROP VIEW IF EXISTS `componentTypeRate__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `componentTypeRate__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `base` from `bi`.`tarifa_componentes_series` `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 `componentType__` +-- + +/*!50001 DROP TABLE IF EXISTS `componentType__`*/; +/*!50001 DROP VIEW IF EXISTS `componentType__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `componentType__` AS select `t`.`tarifa_componentes_series_id` AS `id`,`t`.`Serie` AS `type`,`t`.`base` AS `isBase`,`t`.`margen` AS `isMargin` from `bi`.`tarifa_componentes_series` `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 `component__` +-- + +/*!50001 DROP TABLE IF EXISTS `component__`*/; +/*!50001 DROP VIEW IF EXISTS `component__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `component__` AS select `t`.`Id_Componente` AS `id`,`t`.`Componente` AS `name`,`t`.`tarifa_componentes_series_id` AS `typeFk`,`t`.`tarifa_class` AS `classRate`,`t`.`tax` AS `tax`,`t`.`is_renewable` AS `isRenewable`,`t`.`code` AS `code` from `bi`.`tarifa_componentes` `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 `defaulter` +-- + +/*!50001 DROP TABLE IF EXISTS `defaulter`*/; +/*!50001 DROP VIEW IF EXISTS `defaulter`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `defaulter` AS select `d`.`clientFk` AS `clientFk`,`d`.`created` AS `created`,`d`.`amount` AS `amount`,`d`.`defaulterSinced` AS `defaulterSinced`,`d`.`hasChanged` AS `hasChanged` from `bs`.`defaulter` `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 `departmentTree` +-- + +/*!50001 DROP TABLE IF EXISTS `departmentTree`*/; +/*!50001 DROP VIEW IF EXISTS `departmentTree`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `departmentTree` AS select `node`.`id` AS `id`,concat(convert(repeat(repeat(' ',5),(count(`parent`.`id`) - 1)) using utf8),`node`.`name`) AS `dep` from (`department` `node` join `department` `parent`) where (`node`.`lft` between `parent`.`lft` and `parent`.`rgt`) group by `node`.`id` order by `node`.`lft` */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `ektSubAddress` +-- + +/*!50001 DROP TABLE IF EXISTS `ektSubAddress`*/; +/*!50001 DROP VIEW IF EXISTS `ektSubAddress`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ektSubAddress` AS select `eea`.`sub` AS `sub`,`a`.`clientFk` AS `clientFk`,`a`.`nickname` AS `nickname`,`eea`.`addressFk` AS `addressFk` from (`ektEntryAssign` `eea` join `address` `a` on((`a`.`id` = `eea`.`addressFk`))) group by `eea`.`sub` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `entryList` +-- + +/*!50001 DROP TABLE IF EXISTS `entryList`*/; +/*!50001 DROP VIEW IF EXISTS `entryList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `entryList` AS select `e`.`id` AS `entryFk`,if(`tr`.`isReceived`,' x','') AS `isHere`,`tr`.`landed` AS `landed`,ifnull(`s`.`nickname`,`s`.`name`) AS `supplier`,`e`.`ref` AS `entryRef`,`a`.`name` AS `agency`,`tr`.`ref` AS `travelRef`,`tr`.`appointment` AS `appointment`,`e`.`supplierFk` AS `supplierFk`,`tr`.`warehouseInFk` AS `warehouseInFk` from (((`entry` `e` join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) left join `agency` `a` on((`tr`.`agencyFk` = `a`.`id`))) where (`tr`.`landed` between (curdate() + interval -(1) week) and (curdate() + interval 3 month)) order by (`tr`.`landed` < (curdate() + interval 2 day)) desc,`tr`.`landed` desc,ifnull(`s`.`nickname`,`s`.`name`),`e`.`id` desc */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `exchangeInsuranceEntry` +-- + +/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceEntry`*/; +/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceEntry`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `exchangeInsuranceEntry` AS select max(`tr`.`landed`) AS `dated`,cast(sum(((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`)) as decimal(10,2)) AS `Dolares`,cast((sum(((`b`.`buyingValue` + `b`.`freightValue`) * `b`.`quantity`)) / sum(((((100 + `e`.`commission`) / 100) * (`b`.`buyingValue` + `b`.`freightValue`)) * `b`.`quantity`))) as decimal(10,4)) AS `rate` from ((`entry` `e` join `buy` `b` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) where ((`tr`.`landed` between '2016-01-31' and curdate()) and (`e`.`commission` < 0) and (`e`.`currencyFk` = 2)) group by month(`tr`.`landed`),year(`tr`.`landed`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `exchangeInsuranceIn` +-- + +/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceIn`*/; +/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceIn`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `exchangeInsuranceIn` AS select `exchangeInsuranceInPrevious`.`dated` AS `dated`,sum(`exchangeInsuranceInPrevious`.`amount`) AS `amount`,cast((sum((`exchangeInsuranceInPrevious`.`amount` * `exchangeInsuranceInPrevious`.`rate`)) / sum(`exchangeInsuranceInPrevious`.`amount`)) as decimal(10,4)) AS `rate` from `vn`.`exchangeInsuranceInPrevious` group by `exchangeInsuranceInPrevious`.`dated` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `exchangeInsuranceOut` +-- + +/*!50001 DROP TABLE IF EXISTS `exchangeInsuranceOut`*/; +/*!50001 DROP VIEW IF EXISTS `exchangeInsuranceOut`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `exchangeInsuranceOut` AS select `p`.`received` AS `received`,sum(`p`.`divisa`) AS `divisa`,(sum(`p`.`divisa`) / sum(`p`.`amount`)) AS `rate` from ((`payment` `p` join `bank` `b` on((`b`.`id` = `p`.`bankFk`))) join `accountingType` `at2` on((`at2`.`id` = `b`.`cash`))) where ((`p`.`currencyFk` = 2) and (`at2`.`code` = 'wireTransfer') and (`p`.`supplierFk` <> 2213)) group by `p`.`received` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `exchangeReportSourcePrevious` +-- + +/*!50001 DROP TABLE IF EXISTS `exchangeReportSourcePrevious`*/; +/*!50001 DROP VIEW IF EXISTS `exchangeReportSourcePrevious`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `exchangeReportSourcePrevious` AS select `exchangeInsuranceIn`.`dated` AS `dated`,`exchangeInsuranceIn`.`amount` AS `amountIn`,`exchangeInsuranceIn`.`rate` AS `rateIn`,0.00 AS `amountOut`,0.00 AS `rateOut`,0.00 AS `amountEntry`,0.00 AS `rateEntry` from `vn`.`exchangeInsuranceIn` union all select `exchangeInsuranceOut`.`received` AS `received`,0.00 AS `amountIn`,0.00 AS `ratedIn`,`exchangeInsuranceOut`.`divisa` AS `amountOut`,`exchangeInsuranceOut`.`rate` AS `ratedOut`,0.00 AS `amountEntry`,0.00 AS `rateEntry` from `vn`.`exchangeInsuranceOut` union all select `exchangeInsuranceEntry`.`dated` AS `dated`,0.00 AS `amountIn`,0.00 AS `ratedIn`,0.00 AS `amountOut`,0.00 AS `ratedOut`,`exchangeInsuranceEntry`.`Dolares` AS `amountEntry`,`exchangeInsuranceEntry`.`rate` AS `rateEntry` from `vn`.`exchangeInsuranceEntry` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `expeditionCommon` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionCommon`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionCommon`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionCommon` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `etd`,ifnull(ucase(`et`.`description`),'SIN ESCANEAR') AS `description`,`es`.`palletFk` AS `palletFk`,`t`.`routeFk` AS `routeFk`,`es`.`id` AS `scanFk`,`e`.`id` AS `expeditionFk`,`r`.`expeditionTruckFk` AS `expeditionTruckFk`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `lastPacked`,`t`.`id` AS `ticketFk` from (((((`expeditionTruck` `et` left join `routesMonitor` `r` on((`et`.`id` = `r`.`expeditionTruckFk`))) left join `ticket` `t` on((`r`.`routeFk` = `t`.`routeFk`))) left join `expedition` `e` on((`t`.`id` = `e`.`ticketFk`))) left join `expeditionScan` `es` on((`e`.`id` = `es`.`expeditionFk`))) left join `expeditionPallet` `ep` on((`es`.`palletFk` = `ep`.`id`))) where (`et`.`ETD` >= 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 `expeditionPallet_Print` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionPallet_Print`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionPallet_Print`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionPallet_Print` AS select `et2`.`description` AS `truck`,`t`.`routeFk` AS `routeFk`,`r`.`description` AS `zone`,count(`es`.`id`) AS `eti`,`ep`.`id` AS `palletFk`,(`et`.`id` <=> `rm`.`expeditionTruckFk`) AS `isMatch`,`t`.`warehouseFk` AS `warehouseFk`,if((`r`.`created` > (curdate() + interval 1 day)),ucase(dayname(`r`.`created`)),NULL) AS `nombreDia` from (((((((`vn`.`expeditionTruck` `et` join `vn`.`expeditionPallet` `ep` on((`ep`.`truckFk` = `et`.`id`))) join `vn`.`expeditionScan` `es` on((`es`.`palletFk` = `ep`.`id`))) join `vn`.`expedition` `e` on((`e`.`id` = `es`.`expeditionFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `vn`.`route` `r` on((`r`.`id` = `t`.`routeFk`))) left join `vn2008`.`Rutas_monitor` `rm` on((`rm`.`Id_Ruta` = `r`.`id`))) left join `vn`.`expeditionTruck` `et2` on((`et2`.`id` = `rm`.`expeditionTruckFk`))) where (`ep`.`isPrint` = 0) group by `ep`.`id`,`t`.`routeFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `expeditionRoute_Monitor` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionRoute_Monitor`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionRoute_Monitor`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionRoute_Monitor` AS select `r`.`id` AS `routeFk`,count(distinct if(isnull(`e`.`id`),`t`.`id`,NULL)) AS `tickets`,count(distinct `e`.`id`) AS `expeditions`,count(distinct `es`.`id`) AS `scanned`,max(`e`.`created`) AS `lastPacked`,`r`.`created` AS `created` from ((((((`route` `r` left join `routesMonitor` `rm` on((`r`.`id` = `rm`.`routeFk`))) left join `expeditionTruck` `et` on((`et`.`id` = `rm`.`expeditionTruckFk`))) join `ticket` `t` on((`t`.`routeFk` = `r`.`id`))) left join `expedition` `e` on((`e`.`ticketFk` = `t`.`id`))) left join `expeditionScan` `es` on((`es`.`expeditionFk` = `e`.`id`))) left join `stowaway` `st` on((`st`.`id` = `t`.`id`))) where ((`r`.`created` >= `util`.`yesterday`()) and isnull(`st`.`id`)) group by `r`.`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 `expeditionRoute_freeTickets` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionRoute_freeTickets`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionRoute_freeTickets`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionRoute_freeTickets` AS select `t`.`routeFk` AS `routeFk`,`tss`.`ticket` AS `ticket`,`s`.`name` AS `code`,`w`.`name` AS `almacen`,`tss`.`updated` AS `updated`,`p`.`code` AS `parkingCode` from ((((((`vn`.`ticketState` `tss` join `vn`.`ticket` `t` on((`t`.`id` = `tss`.`ticket`))) join `vn`.`warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) join `vn`.`state` `s` on((`s`.`id` = `tss`.`state`))) left join `vn`.`stowaway` `st` on((`st`.`id` = `t`.`id`))) left join `vn`.`ticketParking` `tp` on((`tp`.`ticketFk` = `t`.`id`))) left join `vn`.`parking` `p` on((`p`.`id` = `tp`.`parkingFk`))) where ((ifnull(`t`.`packages`,0) = 0) and isnull(`st`.`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 `expeditionScan_Monitor` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionScan_Monitor`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionScan_Monitor`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionScan_Monitor` AS select `et`.`id` AS `truckFk`,`et`.`ETD` AS `ETD`,`et`.`description` AS `description`,`ep`.`id` AS `palletFk`,`ep`.`position` AS `position`,`ep`.`built` AS `built`,`es`.`id` AS `scanFk`,`es`.`expeditionFk` AS `expeditionFk`,`es`.`scanned` AS `scanned` from ((`expeditionTruck` `et` left join `expeditionPallet` `ep` on((`ep`.`truckFk` = `et`.`id`))) left join `expeditionScan` `es` on((`es`.`palletFk` = `ep`.`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 `expeditionSticker` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionSticker`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionSticker`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionSticker` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',convert(right(`t`.`routeFk`,3) using utf8mb4),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,replace(`am`.`name`,'ZONA ','Z'),`z`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`c`.`mobile`,ifnull(`a`.`mobile`,ifnull(`c`.`phone`,`a`.`phone`))) AS `phone`,`w`.`code` AS `workerCode` from ((((((((((`expedition` `e` join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) left join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) left join `beach` `b` on((`b`.`id` = `rm`.`beachFk`))) left join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `route` `r` on((`r`.`id` = `t`.`routeFk`))) left join `agencyMode` `am` on((`am`.`id` = `r`.`agencyModeFk`))) join `client` `c` on((`c`.`id` = `a`.`clientFk`))) join `worker` `w` on((`w`.`id` = `e`.`workerFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `expeditionSticker__` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionSticker__`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionSticker__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionSticker__` AS select `e`.`id` AS `expeditionFk`,`e`.`ticketFk` AS `ticketFk`,`t`.`addressFk` AS `addressFk`,`t`.`clientFk` AS `clientFk`,`a`.`street` AS `street`,`a`.`postalCode` AS `postalCode`,`a`.`city` AS `city`,`a`.`nickname` AS `nickname`,concat('R(',convert(right(`t`.`routeFk`,4) using utf8mb4),')') AS `routeFk`,`rm`.`beachFk` AS `beachFk`,if(`t`.`routeFk`,replace(`z`.`name`,'ZONA ','Z'),`am`.`name`) AS `zona`,`p`.`name` AS `province`,ifnull(`a`.`mobile`,`a`.`phone`) AS `phone` from (((((((`expedition` `e` join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) left join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) left join `beach` `b` on((`b`.`id` = `rm`.`beachFk`))) left join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) join `agencyMode` `am` on((`t`.`agencyModeFk` = `am`.`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 `expeditionTicket_NoBoxes` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionTicket_NoBoxes`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionTicket_NoBoxes`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionTicket_NoBoxes` AS select `t`.`id` AS `ticketFk`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`routeFk` AS `routeFk`,`et`.`description` AS `description` from (((`ticket` `t` left join `expedition` `e` on((`e`.`ticketFk` = `t`.`id`))) join `routesMonitor` `rm` on((`rm`.`routeFk` = `t`.`routeFk`))) join `expeditionTruck` `et` on((`et`.`id` = `rm`.`expeditionTruckFk`))) where (isnull(`e`.`id`) and (`et`.`ETD` > 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 `expeditionTimeExpended` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionTimeExpended`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionTimeExpended`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionTimeExpended` AS select `e`.`ticketFk` AS `ticketFk`,min(`e`.`created`) AS `started`,max(`e`.`created`) AS `finished`,max(`e`.`counter`) AS `cajas`,`w`.`code` AS `code`,`t`.`warehouseFk` AS `warehouseFk` from ((`expedition` `e` join `worker` `w` on((`w`.`id` = `e`.`workerFk`))) join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) where (`e`.`created` > curdate()) group by `e`.`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 `expeditionTruck_Control` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionTruck_Control` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `description`,count(distinct if(isnull(`e`.`expeditionFk`),`e`.`ticketFk`,NULL)) AS `ticketsSinBultos`,count(distinct `e`.`palletFk`) AS `pallets`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionFk`) AS `expeditions`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk` order by `fallos` desc,`e`.`etd` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `expeditionTruck_Control_Detail` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control_Detail`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control_Detail`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionTruck_Control_Detail` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,count(distinct `e`.`routeFk`) AS `routes`,count(distinct `e`.`scanFk`) AS `scans`,count(distinct `e`.`expeditionTruckFk`) AS `destinos`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,max(`e`.`lastPacked`) AS `lastPacked` from `expeditionCommon` `e` group by `e`.`truckFk`,`e`.`palletFk` order by `fallos` desc,`e`.`etd`,`e`.`truckFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `expeditionTruck_Control_Detail_Pallet` +-- + +/*!50001 DROP TABLE IF EXISTS `expeditionTruck_Control_Detail_Pallet`*/; +/*!50001 DROP VIEW IF EXISTS `expeditionTruck_Control_Detail_Pallet`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `expeditionTruck_Control_Detail_Pallet` AS select `e`.`truckFk` AS `id`,`e`.`etd` AS `ETD`,`e`.`description` AS `destino`,`e`.`palletFk` AS `pallet`,`e`.`routeFk` AS `route`,count(distinct `e`.`scanFk`) AS `scans`,`et`.`description` AS `destinos`,sum((`e`.`truckFk` <> `e`.`expeditionTruckFk`)) AS `fallos`,`e`.`expeditionTruckFk` AS `expeditionTruckFk`,max(`e`.`lastPacked`) AS `lastPacked` from (`expeditionCommon` `e` left join `expeditionTruck` `et` on((`et`.`id` = `e`.`expeditionTruckFk`))) group by `e`.`truckFk`,`e`.`palletFk`,`e`.`routeFk` order by `fallos` desc,`e`.`palletFk` */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `firstTicketShipped` AS select min(`ticket`.`shipped`) AS `shipped`,`ticket`.`clientFk` AS `clientFk` from `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 `floraHollandBuyedItems` +-- + +/*!50001 DROP TABLE IF EXISTS `floraHollandBuyedItems`*/; +/*!50001 DROP VIEW IF EXISTS `floraHollandBuyedItems`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `floraHollandBuyedItems` AS select `b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`b`.`quantity` AS `quantity`,`b`.`buyingValue` AS `buyingValue`,`tr`.`landed` AS `landed`,`e`.`companyFk` AS `companyFk` from (((((`buy` `b` join `item` `i` on((`b`.`itemFk` = `i`.`id`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `itemCategory` `ic` on((`ic`.`id` = `it`.`categoryFk`))) join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on(((`tr`.`id` = `e`.`travelFk`) and (`ic`.`id` not in (8,6)) and (`b`.`buyingValue` <> 0) and (`b`.`quantity` <> 0) and (`e`.`supplierFk` in (1664,1665,1666,1465,1433))))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `holidayDetail__` +-- + +/*!50001 DROP TABLE IF EXISTS `holidayDetail__`*/; +/*!50001 DROP VIEW IF EXISTS `holidayDetail__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `holidayDetail__` AS select `cll`.`calendar_labour_legend_id` AS `id`,`cll`.`descripcion` AS `description` from `postgresql`.`calendar_labour_legend__` `cll` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `holidayLegend__` +-- + +/*!50001 DROP TABLE IF EXISTS `holidayLegend__`*/; +/*!50001 DROP VIEW IF EXISTS `holidayLegend__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `holidayLegend__` AS select `cll`.`calendar_labour_legend_id` AS `id`,`cll`.`descripcion` AS `description` from `postgresql`.`calendar_labour_legend__` `cll` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `holidayType__` +-- + +/*!50001 DROP TABLE IF EXISTS `holidayType__`*/; +/*!50001 DROP VIEW IF EXISTS `holidayType__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `holidayType__` AS select `cf`.`calendar_free_id` AS `id`,`cf`.`type` AS `name`,`cf`.`rgb` AS `rgb` from `postgresql`.`calendar_free__` `cf` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `holiday__` +-- + +/*!50001 DROP TABLE IF EXISTS `holiday__`*/; +/*!50001 DROP VIEW IF EXISTS `holiday__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `holiday__` AS select `cl`.`calendar_labour_legend_id` AS `holidayDetailFk`,`cl`.`calendar_free_id` AS `holidayTypeFk`,`cl`.`workcenter_id` AS `workCenterFk`,`cl`.`day` AS `dated` from `postgresql`.`calendar_labour__` `cl` */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `inkL10n` AS select `k`.`id` AS `id`,ifnull(`i`.`name`,`k`.`name`) AS `name` from (`ink` `k` left join `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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 (`sale` `s` join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) where (`t`.`shipped` > (curdate() + interval -(3) year)) */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `foreignValue`,`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 `invoiceInIntrastat2__` +-- + +/*!50001 DROP TABLE IF EXISTS `invoiceInIntrastat2__`*/; +/*!50001 DROP VIEW IF EXISTS `invoiceInIntrastat2__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `invoiceInIntrastat2__` AS select `id`.`id` AS `id`,`id`.`recibida_id` AS `invoiceInFk`,`id`.`neto` AS `net`,`id`.`intrastat_id` AS `intrastatFk`,`id`.`importe` AS `amount`,`id`.`unidades` AS `stems`,`id`.`Paises_Id` AS `countryFk`,`id`.`odbc_date` AS `dated`,`id`.`valorestadistico` AS `statisticalValue` from `vn2008`.`intrastat_data` `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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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`,`r`.`isVatDeductible` AS `isVatDeductible`,`r`.`withholdingSageFk` AS `withholdingSageFk` 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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemBotanicalWithGenus` AS select `ib`.`itemFk` AS `itemFk`,concat(`g`.`name`,' ',ifnull(`s`.`name`,'')) AS `ediBotanic` from ((`itemBotanical` `ib` left join `specie` `s` on((`s`.`id` = `ib`.`specieFk`))) left join `genus` `g` on((`g`.`id` = `ib`.`genusFk`))) */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemCategoryL10n` AS select `c`.`id` AS `id`,ifnull(`i`.`name`,`c`.`name`) AS `name` from (`itemCategory` `c` left join `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 `itemColor` +-- + +/*!50001 DROP TABLE IF EXISTS `itemColor`*/; +/*!50001 DROP VIEW IF EXISTS `itemColor`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemColor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `color` from (`itemTag` `it` join `tag` `t` on((`t`.`id` = `it`.`tagFk`))) where (`t`.`code` = 'COLOR') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemEntryIn` +-- + +/*!50001 DROP TABLE IF EXISTS `itemEntryIn`*/; +/*!50001 DROP VIEW IF EXISTS `itemEntryIn`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemEntryIn` AS select `t`.`warehouseInFk` AS `warehouseInFk`,`t`.`landed` AS `landed`,`b`.`itemFk` AS `itemFk`,`b`.`quantity` AS `quantity`,`t`.`isReceived` AS `isReceived`,`e`.`isRaid` AS `isVirtualStock`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on((`b`.`entryFk` = `e`.`id`))) join `travel` `t` on((`e`.`travelFk` = `t`.`id`))) where ((`e`.`isInventory` = 0) and (`b`.`quantity` <> 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 `itemEntryOut` +-- + +/*!50001 DROP TABLE IF EXISTS `itemEntryOut`*/; +/*!50001 DROP VIEW IF EXISTS `itemEntryOut`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemEntryOut` AS select `t`.`warehouseOutFk` AS `warehouseOutFk`,`t`.`shipped` AS `shipped`,`b`.`itemFk` AS `itemFk`,-(`b`.`quantity`) AS `quantity`,`t`.`isDelivered` AS `isDelivered`,`e`.`id` AS `entryFk` from ((`buy` `b` join `entry` `e` on((`b`.`entryFk` = `e`.`id`))) join `travel` `t` on((`e`.`travelFk` = `t`.`id`))) where ((`e`.`isInventory` = 0) and (`e`.`isRaid` = 0) and (`b`.`quantity` <> 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 `itemInk` +-- + +/*!50001 DROP TABLE IF EXISTS `itemInk`*/; +/*!50001 DROP VIEW IF EXISTS `itemInk`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemInk` AS select `i`.`longName` AS `longName`,`i`.`inkFk` AS `inkFk`,`ink`.`name` AS `color` from (`item` `i` join `ink` on((`ink`.`id` = `i`.`inkFk`))) where `ink`.`isRealColor` group by `i`.`longName` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemPlacementSupplyList` +-- + +/*!50001 DROP TABLE IF EXISTS `itemPlacementSupplyList`*/; +/*!50001 DROP VIEW IF EXISTS `itemPlacementSupplyList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemPlacementSupplyList` AS select `ips`.`id` AS `id`,`ips`.`itemFk` AS `itemFk`,`ips`.`quantity` AS `quantity`,`ips`.`priority` AS `priority`,ifnull(`isps`.`created`,`ips`.`created`) AS `created`,`ips`.`userFk` AS `userFk`,`ips`.`repoUserFk` AS `repoUserFk`,(`ips`.`quantity` - sum(ifnull(`isps`.`quantity`,0))) AS `saldo`,concat(`i`.`longName`,' ',`i`.`size`) AS `longName`,`i`.`subName` AS `subName`,`i`.`size` AS `size`,`w`.`code` AS `workerCode`,`rw`.`code` AS `repoCode`,`ips`.`sectorFk` AS `sectorFk` from ((((`itemPlacementSupply` `ips` join `item` `i` on((`i`.`id` = `ips`.`itemFk`))) left join `worker` `w` on((`w`.`userFk` = `ips`.`userFk`))) left join `worker` `rw` on((`rw`.`userFk` = `ips`.`repoUserFk`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemPlacementSupplyFk` = `ips`.`id`))) where (`ips`.`created` >= curdate()) group by `ips`.`priority`,`ips`.`id`,`ips`.`sectorFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemProductor` +-- + +/*!50001 DROP TABLE IF EXISTS `itemProductor`*/; +/*!50001 DROP VIEW IF EXISTS `itemProductor`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemProductor` AS select `it`.`itemFk` AS `itemFk`,`it`.`value` AS `productor` from (`itemTag` `it` join `tag` `t` on((`t`.`id` = `it`.`tagFk`))) where (`t`.`code` = 'PRODUCER') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemSearch` +-- + +/*!50001 DROP TABLE IF EXISTS `itemSearch`*/; +/*!50001 DROP VIEW IF EXISTS `itemSearch`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemSearch` AS select `s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`t`.`nickname` AS `nickname`,`t`.`shipped` AS `shipped` from ((`sale` `s` join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`tomorrow`()) and (`w`.`name` in ('VNH','Floramondo'))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemShelvingAvailable` +-- + +/*!50001 DROP TABLE IF EXISTS `itemShelvingAvailable`*/; +/*!50001 DROP VIEW IF EXISTS `itemShelvingAvailable`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemShelvingAvailable` AS select `s`.`id` AS `saleFk`,`tst`.`updated` AS `Modificado`,`s`.`ticketFk` AS `ticketFk`,0 AS `isPicked`,`s`.`itemFk` AS `itemFk`,`s`.`quantity` AS `quantity`,`s`.`concept` AS `concept`,`i`.`size` AS `size`,`st`.`name` AS `Estado`,`st`.`sectorProdPriority` AS `sectorProdPriority`,`stock`.`visible` AS `available`,`stock`.`sectorFk` AS `sectorFk`,`stock`.`shelvingFk` AS `matricula`,`stock`.`parkingFk` AS `parking`,`stock`.`itemShelvingFk` AS `itemShelving`,`am`.`name` AS `Agency`,`t`.`shipped` AS `shipped`,`stock`.`grouping` AS `grouping`,`stock`.`packing` AS `packing`,`z`.`hour` AS `hour`,`st`.`isPreviousPreparable` AS `isPreviousPreparable`,`sv`.`physicalVolume` AS `physicalVolume`,`t`.`warehouseFk` AS `warehouseFk` from (((((((((`vn`.`sale` `s` join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `st` on((`st`.`id` = `tst`.`state`))) join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemShelvingStock` `stock` on((`stock`.`itemFk` = `i`.`id`))) left join `vn`.`saleTracking` `stk` on((`stk`.`saleFk` = `s`.`id`))) left join `vn`.`zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `vn`.`saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) where ((`t`.`shipped` between `util`.`yesterday`() and `util`.`dayend`(curdate())) and isnull(`stk`.`id`) and (`stock`.`visible` > 0) and isnull(`stk`.`saleFk`) and `st`.`isPreviousPreparable`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemShelvingList` +-- + +/*!50001 DROP TABLE IF EXISTS `itemShelvingList`*/; +/*!50001 DROP VIEW IF EXISTS `itemShelvingList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemShelvingList` AS select `ish`.`shelvingFk` AS `shelvingFk`,`ish`.`visible` AS `visible`,`ish`.`created` AS `created`,`pk`.`code` AS `parking`,`ish`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`parked` AS `parked`,`pk`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) left join `parking` `pk` on((`pk`.`id` = `sh`.`parkingFk`))) order by `ish`.`created` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemShelvingPlacementSupplyStock` +-- + +/*!50001 DROP TABLE IF EXISTS `itemShelvingPlacementSupplyStock`*/; +/*!50001 DROP VIEW IF EXISTS `itemShelvingPlacementSupplyStock`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemShelvingPlacementSupplyStock` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,`ish`.`packing` AS `packing`,`ish`.`visible` AS `stock`,`i`.`longName` AS `longName`,`i`.`size` AS `size`,`i`.`subName` AS `subName`,`sh`.`code` AS `shelving`,`p`.`code` AS `parking`,`ish`.`created` AS `created`,ifnull(`sh`.`priority`,1) AS `priority`,`p`.`id` AS `parkingFk`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `item` `i` on((`i`.`id` = `ish`.`itemFk`))) group by `ish`.`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 `itemShelvingSaleSum` +-- + +/*!50001 DROP TABLE IF EXISTS `itemShelvingSaleSum`*/; +/*!50001 DROP VIEW IF EXISTS `itemShelvingSaleSum`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemShelvingSaleSum` AS select `iss`.`id` AS `id`,`iss`.`itemShelvingFk` AS `itemShelvingFk`,`iss`.`saleFk` AS `saleFk`,sum(`iss`.`quantity`) AS `quantity`,`iss`.`created` AS `created`,`p`.`sectorFk` AS `sectorFk` from (((`itemShelvingSale` `iss` join `itemShelving` `ish` on((`ish`.`id` = `iss`.`itemShelvingFk`))) join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) group by `iss`.`saleFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemShelvingStock` +-- + +/*!50001 DROP TABLE IF EXISTS `itemShelvingStock`*/; +/*!50001 DROP VIEW IF EXISTS `itemShelvingStock`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemShelvingStock` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,min(`ish`.`packing`) AS `packing`,min(`ish`.`grouping`) AS `grouping`,`s`.`description` AS `sector`,sum(`ish`.`visible`) AS `visibleOriginal`,0 AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created`,`s`.`isPreviousPrepared` AS `isPreviousPrepared` from (((`itemShelving` `ish` left join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) left join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) left join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) where ((`ish`.`visible` <> 0) and `p`.`sectorFk`) group by `ish`.`itemFk`,`p`.`sectorFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `itemShelvingStockFull` +-- + +/*!50001 DROP TABLE IF EXISTS `itemShelvingStockFull`*/; +/*!50001 DROP VIEW IF EXISTS `itemShelvingStockFull`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemShelvingStockFull` AS select `ish`.`itemFk` AS `itemFk`,`ish`.`visible` AS `quantity`,`ish`.`packing` AS `packing`,`ish`.`grouping` AS `grouping`,`s`.`description` AS `sector`,`issr`.`removed` AS `removed`,`p`.`sectorFk` AS `sectorFk`,`s`.`warehouseFk` AS `warehouseFk`,`ish`.`shelvingFk` AS `shelvingFk`,`p`.`code` AS `parkingCode`,`sh`.`parkingFk` AS `parkingFk`,`ish`.`id` AS `itemShelvingFk`,`ish`.`created` AS `created` from ((((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) left join `itemShelvingStockRemoved` `issr` on((`issr`.`itemShelvingFk` = `ish`.`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 `itemShelvingStockRemoved` +-- + +/*!50001 DROP TABLE IF EXISTS `itemShelvingStockRemoved`*/; +/*!50001 DROP VIEW IF EXISTS `itemShelvingStockRemoved`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemShelvingStockRemoved` AS select `ish`.`id` AS `itemShelvingFk`,`ish`.`itemFk` AS `itemFk`,0 AS `removed` from ((`itemShelving` `ish` left join `itemShelvingSale` `iss` on((`iss`.`itemShelvingFk` = `ish`.`id`))) left join `itemShelvingPlacementSupply` `isps` on((`isps`.`itemShelvingFk` = `ish`.`id`))) group by `ish`.`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 `itemShelvingStock_byWarehouse` +-- + +/*!50001 DROP TABLE IF EXISTS `itemShelvingStock_byWarehouse`*/; +/*!50001 DROP VIEW IF EXISTS `itemShelvingStock_byWarehouse`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemShelvingStock_byWarehouse` AS select `ish`.`itemFk` AS `itemFk`,sum(`ish`.`visible`) AS `visible`,`s`.`warehouseFk` AS `warehouseFk` from (((`itemShelving` `ish` join `shelving` `sh` on((`sh`.`code` = `ish`.`shelvingFk`))) join `parking` `p` on((`p`.`id` = `sh`.`parkingFk`))) join `sector` `s` on((`s`.`id` = `p`.`sectorFk`))) group by `ish`.`itemFk`,`s`.`warehouseFk` */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `itemTicketOut` +-- + +/*!50001 DROP TABLE IF EXISTS `itemTicketOut`*/; +/*!50001 DROP VIEW IF EXISTS `itemTicketOut`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemTicketOut` AS select `t`.`warehouseFk` AS `warehouseFk`,`t`.`shipped` AS `shipped`,`s`.`itemFk` AS `itemFk`,-(`s`.`quantity`) AS `quantity`,`s`.`isPicked` AS `isPicked`,`s`.`reserved` AS `reserved`,`t`.`refFk` AS `refFk`,`s`.`id` AS `saleFk`,`s`.`ticketFk` AS `ticketFk` from (`sale` `s` join `ticket` `t` on((`s`.`ticketFk` = `t`.`id`))) where (`s`.`quantity` <> 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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `itemTypeL10n` AS select `t`.`id` AS `id`,ifnull(`i`.`name`,`t`.`name`) AS `name` from (`itemType` `t` left join `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 `item_Free_Id` +-- + +/*!50001 DROP TABLE IF EXISTS `item_Free_Id`*/; +/*!50001 DROP VIEW IF EXISTS `item_Free_Id`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `item_Free_Id` AS select (`i1`.`id` + 1) AS `newId` from (`item` `i1` left join `item` `i2` on(((`i1`.`id` + 1) = `i2`.`id`))) where (isnull(`i2`.`id`) and (`i1`.`id` > 400000)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `labelInfo` +-- + +/*!50001 DROP TABLE IF EXISTS `labelInfo`*/; +/*!50001 DROP VIEW IF EXISTS `labelInfo`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `labelInfo` AS select `i`.`id` AS `itemId`,`i`.`name` AS `itemName`,`b`.`stickers` AS `stickers`,`b`.`printedStickers` AS `life`,`i`.`inkFk` AS `colorCode`,`i`.`stems` AS `stems`,`i`.`category` AS `category`,`i`.`subName` AS `productor`,`b`.`packing` AS `packing`,`clb`.`warehouse_id` AS `warehouse_id`,`i`.`size` AS `size`,`b`.`isPickedOff` AS `isPickedOff`,`e`.`evaNotes` AS `notes`,`w`.`name` AS `wh_in`,`e`.`id` AS `entryId`,`b`.`id` AS `buyId` from (((((`vn`.`buy` `b` join `vn`.`item` `i` on((`i`.`id` = `b`.`itemFk`))) join `cache`.`last_buy` `clb` on((`clb`.`item_id` = `i`.`id`))) join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) left join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `lastHourProduction` +-- + +/*!50001 DROP TABLE IF EXISTS `lastHourProduction`*/; +/*!50001 DROP VIEW IF EXISTS `lastHourProduction`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `lastHourProduction` AS select `t`.`warehouseFk` AS `warehouseFk`,cast(sum((ifnull(`p`.`volume`,((`p`.`width` * `p`.`height`) * `p`.`depth`)) / 1000000)) as decimal(5,1)) AS `m3` from (((`warehouse` `w` join `ticket` `t` on((`t`.`warehouseFk` = `w`.`id`))) left join `expedition` `e` on((`t`.`id` = `e`.`ticketFk`))) left join `packaging` `p` on((`p`.`id` = `e`.`packagingFk`))) where (`e`.`created` between (now() - interval 1 hour) and now()) group by `t`.`warehouseFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `lastPurchases` +-- + +/*!50001 DROP TABLE IF EXISTS `lastPurchases`*/; +/*!50001 DROP VIEW IF EXISTS `lastPurchases`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `lastPurchases` AS select `tr`.`landed` AS `landed`,`w`.`id` AS `warehouseFk`,`w`.`name` AS `warehouse`,`i`.`longName` AS `longName`,`i`.`subName` AS `subName`,`e`.`id` AS `entryFk`,`b`.`stickers` AS `stickers`,`b`.`packing` AS `packing`,`e`.`ref` AS `ref`,`b`.`itemFk` AS `itemFk`,`ek`.`pro` AS `pro`,`ek`.`ref` AS `ektRef`,`ek`.`agj` AS `agj` from (((((`vn`.`buy` `b` join `vn`.`entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `vn`.`item` `i` on((`i`.`id` = `b`.`itemFk`))) join `vn`.`travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) left join `edi`.`ekt` `ek` on((`ek`.`id` = `b`.`ektFk`))) where ((`tr`.`landed` between `util`.`yesterday`() and `util`.`tomorrow`()) and (`e`.`isRaid` = 0) and (`b`.`stickers` > 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 `lastTopClaims` +-- + +/*!50001 DROP TABLE IF EXISTS `lastTopClaims`*/; +/*!50001 DROP VIEW IF EXISTS `lastTopClaims`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `lastTopClaims` AS select `s`.`itemFk` AS `itemFk`,`i`.`longName` AS `itemName`,`it`.`name` AS `itemTypeName`,count(0) AS `claimsNumber`,round(sum(((((`cb`.`quantity` * `s`.`price`) * (1 - ((`c`.`responsibility` - 1) / 4))) * (100 - `s`.`discount`)) / 100)),2) AS `claimedAmount`,round(sum((((`cb`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)),2) AS `totalAmount` from ((((`claim` `c` join `claimBeginning` `cb` on((`cb`.`claimFk` = `c`.`id`))) join `sale` `s` on((`s`.`id` = `cb`.`saleFk`))) join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `itemType` `it` on((`it`.`id` = `i`.`typeFk`))) where (`c`.`created` >= (curdate() + interval -(1) week)) group by `s`.`itemFk` having (((`claimedAmount` > 100) and (`claimsNumber` > 2)) or (`claimsNumber` > 4)) order by `claimsNumber` 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 `mistake` +-- + +/*!50001 DROP TABLE IF EXISTS `mistake`*/; +/*!50001 DROP VIEW IF EXISTS `mistake`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `mistake` AS select `wr`.`code` AS `revisador`,`s`.`concept` AS `concept`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk` from (((((`saleMistake` `sm` join `mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) join `worker` `wr` on((`wr`.`id` = `sm`.`userFk`))) join `sale` `s` on((`s`.`id` = `sm`.`saleFk`))) join `itemShelvingSale` `iss` on((`iss`.`saleFk` = `sm`.`saleFk`))) join `worker` `w` on((`w`.`id` = `iss`.`userFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `mistakeRatio` +-- + +/*!50001 DROP TABLE IF EXISTS `mistakeRatio`*/; +/*!50001 DROP VIEW IF EXISTS `mistakeRatio`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `mistakeRatio` AS select `wr`.`code` AS `revisador`,`w`.`code` AS `sacador`,`w`.`firstName` AS `firstName`,`w`.`lastName` AS `lastName`,`mt`.`description` AS `description`,cast(`iss`.`created` as date) AS `created`,`w`.`id` AS `workerFk`,`sm`.`saleFk` AS `saleFk` from ((((`itemShelvingSale` `iss` join `worker` `w` on((`w`.`id` = `iss`.`userFk`))) left join `saleMistake` `sm` on((`iss`.`saleFk` = `sm`.`saleFk`))) left join `mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `worker` `wr` on((`wr`.`id` = `sm`.`userFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `newBornSales` +-- + +/*!50001 DROP TABLE IF EXISTS `newBornSales`*/; +/*!50001 DROP VIEW IF EXISTS `newBornSales`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `newBornSales` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from ((((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) join `account`.`role` `r` on((`r`.`id` = `u`.`role`))) where ((`r`.`name` = 'salesPerson') and (`u`.`name` not in ('ismaelalcolea','ruben'))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `newBornSales__` +-- + +/*!50001 DROP TABLE IF EXISTS `newBornSales__`*/; +/*!50001 DROP VIEW IF EXISTS `newBornSales__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `newBornSales__` AS select `v`.`importe` AS `amount`,`v`.`Id_Cliente` AS `clientFk`,`c`.`salesPersonFk` AS `userFk`,`v`.`fecha` AS `dated`,`cn`.`firstShipped` AS `firstShipped` from (((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) where ((`u`.`role` = 18) and (`u`.`name` not in ('ismaelalcolea','ruben'))) */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `originL10n` AS select `o`.`id` AS `id`,ifnull(`i`.`name`,`o`.`name`) AS `name` from (`origin` `o` left join `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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `packageEquivalentItem` AS select `p`.`itemFk` AS `itemFk`,`p2`.`itemFk` AS `equivalentFk` from ((`packageEquivalent` `pe` join `packaging` `p` on((`p`.`id` = `pe`.`packagingFk`))) join `packaging` `p2` on((`p2`.`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 `payDemDetail__` +-- + +/*!50001 DROP TABLE IF EXISTS `payDemDetail__`*/; +/*!50001 DROP VIEW IF EXISTS `payDemDetail__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `payDemDetail__` AS select `pdd`.`id` AS `id`,`pdd`.`detalle` AS `detail` from `vn2008`.`pay_dem_det` `pdd` */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `payment__` AS select `p`.`id` AS `id`,`p`.`fecha` AS `received`,`p`.`dueDated` AS `dueDated`,`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 `payMethodFk`,`p`.`empresa_id` AS `companyFk`,`p`.`pago_sdc_id` AS `exchangeInsuranceFk`,`p`.`conciliado` AS `isConciliated` 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 `personMedia` +-- + +/*!50001 DROP TABLE IF EXISTS `personMedia`*/; +/*!50001 DROP VIEW IF EXISTS `personMedia`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `personMedia` AS select `p`.`id_trabajador` AS `workerFk`,`m`.`value` AS `mediaValue` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `po` on((`po`.`person_id` = `p`.`person_id`))) join `postgresql`.`profile_media` `pom` on((`pom`.`profile_id` = `po`.`profile_id`))) join `postgresql`.`media` `m` on((`m`.`media_id` = `pom`.`media_id`))) join `postgresql`.`media_type` `mt` on((`mt`.`media_type_id` = `m`.`media_type_id`))) where (`mt`.`name` = 'movil personal') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `printer__` +-- + +/*!50001 DROP TABLE IF EXISTS `printer__`*/; +/*!50001 DROP VIEW IF EXISTS `printer__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `printer__` AS select `i`.`Id_Impresora` AS `id`,`i`.`Ruta` AS `path`,`i`.`Impresora` AS `name`,`i`.`referencia` AS `reference`,`i`.`isLabeler` AS `isLabeler`,`i`.`description` AS `description` from `vn2008`.`Impresoras__` `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 `productionVolume` +-- + +/*!50001 DROP TABLE IF EXISTS `productionVolume`*/; +/*!50001 DROP VIEW IF EXISTS `productionVolume`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `productionVolume` AS select hour(`e`.`created`) AS `hora`,minute(`e`.`created`) AS `minuto`,ifnull(`p`.`volume`,ifnull(((`p`.`width` * `p`.`height`) * `p`.`depth`),94500)) AS `cm3`,`t`.`warehouseFk` AS `warehouseFk`,`e`.`created` AS `created` from (((`expedition` `e` left join `packaging` `p` on((`p`.`itemFk` = `e`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `e`.`ticketFk`))) join `client` `c` on((`c`.`id` = `t`.`clientFk`))) where ((`e`.`created` between curdate() and `util`.`dayend`(curdate())) and `c`.`isRelevant`) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `productionVolume_LastHour` +-- + +/*!50001 DROP TABLE IF EXISTS `productionVolume_LastHour`*/; +/*!50001 DROP VIEW IF EXISTS `productionVolume_LastHour`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `productionVolume_LastHour` AS select cast(sum((`productionVolume`.`cm3` / 1000000)) as decimal(10,0)) AS `m3`,`productionVolume`.`warehouseFk` AS `warehouseFk` from `productionVolume` where ((`productionVolume`.`created` > (now() + interval -(1) hour)) and (`productionVolume`.`warehouseFk` in (1,44,60))) group by `productionVolume`.`warehouseFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `rankingNewBornByQuarter__` +-- + +/*!50001 DROP TABLE IF EXISTS `rankingNewBornByQuarter__`*/; +/*!50001 DROP VIEW IF EXISTS `rankingNewBornByQuarter__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `rankingNewBornByQuarter__` AS select sum(`v`.`importe`) AS `total`,`u`.`name` AS `name`,now() AS `time_sec`,`u`.`id` AS `userFk` from (((`bs`.`clientNewBorn` `cn` join `bs`.`ventas` `v` on((((`cn`.`firstShipped` + interval 1 year) > `v`.`fecha`) and (`v`.`Id_Cliente` = `cn`.`clientFk`)))) join `vn`.`client` `c` on((`c`.`id` = `v`.`Id_Cliente`))) join `account`.`user` `u` on((`u`.`id` = `c`.`salesPersonFk`))) where ((`v`.`fecha` >= '2020-07-01') and (`cn`.`firstShipped` >= '2019-07-01') and (`u`.`role` = 18) and (`u`.`name` not in ('ismaelalcolea','ruben'))) group by `u`.`id` order by sum(`v`.`importe`) desc limit 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 `rankingSellingByQuarter__` +-- + +/*!50001 DROP TABLE IF EXISTS `rankingSellingByQuarter__`*/; +/*!50001 DROP VIEW IF EXISTS `rankingSellingByQuarter__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `rankingSellingByQuarter__` AS select sum(`v`.`importe`) AS `importe`,`u`.`name` AS `name`,`u`.`id` AS `userFk`,now() AS `time_sec` from (`bs`.`vendedores` `v` join `account`.`user` `u` on((`u`.`id` = `v`.`Id_Trabajador`))) where ((`v`.`año` = year(curdate())) and (quarter(concat(year(curdate()),'-',`v`.`mes`,'-01')) = quarter(curdate())) and (`u`.`name` not in ('ismaelalcolea','ruben'))) group by `v`.`Id_Trabajador` order by sum(`v`.`importe`) desc limit 15 */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `rate__` +-- + +/*!50001 DROP TABLE IF EXISTS `rate__`*/; +/*!50001 DROP VIEW IF EXISTS `rate__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `rate__` AS select `r`.`tarifa_id` AS `id`,`r`.`fecha` AS `dated`,`r`.`warehouse_id` AS `warehouseFk`,`r`.`t0` AS `rate0`,`r`.`t1` AS `rate1`,`r`.`t2` AS `rate2`,`r`.`t3` AS `rate3` from `vn2008`.`tarifas` `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `saleCost` +-- + +/*!50001 DROP TABLE IF EXISTS `saleCost`*/; +/*!50001 DROP VIEW IF EXISTS `saleCost`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleCost` AS select `s`.`itemFk` AS `itemFk`,`s`.`ticketFk` AS `ticketFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`s`.`discount` AS `discount`,`s`.`price` AS `price`,`c`.`name` AS `component`,`sc`.`value` AS `coste` from (((`sale` `s` join `saleComponent` `sc` on((`sc`.`saleFk` = `s`.`id`))) join `component` `c` on((`c`.`id` = `sc`.`componentFk`))) join `componentType` `ct` on((`ct`.`id` = `c`.`typeFk`))) where (`ct`.`type` = 'coste') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `saleMistakeList` +-- + +/*!50001 DROP TABLE IF EXISTS `saleMistakeList`*/; +/*!50001 DROP VIEW IF EXISTS `saleMistakeList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleMistakeList` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `saleMistake_list__` +-- + +/*!50001 DROP TABLE IF EXISTS `saleMistake_list__`*/; +/*!50001 DROP VIEW IF EXISTS `saleMistake_list__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleMistake_list__` AS select `st`.`saleFk` AS `saleFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) where (`st`.`created` > '2020-10-01') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `saleMistake_list__2` +-- + +/*!50001 DROP TABLE IF EXISTS `saleMistake_list__2`*/; +/*!50001 DROP VIEW IF EXISTS `saleMistake_list__2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleMistake_list__2` AS select `st`.`saleFk` AS `saleFk`,`st`.`workerFk` AS `workerFk`,concat(`w2`.`firstName`,' ',`w2`.`lastName`) AS `sacador`,`st`.`created` AS `created`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `revisador`,`mt`.`description` AS `description`,`sm`.`created` AS `controlled` from (((((`vn`.`saleTracking` `st` join `vn`.`worker` `w2` on((`w2`.`id` = `st`.`workerFk`))) join `vncontrol`.`accion` `a` on(((`a`.`accion_id` = `st`.`actionFk`) and (`a`.`accion` = 'SACAR')))) left join `vn`.`saleMistake` `sm` on((`st`.`saleFk` = `sm`.`saleFk`))) left join `vn`.`mistakeType` `mt` on((`mt`.`id` = `sm`.`typeFk`))) left join `vn`.`worker` `w` on((`w`.`id` = `sm`.`userFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `saleSaleTracking` +-- + +/*!50001 DROP TABLE IF EXISTS `saleSaleTracking`*/; +/*!50001 DROP VIEW IF EXISTS `saleSaleTracking`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleSaleTracking` AS select distinct `st`.`saleFk` AS `saleFk` from `saleTracking` `st` where (`st`.`created` >= (curdate() + interval -(1) 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 `saleValue` +-- + +/*!50001 DROP TABLE IF EXISTS `saleValue`*/; +/*!50001 DROP VIEW IF EXISTS `saleValue`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleValue` AS select `wh`.`name` AS `warehouse`,`c`.`name` AS `client`,`c`.`typeFk` AS `clientTypeFk`,`u`.`name` AS `buyer`,`it`.`id` AS `itemTypeFk`,`it`.`name` AS `family`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,(((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) AS `cost`,((((`b`.`buyingValue` + `b`.`freightValue`) + `b`.`comissionValue`) + `b`.`packageValue`) * `s`.`quantity`) AS `value`,`tm`.`year` AS `year`,`tm`.`week` AS `week` from (((((((((`vn`.`sale` `s` join `vn`.`item` `i` on((`i`.`id` = `s`.`itemFk`))) join `vn`.`itemType` `it` on((`it`.`id` = `i`.`typeFk`))) join `account`.`user` `u` on((`u`.`id` = `it`.`workerFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`client` `c` on((`c`.`id` = `t`.`clientFk`))) join `vn`.`warehouse` `wh` on((`wh`.`id` = `t`.`warehouseFk`))) join `vn`.`time` `tm` on((`tm`.`dated` = cast(`t`.`shipped` as date)))) join `cache`.`last_buy` `lb` on(((`lb`.`item_id` = `i`.`id`) and (`lb`.`warehouse_id` = `wh`.`id`)))) join `vn`.`buy` `b` on((`b`.`id` = `lb`.`buy_id`))) where (`wh`.`isManaged` <> 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 `saleVolume` +-- + +/*!50001 DROP TABLE IF EXISTS `saleVolume`*/; +/*!50001 DROP VIEW IF EXISTS `saleVolume`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleVolume` AS select `s`.`ticketFk` AS `ticketFk`,`s`.`id` AS `saleFk`,round(((`ic`.`cm3delivery` * `s`.`quantity`) / 1000),0) AS `litros`,`t`.`routeFk` AS `routeFk`,`t`.`shipped` AS `shipped`,`t`.`landed` AS `landed`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `volume`,((`s`.`quantity` * `ic`.`grams`) / 1000) AS `physicalWeight`,(((`s`.`quantity` * `ic`.`cm3delivery`) * greatest(`i`.`density`,167)) / 1000000) AS `weight`,((`s`.`quantity` * `ic`.`cm3delivery`) / 1000000) AS `physicalVolume`,(((`s`.`quantity` * `ic`.`cm3delivery`) * ifnull(`t`.`zonePrice`,`z`.`price`)) / (`vc`.`standardFlowerBox` * 1000)) AS `freight`,`t`.`zoneFk` AS `zoneFk`,`t`.`clientFk` AS `clientFk`,`s`.`isPicked` AS `isPicked`,(((`s`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100) AS `eurosValue`,`i`.`itemPackingTypeFk` AS `itemPackingTypeFk` from (((((`sale` `s` join `item` `i` on((`i`.`id` = `s`.`itemFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `zone` `z` on((`z`.`id` = `t`.`zoneFk`))) join `volumeConfig` `vc`) join `itemCost` `ic` on(((`ic`.`itemFk` = `s`.`itemFk`) and (`ic`.`warehouseFk` = `t`.`warehouseFk`)))) where (`s`.`quantity` > 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 `saleVolume_Today_VNH` +-- + +/*!50001 DROP TABLE IF EXISTS `saleVolume_Today_VNH`*/; +/*!50001 DROP VIEW IF EXISTS `saleVolume_Today_VNH`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `saleVolume_Today_VNH` AS select `t`.`nickname` AS `Cliente`,`p`.`name` AS `Provincia`,`c`.`country` AS `Pais`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `volume` from (((((`saleVolume` `sv` join `ticket` `t` on((`t`.`id` = `sv`.`ticketFk`))) join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) join `country` `c` on((`c`.`id` = `p`.`countryFk`))) join `warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) where ((`w`.`name` = 'VNH') and (`t`.`shipped` between curdate() and `util`.`dayend`(curdate()))) group by `t`.`nickname`,`p`.`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 `sale_freightComponent` +-- + +/*!50001 DROP TABLE IF EXISTS `sale_freightComponent`*/; +/*!50001 DROP VIEW IF EXISTS `sale_freightComponent`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `sale_freightComponent` AS select `t`.`id` AS `ticketFk`,(`sc`.`value` * `s`.`quantity`) AS `amount`,`t`.`shipped` AS `shipped` from ((((`ticket` `t` straight_join `sale` `s` on((`t`.`id` = `s`.`ticketFk`))) join `saleComponent` `sc` on((`sc`.`saleFk` = `s`.`id`))) join `component` `c` on((`c`.`id` = `sc`.`componentFk`))) join `componentType` `ct` on(((`ct`.`id` = `c`.`typeFk`) and (`ct`.`type` = 'agencia')))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `salesPersonSince` +-- + +/*!50001 DROP TABLE IF EXISTS `salesPersonSince`*/; +/*!50001 DROP VIEW IF EXISTS `salesPersonSince`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `salesPersonSince` AS select `p`.`id_trabajador` AS `workerFk`,min(`b`.`date_start`) AS `started` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join `postgresql`.`business` `b` on((`pr`.`profile_id` = `b`.`client_id`))) left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `postgresql`.`professional_category` `pc` on((`pc`.`professional_category_id` = `bl`.`professional_category_id`))) where (`pc`.`category_name` = 'Aux ventas') group by `p`.`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 `salesPreparedLastHour` +-- + +/*!50001 DROP TABLE IF EXISTS `salesPreparedLastHour`*/; +/*!50001 DROP VIEW IF EXISTS `salesPreparedLastHour`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `salesPreparedLastHour` AS select `t`.`warehouseFk` AS `warehouseFk`,`st`.`saleFk` AS `saleFk`,`st`.`isChecked` AS `isChecked`,`st`.`originalQuantity` AS `originalQuantity`,`a`.`accion` AS `accion`,`st`.`created` AS `created`,`e`.`code` AS `code`,`w`.`firstName` AS `firstname`,`w`.`lastName` AS `lastName`,`w`.`code` AS `workerCode`,((`ic`.`cm3delivery` * `s`.`quantity`) / 1000) AS `litros`,`s`.`concept` AS `concept`,`d`.`name` AS `departmentName` from (((((((((`vn`.`saleTracking` `st` left join `vn`.`salesPreviousPreparated` `prevPrepSales` on((`prevPrepSales`.`saleFk` = `st`.`saleFk`))) join `vn`.`sale` `s` on((`s`.`id` = `st`.`saleFk`))) join `vn`.`ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `vn`.`itemCost` `ic` on(((`ic`.`warehouseFk` = `t`.`warehouseFk`) and (`ic`.`itemFk` = `s`.`itemFk`)))) join `vn`.`worker` `w` on((`w`.`id` = `st`.`workerFk`))) join `vn`.`state` `e` on((`e`.`id` = `st`.`stateFk`))) join `vncontrol`.`accion` `a` on((`a`.`accion_id` = `st`.`actionFk`))) join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `st`.`workerFk`))) join `vn`.`department` `d` on((`d`.`id` = `wd`.`departmentFk`))) where ((`st`.`created` > (now() + interval -(1) hour)) and isnull(`prevPrepSales`.`saleFk`) and (not((`d`.`name` like 'EQUIPO%')))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `salesPreviousPreparated` +-- + +/*!50001 DROP TABLE IF EXISTS `salesPreviousPreparated`*/; +/*!50001 DROP VIEW IF EXISTS `salesPreviousPreparated`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `salesPreviousPreparated` AS select `st`.`saleFk` AS `saleFk` from (`saleTracking` `st` join `state` `e` on((`e`.`id` = `st`.`stateFk`))) where ((`st`.`created` > curdate()) and (`e`.`code` like 'PREVIOUS_PREPARATION')) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `salesToPrePrepare__` +-- + +/*!50001 DROP TABLE IF EXISTS `salesToPrePrepare__`*/; +/*!50001 DROP VIEW IF EXISTS `salesToPrePrepare__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `salesToPrePrepare__` AS select `m`.`ticketFk` AS `Id_Ticket`,`mk`.`Id_Movimiento` AS `Id_Movimiento`,`mk`.`Id_Movimiento_mark` AS `Id_Movimiento_mark`,`mk`.`Id_Trabajador` AS `Id_Trabjador`,`mk`.`valor` AS `isChecked`,`mk`.`odbc_date` AS `created`,`m`.`itemFk` AS `Id_Article`,`m`.`concept` AS `Concepte`,`art`.`subName` AS `subName`,ifnull(`m`.`quantity`,0) AS `Cantidad`,ifnull(`m`.`originalQuantity`,`m`.`quantity`) AS `original_quantity`,hour(`t`.`shipped`) AS `Hora`,hour(`t`.`shipped`) AS `Departure`,minute(`t`.`shipped`) AS `Minuto`,`am`.`agencyFk` AS `agency_id`,`t`.`warehouseFk` AS `warehouse_id`,`a`.`provinceFk` AS `province_id`,`is`.`quantity` AS `picked`,`t`.`CodigoTrabajador` AS `trabajador`,`is`.`sectorFk` AS `sectorFk`,`mk`.`stateFk` AS `stateFk` from ((((((((`vn2008`.`Movimientos_mark` `mk` join `vn`.`state` `st` on((`st`.`id` = `mk`.`stateFk`))) join `vn`.`sale` `m` on((`m`.`id` = `mk`.`Id_Movimiento`))) join `vn`.`ticket` `t` on((`m`.`ticketFk` = `t`.`id`))) join `vn`.`agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) join `vn`.`address` `a` on((`a`.`id` = `t`.`addressFk`))) left join `vn`.`itemShelvingSaleSum` `is` on((`is`.`saleFk` = `mk`.`Id_Movimiento`))) join `vn2008`.`Articles` `art` on((`art`.`Id_Article` = `m`.`itemFk`))) left join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `mk`.`Id_Trabajador`))) where (`st`.`code` like 'PREVIOUS_PREPARATION') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `supplierPackaging` +-- + +/*!50001 DROP TABLE IF EXISTS `supplierPackaging`*/; +/*!50001 DROP VIEW IF EXISTS `supplierPackaging`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `supplierPackaging` AS select `e`.`supplierFk` AS `supplierFk`,`b`.`itemFk` AS `itemFk`,`i`.`longName` AS `longName`,`s`.`name` AS `supplier`,`b`.`entryFk` AS `entryFk`,`tr`.`landed` AS `landed`,-(least(`b`.`quantity`,0)) AS `out`,greatest(`b`.`quantity`,0) AS `in`,`w`.`name` AS `warehouse`,`b`.`buyingValue` AS `buyingValue` from ((((((`buy` `b` join `item` `i` on((`i`.`id` = `b`.`itemFk`))) join `packaging` `p` on((`p`.`itemFk` = `i`.`id`))) join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) where `p`.`isPackageReturnable` */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `ticketLabel_Source` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketLabel_Source`*/; +/*!50001 DROP VIEW IF EXISTS `ticketLabel_Source`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketLabel_Source` AS select concat(`tc`.`collectionFk`,' ',`tc`.`wagon`,'-',`tc`.`level`) AS `level`,`t`.`id` AS `Id_Ticket`,(case when (`t`.`routeFk` is not null) then if(`agr`.`showAgencyName`,concat(right(left(`agr`.`name`,(locate(' ',`agr`.`name`) - 1)),2),'- R',convert(right(`t`.`routeFk`,3) using utf8)),`agr`.`name`) else if((`am`.`deliveryMethodFk` = 2),`zo`.`name`,`am`.`name`) end) AS `Agencia`,`t`.`clientFk` AS `Id_Cliente`,`t`.`notes` AS `Notas`,'CDT' AS `Sacador`,1 AS `ncarro`,if(hour(`t`.`shipped`),date_format(`t`.`shipped`,'%H:%i'),date_format(`zo`.`hour`,'%H:%i')) AS `horaagencia`,`t`.`shipped` AS `fecha`,if(((now() + interval 1 hour) > `ze`.`etc`),'!!!','') AS `urgente` from (((((((`vn`.`ticket` `t` join `vn`.`agencyMode` `am` on((`t`.`agencyModeFk` = `am`.`id`))) left join `vn`.`address` `a` on((`a`.`id` = `t`.`addressFk`))) left join `vn`.`route` `r` on((`t`.`routeFk` = `r`.`id`))) left join `vn`.`zoneEstimatedDelivery` `ze` on((`ze`.`zoneFk` = `t`.`zoneFk`))) left join `vn`.`ticketCollection` `tc` on((`tc`.`ticketFk` = `t`.`id`))) left join `vn`.`agencyMode` `agr` on((`r`.`agencyModeFk` = `agr`.`id`))) left join `vn`.`zone` `zo` on((`t`.`zoneFk` = `zo`.`id`))) where (`t`.`shipped` between `util`.`yesterday`() and `util`.`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 `ticketLastUpdated` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketLastUpdated`*/; +/*!50001 DROP VIEW IF EXISTS `ticketLastUpdated`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketLastUpdated` AS select `ticketLastUpdatedList`.`ticketFk` AS `ticketFk`,max(`ticketLastUpdatedList`.`created`) AS `lastUpdated` from `vn`.`ticketLastUpdatedList` group by `ticketLastUpdatedList`.`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 `ticketLastUpdatedList` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketLastUpdatedList`*/; +/*!50001 DROP VIEW IF EXISTS `ticketLastUpdatedList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketLastUpdatedList` AS select `s`.`ticketFk` AS `ticketFk`,`st`.`created` AS `created` from (`vn`.`saleTracking` `st` join `vn`.`sale` `s` on((`s`.`id` = `st`.`saleFk`))) where (`st`.`created` > curdate()) union all select `i`.`Id_Ticket` AS `Id_Ticket`,`i`.`odbc_date` AS `odbc_date` from `vncontrol`.`inter` `i` where (`i`.`odbc_date` > curdate()) union all select `s`.`ticketFk` AS `ticketFk`,`iss`.`created` AS `created` from (`vn`.`itemShelvingSale` `iss` join `vn`.`sale` `s` on((`s`.`id` = `iss`.`saleFk`))) where (`iss`.`created` > 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 `ticketLocation` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketLocation`*/; +/*!50001 DROP VIEW IF EXISTS `ticketLocation`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketLocation` AS select `tl`.`Id_Ticket` AS `ticketFk`,`tl`.`longitude` AS `longitude`,`tl`.`latitude` AS `latitude` from `vn2008`.`ticket_location` `tl` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `ticketMRW` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketMRW`*/; +/*!50001 DROP VIEW IF EXISTS `ticketMRW`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketMRW` AS select `Tickets`.`Id_Agencia` AS `id_Agencia`,`Tickets`.`empresa_id` AS `empresa_id`,`Consignatarios`.`consignatario` AS `Consignatario`,`Consignatarios`.`domicilio` AS `DOMICILIO`,`Consignatarios`.`poblacion` AS `POBLACION`,`Consignatarios`.`codPostal` AS `CODPOSTAL`,`Consignatarios`.`telefono` AS `telefono`,ifnull(ifnull(ifnull(ifnull(`Consignatarios`.`movil`,`Clientes`.`movil`),`Consignatarios`.`telefono`),`Clientes`.`telefono`),0) AS `movil`,`Clientes`.`if` AS `IF`,`Tickets`.`Id_Ticket` AS `Id_Ticket`,`Tickets`.`warehouse_id` AS `warehouse_id`,`Consignatarios`.`id_consigna` AS `Id_Consigna`,`Paises`.`Codigo` AS `CodigoPais`,`Tickets`.`Fecha` AS `Fecha`,`province`.`province_id` AS `province_id`,`Tickets`.`landing` AS `landing` from ((((`vn2008`.`Clientes` join `vn2008`.`Consignatarios` on((`Clientes`.`id_cliente` = `Consignatarios`.`Id_cliente`))) join `vn2008`.`Tickets` on((`Consignatarios`.`id_consigna` = `Tickets`.`Id_Consigna`))) join `vn2008`.`province` on((`Consignatarios`.`province_id` = `province`.`province_id`))) join `vn2008`.`Paises` on((`province`.`Paises_Id` = `Paises`.`Id`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `ticketNotInvoiced` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketNotInvoiced`*/; +/*!50001 DROP VIEW IF EXISTS `ticketNotInvoiced`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketNotInvoiced` AS select `t`.`companyFk` AS `companyFk`,`cm`.`code` AS `companyCode`,`t`.`clientFk` AS `clientFk`,`c`.`name` AS `clientName`,`t`.`shipped` AS `shipped`,cast(sum((((`s`.`quantity` * `s`.`price`) * (100 - `s`.`discount`)) / 100)) as decimal(10,2)) AS `value` from (((`ticket` `t` join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) join `client` `c` on((`c`.`id` = `t`.`clientFk`))) join `company` `cm` on((`cm`.`id` = `t`.`companyFk`))) where (isnull(`t`.`refFk`) and (`t`.`shipped` > '2017-01-01')) group by `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 `ticketPackingList` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketPackingList`*/; +/*!50001 DROP VIEW IF EXISTS `ticketPackingList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketPackingList` AS select `t`.`nickname` AS `nickname`,`t`.`id` AS `ticketFk`,`am`.`name` AS `agencyMode`,`am`.`flag` AS `flag`,`p`.`name` AS `province`,`s`.`itemFk` AS `itemFk`,`s`.`concept` AS `concept`,`s`.`quantity` AS `quantity`,`sv`.`litros` AS `litros`,`to`.`description` AS `observaciones` from (((((((`ticket` `t` join `address` `a` on((`a`.`id` = `t`.`addressFk`))) join `province` `p` on((`p`.`id` = `a`.`provinceFk`))) join `agencyMode` `am` on((`am`.`id` = `t`.`agencyModeFk`))) left join `sale` `s` on((`s`.`ticketFk` = `t`.`id`))) left join `saleVolume` `sv` on((`sv`.`saleFk` = `s`.`id`))) join `observationType` `ot` on((`ot`.`code` = 'packager'))) left join `ticketObservation` `to` on(((`to`.`ticketFk` = `t`.`id`) and (`ot`.`id` = `to`.`observationTypeFk`)))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `ticketPreviousPreparingList` +-- + +/*!50001 DROP TABLE IF EXISTS `ticketPreviousPreparingList`*/; +/*!50001 DROP VIEW IF EXISTS `ticketPreviousPreparingList`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketPreviousPreparingList` AS select `s`.`ticketFk` AS `ticketFk`,`w`.`code` AS `code`,count(`s`.`id`) AS `saleLines`,sum((`s`.`isPicked` <> 0)) AS `alreadyMadeSaleLines`,(sum((`s`.`isPicked` <> 0)) / count(`s`.`id`)) AS `madeRate`,`sg`.`created` AS `created`,`p`.`code` AS `parking`,`iss`.`sectorFk` AS `sectorFk`,`al`.`code` AS `alertCode` from (((((((`vn`.`saleGroup` `sg` join `vn`.`saleGroupDetail` `sgd` on((`sgd`.`saleGroupFk` = `sg`.`id`))) join `vn`.`sale` `s` on((`s`.`id` = `sgd`.`saleFk`))) join `vn`.`ticketState` `tls` on((`tls`.`ticketFk` = `s`.`ticketFk`))) join `vn`.`alertLevel` `al` on((`al`.`id` = `tls`.`alertLevel`))) join `vn`.`worker` `w` on((`w`.`id` = `sg`.`userFk`))) left join `vn`.`parking` `p` on((`p`.`id` = `sg`.`parkingFk`))) join `vn`.`itemShelvingStock` `iss` on((`iss`.`itemFk` = `s`.`itemFk`))) where (`sg`.`created` >= (curdate() + interval 0.1 day)) group by `sg`.`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 `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `ticketState` AS select `i`.`odbc_date` AS `updated`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `workerFk`,`tls`.`ticketFk` AS `ticketFk`,`s`.`id` AS `state`,`s`.`order` AS `productionOrder`,`s`.`alertLevel` AS `alertLevel`,`s`.`code` AS `code`,`tls`.`ticketFk` AS `ticket`,`i`.`Id_Trabajador` AS `worker`,`s`.`isPreviousPreparable` AS `isPreviousPreparable`,`s`.`isPicked` AS `isPicked` from ((`vn`.`ticketLastState` `tls` join `vncontrol`.`inter` `i` on((`i`.`inter_id` = `tls`.`ticketTrackingFk`))) join `vn`.`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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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`,`ts`.`updated` AS `updated`,`ts`.`isPicked` AS `isPicked` 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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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`,`t`.`yearMonth` AS `yearMonth` 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 `tr2` +-- + +/*!50001 DROP TABLE IF EXISTS `tr2`*/; +/*!50001 DROP VIEW IF EXISTS `tr2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `tr2` AS select `travel`.`id` AS `id`,`travel`.`shipped` AS `shipped`,`travel`.`shipmentHour` AS `shipmentHour`,`travel`.`landed` AS `landed`,`travel`.`landingHour` AS `landingHour`,`travel`.`warehouseInFk` AS `warehouseInFk`,`travel`.`warehouseOutFk` AS `warehouseOutFk`,`travel`.`agencyFk` AS `agencyFk`,`travel`.`ref` AS `ref`,`travel`.`isDelivered` AS `isDelivered`,`travel`.`isReceived` AS `isReceived`,`travel`.`m3` AS `m3`,`travel`.`kg` AS `kg`,`travel`.`cargoSupplierFk` AS `cargoSupplierFk`,`travel`.`totalEntries` AS `totalEntries` from `travel` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `traceabilityBuy` +-- + +/*!50001 DROP TABLE IF EXISTS `traceabilityBuy`*/; +/*!50001 DROP VIEW IF EXISTS `traceabilityBuy`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `traceabilityBuy` AS select `b`.`id` AS `buyFk`,`b`.`quantity` AS `quantity`,`tr`.`landed` AS `landed`,`w`.`name` AS `warehouseName`,`b`.`entryFk` AS `entryFk`,`s`.`name` AS `supplierName`,ifnull(`b`.`itemOriginalFk`,`b`.`itemFk`) AS `itemFk` from ((((`buy` `b` join `entry` `e` on((`e`.`id` = `b`.`entryFk`))) join `travel` `tr` on((`tr`.`id` = `e`.`travelFk`))) join `supplier` `s` on((`s`.`id` = `e`.`supplierFk`))) join `warehouse` `w` on((`w`.`id` = `tr`.`warehouseInFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `traceabilitySale` +-- + +/*!50001 DROP TABLE IF EXISTS `traceabilitySale`*/; +/*!50001 DROP VIEW IF EXISTS `traceabilitySale`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `traceabilitySale` AS select `s`.`ticketFk` AS `ticketFk`,`sb`.`buyFk` AS `buyFk`,`t`.`shipped` AS `shipped`,`t`.`nickname` AS `nickname`,`s`.`quantity` AS `quantity`,concat(`w`.`firstName`,' ',`w`.`lastName`) AS `worker` from (((`saleBuy` `sb` join `sale` `s` on((`s`.`id` = `sb`.`saleFk`))) join `ticket` `t` on((`t`.`id` = `s`.`ticketFk`))) join `worker` `w` on((`w`.`id` = `sb`.`workerFk`))) */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `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 `workerBusinessDated` +-- + +/*!50001 DROP TABLE IF EXISTS `workerBusinessDated`*/; +/*!50001 DROP VIEW IF EXISTS `workerBusinessDated`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerBusinessDated` AS select `t`.`dated` AS `dated`,`b`.`business_id` AS `business_id`,`w`.`id` AS `workerFk` from ((((`vn`.`time` `t` left join `postgresql`.`business` `b` on((`t`.`dated` between `b`.`date_start` and ifnull(`b`.`date_end`,curdate())))) left join `postgresql`.`profile` `pr` on((`b`.`client_id` = `pr`.`profile_id`))) left join `postgresql`.`person` `p` on((`pr`.`person_id` = `p`.`person_id`))) left join `vn`.`worker` `w` on((`p`.`id_trabajador` = `w`.`id`))) where (`t`.`dated` > (curdate() + interval -(2) year)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerCalendar` +-- + +/*!50001 DROP TABLE IF EXISTS `workerCalendar`*/; +/*!50001 DROP VIEW IF EXISTS `workerCalendar`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerCalendar` AS select `ce`.`business_id` AS `businessFk`,`p`.`id_trabajador` AS `workerFk`,`ce`.`calendar_state_id` AS `absenceTypeFk`,`ce`.`date` AS `dated` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`calendar_employee` `ce` on((`ce`.`business_id` = `b`.`business_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 `workerDepartment` +-- + +/*!50001 DROP TABLE IF EXISTS `workerDepartment`*/; +/*!50001 DROP VIEW IF EXISTS `workerDepartment`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerDepartment` AS select `p`.`id_trabajador` AS `workerFk`,`d`.`id` AS `departmentFk` from (((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) left join (`postgresql`.`business` `b` left join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) on((`pr`.`profile_id` = `b`.`client_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where ((isnull(`b`.`date_end`) and (`b`.`date_start` <= curdate())) or ((`b`.`date_end` >= curdate()) and (`b`.`date_start` <= 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 `workerDepartmentTest` +-- + +/*!50001 DROP TABLE IF EXISTS `workerDepartmentTest`*/; +/*!50001 DROP VIEW IF EXISTS `workerDepartmentTest`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerDepartmentTest` AS select `p`.`workerFk` AS `workerFk`,`d`.`id` AS `departmentFk` from ((((`vn`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) where (curdate() between `b`.`date_start` and ifnull(`b`.`date_end`,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 `workerLabour` +-- + +/*!50001 DROP TABLE IF EXISTS `workerLabour`*/; +/*!50001 DROP VIEW IF EXISTS `workerLabour`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerLabour` AS select `b`.`business_id` AS `businessFk`,`p`.`id_trabajador` AS `workerFk`,`bl`.`workcenter_id` AS `workCenterFk`,`b`.`date_start` AS `started`,`b`.`date_end` AS `ended`,`d`.`id` AS `departmentFk`,`b`.`payedHolidays` AS `payedHolidays` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `pr` on((`pr`.`person_id` = `p`.`person_id`))) join `postgresql`.`business` `b` on((`b`.`client_id` = `pr`.`profile_id`))) join `postgresql`.`business_labour` `bl` on((`b`.`business_id` = `bl`.`business_id`))) join `vn`.`department` `d` on((`d`.`id` = `bl`.`department_id`))) order by `b`.`date_start` 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 `workerMana__` +-- + +/*!50001 DROP TABLE IF EXISTS `workerMana__`*/; +/*!50001 DROP VIEW IF EXISTS `workerMana__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerMana__` AS select `ms`.`Id_Trabajador` AS `workerFk`,`ms`.`size` AS `size`,`ms`.`used` AS `amount`,`ms`.`prices_modifier_rate` AS `pricesModifierRate`,`ms`.`prices_modifier_activated` AS `isPricesModifierActivated`,`ms`.`minRate` AS `minRate`,`ms`.`maxRate` AS `maxRate` from `bs`.`mana_spellers` `ms` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerMedia` +-- + +/*!50001 DROP TABLE IF EXISTS `workerMedia`*/; +/*!50001 DROP VIEW IF EXISTS `workerMedia`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerMedia` AS select `p`.`id_trabajador` AS `workerFk`,`m`.`value` AS `mediaValue` from ((((`postgresql`.`person` `p` join `postgresql`.`profile` `po` on((`po`.`person_id` = `p`.`person_id`))) join `postgresql`.`profile_media` `pom` on((`pom`.`profile_id` = `po`.`profile_id`))) join `postgresql`.`media` `m` on((`m`.`media_id` = `pom`.`media_id`))) join `postgresql`.`media_type` `mt` on((`mt`.`media_type_id` = `m`.`media_type_id`))) where (`mt`.`name` = 'movil empresa') */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerSpeedExpedition` +-- + +/*!50001 DROP TABLE IF EXISTS `workerSpeedExpedition`*/; +/*!50001 DROP VIEW IF EXISTS `workerSpeedExpedition`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerSpeedExpedition` AS select `sv`.`ticketFk` AS `ticketFk`,sum(`sv`.`litros`) AS `litros`,sum(if((`sub`.`started` > (now() + interval -(1) hour)),`sv`.`litros`,0)) AS `literLastHour`,cast(((60 * sum(`sv`.`litros`)) / time_to_sec(timediff(max(`sub`.`finished`),min(`sub`.`started`)))) as decimal(10,1)) AS `litersByMinute`,`sub`.`code` AS `workerCode`,`sub`.`cajas` AS `cajas`,`sub`.`warehouseFk` AS `warehouseFk` from (`saleVolume` `sv` join `expeditionTimeExpended` `sub` on((`sub`.`ticketFk` = `sv`.`ticketFk`))) group by `workerCode` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerSpeedSaleTracking` +-- + +/*!50001 DROP TABLE IF EXISTS `workerSpeedSaleTracking`*/; +/*!50001 DROP VIEW IF EXISTS `workerSpeedSaleTracking`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerSpeedSaleTracking` AS select `salesPreparedLastHour`.`warehouseFk` AS `warehouseFk`,`salesPreparedLastHour`.`accion` AS `accion`,`salesPreparedLastHour`.`workerCode` AS `workerCode`,sum(`salesPreparedLastHour`.`litros`) AS `sumaLitros`,min(`salesPreparedLastHour`.`created`) AS `started`,max(`salesPreparedLastHour`.`created`) AS `finished`,sum(if((`salesPreparedLastHour`.`created` >= (now() + interval -(1) hour)),`salesPreparedLastHour`.`litros`,0)) AS `sumaLitrosLastHour`,cast(((60 * sum(`salesPreparedLastHour`.`litros`)) / time_to_sec(timediff(max(`salesPreparedLastHour`.`created`),min(`salesPreparedLastHour`.`created`)))) as decimal(10,1)) AS `litersByMinute`,`salesPreparedLastHour`.`departmentName` AS `departmentName` from `vn`.`salesPreparedLastHour` group by `salesPreparedLastHour`.`warehouseFk`,`salesPreparedLastHour`.`accion`,`salesPreparedLastHour`.`workerCode` */; +/*!50001 SET character_set_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 = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTeamCollegues` AS select distinct `w`.`workerFk` AS `workerFk`,`t`.`workerFk` AS `collegueFk` from (`workerTeam` `w` join `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 `workerTimeControlUserInfo` +-- + +/*!50001 DROP TABLE IF EXISTS `workerTimeControlUserInfo`*/; +/*!50001 DROP VIEW IF EXISTS `workerTimeControlUserInfo`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTimeControlUserInfo` AS select `u`.`id` AS `userFk`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`u`.`name` AS `user`,`u`.`password` AS `password`,`u`.`bcryptPassword` AS `bcryptPassword`,`wd`.`departmentFk` AS `departmentFk`,left(`c`.`fi`,8) AS `dni` from (((`account`.`user` `u` join `vn`.`worker` `w` on((`w`.`userFk` = `u`.`id`))) join `vn`.`client` `c` on((`c`.`id` = `u`.`id`))) left join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `w`.`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 `workerTimeControlWorking` +-- + +/*!50001 DROP TABLE IF EXISTS `workerTimeControlWorking`*/; +/*!50001 DROP VIEW IF EXISTS `workerTimeControlWorking`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTimeControlWorking` AS select `wtc`.`userFk` AS `userFk`,`wtc`.`timed` AS `timed`,`w`.`firstName` AS `name`,`w`.`lastName` AS `surname`,`pm`.`mediaValue` AS `phone`,`wm`.`mediaValue` AS `workerPhone`,`d`.`name` AS `department`,`wc`.`name` AS `workerCenter`,count(`wtc`.`order`) AS `maxOrder` from (((((((`vn`.`workerTimeControl` `wtc` join `vn`.`worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) left join `vn`.`personMedia` `pm` on((`pm`.`workerFk` = `w`.`id`))) left join `vn`.`workerMedia` `wm` on((`wm`.`workerFk` = `w`.`id`))) left join `vn`.`workerDepartment` `wd` on((`wd`.`workerFk` = `w`.`id`))) left join `vn`.`department` `d` on((`d`.`id` = `wd`.`departmentFk`))) left join `vn`.`workerLabour` `wl` on((`wl`.`businessFk` = (select `wl2`.`businessFk` from `vn`.`workerLabour` `wl2` where (`wl2`.`workerFk` = `w`.`id`) order by `wl2`.`started` desc limit 1)))) left join `vn`.`workCenter` `wc` on((`wc`.`id` = `wl`.`workCenterFk`))) where (cast(`wtc`.`timed` as date) = curdate()) group by `wtc`.`userFk` having ((`maxOrder` % 2) = 1) order by `wtc`.`timed` 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 `workerTimeControl_Journey__` +-- + +/*!50001 DROP TABLE IF EXISTS `workerTimeControl_Journey__`*/; +/*!50001 DROP VIEW IF EXISTS `workerTimeControl_Journey__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTimeControl_Journey__` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,cast(sum((if((`wtc`.`order` % 2),-(1),1) * (hour(`wtc`.`timed`) + (minute(`wtc`.`timed`) / 60)))) as decimal(10,2)) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) group by cast(`wtc`.`timed` as date),`wtc`.`userFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerTimeJourneyNG` +-- + +/*!50001 DROP TABLE IF EXISTS `workerTimeJourneyNG`*/; +/*!50001 DROP VIEW IF EXISTS `workerTimeJourneyNG`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerTimeJourneyNG` AS select `wtc`.`userFk` AS `userFk`,cast(`wtc`.`timed` as date) AS `dated`,(if((`wtc`.`order` % 2),-(1),1) * (hour(`wtc`.`timed`) + (minute(`wtc`.`timed`) / 60))) AS `Journey`,dayname(`wtc`.`timed`) AS `dayName`,`w`.`lastName` AS `name`,`w`.`firstName` AS `firstname` from (`workerTimeControl` `wtc` join `worker` `w` on((`w`.`userFk` = `wtc`.`userFk`))) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerWithoutDevice__` +-- + +/*!50001 DROP TABLE IF EXISTS `workerWithoutDevice__`*/; +/*!50001 DROP VIEW IF EXISTS `workerWithoutDevice__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerWithoutDevice__` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones` from ((`collection` `c` join `client` `cl` on((`cl`.`id` = `c`.`workerFk`))) left join `deviceProductionUser` `dpu` on((`dpu`.`userFk` = `c`.`workerFk`))) where ((`c`.`created` > curdate()) and isnull(`dpu`.`userFk`)) group by `c`.`workerFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `workerWithoutTractor` +-- + +/*!50001 DROP TABLE IF EXISTS `workerWithoutTractor`*/; +/*!50001 DROP VIEW IF EXISTS `workerWithoutTractor`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `workerWithoutTractor` AS select `c`.`workerFk` AS `workerFk`,`cl`.`name` AS `Trabajador`,count(distinct `c`.`id`) AS `Colecciones`,max(`c`.`created`) AS `created` from ((`collection` `c` join `client` `cl` on((`cl`.`id` = `c`.`workerFk`))) left join `machineWorker` `mw` on(((`mw`.`workerFk` = `c`.`workerFk`) and (`mw`.`inTimed` > curdate())))) where ((`c`.`created` > curdate()) and isnull(`mw`.`workerFk`)) group by `c`.`workerFk` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; + +-- +-- Final view structure for view `zoneEstimatedDelivery` +-- + +/*!50001 DROP TABLE IF EXISTS `zoneEstimatedDelivery`*/; +/*!50001 DROP VIEW IF EXISTS `zoneEstimatedDelivery`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `zoneEstimatedDelivery` AS select `t`.`zoneFk` AS `zoneFk`,cast((curdate() + interval ((hour(ifnull(`zc`.`hour`,`z`.`hour`)) * 60) + minute(ifnull(`zc`.`hour`,`z`.`hour`))) minute) as time) AS `hourTheoretical`,cast(sum(`sv`.`volume`) as decimal(5,1)) AS `totalVolume`,cast(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0)) as decimal(5,1)) AS `remainingVolume`,greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)) AS `speed`,cast((`zc`.`hour` + interval ((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) minute) as time) AS `hourEffective`,floor(((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0)))) AS `minutesLess`,cast((`zc`.`hour` + interval ((-(sum(if((`s`.`alertLevel` < 2),`sv`.`volume`,0))) * 60) / greatest(ifnull(`lhp`.`m3`,0),ifnull(`dl`.`minSpeed`,0))) minute) as time) AS `etc` from (((((((((`vn`.`ticket` `t` join `vn`.`ticketStateToday` `tst` on((`tst`.`ticket` = `t`.`id`))) join `vn`.`state` `s` on((`s`.`id` = `tst`.`state`))) join `vn`.`saleVolume` `sv` on((`sv`.`ticketFk` = `t`.`id`))) left join `vn`.`lastHourProduction` `lhp` on((`lhp`.`warehouseFk` = `t`.`warehouseFk`))) join `vn`.`warehouse` `w` on((`w`.`id` = `t`.`warehouseFk`))) join `vn`.`warehouseAlias` `wa` on((`wa`.`id` = `w`.`aliasFk`))) join `vn`.`zone` `z` on((`z`.`id` = `t`.`zoneFk`))) left join `vn`.`zoneClosure` `zc` on(((`zc`.`zoneFk` = `t`.`zoneFk`) and (`zc`.`dated` = curdate())))) left join `cache`.`departure_limit` `dl` on(((`dl`.`warehouse_id` = `t`.`warehouseFk`) and (`dl`.`fecha` = curdate())))) where (`w`.`hasProduction` and (cast(`t`.`shipped` as date) = curdate())) group by `t`.`zoneFk` */; +/*!50001 SET character_set_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_ETD__` +-- + +/*!50001 DROP TABLE IF EXISTS `zone_ETD__`*/; +/*!50001 DROP VIEW IF EXISTS `zone_ETD__`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8mb4 */; +/*!50001 SET character_set_results = utf8mb4 */; +/*!50001 SET collation_connection = utf8mb4_unicode_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `zone_ETD__` AS select `zed`.`zoneFk` AS `zoneFk`,`zed`.`hourTheoretical` AS `HoraTeórica`,`zed`.`totalVolume` AS `volumenTotal`,`zed`.`remainingVolume` AS `volumenPendiente`,`zed`.`speed` AS `velocidad`,`zed`.`hourEffective` AS `HoraPráctica`,`zed`.`minutesLess` AS `minutesLess`,`zed`.`etc` AS `etc` from `vn`.`zoneEstimatedDelivery` `zed` */; +/*!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`; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2022-05-04 15:56:23 diff --git a/db/export-structure.sh b/db/export-structure.sh index d9729879d..388231306 100755 --- a/db/export-structure.sh +++ b/db/export-structure.sh @@ -49,6 +49,7 @@ IGNORETABLES=( --ignore-table=vn.grantGroup --ignore-table=vn.invoiceCorrection__ --ignore-table=vn.itemTaxCountrySpain + --ignore-table=vn.itemShelvingPlacementSupplyStock__ --ignore-table=vn.itemFreeNumber__ --ignore-table=vn.mail__ --ignore-table=vn.manaSpellers From a0af774837f0d93f3b0823ffeef29eddacd39c29 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 6 May 2022 09:02:52 +0200 Subject: [PATCH 072/141] fix: test --- back/methods/collection/collectionFaults.js | 35 - .../collection/spec/collectionFauls.spec.js | 9 - back/models/collection.js | 1 - db/dump/fixtures.sql | 45 +- db/dump/structure.sql | 13906 ++++++++-------- 5 files changed, 6962 insertions(+), 7034 deletions(-) delete mode 100644 back/methods/collection/collectionFaults.js delete mode 100644 back/methods/collection/spec/collectionFauls.spec.js diff --git a/back/methods/collection/collectionFaults.js b/back/methods/collection/collectionFaults.js deleted file mode 100644 index 395c7e581..000000000 --- a/back/methods/collection/collectionFaults.js +++ /dev/null @@ -1,35 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('collectionFaults', { - description: 'Update sale of a collection', - accessType: 'WRITE', - accepts: [{ - arg: 'shelvingFk', - type: 'String', - required: true, - description: 'The shalving id' - }, { - arg: 'quantity', - type: 'Number', - required: true, - description: 'The quantity to sale' - }, { - arg: 'itemFk', - type: 'Number', - required: true, - description: 'The ticket id' - }], - returns: { - type: 'Object', - root: true - }, - http: { - path: `/collectionFaults`, - verb: 'POST' - } - }); - - Self.collectionFaults = async(shelvingFk, quantity, itemFk) => { - query = `CALL vn.collection_faults(?,?,?)`; - return await Self.rawSql(query, [shelvingFk, quantity, itemFk]); - }; -}; diff --git a/back/methods/collection/spec/collectionFauls.spec.js b/back/methods/collection/spec/collectionFauls.spec.js deleted file mode 100644 index 210dcdf63..000000000 --- a/back/methods/collection/spec/collectionFauls.spec.js +++ /dev/null @@ -1,9 +0,0 @@ -const app = require('vn-loopback/server/server'); -describe('collectionFaults()', () => { - it('return shelving afected', async() => { - let response = await app.models.Collection.collectionFaults('UXN', 0, 1); - - expect(response.length).toBeGreaterThan(0); - expect(response[0][0].shelvingFk).toEqual('UXN'); - }); -}); diff --git a/back/models/collection.js b/back/models/collection.js index 29a0c4c32..436414f62 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -3,5 +3,4 @@ module.exports = Self => { require('../methods/collection/newCollection')(Self); require('../methods/collection/getSectors')(Self); require('../methods/collection/setSaleQuantity')(Self); - require('../methods/collection/collectionFaults')(Self); }; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index c2e42d140..a83632740 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -54,28 +54,7 @@ INSERT INTO `vn`.`educationLevel` (`id`, `name`) INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`) SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9 - FROM `vn`.`user`; - -ALTER TABLE `vn`.`worker` ADD `originCountryFk` mediumint(8) unsigned NULL COMMENT 'País de origen'; -ALTER TABLE `vn`.`worker` ADD `educationLevelFk` SMALLINT NULL; -ALTER TABLE `vn`.`worker` ADD `SSN` varchar(15) NULL; -ALTER TABLE `vn`.`worker` CHANGE `maritalStatus__` `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL; -ALTER TABLE `vn`.`worker` MODIFY COLUMN `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL; -ALTER TABLE `vn`.`worker` CHANGE `maritalStatus` maritalStatus enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER sectorFk; -ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `vn`.`educationLevel`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; -ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `vn`.`country`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE; - -UPDATE `vn`.`worker` `w` - SET `maritalStatus` = 'S'; - -UPDATE `vn`.`worker` `w` - SET `originCountryFk` = '1'; - -UPDATE `vn`.`worker` `w` - SET `educationLevelFk` = '2'; - -UPDATE `vn`.`worker` `w` - SET `SSN` = '123456789123'; + FROM `vn`.`user`; UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20; UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9; @@ -173,8 +152,9 @@ INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingO INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `parked`, `userFk`) VALUES - ('GVC', '1', '0', '1', '0', '1106'), - ('HEJ', '2', '0', '1', '0', '1106'); + ('GVC', 1, 0, 1, 0, 1106), + ('HEJ', 2, 0, 1, 0, 1106), + ('UXN', 1, 0, 1, 0, 1106); INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`) VALUES @@ -1069,10 +1049,11 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (32, 36, -92.324), (32, 39, 0.994); -INSERT INTO `vn`.`itemShelving` (`id`, `itemFk`, `shelvingFk`, `shelve`, `deep`, `quantity`, `visible`, `available`, `grouping`, `packing`, `level`, `userFk`) +INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `visible`, `grouping`, `packing`, `userFk`) VALUES - ('1', '2', 'GVC', 'A', '0', '1', '1', '1', '1', '1', '1', '1106'), - ('2', '4', 'HEJ', 'A', '0', '2', '1', '1', '1', '1', '1', '1106'); + (2, 'GVC', 'A', 1, 1, 1, 1106), + (4, 'HEJ', 'A', 1, 1, 1, 1106), + (1, 'UXN', 'A', 2, 12, 12, 1106); INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`) VALUES @@ -1126,14 +1107,6 @@ INSERT INTO `vn`.`parking` (`column`, `row`, `sectorFk`, `code`, `pickingOrder`) VALUES ('100', '01', 1, '100-01', 1); -INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `priority`, `userFk`) - VALUES - ('UXN', 1, 1, 1106); - -INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `deep`, `quantity`, `visible`, `available`, `grouping`, `packing`, `level`, `userFk`) - VALUES - (1, 'UXN', 'A', 2, 12, 12, 12, 12, 12, 1, 1106); - INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `level`) VALUES (1, 1, 1); @@ -2523,7 +2496,7 @@ INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`) INSERT INTO `vn`.`docuware` (`code`, `fileCabinetName`, `dialogName` , `find`) VALUES - ('deliveryClientTest', 'deliveryClientTest', 'findTest', 'word'); + ('deliveryClient', 'deliveryClient', 'findTicket', 'word'); INSERT INTO `vn`.`docuwareConfig` (`url`) VALUES diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 74bcd8966..fdd7e1151 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -920,52 +920,52 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `passwordGenerate`() RETURNS text CHARSET utf8 COLLATE utf8_unicode_ci READS SQL DATA -BEGIN -/** - * Generates a random password that meets the minimum requirements. - * - * @return Generated password - */ - DECLARE vMinLength TINYINT; - DECLARE vMinAlpha TINYINT; - DECLARE vMinUpper TINYINT; - DECLARE vMinDigits TINYINT; - DECLARE vMinPunct TINYINT; - DECLARE vAlpha TINYINT DEFAULT 0; - DECLARE vUpper TINYINT DEFAULT 0; - DECLARE vDigits TINYINT DEFAULT 0; - DECLARE vPunct TINYINT DEFAULT 0; - DECLARE vRandIndex INT; - DECLARE vPwd TEXT DEFAULT ''; - - 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); - - 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; +BEGIN +/** + * Generates a random password that meets the minimum requirements. + * + * @return Generated password + */ + DECLARE vMinLength TINYINT; + DECLARE vMinAlpha TINYINT; + DECLARE vMinUpper TINYINT; + DECLARE vMinDigits TINYINT; + DECLARE vMinPunct TINYINT; + DECLARE vAlpha TINYINT DEFAULT 0; + DECLARE vUpper TINYINT DEFAULT 0; + DECLARE vDigits TINYINT DEFAULT 0; + DECLARE vPunct TINYINT DEFAULT 0; + DECLARE vRandIndex INT; + DECLARE vPwd TEXT DEFAULT ''; + + 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); + + 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 */ ; @@ -1104,23 +1104,23 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `user_getMysqlRole`(vUserName VARCHAR(255)) RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci DETERMINISTIC -BEGIN -/** - * From a username, it returns the associated MySQL wich should be used when - * using external authentication systems. - * - * @param vUserName The user name - * @return The associated MySQL role - */ - DECLARE vRole VARCHAR(255); - - SELECT CONCAT(IF(r.hasLogin, c.rolePrefix, ''), r.name) INTO vRole - FROM role r - JOIN user u ON u.role = r.id - JOIN roleConfig c - WHERE u.name = vUserName; - - RETURN vRole; +BEGIN +/** + * From a username, it returns the associated MySQL wich should be used when + * using external authentication systems. + * + * @param vUserName The user name + * @return The associated MySQL role + */ + DECLARE vRole VARCHAR(255); + + SELECT CONCAT(IF(r.hasLogin, c.rolePrefix, ''), r.name) INTO vRole + FROM role r + JOIN user u ON u.role = r.id + JOIN roleConfig c + WHERE u.name = vUserName; + + RETURN vRole; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -1139,20 +1139,20 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `user_getNameFromId`(vSelf INT) RETURNS varchar(30) CHARSET utf8 COLLATE utf8_unicode_ci DETERMINISTIC -BEGIN -/** - * Gets user name from it's id. - * - * @param vSelf The user id - * @return The user name - */ - DECLARE vName VARCHAR(30); - - SELECT `name` INTO vName - FROM user - WHERE id = vSelf; - - RETURN vName; +BEGIN +/** + * Gets user name from it's id. + * + * @param vSelf The user id + * @return The user name + */ + DECLARE vName VARCHAR(30); + + SELECT `name` INTO vName + FROM user + WHERE id = vSelf; + + RETURN vName; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -4091,21 +4091,21 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `carteras_add`() -BEGIN -/** - * Inserta en @bs.carteras. - */ - DELETE FROM bs.carteras - WHERE Año >= YEAR(CURDATE()) - 1; - - INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) - SELECT t.year AS Año, t.month AS Mes, w.code AS CodigoTrabajador, SUM(v.importe) AS Peso - FROM vn.time t - JOIN bs.ventas v on t.dated = v.fecha - JOIN vn.client c on c.id = v.Id_Cliente - JOIN vn.worker w ON w.id = c.salesPersonFk - WHERE t.year >= YEAR(CURDATE()) - 1 - GROUP BY w.code, t.year , t.month; +BEGIN +/** + * Inserta en @bs.carteras. + */ + DELETE FROM bs.carteras + WHERE Año >= YEAR(CURDATE()) - 1; + + INSERT INTO bs.carteras(Año,Mes,CodigoTrabajador,Peso) + SELECT t.year AS Año, t.month AS Mes, w.code AS CodigoTrabajador, SUM(v.importe) AS Peso + FROM vn.time t + JOIN bs.ventas v on t.dated = v.fecha + JOIN vn.client c on c.id = v.Id_Cliente + JOIN vn.worker w ON w.id = c.salesPersonFk + WHERE t.year >= YEAR(CURDATE()) - 1 + GROUP BY w.code, t.year , t.month; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6444,104 +6444,104 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ventas_contables_add`(IN vYear INT, IN vMonth INT) -BEGIN - - /** - * Reemplaza las ventas contables del último año. - * Es el origen de datos para el balance de Entradas - * - * @param vYear Año a reemplazar - * @param vMonth Mes a reemplazar - * - **/ - - DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; - - DELETE FROM bs.ventas_contables - WHERE year = vYear - AND month = vMonth; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; - CREATE TEMPORARY TABLE tmp.ticket_list - (PRIMARY KEY (Id_Ticket)) - ENGINE = MEMORY - SELECT Id_Ticket - FROM vn2008.Tickets t - JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura - WHERE year(f.Fecha) = vYear - AND month(f.Fecha) = vMonth; - - INSERT INTO bs.ventas_contables(year - , month - , venta - , grupo - , reino_id - , tipo_id - , empresa_id - , gasto) - - SELECT vYear - , vMonth - , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) - , IF( - e.empresa_grupo = e2.empresa_grupo - ,1 - ,IF(e2.empresa_grupo,2,0) - ) as grupo - , tp.reino_id - , a.tipo_id - , t.empresa_id - , 7000000000 - + IF(e.empresa_grupo = e2.empresa_grupo - ,1 - ,IF(e2.empresa_grupo,2,0) - ) * 1000000 - + tp.reino_id * 10000 as Gasto - FROM vn2008.Movimientos m - JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket - JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna - JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente - JOIN tmp.ticket_list tt on tt.Id_Ticket = t.Id_Ticket - JOIN vn2008.Articles a on m.Id_Article = a.Id_Article - JOIN vn2008.empresa e on e.id = t.empresa_id - LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente - JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id - WHERE Cantidad <> 0 - AND Preu <> 0 - AND m.Descuento <> 100 - AND a.tipo_id != TIPO_PATRIMONIAL - GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto; - - INSERT INTO bs.ventas_contables(year - , month - , venta - , grupo - , reino_id - , tipo_id - , empresa_id - , gasto) - SELECT vYear - , vMonth - , sum(ts.quantity * ts.price) - , IF( - c.companyGroupFk = c2.companyGroupFk - ,1 - ,IF(c2.companyGroupFk, 2, 0) - ) as grupo - , NULL - , NULL - , t.companyFk - , 7050000000 - FROM vn.ticketService ts - JOIN vn.ticket t ON ts.ticketFk = t.id - JOIN vn.address a on a.id = t.addressFk - JOIN vn.client cl on cl.id = a.clientFk - JOIN tmp.ticket_list tt on tt.Id_Ticket = t.id - JOIN vn.company c on c.id = t.companyFk - LEFT JOIN vn.company c2 on c2.clientFk = cl.id - GROUP BY grupo, t.companyFk ; - - DROP TEMPORARY TABLE tmp.ticket_list; +BEGIN + + /** + * Reemplaza las ventas contables del último año. + * Es el origen de datos para el balance de Entradas + * + * @param vYear Año a reemplazar + * @param vMonth Mes a reemplazar + * + **/ + + DECLARE TIPO_PATRIMONIAL INT DEFAULT 188; + + DELETE FROM bs.ventas_contables + WHERE year = vYear + AND month = vMonth; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list; + CREATE TEMPORARY TABLE tmp.ticket_list + (PRIMARY KEY (Id_Ticket)) + ENGINE = MEMORY + SELECT Id_Ticket + FROM vn2008.Tickets t + JOIN vn2008.Facturas f ON f.Id_Factura = t.Factura + WHERE year(f.Fecha) = vYear + AND month(f.Fecha) = vMonth; + + INSERT INTO bs.ventas_contables(year + , month + , venta + , grupo + , reino_id + , tipo_id + , empresa_id + , gasto) + + SELECT vYear + , vMonth + , round(sum(Cantidad * Preu * (100 - m.Descuento)/100)) + , IF( + e.empresa_grupo = e2.empresa_grupo + ,1 + ,IF(e2.empresa_grupo,2,0) + ) as grupo + , tp.reino_id + , a.tipo_id + , t.empresa_id + , 7000000000 + + IF(e.empresa_grupo = e2.empresa_grupo + ,1 + ,IF(e2.empresa_grupo,2,0) + ) * 1000000 + + tp.reino_id * 10000 as Gasto + FROM vn2008.Movimientos m + JOIN vn2008.Tickets t on t.Id_Ticket = m.Id_Ticket + JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna + JOIN vn2008.Clientes c on c.Id_Cliente = cs.Id_Cliente + JOIN tmp.ticket_list tt on tt.Id_Ticket = t.Id_Ticket + JOIN vn2008.Articles a on m.Id_Article = a.Id_Article + JOIN vn2008.empresa e on e.id = t.empresa_id + LEFT JOIN vn2008.empresa e2 on e2.Id_Cliente = c.Id_Cliente + JOIN vn2008.Tipos tp on tp.tipo_id = a.tipo_id + WHERE Cantidad <> 0 + AND Preu <> 0 + AND m.Descuento <> 100 + AND a.tipo_id != TIPO_PATRIMONIAL + GROUP BY grupo, reino_id, tipo_id, empresa_id, Gasto; + + INSERT INTO bs.ventas_contables(year + , month + , venta + , grupo + , reino_id + , tipo_id + , empresa_id + , gasto) + SELECT vYear + , vMonth + , sum(ts.quantity * ts.price) + , IF( + c.companyGroupFk = c2.companyGroupFk + ,1 + ,IF(c2.companyGroupFk, 2, 0) + ) as grupo + , NULL + , NULL + , t.companyFk + , 7050000000 + FROM vn.ticketService ts + JOIN vn.ticket t ON ts.ticketFk = t.id + JOIN vn.address a on a.id = t.addressFk + JOIN vn.client cl on cl.id = a.clientFk + JOIN tmp.ticket_list tt on tt.Id_Ticket = t.id + JOIN vn.company c on c.id = t.companyFk + LEFT JOIN vn.company c2 on c2.clientFk = cl.id + GROUP BY grupo, t.companyFk ; + + DROP TEMPORARY TABLE tmp.ticket_list; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6852,33 +6852,33 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `waste_addSales_lastWeek__`() -BEGIN - DECLARE vWeek INT; - DECLARE vYear INT; - - SELECT week, year - INTO vWeek, vYear - FROM vn.time - WHERE dated = TIMESTAMPADD(WEEK, -1, CURDATE()); - - REPLACE bs.waste - SELECT *, 100 * mermas / total as porcentaje - FROM ( - SELECT buyer, - year, - week, - family, - itemFk, - itemTypeFk, - floor(sum(value)) as total, - floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas - FROM vn.saleValue - where year = vYear and week = vWeek - - GROUP BY family, itemFk - - ) sub - ORDER BY mermas DESC; +BEGIN + DECLARE vWeek INT; + DECLARE vYear INT; + + SELECT week, year + INTO vWeek, vYear + FROM vn.time + WHERE dated = TIMESTAMPADD(WEEK, -1, CURDATE()); + + REPLACE bs.waste + SELECT *, 100 * mermas / total as porcentaje + FROM ( + SELECT buyer, + year, + week, + family, + itemFk, + itemTypeFk, + floor(sum(value)) as total, + floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas + FROM vn.saleValue + where year = vYear and week = vWeek + + GROUP BY family, itemFk + + ) sub + ORDER BY mermas DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -7605,147 +7605,147 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `availableNoRaids_refresh`(OUT `vCalc` INT, IN `vRefresh` INT, IN `vWarehouse` INT, IN `vDate` DATE) -proc: BEGIN - DECLARE vStartDate DATE; - DECLARE vEndDate DATETIME; - DECLARE vReserveDate DATETIME; - DECLARE vParams CHAR(100); - DECLARE vInventoryDate DATE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - CALL cache_calc_unlock (vCalc); - RESIGNAL; - END; - - IF vDate < CURDATE() THEN - LEAVE proc; - END IF; - - CALL vn.itemStock (vWarehouse, vDate, NULL); - - SET vParams = CONCAT_WS('/', vWarehouse, vDate); - CALL cache_calc_start (vCalc, vRefresh, 'availableNoRaids', vParams); - - IF !vRefresh THEN - LEAVE proc; - END IF; - - -- Calcula algunos parámetros necesarios - - SET vStartDate = TIMESTAMP(vDate, '00:00:00'); - SET vEndDate = TIMESTAMP(TIMESTAMPADD(DAY, 4, vDate), '23:59:59'); - - SELECT inventoried INTO vInventoryDate FROM vn.config; - - SELECT SUBTIME(NOW(), reserveTime) INTO vReserveDate - FROM hedera.orderConfig; - - -- 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.item_id, IF(it.life IS NULL, NULL, - TIMESTAMP(TIMESTAMPADD(DAY, it.life, c.landing), '23:59:59')) AS date_end - FROM ( - SELECT b.itemFk item_id, MAX(t.landed) landing - FROM vn.buy b - JOIN vn.entry e ON b.entryFk = e.id - JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.warehouse w ON w.id = t.warehouseInFk - JOIN vn.supplier s ON s.id = e.supplierFk - WHERE t.landed BETWEEN vInventoryDate AND vStartDate - AND t.warehouseInFk = vWarehouse - AND s.name != 'INVENTARIO' - AND NOT e.isRaid - GROUP BY b.itemFk - ) c - JOIN vn.item i ON i.id = c.item_id - JOIN vn.itemType it ON it.id = i.typeFk - HAVING date_end >= vStartDate OR date_end IS NULL; - - -- 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 * FROM item_range; - - DROP TEMPORARY TABLE IF EXISTS item_range_copy2; - CREATE TEMPORARY TABLE item_range_copy2 LIKE item_range; - INSERT INTO item_range_copy2 - SELECT * FROM item_range; - - DROP TEMPORARY TABLE IF EXISTS item_range_copy3; - CREATE TEMPORARY TABLE item_range_copy3 LIKE item_range; - INSERT INTO item_range_copy3 - SELECT * FROM item_range; - - DROP TEMPORARY TABLE IF EXISTS item_range_copy4; - CREATE TEMPORARY TABLE item_range_copy4 LIKE item_range; - INSERT INTO item_range_copy4 - SELECT * FROM item_range; - - -- Calcula el ATP - - DELETE FROM availableNoRaids WHERE calc_id = vCalc; - - INSERT INTO availableNoRaids (calc_id, item_id, available) - SELECT vCalc, t.item_id, SUM(stock) amount FROM ( - SELECT il.itemFk AS item_id, stock - FROM tmp.itemList il - JOIN item_range ir ON ir.item_id = il.itemFk - UNION ALL - SELECT t.item_id, minacum(dt, amount, vDate) AS available FROM ( - SELECT itemFk AS item_id, DATE(dat) dt, SUM(quantity) amount FROM ( - SELECT i.itemFk, i.shipped AS dat, i.quantity - FROM vn.itemTicketOut i - JOIN item_range_copy1 ir ON ir.item_id = i.itemFk - WHERE i.shipped >= vStartDate - AND (ir.date_end IS NULL OR i.shipped <= ir.date_end) - AND i.warehouseFk = vWarehouse - UNION ALL - SELECT i.itemFk, i.landed AS dat, i.quantity - FROM vn.itemEntryIn i - JOIN item_range_copy2 ir ON ir.item_id = i.itemFk - WHERE i.landed >= vStartDate - AND (ir.date_end IS NULL OR i.landed <= ir.date_end) - AND i.warehouseInFk = vWarehouse - AND i.isVirtualStock = FALSE - UNION ALL - SELECT i.itemFk, i.shipped AS dat, i.quantity - FROM vn.itemEntryOut i - JOIN item_range_copy3 ir ON ir.item_id = i.itemFk - WHERE i.shipped >= vStartDate - AND (ir.date_end IS NULL OR i.shipped <= ir.date_end) - AND i.warehouseOutFk = vWarehouse - 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 >= vStartDate - AND (ir.date_end IS NULL OR r.shipment <= ir.date_end) - AND r.warehouse_id = vWarehouse - AND r.created >= vReserveDate - AND NOT o.confirmed - ) t - GROUP BY item_id, dt - ) t - GROUP BY t.item_id - ) t GROUP BY t.item_id; - - DROP TEMPORARY TABLE IF EXISTS - tmp.itemList - ,item_range - ,item_range_copy1 - ,item_range_copy2 - ,item_range_copy3 - ,item_range_copy4; - - CALL cache_calc_end (vCalc); +proc: BEGIN + DECLARE vStartDate DATE; + DECLARE vEndDate DATETIME; + DECLARE vReserveDate DATETIME; + DECLARE vParams CHAR(100); + DECLARE vInventoryDate DATE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + CALL cache_calc_unlock (vCalc); + RESIGNAL; + END; + + IF vDate < CURDATE() THEN + LEAVE proc; + END IF; + + CALL vn.itemStock (vWarehouse, vDate, NULL); + + SET vParams = CONCAT_WS('/', vWarehouse, vDate); + CALL cache_calc_start (vCalc, vRefresh, 'availableNoRaids', vParams); + + IF !vRefresh THEN + LEAVE proc; + END IF; + + -- Calcula algunos parámetros necesarios + + SET vStartDate = TIMESTAMP(vDate, '00:00:00'); + SET vEndDate = TIMESTAMP(TIMESTAMPADD(DAY, 4, vDate), '23:59:59'); + + SELECT inventoried INTO vInventoryDate FROM vn.config; + + SELECT SUBTIME(NOW(), reserveTime) INTO vReserveDate + FROM hedera.orderConfig; + + -- 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.item_id, IF(it.life IS NULL, NULL, + TIMESTAMP(TIMESTAMPADD(DAY, it.life, c.landing), '23:59:59')) AS date_end + FROM ( + SELECT b.itemFk item_id, MAX(t.landed) landing + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse w ON w.id = t.warehouseInFk + JOIN vn.supplier s ON s.id = e.supplierFk + WHERE t.landed BETWEEN vInventoryDate AND vStartDate + AND t.warehouseInFk = vWarehouse + AND s.name != 'INVENTARIO' + AND NOT e.isRaid + GROUP BY b.itemFk + ) c + JOIN vn.item i ON i.id = c.item_id + JOIN vn.itemType it ON it.id = i.typeFk + HAVING date_end >= vStartDate OR date_end IS NULL; + + -- 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 * FROM item_range; + + DROP TEMPORARY TABLE IF EXISTS item_range_copy2; + CREATE TEMPORARY TABLE item_range_copy2 LIKE item_range; + INSERT INTO item_range_copy2 + SELECT * FROM item_range; + + DROP TEMPORARY TABLE IF EXISTS item_range_copy3; + CREATE TEMPORARY TABLE item_range_copy3 LIKE item_range; + INSERT INTO item_range_copy3 + SELECT * FROM item_range; + + DROP TEMPORARY TABLE IF EXISTS item_range_copy4; + CREATE TEMPORARY TABLE item_range_copy4 LIKE item_range; + INSERT INTO item_range_copy4 + SELECT * FROM item_range; + + -- Calcula el ATP + + DELETE FROM availableNoRaids WHERE calc_id = vCalc; + + INSERT INTO availableNoRaids (calc_id, item_id, available) + SELECT vCalc, t.item_id, SUM(stock) amount FROM ( + SELECT il.itemFk AS item_id, stock + FROM tmp.itemList il + JOIN item_range ir ON ir.item_id = il.itemFk + UNION ALL + SELECT t.item_id, minacum(dt, amount, vDate) AS available FROM ( + SELECT itemFk AS item_id, DATE(dat) dt, SUM(quantity) amount FROM ( + SELECT i.itemFk, i.shipped AS dat, i.quantity + FROM vn.itemTicketOut i + JOIN item_range_copy1 ir ON ir.item_id = i.itemFk + WHERE i.shipped >= vStartDate + AND (ir.date_end IS NULL OR i.shipped <= ir.date_end) + AND i.warehouseFk = vWarehouse + UNION ALL + SELECT i.itemFk, i.landed AS dat, i.quantity + FROM vn.itemEntryIn i + JOIN item_range_copy2 ir ON ir.item_id = i.itemFk + WHERE i.landed >= vStartDate + AND (ir.date_end IS NULL OR i.landed <= ir.date_end) + AND i.warehouseInFk = vWarehouse + AND i.isVirtualStock = FALSE + UNION ALL + SELECT i.itemFk, i.shipped AS dat, i.quantity + FROM vn.itemEntryOut i + JOIN item_range_copy3 ir ON ir.item_id = i.itemFk + WHERE i.shipped >= vStartDate + AND (ir.date_end IS NULL OR i.shipped <= ir.date_end) + AND i.warehouseOutFk = vWarehouse + 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 >= vStartDate + AND (ir.date_end IS NULL OR r.shipment <= ir.date_end) + AND r.warehouse_id = vWarehouse + AND r.created >= vReserveDate + AND NOT o.confirmed + ) t + GROUP BY item_id, dt + ) t + GROUP BY t.item_id + ) t GROUP BY t.item_id; + + DROP TEMPORARY TABLE IF EXISTS + tmp.itemList + ,item_range + ,item_range_copy1 + ,item_range_copy2 + ,item_range_copy3 + ,item_range_copy4; + + CALL cache_calc_end (vCalc); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -7989,27 +7989,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cache_calc_end`(IN `v_calc` INT) -BEGIN - DECLARE v_cache_name VARCHAR(255); - DECLARE v_params VARCHAR(255); - - -- Libera el bloqueo y actualiza la fecha de ultimo refresco. - - UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id - SET - cc.last_refresh = NOW(), - cc.expires = LEAST(ADDTIME(NOW(), c.lifetime), util.midNight()), - cc.connection_id = NULL - WHERE cc.id = v_calc; - - SELECT c.name, ca.params INTO v_cache_name, v_params - FROM cache c - JOIN cache_calc ca ON c.id = ca.cache_id - WHERE ca.id = v_calc; - - IF v_cache_name IS NOT NULL THEN - DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); - END IF; +BEGIN + DECLARE v_cache_name VARCHAR(255); + DECLARE v_params VARCHAR(255); + + -- Libera el bloqueo y actualiza la fecha de ultimo refresco. + + UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id + SET + cc.last_refresh = NOW(), + cc.expires = LEAST(ADDTIME(NOW(), c.lifetime), util.midNight()), + cc.connection_id = NULL + WHERE cc.id = v_calc; + + SELECT c.name, ca.params INTO v_cache_name, v_params + FROM cache c + JOIN cache_calc ca ON c.id = ca.cache_id + WHERE ca.id = v_calc; + + IF v_cache_name IS NOT NULL THEN + DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8027,88 +8027,88 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100)) -proc: BEGIN - DECLARE v_valid BOOL; - DECLARE v_lock_id VARCHAR(100); - DECLARE v_cache_id INT; - DECLARE v_expires DATETIME; - DECLARE v_clean_time DATETIME; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - IF v_lock_id IS NOT NULL THEN - DO RELEASE_LOCK(v_lock_id); - END IF; - - RESIGNAL; - END; - - SET v_params = IFNULL(v_params, ''); - - -- Si el servidor se ha reiniciado invalida todos los calculos. - - SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid; - - IF !v_valid - THEN - DELETE FROM cache_calc; - INSERT INTO cache_valid (valid) VALUES (TRUE); - END IF; - - -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia. - - SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params); - - IF !GET_LOCK(v_lock_id, 30) - THEN - SET v_calc = NULL; - SET v_refresh = FALSE; - LEAVE proc; - END IF; - - -- Comprueba si el calculo solicitado existe y esta actualizado. - - SELECT c.id, ca.id, ca.expires - INTO v_cache_id, v_calc, v_expires - FROM cache c - LEFT JOIN cache_calc ca - ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci' - WHERE c.name = v_cache_name COLLATE 'utf8_general_ci'; - - -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. - - IF !v_refresh AND NOW() < v_expires - THEN - DO RELEASE_LOCK(v_lock_id); - SET v_refresh = FALSE; - LEAVE proc; - END IF; - - -- Si el calculo no existe le crea una entrada en la tabla de calculos. - - IF v_calc IS NULL - THEN - INSERT INTO cache_calc SET - cache_id = v_cache_id, - cacheName = v_cache_name, - params = v_params, - last_refresh = NULL, - expires = NULL, - connection_id = CONNECTION_ID(); - - SET v_calc = LAST_INSERT_ID(); - ELSE - UPDATE cache_calc - SET - last_refresh = NULL, - expires = NULL, - connection_id = CONNECTION_ID() - WHERE id = v_calc; - END IF; - - -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador. - - SET v_refresh = TRUE; +proc: BEGIN + DECLARE v_valid BOOL; + DECLARE v_lock_id VARCHAR(100); + DECLARE v_cache_id INT; + DECLARE v_expires DATETIME; + DECLARE v_clean_time DATETIME; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + IF v_lock_id IS NOT NULL THEN + DO RELEASE_LOCK(v_lock_id); + END IF; + + RESIGNAL; + END; + + SET v_params = IFNULL(v_params, ''); + + -- Si el servidor se ha reiniciado invalida todos los calculos. + + SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid; + + IF !v_valid + THEN + DELETE FROM cache_calc; + INSERT INTO cache_valid (valid) VALUES (TRUE); + END IF; + + -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia. + + SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params); + + IF !GET_LOCK(v_lock_id, 30) + THEN + SET v_calc = NULL; + SET v_refresh = FALSE; + LEAVE proc; + END IF; + + -- Comprueba si el calculo solicitado existe y esta actualizado. + + SELECT c.id, ca.id, ca.expires + INTO v_cache_id, v_calc, v_expires + FROM cache c + LEFT JOIN cache_calc ca + ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci' + WHERE c.name = v_cache_name COLLATE 'utf8_general_ci'; + + -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. + + IF !v_refresh AND NOW() < v_expires + THEN + DO RELEASE_LOCK(v_lock_id); + SET v_refresh = FALSE; + LEAVE proc; + END IF; + + -- Si el calculo no existe le crea una entrada en la tabla de calculos. + + IF v_calc IS NULL + THEN + INSERT INTO cache_calc SET + cache_id = v_cache_id, + cacheName = v_cache_name, + params = v_params, + last_refresh = NULL, + expires = NULL, + connection_id = CONNECTION_ID(); + + SET v_calc = LAST_INSERT_ID(); + ELSE + UPDATE cache_calc + SET + last_refresh = NULL, + expires = NULL, + connection_id = CONNECTION_ID() + WHERE id = v_calc; + END IF; + + -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador. + + SET v_refresh = TRUE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8126,24 +8126,24 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `cache_calc_unlock`(IN `v_calc` INT) -proc: BEGIN - DECLARE v_cache_name VARCHAR(50); - DECLARE v_params VARCHAR(100); - - IF v_calc IS NULL THEN - LEAVE proc; - END IF; - - SELECT c.name, ca.params INTO v_cache_name, v_params - FROM cache c - JOIN cache_calc ca ON c.id = ca.cache_id - WHERE ca.id = v_calc; - - DELETE FROM cache_calc WHERE id = v_calc; - - IF v_cache_name IS NOT NULL THEN - DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); - END IF; +proc: BEGIN + DECLARE v_cache_name VARCHAR(50); + DECLARE v_params VARCHAR(100); + + IF v_calc IS NULL THEN + LEAVE proc; + END IF; + + SELECT c.name, ca.params INTO v_cache_name, v_params + FROM cache c + JOIN cache_calc ca ON c.id = ca.cache_id + WHERE ca.id = v_calc; + + DELETE FROM cache_calc WHERE id = v_calc; + + IF v_cache_name IS NOT NULL THEN + DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8182,13 +8182,13 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean`() -BEGIN - - DECLARE vDateShort DATETIME; - - SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE()); - - DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; +BEGIN + + DECLARE vDateShort DATETIME; + + SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE()); + + DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10002,22 +10002,22 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `imageName`(vPictureReference VARCHAR(255)) RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci DETERMINISTIC -BEGIN - - SET vPictureReference = REPLACE(vPictureReference,'.',''); - - SET vPictureReference = REPLACE(vPictureReference,'/',''); - - SET vPictureReference = REPLACE(vPictureReference,'%',''); - - SET vPictureReference = REPLACE(vPictureReference,':',''); - - SET vPictureReference = REPLACE(vPictureReference,'?',''); - - SET vPictureReference = REPLACE(vPictureReference,'=',''); - - RETURN vPictureReference; - +BEGIN + + SET vPictureReference = REPLACE(vPictureReference,'.',''); + + SET vPictureReference = REPLACE(vPictureReference,'/',''); + + SET vPictureReference = REPLACE(vPictureReference,'%',''); + + SET vPictureReference = REPLACE(vPictureReference,':',''); + + SET vPictureReference = REPLACE(vPictureReference,'?',''); + + SET vPictureReference = REPLACE(vPictureReference,'=',''); + + RETURN vPictureReference; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10067,28 +10067,28 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `deliveryInformation_Delete`() -BEGIN - - DECLARE vID INT; - DECLARE vGap INT DEFAULT 100; - DECLARE vTope INT; - - SELECT MIN(ID), MAX(ID) - INTO vID, vTope - FROM edi.deliveryInformation; - - WHILE vID <= vTope DO - - SET vID = vID + vGap; - - DELETE - FROM edi.deliveryInformation - WHERE ID < vID - AND EarliestDespatchDateTime IS NULL; - - END WHILE; - - +BEGIN + + DECLARE vID INT; + DECLARE vGap INT DEFAULT 100; + DECLARE vTope INT; + + SELECT MIN(ID), MAX(ID) + INTO vID, vTope + FROM edi.deliveryInformation; + + WHILE vID <= vTope DO + + SET vID = vID + vGap; + + DELETE + FROM edi.deliveryInformation + WHERE ID < vID + AND EarliestDespatchDateTime IS NULL; + + END WHILE; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10473,38 +10473,38 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_loadNotBuy`() -BEGIN - - /** - * Ejecuta ekt_load para aquellos ekt de hoy que no tienen vn.buy - */ - - DECLARE vEktFk INTEGER; - DECLARE done BOOL; - - - DECLARE cursor1 CURSOR FOR SELECT e.id - FROM edi.ekt e - LEFT JOIN vn.buy b ON b.ektFk = e.id - WHERE e.fec >= CURDATE() - AND ISNULL(b.ektFk); - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; - - OPEN cursor1; - bucle: LOOP - - FETCH cursor1 INTO vEktFk; - - IF done THEN - LEAVE bucle; - END IF; - - CALL edi.ekt_load(vEktFk); - - END LOOP bucle; - CLOSE cursor1; - +BEGIN + + /** + * Ejecuta ekt_load para aquellos ekt de hoy que no tienen vn.buy + */ + + DECLARE vEktFk INTEGER; + DECLARE done BOOL; + + + DECLARE cursor1 CURSOR FOR SELECT e.id + FROM edi.ekt e + LEFT JOIN vn.buy b ON b.ektFk = e.id + WHERE e.fec >= CURDATE() + AND ISNULL(b.ektFk); + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; + + OPEN cursor1; + bucle: LOOP + + FETCH cursor1 INTO vEktFk; + + IF done THEN + LEAVE bucle; + END IF; + + CALL edi.ekt_load(vEktFk); + + END LOOP bucle; + CLOSE cursor1; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -12168,56 +12168,56 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_freeAdd`() -BEGIN - - /** - * Rellena la tabla item_free con los id ausentes en vn.item - * - */ - - DECLARE vCounter INT DEFAULT 400000; - - DECLARE vCounterNewItems INT DEFAULT 0; - - DECLARE vMaxItem INT; - - DECLARE vExists BOOLEAN DEFAULT FALSE; - - SELECT MAX(id) - INTO vMaxItem - FROM vn.item; - - DROP TEMPORARY TABLE IF EXISTS tmp.itemBusy; - CREATE TEMPORARY TABLE tmp.itemBusy - (id INT PRIMARY KEY) - SELECT i.id - FROM vn.item i - WHERE id >= 400000 - UNION ALL - SELECT ifr.id - FROM edi.item_free ifr; - - WHILE vCounter < vMaxItem DO - - SET vCounter = vCounter + 1; - - SELECT count(*) INTO vExists - FROM tmp.itemBusy - WHERE id = vCounter; - - IF NOT vExists THEN - - SET vCounterNewItems = vCounterNewItems + 1; - - INSERT INTO edi.item_free(id) - VALUES (vCounter); - - END IF; - - END WHILE; - - DROP TEMPORARY TABLE tmp.itemBusy; - +BEGIN + + /** + * Rellena la tabla item_free con los id ausentes en vn.item + * + */ + + DECLARE vCounter INT DEFAULT 400000; + + DECLARE vCounterNewItems INT DEFAULT 0; + + DECLARE vMaxItem INT; + + DECLARE vExists BOOLEAN DEFAULT FALSE; + + SELECT MAX(id) + INTO vMaxItem + FROM vn.item; + + DROP TEMPORARY TABLE IF EXISTS tmp.itemBusy; + CREATE TEMPORARY TABLE tmp.itemBusy + (id INT PRIMARY KEY) + SELECT i.id + FROM vn.item i + WHERE id >= 400000 + UNION ALL + SELECT ifr.id + FROM edi.item_free ifr; + + WHILE vCounter < vMaxItem DO + + SET vCounter = vCounter + 1; + + SELECT count(*) INTO vExists + FROM tmp.itemBusy + WHERE id = vCounter; + + IF NOT vExists THEN + + SET vCounterNewItems = vCounterNewItems + 1; + + INSERT INTO edi.item_free(id) + VALUES (vCounter); + + END IF; + + END WHILE; + + DROP TEMPORARY TABLE tmp.itemBusy; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -12480,49 +12480,49 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `orderLog__`(vItemFk INT) -BEGIN - - DECLARE vSupplyResponseFk INT; - DECLARE vDescription VARCHAR(100); - - SELECT supplyResponseFk, CONCAT(id, ' ',longName) INTO vSupplyResponseFk, vDescription - FROM vn.item - WHERE id = vItemFk; - - SELECT * FROM - ( - SELECT 'Cliente confirma' accion, or2.created hora, amount Cantidad - FROM hedera.order_row or2 - JOIN vn.item i ON i.id = or2.item_id - WHERE i.supplyResponseFk = vSupplyResponseFk - - UNION ALL - - SELECT vDescription, NULL, NULL - - UNION ALL - - SELECT 'Cliente se conecta' , o.date_make , NULL - FROM hedera.`order` o - JOIN hedera.order_row or2 ON or2.order_id = o.id - JOIN vn.item i ON i.id = or2.item_id - WHERE i.supplyResponseFk = vSupplyResponseFk - - UNION ALL - - SELECT DISTINCT 'Subasta cambia cantidad', srl.created, srl.NumberOfUnitsNew * sr.NumberOfItemsPerCask - FROM edi.supplyResponseLog srl - JOIN edi.supplyResponse sr ON sr.ID = srl.supplyResponseFk - WHERE srl.supplyResponseFk = vSupplyResponseFk - - UNION ALL - - SELECT 'Linea de venta definitiva', s.created, s.quantity - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - WHERE i.supplyResponseFk = vSupplyResponseFk) sub - ORDER BY hora; - +BEGIN + + DECLARE vSupplyResponseFk INT; + DECLARE vDescription VARCHAR(100); + + SELECT supplyResponseFk, CONCAT(id, ' ',longName) INTO vSupplyResponseFk, vDescription + FROM vn.item + WHERE id = vItemFk; + + SELECT * FROM + ( + SELECT 'Cliente confirma' accion, or2.created hora, amount Cantidad + FROM hedera.order_row or2 + JOIN vn.item i ON i.id = or2.item_id + WHERE i.supplyResponseFk = vSupplyResponseFk + + UNION ALL + + SELECT vDescription, NULL, NULL + + UNION ALL + + SELECT 'Cliente se conecta' , o.date_make , NULL + FROM hedera.`order` o + JOIN hedera.order_row or2 ON or2.order_id = o.id + JOIN vn.item i ON i.id = or2.item_id + WHERE i.supplyResponseFk = vSupplyResponseFk + + UNION ALL + + SELECT DISTINCT 'Subasta cambia cantidad', srl.created, srl.NumberOfUnitsNew * sr.NumberOfItemsPerCask + FROM edi.supplyResponseLog srl + JOIN edi.supplyResponse sr ON sr.ID = srl.supplyResponseFk + WHERE srl.supplyResponseFk = vSupplyResponseFk + + UNION ALL + + SELECT 'Linea de venta definitiva', s.created, s.quantity + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + WHERE i.supplyResponseFk = vSupplyResponseFk) sub + ORDER BY hora; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -12540,55 +12540,55 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_calcCompByFloramondo`(vSelf INT) -BEGIN - - /** - * Recalcula "a pelo" los componentes para un ticket de Floramondo - * - * Pendiente de concretar la solución cuando Logiflora conteste. - * - * @param vSelf Identificador de vn.ticket - */ - - CALL cache.last_buy_refresh(TRUE); - - DELETE sc.* - FROM vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk - WHERE s.ticketFk = vSelf; - - UPDATE vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN edi.floraHollandConfig fhc - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.warehouse w ON w.id = lb.warehouse_id AND w.name = 'Floramondo' - SET s.price = b.buyingValue * (1 + fhc.floramondoMargin) - WHERE s.ticketFk = vSelf; - - INSERT INTO vn.saleComponent(saleFk, componentFk, value) - SELECT s.id, c.id, MAX(b.buyingValue) - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.warehouse w ON w.id = lb.warehouse_id AND w.name = 'Floramondo' - JOIN vn.component c ON c.code = 'purchaseValue' - WHERE s.ticketFk = vSelf - GROUP BY s.id; - - INSERT INTO vn.saleComponent(saleFk, componentFk, value) - SELECT s.id, c.id, MAX(b.buyingValue) * fhc.floramondoMargin - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN edi.floraHollandConfig fhc - LEFT JOIN cache.last_buy lb ON lb.item_id = i.id - LEFT JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN vn.warehouse w ON w.id = lb.warehouse_id AND w.name = 'Floramondo' - JOIN vn.component c ON c.code = 'margin' - WHERE s.ticketFk = vSelf - GROUP BY s.id; - +BEGIN + + /** + * Recalcula "a pelo" los componentes para un ticket de Floramondo + * + * Pendiente de concretar la solución cuando Logiflora conteste. + * + * @param vSelf Identificador de vn.ticket + */ + + CALL cache.last_buy_refresh(TRUE); + + DELETE sc.* + FROM vn.saleComponent sc + JOIN vn.sale s ON s.id = sc.saleFk + WHERE s.ticketFk = vSelf; + + UPDATE vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN edi.floraHollandConfig fhc + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN vn.warehouse w ON w.id = lb.warehouse_id AND w.name = 'Floramondo' + SET s.price = b.buyingValue * (1 + fhc.floramondoMargin) + WHERE s.ticketFk = vSelf; + + INSERT INTO vn.saleComponent(saleFk, componentFk, value) + SELECT s.id, c.id, MAX(b.buyingValue) + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN vn.warehouse w ON w.id = lb.warehouse_id AND w.name = 'Floramondo' + JOIN vn.component c ON c.code = 'purchaseValue' + WHERE s.ticketFk = vSelf + GROUP BY s.id; + + INSERT INTO vn.saleComponent(saleFk, componentFk, value) + SELECT s.id, c.id, MAX(b.buyingValue) * fhc.floramondoMargin + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN edi.floraHollandConfig fhc + LEFT JOIN cache.last_buy lb ON lb.item_id = i.id + LEFT JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN vn.warehouse w ON w.id = lb.warehouse_id AND w.name = 'Floramondo' + JOIN vn.component c ON c.code = 'margin' + WHERE s.ticketFk = vSelf + GROUP BY s.id; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -13470,24 +13470,24 @@ DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `hedera`.`order_afterUpdate` AFTER UPDATE ON `order` FOR EACH ROW -BEGIN - CALL stock.log_add('order', NEW.id, OLD.id); - - IF !(OLD.address_id <=> NEW.address_id) - OR !(OLD.company_id <=> NEW.company_id) - OR !(OLD.customer_id <=> NEW.customer_id) THEN - CALL order_requestRecalc(NEW.id); - END IF; - - IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN - -- Fallo que se actualiza no se sabe como tickets en este cliente - CALL vn.mail_insert( - 'jgallego@verdnatura.es', - 'noreply@verdnatura.es', - 'Actualizada order al address 2850', - CONCAT(account.myUserGetName(), ' ha creado la order ',NEW.id) - ); - END IF; +BEGIN + CALL stock.log_add('order', NEW.id, OLD.id); + + IF !(OLD.address_id <=> NEW.address_id) + OR !(OLD.company_id <=> NEW.company_id) + OR !(OLD.customer_id <=> NEW.customer_id) THEN + CALL order_requestRecalc(NEW.id); + END IF; + + IF !(OLD.address_id <=> NEW.address_id) AND NEW.address_id = 2850 THEN + -- Fallo que se actualiza no se sabe como tickets en este cliente + CALL vn.mail_insert( + 'jgallego@verdnatura.es', + 'noreply@verdnatura.es', + 'Actualizada order al address 2850', + CONCAT(account.myUserGetName(), ' ha creado la order ',NEW.id) + ); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -14881,30 +14881,30 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_listAllocation`(IN `vWh` TINYINT, IN `vDate` DATE, IN `vType` INT, IN `vPrefix` VARCHAR(255), IN `vUseIds` BOOLEAN) -BEGIN -/** - * Lists visible items and it's box sizes of the specified - * type at specified date. - * - * @param vWh The warehouse id - * @param vDate The visible date - * @param vType The type id - * @param vPrefix The article prefix to filter or %NULL for all - * @param vUseIds Whether to order the result by item id - * @select List of visible items with it's box sizes - */ - CALL item_getVisible(vWh, vDate, vType, vPrefix); - - IF vUseIds - THEN - SELECT * FROM tmp.itemVisible - ORDER BY Id_Article; - ELSE - SELECT * FROM tmp.itemVisible - ORDER BY Article, packing; - END IF; - - DROP TEMPORARY TABLE tmp.itemVisible; +BEGIN +/** + * Lists visible items and it's box sizes of the specified + * type at specified date. + * + * @param vWh The warehouse id + * @param vDate The visible date + * @param vType The type id + * @param vPrefix The article prefix to filter or %NULL for all + * @param vUseIds Whether to order the result by item id + * @select List of visible items with it's box sizes + */ + CALL item_getVisible(vWh, vDate, vType, vPrefix); + + IF vUseIds + THEN + SELECT * FROM tmp.itemVisible + ORDER BY Id_Article; + ELSE + SELECT * FROM tmp.itemVisible + ORDER BY Article, packing; + END IF; + + DROP TEMPORARY TABLE tmp.itemVisible; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -15051,82 +15051,82 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `myBasket_configure`( - vDelivery DATE, - vDeliveryMethod VARCHAR(45), - vAgency INT, +CREATE DEFINER=`root`@`localhost` PROCEDURE `myBasket_configure`( + 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 vSelf INT; - DECLARE vCompany INT; - DECLARE vDeliveryMethodId INT; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vSelf = 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 vSelf = myBasket_getId(); - - IF vSelf IS NULL - THEN - - SELECT defaultCompanyFk INTO vCompany - FROM orderConfig; - - 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 vSelf = LAST_INSERT_ID(); - - INSERT INTO basketOrder SET - clientFk = account.userGetId(), - orderFk = vSelf; - ELSE - UPDATE `order` - SET - date_send = vDelivery, - delivery_method_id = vDeliveryMethodId, - agency_id = vAgency, - address_id = vAddress - WHERE - id = vSelf; - - CALL order_update(vSelf); - END IF; - - CALL order_checkConfig(vSelf); - - COMMIT; +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 vSelf INT; + DECLARE vCompany INT; + DECLARE vDeliveryMethodId INT; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vSelf = 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 vSelf = myBasket_getId(); + + IF vSelf IS NULL + THEN + + SELECT defaultCompanyFk INTO vCompany + FROM orderConfig; + + 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 vSelf = LAST_INSERT_ID(); + + INSERT INTO basketOrder SET + clientFk = account.userGetId(), + orderFk = vSelf; + ELSE + UPDATE `order` + SET + date_send = vDelivery, + delivery_method_id = vDeliveryMethodId, + agency_id = vAgency, + address_id = vAddress + WHERE + id = vSelf; + + CALL order_update(vSelf); + END IF; + + CALL order_checkConfig(vSelf); + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -15351,62 +15351,62 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_newWithAddress`( - OUT vSelf INT, - vLandingDate DATE, +CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_newWithAddress`( + OUT vSelf INT, + vLandingDate DATE, vAddressFk INT) -BEGIN -/** - * Crea una nueva orden para el usuario actual especificando - * una fecha de entrega. - * - * @param vSelf Id de la nueva orden - * @param vLandingDate Fecha de entrega - */ - DECLARE vCompany INT; - DECLARE vDeliveryMethodId INT; - DECLARE vAgencyMode INT; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vSelf = NULL; - DECLARE EXIT HANDLER FOR SQLSTATE '45000' - BEGIN - ROLLBACK; - SET vSelf = NULL; - RESIGNAL; - END; - - START TRANSACTION; - - SELECT a.agencyModeFk, a.id - INTO vAgencyMode, vAddressFk - FROM vn.address a - WHERE a.id = vAddressFk; - - SELECT deliveryMethodFk INTO vDeliveryMethodId - FROM vn.agencyMode am - WHERE am.id = vAgencyMode; - - IF vCompany IS NULL - THEN - SELECT defaultCompanyFk INTO vCompany - FROM orderConfig; - END IF; - - INSERT INTO `order` - SET - customer_id = account.userGetId(), - date_send = vLandingDate, - delivery_method_id = vDeliveryMethodId, - agency_id = vAgencyMode, - address_id = vAddressFk, - source_app = 'WEB', - company_id = vCompany; - - SET vSelf = LAST_INSERT_ID(); - - CALL order_checkConfig(vSelf); - - COMMIT; +BEGIN +/** + * Crea una nueva orden para el usuario actual especificando + * una fecha de entrega. + * + * @param vSelf Id de la nueva orden + * @param vLandingDate Fecha de entrega + */ + DECLARE vCompany INT; + DECLARE vDeliveryMethodId INT; + DECLARE vAgencyMode INT; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vSelf = NULL; + DECLARE EXIT HANDLER FOR SQLSTATE '45000' + BEGIN + ROLLBACK; + SET vSelf = NULL; + RESIGNAL; + END; + + START TRANSACTION; + + SELECT a.agencyModeFk, a.id + INTO vAgencyMode, vAddressFk + FROM vn.address a + WHERE a.id = vAddressFk; + + SELECT deliveryMethodFk INTO vDeliveryMethodId + FROM vn.agencyMode am + WHERE am.id = vAgencyMode; + + IF vCompany IS NULL + THEN + SELECT defaultCompanyFk INTO vCompany + FROM orderConfig; + END IF; + + INSERT INTO `order` + SET + customer_id = account.userGetId(), + date_send = vLandingDate, + delivery_method_id = vDeliveryMethodId, + agency_id = vAgencyMode, + address_id = vAddressFk, + source_app = 'WEB', + company_id = vCompany; + + SET vSelf = LAST_INSERT_ID(); + + CALL order_checkConfig(vSelf); + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -15423,62 +15423,62 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_newWithDate`( - OUT vSelf INT, +CREATE DEFINER=`root`@`localhost` PROCEDURE `myOrder_newWithDate`( + OUT vSelf INT, vLandingDate DATE) -BEGIN -/** - * Crea una nueva orden para el usuario actual especificando - * una fecha de entrega. - * - * @param vSelf Id de la nueva orden - * @param vLandingDate Fecha de entrega - */ - DECLARE vCompany INT; - DECLARE vDeliveryMethodId INT; - DECLARE vAgencyMode INT; - DECLARE vAddress INT; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vSelf = NULL; - DECLARE EXIT HANDLER FOR SQLSTATE '45000' - BEGIN - ROLLBACK; - SET vSelf = NULL; - RESIGNAL; - END; - - START TRANSACTION; - - SELECT a.agencyModeFk, a.id - INTO vAgencyMode, vAddress - FROM myClient c - JOIN vn.address a ON a.id = c.defaultAddressFk; - - SELECT deliveryMethodFk INTO vDeliveryMethodId - FROM vn.agencyMode am - WHERE am.id = vAgencyMode; - - IF vCompany IS NULL - THEN - SELECT defaultCompanyFk INTO vCompany - FROM orderConfig; - END IF; - - INSERT INTO `order` - SET - customer_id = account.userGetId(), - date_send = vLandingDate, - delivery_method_id = vDeliveryMethodId, - agency_id = vAgencyMode, - address_id = vAddress, - source_app = 'WEB', - company_id = vCompany; - - SET vSelf = LAST_INSERT_ID(); - - CALL order_checkConfig(vSelf); - - COMMIT; +BEGIN +/** + * Crea una nueva orden para el usuario actual especificando + * una fecha de entrega. + * + * @param vSelf Id de la nueva orden + * @param vLandingDate Fecha de entrega + */ + DECLARE vCompany INT; + DECLARE vDeliveryMethodId INT; + DECLARE vAgencyMode INT; + DECLARE vAddress INT; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vSelf = NULL; + DECLARE EXIT HANDLER FOR SQLSTATE '45000' + BEGIN + ROLLBACK; + SET vSelf = NULL; + RESIGNAL; + END; + + START TRANSACTION; + + SELECT a.agencyModeFk, a.id + INTO vAgencyMode, vAddress + FROM myClient c + JOIN vn.address a ON a.id = c.defaultAddressFk; + + SELECT deliveryMethodFk INTO vDeliveryMethodId + FROM vn.agencyMode am + WHERE am.id = vAgencyMode; + + IF vCompany IS NULL + THEN + SELECT defaultCompanyFk INTO vCompany + FROM orderConfig; + END IF; + + INSERT INTO `order` + SET + customer_id = account.userGetId(), + date_send = vLandingDate, + delivery_method_id = vDeliveryMethodId, + agency_id = vAgencyMode, + address_id = vAddress, + source_app = 'WEB', + company_id = vCompany; + + SET vSelf = LAST_INSERT_ID(); + + CALL order_checkConfig(vSelf); + + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -18569,19 +18569,19 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sip_getExtension`(vUserId INT(10)) -BEGIN - - /* - * Devuelve la extensión pbx del usuario - * - * @param vUserId Id del usuario - * - */ - - SELECT extension - FROM sip s - WHERE s.user_id = vUserId; - +BEGIN + + /* + * Devuelve la extensión pbx del usuario + * + * @param vUserId Id del usuario + * + */ + + SELECT extension + FROM sip s + WHERE s.user_id = vUserId; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -18793,32 +18793,32 @@ CREATE TABLE `business` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `postgresql`.`business_beforeUpdate` - BEFORE UPDATE ON `business` - FOR EACH ROW -BEGIN - DECLARE isOverlapping BOOL; - - IF !(OLD.date_start <=> NEW.date_start AND OLD.date_end <=> NEW.date_end) THEN - - SELECT COUNT(*) > 0 INTO isOverlapping - FROM business b - WHERE (util.hasDateOverlapped( - NEW.date_start, - IFNULL(NEW.date_end,b.date_start), - b.date_start, - IFNULL(b.date_end,NEW.date_start)) - OR (NEW.date_end <=> NULL AND b.date_end <=> NULL)) - AND b.business_id <> OLD.business_id - AND client_id = OLD.client_id - ; - - IF isOverlapping THEN - CALL util.throw ('IS_OVERLAPPING'); - END IF; - - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `postgresql`.`business_beforeUpdate` + BEFORE UPDATE ON `business` + FOR EACH ROW +BEGIN + DECLARE isOverlapping BOOL; + + IF !(OLD.date_start <=> NEW.date_start AND OLD.date_end <=> NEW.date_end) THEN + + SELECT COUNT(*) > 0 INTO isOverlapping + FROM business b + WHERE (util.hasDateOverlapped( + NEW.date_start, + IFNULL(NEW.date_end,b.date_start), + b.date_start, + IFNULL(b.date_end,NEW.date_start)) + OR (NEW.date_end <=> NULL AND b.date_end <=> NULL)) + AND b.business_id <> OLD.business_id + AND client_id = OLD.client_id + ; + + IF isOverlapping THEN + CALL util.throw ('IS_OVERLAPPING'); + END IF; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -24914,7 +24914,7 @@ DROP TABLE IF EXISTS `versionLog`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `versionLog` ( - `code` varchar(255) COLLATE utf8_unicode_ci NOT NULL, + `code` varchar(200) COLLATE utf8_unicode_ci NOT NULL, `number` char(11) COLLATE utf8_unicode_ci NOT NULL, `file` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `user` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, @@ -25935,20 +25935,20 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `slowLog_prune`() -BEGIN -/** - * Prunes MySQL slow query log table deleting all records older than one week. - */ - DECLARE vSlowQueryLog INT DEFAULT @@slow_query_log; - - SET GLOBAL slow_query_log = 'OFF'; - RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; - - DELETE FROM `mysql`.`slow_log_temp` - WHERE start_time < TIMESTAMPADD(WEEK, -1, NOW()); - - RENAME TABLE `mysql`.`slow_log_temp` TO `mysql`.`slow_log`; - SET GLOBAL slow_query_log = vSlowQueryLog; +BEGIN +/** + * Prunes MySQL slow query log table deleting all records older than one week. + */ + DECLARE vSlowQueryLog INT DEFAULT @@slow_query_log; + + SET GLOBAL slow_query_log = 'OFF'; + RENAME TABLE `mysql`.`slow_log` TO `mysql`.`slow_log_temp`; + + DELETE FROM `mysql`.`slow_log_temp` + WHERE start_time < TIMESTAMPADD(WEEK, -1, NOW()); + + RENAME TABLE `mysql`.`slow_log_temp` TO `mysql`.`slow_log`; + SET GLOBAL slow_query_log = vSlowQueryLog; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27417,71 +27417,71 @@ CREATE TABLE `buy` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeInsert` - BEFORE INSERT ON `buy` - FOR EACH ROW -trig: BEGIN - DECLARE vWarehouse INT; - DECLARE vLanding DATE; - DECLARE vGrouping INT; - DECLARE vGroupingMode TINYINT; - DECLARE vGenericFk INT; - DECLARE vGenericInDate BOOL; - - IF @isModeInventory THEN - LEAVE trig; - END IF; - - CALL buy_checkGrouping(NEW.`grouping`); - - SELECT t.warehouseInFk, t.landed INTO vWarehouse, vLanding - FROM entry e - JOIN travel t ON t.id = e.travelFk - WHERE e.id = NEW.entryFk; - - SELECT b.`grouping`, b.groupingMode INTO vGrouping, vGroupingMode - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed <= vLanding - AND b.itemFk = NEW.itemFk - AND !b.isIgnored - ORDER BY t.warehouseInFk = vWarehouse DESC, t.landed DESC, b.id DESC - LIMIT 1; - - IF NEW.`grouping` IS NULL THEN - SET NEW.`grouping` = vGrouping; - END IF; - - IF NEW.groupingMode IS NULL THEN - SET NEW.groupingMode = vGroupingMode; - END IF; - - -- Generics - - SELECT i.genericFk INTO vGenericFk - FROM vn.item i - WHERE i.id = NEW.itemFk; - - IF vGenericFk THEN - - SELECT COUNT(*) INTO vGenericInDate - FROM vn.genericAllocation ga - JOIN vn.entry e ON e.id = NEW.entryFk - JOIN vn.travel tr on tr.id = e.travelFk - WHERE ga.itemFk = vGenericFk - AND tr.landed BETWEEN ga.startDated AND ga.endDated; - - IF vGenericInDate THEN - - SET NEW.itemOriginalFk = NEW.itemFk; - - SET NEW.itemFk = vGenericFk; - - END IF; - - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeInsert` + BEFORE INSERT ON `buy` + FOR EACH ROW +trig: BEGIN + DECLARE vWarehouse INT; + DECLARE vLanding DATE; + DECLARE vGrouping INT; + DECLARE vGroupingMode TINYINT; + DECLARE vGenericFk INT; + DECLARE vGenericInDate BOOL; + + IF @isModeInventory THEN + LEAVE trig; + END IF; + + CALL buy_checkGrouping(NEW.`grouping`); + + SELECT t.warehouseInFk, t.landed INTO vWarehouse, vLanding + FROM entry e + JOIN travel t ON t.id = e.travelFk + WHERE e.id = NEW.entryFk; + + SELECT b.`grouping`, b.groupingMode INTO vGrouping, vGroupingMode + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed <= vLanding + AND b.itemFk = NEW.itemFk + AND !b.isIgnored + ORDER BY t.warehouseInFk = vWarehouse DESC, t.landed DESC, b.id DESC + LIMIT 1; + + IF NEW.`grouping` IS NULL THEN + SET NEW.`grouping` = vGrouping; + END IF; + + IF NEW.groupingMode IS NULL THEN + SET NEW.groupingMode = vGroupingMode; + END IF; + + -- Generics + + SELECT i.genericFk INTO vGenericFk + FROM vn.item i + WHERE i.id = NEW.itemFk; + + IF vGenericFk THEN + + SELECT COUNT(*) INTO vGenericInDate + FROM vn.genericAllocation ga + JOIN vn.entry e ON e.id = NEW.entryFk + JOIN vn.travel tr on tr.id = e.travelFk + WHERE ga.itemFk = vGenericFk + AND tr.landed BETWEEN ga.startDated AND ga.endDated; + + IF vGenericInDate THEN + + SET NEW.itemOriginalFk = NEW.itemFk; + + SET NEW.itemFk = vGenericFk; + + END IF; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -27523,47 +27523,47 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeUpdate` - BEFORE UPDATE ON `buy` - FOR EACH ROW -trig:BEGIN - DECLARE vGenericFk INT; - DECLARE vGenericInDate BOOL; - - IF @isTriggerDisabled THEN - - LEAVE trig; - - END IF; - - IF !(NEW.`grouping` <=> OLD.`grouping`) THEN - CALL buy_checkGrouping(NEW.`grouping`); - END IF; - - -- Generics - - SELECT i.genericFk INTO vGenericFk - FROM vn.item i - WHERE i.id = NEW.itemFk; - - IF vGenericFk THEN - - SELECT COUNT(*) INTO vGenericInDate - FROM vn.genericAllocation ga - JOIN vn.entry e ON e.id = NEW.entryFk - JOIN vn.travel tr on tr.id = e.travelFk - WHERE ga.itemFk = vGenericFk - AND tr.landed BETWEEN ga.startDated AND ga.endDated; - - IF vGenericInDate THEN - - SET NEW.itemOriginalFk = NEW.itemFk; - - SET NEW.itemFk = vGenericFk; - - END IF; - - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`buy_beforeUpdate` + BEFORE UPDATE ON `buy` + FOR EACH ROW +trig:BEGIN + DECLARE vGenericFk INT; + DECLARE vGenericInDate BOOL; + + IF @isTriggerDisabled THEN + + LEAVE trig; + + END IF; + + IF !(NEW.`grouping` <=> OLD.`grouping`) THEN + CALL buy_checkGrouping(NEW.`grouping`); + END IF; + + -- Generics + + SELECT i.genericFk INTO vGenericFk + FROM vn.item i + WHERE i.id = NEW.itemFk; + + IF vGenericFk THEN + + SELECT COUNT(*) INTO vGenericInDate + FROM vn.genericAllocation ga + JOIN vn.entry e ON e.id = NEW.entryFk + JOIN vn.travel tr on tr.id = e.travelFk + WHERE ga.itemFk = vGenericFk + AND tr.landed BETWEEN ga.startDated AND ga.endDated; + + IF vGenericInDate THEN + + SET NEW.itemOriginalFk = NEW.itemFk; + + SET NEW.itemFk = vGenericFk; + + END IF; + + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -29133,39 +29133,39 @@ CREATE TABLE `collection` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_BEFORE_UPDATE` - BEFORE UPDATE ON `collection` - FOR EACH ROW -BEGIN - - DECLARE vStateFk INT; - DECLARE vTotalLines INT; - DECLARE vPickedLines INT; - - IF NEW.saleTotalCount <= NEW.salePickedCount - AND (NEW.saleTotalCount != OLD.saleTotalCount - OR NEW.salePickedCount != OLD.salePickedCount) - THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE code = 'PREPARED'; - - SET NEW.stateFk = vStateFk; - - END IF; - - IF NEW.saleTotalCount > NEW.salePickedCount - AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN - - SELECT id INTO vStateFk - FROM vn.state - WHERE code = 'ON_PREPARATION'; - - SET NEW.stateFk = vStateFk; - - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`collection_BEFORE_UPDATE` + BEFORE UPDATE ON `collection` + FOR EACH ROW +BEGIN + + DECLARE vStateFk INT; + DECLARE vTotalLines INT; + DECLARE vPickedLines INT; + + IF NEW.saleTotalCount <= NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount + OR NEW.salePickedCount != OLD.salePickedCount) + THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE code = 'PREPARED'; + + SET NEW.stateFk = vStateFk; + + END IF; + + IF NEW.saleTotalCount > NEW.salePickedCount + AND (NEW.saleTotalCount != OLD.saleTotalCount OR NEW.salePickedCount != OLD.salePickedCount) THEN + + SELECT id INTO vStateFk + FROM vn.state + WHERE code = 'ON_PREPARATION'; + + SET NEW.stateFk = vStateFk; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -30641,31 +30641,31 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeUpdate` - BEFORE UPDATE ON `dms` - FOR EACH ROW -BEGIN - DECLARE vHardCopyNumber INT; - - IF (NEW.hasFile <> 0) AND (OLD.hasFile = 0) AND (NEW.hardCopyNumber IS NULL) - OR - (NEW.hardCopyNumber = OLD.hardCopyNumber AND OLD.warehouseFk <> NEW.warehouseFk) THEN - - IF (SELECT NOT hasDms FROM warehouse WHERE id = NEW.warehouseFk) THEN - SET NEW.warehouseFk = (SELECT id FROM warehouse WHERE name = 'Algemesi'); - END IF; - - SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber - FROM dms - WHERE warehouseFk = NEW.warehouseFk; - - SET NEW.hardCopyNumber = IFNULL(vHardCopyNumber,1); - END IF; - - IF ((NEW.hardCopyNumber = 0) OR NEW.hardCopyNumber IS NULL) AND (OLD.hardCopyNumber <> 0) THEN - - SET NEW.hasFile = 0; - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`dms_beforeUpdate` + BEFORE UPDATE ON `dms` + FOR EACH ROW +BEGIN + DECLARE vHardCopyNumber INT; + + IF (NEW.hasFile <> 0) AND (OLD.hasFile = 0) AND (NEW.hardCopyNumber IS NULL) + OR + (NEW.hardCopyNumber = OLD.hardCopyNumber AND OLD.warehouseFk <> NEW.warehouseFk) THEN + + IF (SELECT NOT hasDms FROM warehouse WHERE id = NEW.warehouseFk) THEN + SET NEW.warehouseFk = (SELECT id FROM warehouse WHERE name = 'Algemesi'); + END IF; + + SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber + FROM dms + WHERE warehouseFk = NEW.warehouseFk; + + SET NEW.hardCopyNumber = IFNULL(vHardCopyNumber,1); + END IF; + + IF ((NEW.hardCopyNumber = 0) OR NEW.hardCopyNumber IS NULL) AND (OLD.hardCopyNumber <> 0) THEN + + SET NEW.hasFile = 0; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -33909,26 +33909,26 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_afterInsert` - AFTER INSERT ON `item` - FOR EACH ROW -BEGIN - - CALL hedera.image_ref('catalog', NEW.image); - - INSERT INTO vn.itemTaxCountry(itemFk, countryFk) - SELECT NEW.id, 1; - - INSERT INTO vn.itemTaxCountry(itemFk, countryFk) - SELECT NEW.id, 5; - - INSERT INTO vn.itemTaxCountry(itemFk, countryFk) - SELECT NEW.id, 30; - - DELETE ifr.* - FROM edi.item_free ifr - WHERE ifr.id = NEW.id; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`item_afterInsert` + AFTER INSERT ON `item` + FOR EACH ROW +BEGIN + + CALL hedera.image_ref('catalog', NEW.image); + + INSERT INTO vn.itemTaxCountry(itemFk, countryFk) + SELECT NEW.id, 1; + + INSERT INTO vn.itemTaxCountry(itemFk, countryFk) + SELECT NEW.id, 5; + + INSERT INTO vn.itemTaxCountry(itemFk, countryFk) + SELECT NEW.id, 30; + + DELETE ifr.* + FROM edi.item_free ifr + WHERE ifr.id = NEW.id; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -37852,19 +37852,19 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterUpdate` - AFTER UPDATE ON `province` - FOR EACH ROW -BEGIN - IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN - CALL zoneGeo_setParent(NEW.geoFk, - (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); - END IF; - - IF !(OLD.`name` <=> NEW.`name`) THEN - UPDATE zoneGeo SET `name` = NEW.`name` - WHERE id = NEW.geoFk; - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`province_afterUpdate` + AFTER UPDATE ON `province` + FOR EACH ROW +BEGIN + IF !(OLD.autonomyFk <=> NEW.autonomyFk) THEN + CALL zoneGeo_setParent(NEW.geoFk, + (SELECT geoFk FROM autonomy WHERE id = NEW.autonomyFk)); + END IF; + + IF !(OLD.`name` <=> NEW.`name`) THEN + UPDATE zoneGeo SET `name` = NEW.`name` + WHERE id = NEW.geoFk; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38064,20 +38064,20 @@ CREATE TABLE `receipt` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeInsert` - BEFORE INSERT ON `receipt` - FOR EACH ROW -BEGIN - DECLARE vIsAutoConciliated BOOLEAN; - - IF NEW.isConciliate = FALSE THEN - SELECT isAutoConciliated INTO vIsAutoConciliated - FROM accounting a - JOIN accountingType at2 ON at2.id = a.accountingTypeFk - WHERE a.id = NEW.bankFk; - - SET NEW.isConciliate = vIsAutoConciliated; - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_beforeInsert` + BEFORE INSERT ON `receipt` + FOR EACH ROW +BEGIN + DECLARE vIsAutoConciliated BOOLEAN; + + IF NEW.isConciliate = FALSE THEN + SELECT isAutoConciliated INTO vIsAutoConciliated + FROM accounting a + JOIN accountingType at2 ON at2.id = a.accountingTypeFk + WHERE a.id = NEW.bankFk; + + SET NEW.isConciliate = vIsAutoConciliated; + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38133,18 +38133,18 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterUpdate` - AFTER UPDATE ON `receipt` - FOR EACH ROW -BEGIN - IF NEW.isConciliate = FALSE AND NEW.payed > OLD.payed THEN - CALL mail_insert( - 'finanzas@verdnatura.es', - NULL, - CONCAT('Cambios de recibos del cliente: ', NEW.clientFk), - CONCAT('Se ha cambiado el recibo: ', NEW.Id, ' de ', OLD.payed, ' a ', NEW.payed) - ); - END IF; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vn`.`receipt_afterUpdate` + AFTER UPDATE ON `receipt` + FOR EACH ROW +BEGIN + IF NEW.isConciliate = FALSE AND NEW.payed > OLD.payed THEN + CALL mail_insert( + 'finanzas@verdnatura.es', + NULL, + CONCAT('Cambios de recibos del cliente: ', NEW.clientFk), + CONCAT('Se ha cambiado el recibo: ', NEW.Id, ' de ', OLD.payed, ' a ', NEW.payed) + ); + END IF; END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -40571,23 +40571,23 @@ CREATE TABLE `supplierAccount` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER supplierAccount_afterUpdate - AFTER UPDATE ON supplierAccount - FOR EACH ROW -BEGIN - DECLARE vPayMethodHasVerified BOOL; - - SELECT pm.hasVerified INTO vPayMethodHasVerified - FROM vn.supplier s - JOIN vn.payMethod pm ON pm.id = s.payMethodFk - WHERE s.id = OLD.supplierFk; - - IF OLD.iban <> NEW.iban OR OLD.bankEntityFk <> NEW.bankEntityFk AND vPayMethodHasVerified THEN - UPDATE vn.supplier - SET isPayMethodChecked = FALSE - WHERE id = OLD.supplierFk; - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER supplierAccount_afterUpdate + AFTER UPDATE ON supplierAccount + FOR EACH ROW +BEGIN + DECLARE vPayMethodHasVerified BOOL; + + SELECT pm.hasVerified INTO vPayMethodHasVerified + FROM vn.supplier s + JOIN vn.payMethod pm ON pm.id = s.payMethodFk + WHERE s.id = OLD.supplierFk; + + IF OLD.iban <> NEW.iban OR OLD.bankEntityFk <> NEW.bankEntityFk AND vPayMethodHasVerified THEN + UPDATE vn.supplier + SET isPayMethodChecked = FALSE + WHERE id = OLD.supplierFk; + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -41328,31 +41328,31 @@ CREATE TABLE `ticketCollection` ( /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER ticketCollection_afterDelete -AFTER DELETE -ON ticketCollection FOR EACH ROW -BEGIN - - DECLARE vSalesRemaining INT; - - SELECT count(*) INTO vSalesRemaining - FROM vn.ticketCollection tc - JOIN sale s ON s.ticketFk = tc.ticketFk - WHERE collectionFk = OLD.collectionFk - AND tc.id != OLD.id; - - IF NOT vSalesRemaining THEN - - DELETE FROM vn.collection WHERE id = OLD.collectionFk; - - ELSE - - UPDATE vn.collection - SET saleTotalCount = vSalesRemaining - WHERE id = OLD.collectionFk; - - END IF; - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER ticketCollection_afterDelete +AFTER DELETE +ON ticketCollection FOR EACH ROW +BEGIN + + DECLARE vSalesRemaining INT; + + SELECT count(*) INTO vSalesRemaining + FROM vn.ticketCollection tc + JOIN sale s ON s.ticketFk = tc.ticketFk + WHERE collectionFk = OLD.collectionFk + AND tc.id != OLD.id; + + IF NOT vSalesRemaining THEN + + DELETE FROM vn.collection WHERE id = OLD.collectionFk; + + ELSE + + UPDATE vn.collection + SET saleTotalCount = vSalesRemaining + WHERE id = OLD.collectionFk; + + END IF; + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -45112,16 +45112,16 @@ DELIMITER ;; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `workerTimeControl_sendMail` ON SCHEDULE EVERY 1 WEEK STARTS '2020-11-25 08:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN - DECLARE vWeek,vYear INT; - - SELECT week,year INTO vWeek,vYear - FROM vn.time - WHERE dated IN (DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY)) - GROUP BY year,week - LIMIT 1; - - CALL vn.workerTimeControl_sendMail(vWeek, vYear, NULL); +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `workerTimeControl_sendMail` ON SCHEDULE EVERY 1 WEEK STARTS '2020-11-25 08:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN + DECLARE vWeek,vYear INT; + + SELECT week,year INTO vWeek,vYear + FROM vn.time + WHERE dated IN (DATE_ADD(CURDATE(), INTERVAL -10 DAY), DATE_ADD(CURDATE(), INTERVAL -4 DAY)) + GROUP BY year,week + LIMIT 1; + + CALL vn.workerTimeControl_sendMail(vWeek, vYear, NULL); END */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; @@ -45674,57 +45674,57 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `clientGetDebt`(`vClient` INT, `vDate` DATE) RETURNS decimal(10,2) READS SQL DATA -BEGIN -/** - * Devuelve el saldo de un cliente. - * - * @param vClient Identificador 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); - DECLARE vHasDebt BOOLEAN; - - SELECT COUNT(*) INTO vHasDebt - FROM `client` c - WHERE c.id = vClient AND c.typeFk = 'normal'; - - IF NOT vHasDebt THEN - RETURN 0; - END IF; - - SET vDate = IFNULL(vDate, CURDATE()); - - SET vDateIni = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET vDateEnd = TIMESTAMP(vDate, '23:59:59'); - - SELECT IFNULL(SUM(t.amount), 0) INTO vDebt - FROM ( - SELECT SUM(IFNULL(totalWithVat,0)) amount - FROM ticket - WHERE clientFk = vClient - AND refFk IS NULL - AND shipped BETWEEN vDateIni AND vDateEnd - UNION ALL - SELECT SUM(amountPaid) amount - FROM receipt - WHERE clientFk = vClient - AND payed > vDateEnd - UNION ALL - SELECT SUM(amount) - FROM clientRisk - WHERE clientFk = vClient - UNION ALL - SELECT CAST(-SUM(amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpvTransaction - WHERE clientFk = vClient - AND receiptFk IS NULL - AND `status` = 'ok' - ) t; - - RETURN vDebt; +BEGIN +/** + * Devuelve el saldo de un cliente. + * + * @param vClient Identificador 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); + DECLARE vHasDebt BOOLEAN; + + SELECT COUNT(*) INTO vHasDebt + FROM `client` c + WHERE c.id = vClient AND c.typeFk = 'normal'; + + IF NOT vHasDebt THEN + RETURN 0; + END IF; + + SET vDate = IFNULL(vDate, CURDATE()); + + SET vDateIni = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET vDateEnd = TIMESTAMP(vDate, '23:59:59'); + + SELECT IFNULL(SUM(t.amount), 0) INTO vDebt + FROM ( + SELECT SUM(IFNULL(totalWithVat,0)) amount + FROM ticket + WHERE clientFk = vClient + AND refFk IS NULL + AND shipped BETWEEN vDateIni AND vDateEnd + UNION ALL + SELECT SUM(amountPaid) amount + FROM receipt + WHERE clientFk = vClient + AND payed > vDateEnd + UNION ALL + SELECT SUM(amount) + FROM clientRisk + WHERE clientFk = vClient + UNION ALL + SELECT CAST(-SUM(amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction + WHERE clientFk = vClient + AND receiptFk IS NULL + AND `status` = 'ok' + ) t; + + RETURN vDebt; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -46149,29 +46149,29 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `collectionExpeditionLacks`(vCollectionFk INT) RETURNS varchar(100) CHARSET utf8 COLLATE utf8_unicode_ci DETERMINISTIC -BEGIN - - DECLARE vExpeditionLacks BOOL; - DECLARE vAnswer VARCHAR(100) DEFAULT ''; - - SELECT (COUNT(*) > 0) INTO vExpeditionLacks - FROM vn.ticketCollection tc - LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND ISNULL(e.id); - - IF vExpeditionLacks THEN - - SELECT CONCAT('Colección: ',tc.collectionFk,' Tickets: ' , GROUP_CONCAT(tc.ticketFk) ) INTO vAnswer - FROM vn.ticketCollection tc - LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk - WHERE tc.collectionFk = vCollectionFk - AND ISNULL(e.id); - - END IF; - - RETURN vAnswer; - +BEGIN + + DECLARE vExpeditionLacks BOOL; + DECLARE vAnswer VARCHAR(100) DEFAULT ''; + + SELECT (COUNT(*) > 0) INTO vExpeditionLacks + FROM vn.ticketCollection tc + LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND ISNULL(e.id); + + IF vExpeditionLacks THEN + + SELECT CONCAT('Colección: ',tc.collectionFk,' Tickets: ' , GROUP_CONCAT(tc.ticketFk) ) INTO vAnswer + FROM vn.ticketCollection tc + LEFT JOIN vn.expedition e ON e.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk + AND ISNULL(e.id); + + END IF; + + RETURN vAnswer; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -46298,79 +46298,79 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ekt_getEntry`(vEktFk INT) RETURNS int(11) READS SQL DATA -BEGIN - - /** - * Devuelve el numero de entrada para el ekt - * - * @param vEktFk Identificador de edi.ekt - */ - - DECLARE vTravelFk INT; - DECLARE vEntryFk INT DEFAULT 0; - DECLARE vEntryAssignFk INT; - - SET vTravelFk = vn.ekt_getTravel(vEktFk); - - IF vTravelFk THEN - - SELECT ea.id INTO vEntryAssignFk - FROM edi.ekt e - JOIN vn.travel tr ON tr.id = vTravelFk - JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk - AND ea.warehouseInFk = tr.warehouseInFk - AND ea.agencyModeFk = tr.agencyFk - AND IFNULL(ea.sub, e.sub) <=> e.sub - AND IFNULL(ea.kop, e.kop) <=> e.kop - AND IFNULL(ea.pro, e.pro) <=> e.pro - WHERE e.id = vEktFk - ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, - ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, - ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, - ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC - LIMIT 1; - - SELECT MAX(e.id) INTO vEntryFk - FROM vn.entry e - JOIN vn.ektEntryAssign ea ON ea.id = vEntryAssignFk - WHERE e.travelFk = vTravelFk - AND e.sub <=> ea.sub - AND e.kop <=> ea.kop - AND e.pro <=> ea.pro; - - - IF IFNULL(vEntryFk,0) = 0 THEN - - INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk, kop, sub, ref, pro) - SELECT vTravelFk, ea.supplierFk, c.id, cu.id, ea.kop, ea.sub, ea.ref, ea.pro - FROM vn.ektEntryAssign ea - JOIN vn.company c ON c.code = 'VNL' - JOIN vn.currency cu ON cu.code = 'EUR' - WHERE ea.id = vEntryAssignFk; - - SELECT MAX(id) INTO vEntryFk - FROM vn.entry - WHERE travelFk = vTravelFk; - - END IF; - - UPDATE vn.ektEntryAssign - SET entryFk = vEntryFk - WHERE id = vEntryAssignFk; - - ELSE - - SELECT ec.defaultEntry INTO vEntryFk - FROM vn.entryConfig ec; - - INSERT IGNORE INTO vn.entry(id) VALUES(vEntryFk); - - END IF; - - RETURN vEntryFk; +BEGIN + + /** + * Devuelve el numero de entrada para el ekt + * + * @param vEktFk Identificador de edi.ekt + */ + + DECLARE vTravelFk INT; + DECLARE vEntryFk INT DEFAULT 0; + DECLARE vEntryAssignFk INT; + + SET vTravelFk = vn.ekt_getTravel(vEktFk); + + IF vTravelFk THEN + + SELECT ea.id INTO vEntryAssignFk + FROM edi.ekt e + JOIN vn.travel tr ON tr.id = vTravelFk + JOIN vn.ektEntryAssign ea ON ea.warehouseOutFk = tr.warehouseOutFk + AND ea.warehouseInFk = tr.warehouseInFk + AND ea.agencyModeFk = tr.agencyFk + AND IFNULL(ea.sub, e.sub) <=> e.sub + AND IFNULL(ea.kop, e.kop) <=> e.kop + AND IFNULL(ea.pro, e.pro) <=> e.pro + WHERE e.id = vEktFk + ORDER BY ea.sub <=> e.sub AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC, + ea.sub <=> e.sub AND ISNULL(ea.kop) AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ea.pro <=> e.pro DESC, + ISNULL(ea.sub) AND ea.kop <=> e.kop AND ISNULL(ea.pro) DESC, + ISNULL(ea.sub) AND ISNULL(ea.kop) AND ea.pro <=> e.pro DESC + LIMIT 1; + + SELECT MAX(e.id) INTO vEntryFk + FROM vn.entry e + JOIN vn.ektEntryAssign ea ON ea.id = vEntryAssignFk + WHERE e.travelFk = vTravelFk + AND e.sub <=> ea.sub + AND e.kop <=> ea.kop + AND e.pro <=> ea.pro; + + + IF IFNULL(vEntryFk,0) = 0 THEN + + INSERT INTO vn.entry(travelFk, supplierFk, companyFk, currencyFk, kop, sub, ref, pro) + SELECT vTravelFk, ea.supplierFk, c.id, cu.id, ea.kop, ea.sub, ea.ref, ea.pro + FROM vn.ektEntryAssign ea + JOIN vn.company c ON c.code = 'VNL' + JOIN vn.currency cu ON cu.code = 'EUR' + WHERE ea.id = vEntryAssignFk; + + SELECT MAX(id) INTO vEntryFk + FROM vn.entry + WHERE travelFk = vTravelFk; + + END IF; + + UPDATE vn.ektEntryAssign + SET entryFk = vEntryFk + WHERE id = vEntryAssignFk; + + ELSE + + SELECT ec.defaultEntry INTO vEntryFk + FROM vn.entryConfig ec; + + INSERT IGNORE INTO vn.entry(id) VALUES(vEntryFk); + + END IF; + + RETURN vEntryFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -46749,32 +46749,32 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `expedition_checkRoute`(vPalletFk INT,vExpeditionFk INT) RETURNS tinyint(1) DETERMINISTIC -BEGIN -/** -* Comprueba si las expediciones del pallet son todas -* de la misma ruta. -* -* @param vExpeditionFk numero de expedition a comprobar -* @param vPalletFk numero de pallet -* @return vHasDistinctRoutes -*/ - DECLARE vRouteFk INT; - DECLARE vHasDistinctRoutes BOOL; - - SELECT t.routeFk INTO vRouteFk - FROM vn.expedition e - JOIN vn.ticket t ON e.ticketFk = t.id - WHERE e.id = vExpeditionFk; - - SELECT COUNT(*) > 0 INTO vHasDistinctRoutes - FROM vn.expeditionScan es - JOIN vn.expedition e ON es.expeditionFk = e.id - JOIN vn.ticket t ON e.ticketFk = t.id - WHERE es.palletFk = vPalletFk - AND t.routeFk <> vRouteFk; - - RETURN vHasDistinctRoutes; - +BEGIN +/** +* Comprueba si las expediciones del pallet son todas +* de la misma ruta. +* +* @param vExpeditionFk numero de expedition a comprobar +* @param vPalletFk numero de pallet +* @return vHasDistinctRoutes +*/ + DECLARE vRouteFk INT; + DECLARE vHasDistinctRoutes BOOL; + + SELECT t.routeFk INTO vRouteFk + FROM vn.expedition e + JOIN vn.ticket t ON e.ticketFk = t.id + WHERE e.id = vExpeditionFk; + + SELECT COUNT(*) > 0 INTO vHasDistinctRoutes + FROM vn.expeditionScan es + JOIN vn.expedition e ON es.expeditionFk = e.id + JOIN vn.ticket t ON e.ticketFk = t.id + WHERE es.palletFk = vPalletFk + AND t.routeFk <> vRouteFk; + + RETURN vHasDistinctRoutes; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47057,30 +47057,30 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `getNextDueDate`(vDated DATE, vGapDays INT, vPayDay INT) RETURNS date NO SQL -BEGIN - - DECLARE vReturn DATE; - DECLARE vDuaDate DATE; - DECLARE vDuaDateDay INT; - - SELECT TIMESTAMPADD(DAY, vGapDays, vDated) INTO vDuaDate; - - IF vDuaDate = CONCAT(YEAR(vDuaDate), '-03-01') THEN - SET vDuaDate = TIMESTAMPADD (DAY , -1, vDuaDate); - ELSEIF vDuaDate = CONCAT(YEAR(vDuaDate), '-02-29') THEN - SET vDuaDate = TIMESTAMPADD (DAY , -2, vDuaDate); - END IF; - - IF MONTH(vDuaDate) = 2 AND vPayDay = 30 THEN - IF util.isLeapYear(YEAR(vDuaDate)) THEN - SET vPayDay = 29; - ELSE - SET vPayDay = 28; - END IF; - END IF; - - SELECT DAY(vDuaDate) INTO vDuaDateDay; - RETURN TIMESTAMPADD(MONTH, (vDuaDateDay > vPayDay), DATE_FORMAT(vDuaDate, CONCAT('%y/%m/', vPayDay))); +BEGIN + + DECLARE vReturn DATE; + DECLARE vDuaDate DATE; + DECLARE vDuaDateDay INT; + + SELECT TIMESTAMPADD(DAY, vGapDays, vDated) INTO vDuaDate; + + IF vDuaDate = CONCAT(YEAR(vDuaDate), '-03-01') THEN + SET vDuaDate = TIMESTAMPADD (DAY , -1, vDuaDate); + ELSEIF vDuaDate = CONCAT(YEAR(vDuaDate), '-02-29') THEN + SET vDuaDate = TIMESTAMPADD (DAY , -2, vDuaDate); + END IF; + + IF MONTH(vDuaDate) = 2 AND vPayDay = 30 THEN + IF util.isLeapYear(YEAR(vDuaDate)) THEN + SET vPayDay = 29; + ELSE + SET vPayDay = 28; + END IF; + END IF; + + SELECT DAY(vDuaDate) INTO vDuaDateDay; + RETURN TIMESTAMPADD(MONTH, (vDuaDateDay > vPayDay), DATE_FORMAT(vDuaDate, CONCAT('%y/%m/', vPayDay))); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47848,19 +47848,19 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `isLogifloraDay`(vShipped DATE, vWarehouse INT) RETURNS tinyint(1) DETERMINISTIC -BEGIN - - DECLARE vIsLogifloraDay BOOLEAN; - - SELECT COUNT(*) INTO vIsLogifloraDay - FROM edi.warehouseFloramondo wf - JOIN vn.floramondoConfig fc - WHERE wf.warehouseFk = vWarehouse - AND vShipped BETWEEN DATE(TIMESTAMPADD(DAY, wf.travellingDays , fc.nextLanded)) - AND DATE(TIMESTAMPADD(DAY, wf.travellingDays + wf.dayRange , fc.nextLanded)); - - RETURN vIsLogifloraDay; - +BEGIN + + DECLARE vIsLogifloraDay BOOLEAN; + + SELECT COUNT(*) INTO vIsLogifloraDay + FROM edi.warehouseFloramondo wf + JOIN vn.floramondoConfig fc + WHERE wf.warehouseFk = vWarehouse + AND vShipped BETWEEN DATE(TIMESTAMPADD(DAY, wf.travellingDays , fc.nextLanded)) + AND DATE(TIMESTAMPADD(DAY, wf.travellingDays + wf.dayRange , fc.nextLanded)); + + RETURN vIsLogifloraDay; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48098,17 +48098,17 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `item_getFhImage`(itemFk INT) RETURNS varchar(255) CHARSET utf8 COLLATE utf8_unicode_ci DETERMINISTIC -BEGIN - DECLARE vImageUrl VARCHAR(255); - SELECT sr.PictureReference INTO vImageUrl - FROM vn.buy b - JOIN edi.ekt e ON b.ektFk = e.id - JOIN edi.supplyResponse sr ON sr.Item_ArticleCode =e.`ref` - JOIN vn.item i ON i.id = b.itemFk - WHERE b.itemFk = itemFk - ORDER BY (sr.EmbalageCode = e.package) DESC - LIMIT 1; - RETURN vImageUrl; +BEGIN + DECLARE vImageUrl VARCHAR(255); + SELECT sr.PictureReference INTO vImageUrl + FROM vn.buy b + JOIN edi.ekt e ON b.ektFk = e.id + JOIN edi.supplyResponse sr ON sr.Item_ArticleCode =e.`ref` + JOIN vn.item i ON i.id = b.itemFk + WHERE b.itemFk = itemFk + ORDER BY (sr.EmbalageCode = e.package) DESC + LIMIT 1; + RETURN vImageUrl; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48127,30 +48127,30 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `item_getPackage`(vItemFk INT) RETURNS varchar(50) CHARSET utf8 COLLATE utf8_unicode_ci DETERMINISTIC -BEGIN - - DECLARE vDiameter INT; - DECLARE vPackageFk VARCHAR(50); - DECLARE vCoeficient DOUBLE DEFAULT 1.08; - - SELECT MAX(LEFT(value,3)) INTO vDiameter - FROM vn.itemTag it - JOIN vn.tag t ON t.id = it.tagFk - WHERE it.itemFk = vItemFk - AND t.overwrite = 'diameter'; - - SELECT 8000 + FLOOR(vc.ccLength * vc.ccWidth / (vCoeficient * PI() * (vDiameter / 2) * (vDiameter / 2))) - INTO vPackageFk - FROM vn.volumeConfig vc; - - INSERT IGNORE INTO vn.packaging(id, width, `depth`) - SELECT vPackageFk, - FLOOR(vc.ccWidth / FLOOR(vc.ccWidth / vDiameter)), - FLOOR(vc.ccLength / FLOOR(vc.ccLength / vDiameter)) - FROM vn.volumeConfig vc; - - RETURN vPackageFk; - +BEGIN + + DECLARE vDiameter INT; + DECLARE vPackageFk VARCHAR(50); + DECLARE vCoeficient DOUBLE DEFAULT 1.08; + + SELECT MAX(LEFT(value,3)) INTO vDiameter + FROM vn.itemTag it + JOIN vn.tag t ON t.id = it.tagFk + WHERE it.itemFk = vItemFk + AND t.overwrite = 'diameter'; + + SELECT 8000 + FLOOR(vc.ccLength * vc.ccWidth / (vCoeficient * PI() * (vDiameter / 2) * (vDiameter / 2))) + INTO vPackageFk + FROM vn.volumeConfig vc; + + INSERT IGNORE INTO vn.packaging(id, width, `depth`) + SELECT vPackageFk, + FLOOR(vc.ccWidth / FLOOR(vc.ccWidth / vDiameter)), + FLOOR(vc.ccLength / FLOOR(vc.ccLength / vDiameter)) + FROM vn.volumeConfig vc; + + RETURN vPackageFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48244,23 +48244,23 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `machineWorker_Worker`(vWorkerFk VARCHAR(10)) RETURNS varchar(20) CHARSET utf8 COLLATE utf8_unicode_ci READS SQL DATA -BEGIN -/** - * Comprueba si existen registros en las últimas 12 horas del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo) - * - * @param vWorkerFk id del trabajador - * @return Devuelve REGISTERED/UNREGISTERED en caso de que haya registros - */ - - IF (SELECT COUNT(*) - FROM machineWorker m - WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) AND ISNULL(m.outTimed)) - THEN - RETURN "REGISTERED"; - ELSE - RETURN "UNREGISTERED"; - END IF; +BEGIN +/** + * Comprueba si existen registros en las últimas 12 horas del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo) + * + * @param vWorkerFk id del trabajador + * @return Devuelve REGISTERED/UNREGISTERED en caso de que haya registros + */ + + IF (SELECT COUNT(*) + FROM machineWorker m + WHERE m.workerFk = vWorkerFk + AND m.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) AND ISNULL(m.outTimed)) + THEN + RETURN "REGISTERED"; + ELSE + RETURN "UNREGISTERED"; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48279,23 +48279,23 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `machine_checkPlate`(vPlate VARCHAR(10)) RETURNS tinyint(1) READS SQL DATA -BEGIN -/** - * Comprueba si existe matrícula - * - * @param vPlate matrícula del vehículo - * @return Devuelve TRUE en caso de que exista - * - */ - - IF (SELECT COUNT(*) - FROM machine m - WHERE m.plate = vPlate - ) THEN - RETURN TRUE; - ELSE - RETURN FALSE; - END IF; +BEGIN +/** + * Comprueba si existe matrícula + * + * @param vPlate matrícula del vehículo + * @return Devuelve TRUE en caso de que exista + * + */ + + IF (SELECT COUNT(*) + FROM machine m + WHERE m.plate = vPlate + ) THEN + RETURN TRUE; + ELSE + RETURN FALSE; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48778,27 +48778,27 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `specie_IsForbidden`(vItemFk INT, vAddressFk INT) RETURNS tinyint(1) READS SQL DATA -BEGIN - - DECLARE vIsForbbiden BOOL; - DECLARE vLeft INT; - - SELECT zg.lft INTO vLeft - FROM vn.address a - JOIN vn.zoneGeo zg ON zg.name = a.postalCode - WHERE a.id = vAddressFk; - - SELECT sgi.isForbidden INTO vIsForbbiden - FROM vn.specieGeoInvasive sgi - JOIN vn.zoneGeo zg ON zg.id = sgi.zoneGeofk - JOIN vn.itemBotanical ib ON ib.genusFk = sgi.genusFk AND sgi.specieFk IN ('sp.',ib.specieFk) - WHERE vLeft BETWEEN zg.lft AND zg.rgt - AND ib.itemFk = vItemFk - ORDER BY zg.`depth` DESC - LIMIT 1; - - RETURN IFNULL(vIsForbbiden, FALSE); - +BEGIN + + DECLARE vIsForbbiden BOOL; + DECLARE vLeft INT; + + SELECT zg.lft INTO vLeft + FROM vn.address a + JOIN vn.zoneGeo zg ON zg.name = a.postalCode + WHERE a.id = vAddressFk; + + SELECT sgi.isForbidden INTO vIsForbbiden + FROM vn.specieGeoInvasive sgi + JOIN vn.zoneGeo zg ON zg.id = sgi.zoneGeofk + JOIN vn.itemBotanical ib ON ib.genusFk = sgi.genusFk AND sgi.specieFk IN ('sp.',ib.specieFk) + WHERE vLeft BETWEEN zg.lft AND zg.rgt + AND ib.itemFk = vItemFk + ORDER BY zg.`depth` DESC + LIMIT 1; + + RETURN IFNULL(vIsForbbiden, FALSE); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48902,55 +48902,55 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `testNIE`(vNIE VARCHAR(9)) RETURNS tinyint(1) DETERMINISTIC -BEGIN - - DECLARE vIndice INT; - DECLARE vNumero VARCHAR(7); - DECLARE vOperador VARCHAR(9); - DECLARE vParteNumerica DECIMAL(8,0); - DECLARE vLetraInicial VARCHAR(1); - DECLARE vLetraFinal VARCHAR(1); - DECLARE vLetrasFinalesPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; - DECLARE vLetraInicialEsIncorrecta BOOL DEFAULT FALSE; - - SET vLetraInicial = SUBSTR(vNIE, 1, 1); - SET vLetraFinal = SUBSTR(vNIE, 9, 1); - SET vNumero = SUBSTR(vNIE, 2, 7); - - CASE vLetraInicial - - WHEN 'X' THEN - - SET vOperador = "0"; - - WHEN 'Y' THEN - - SET vOperador = "1"; - - WHEN 'Z' THEN - - SET vOperador = "2"; - - ELSE - - SET vLetraInicialEsIncorrecta = TRUE; - - END CASE; - - SET vOperador = CONCAT(vOperador, vNumero); - SET vParteNumerica = CAST(vOperador AS DECIMAL(8,0)); - SET vIndice = Round(vParteNumerica Mod 23, 0) + 1; - - IF SUBSTR(vLetrasFinalesPosibles, vIndice, 1) = vLetraFinal AND vLetraInicialEsIncorrecta = FALSE THEN - - RETURN TRUE; - - ELSE - - RETURN FALSE; - - END IF; - +BEGIN + + DECLARE vIndice INT; + DECLARE vNumero VARCHAR(7); + DECLARE vOperador VARCHAR(9); + DECLARE vParteNumerica DECIMAL(8,0); + DECLARE vLetraInicial VARCHAR(1); + DECLARE vLetraFinal VARCHAR(1); + DECLARE vLetrasFinalesPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; + DECLARE vLetraInicialEsIncorrecta BOOL DEFAULT FALSE; + + SET vLetraInicial = SUBSTR(vNIE, 1, 1); + SET vLetraFinal = SUBSTR(vNIE, 9, 1); + SET vNumero = SUBSTR(vNIE, 2, 7); + + CASE vLetraInicial + + WHEN 'X' THEN + + SET vOperador = "0"; + + WHEN 'Y' THEN + + SET vOperador = "1"; + + WHEN 'Z' THEN + + SET vOperador = "2"; + + ELSE + + SET vLetraInicialEsIncorrecta = TRUE; + + END CASE; + + SET vOperador = CONCAT(vOperador, vNumero); + SET vParteNumerica = CAST(vOperador AS DECIMAL(8,0)); + SET vIndice = Round(vParteNumerica Mod 23, 0) + 1; + + IF SUBSTR(vLetrasFinalesPosibles, vIndice, 1) = vLetraFinal AND vLetraInicialEsIncorrecta = FALSE THEN + + RETURN TRUE; + + ELSE + + RETURN FALSE; + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -48969,29 +48969,29 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `testNIF`(vNIF VARCHAR(9)) RETURNS tinyint(1) DETERMINISTIC -BEGIN - - DECLARE vIndice INT; - DECLARE vParteNumerica DECIMAL(8,0); - DECLARE vLetra VARCHAR(1); - DECLARE vLetrasPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; - - SET vLetra = SUBSTRING(vNIF, 9, 1); - - SET vParteNumerica = CAST(SUBSTRING(vNIF, 1, 8) AS DECIMAL(8,0)); - - SET vIndice = Round(vParteNumerica MOD 23, 0) + 1; - - If SUBSTRING(vLetrasPosibles, vIndice, 1) = vLetra Then - - RETURN TRUE; - - ELSE - - RETURN FALSE; - - END IF; - +BEGIN + + DECLARE vIndice INT; + DECLARE vParteNumerica DECIMAL(8,0); + DECLARE vLetra VARCHAR(1); + DECLARE vLetrasPosibles VARCHAR(24) DEFAULT "TRWAGMYFPDXBNJZSQVHLCKE"; + + SET vLetra = SUBSTRING(vNIF, 9, 1); + + SET vParteNumerica = CAST(SUBSTRING(vNIF, 1, 8) AS DECIMAL(8,0)); + + SET vIndice = Round(vParteNumerica MOD 23, 0) + 1; + + If SUBSTRING(vLetrasPosibles, vIndice, 1) = vLetra Then + + RETURN TRUE; + + ELSE + + RETURN FALSE; + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -49053,79 +49053,79 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticketPositionInPath`(vTicketId INT) RETURNS varchar(10) CHARSET utf8 DETERMINISTIC -BEGIN - - DECLARE vRestTicketsMaxOrder INT; - DECLARE vRestTicketsMinOrder INT; - DECLARE vRestTicketsPacking INT; - DECLARE vMyProductionOrder INT; - DECLARE vPosition VARCHAR(10) DEFAULT 'MID'; - DECLARE vMyPath INT; - DECLARE vMyWarehouse INT; - DECLARE PACKING_ORDER INT; - DECLARE vExpeditionsCount INT; - DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE; - -SELECT `order` - INTO PACKING_ORDER - FROM state - WHERE code = 'PACKING'; - -SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0) - INTO vMyPath, vMyWarehouse, vMyProductionOrder - FROM ticket t - LEFT JOIN ticketState ts on ts.ticket = t.id - WHERE t.id = vTicketId; - -SELECT (ag.`name` = 'VN_VALENCIA') - INTO vIsValenciaPath - FROM vn2008.Rutas r - JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia - JOIN vn2008.agency ag on ag.agency_id = a.agency_id - WHERE r.Id_Ruta = vMyPath; - -IF vIsValenciaPath THEN -- Rutas Valencia - - SELECT COUNT(*) - INTO vExpeditionsCount - FROM expedition e - JOIN ticket t ON t.id = e.ticketFk - WHERE t.routeFk = vMyPath; - - SELECT MAX(ts.productionOrder), MIN(ts.productionOrder) - INTO vRestTicketsMaxOrder, vRestTicketsMinOrder - FROM ticket t - LEFT JOIN ticketState ts on t.id = ts.ticket - WHERE t.routeFk = vMyPath - AND t.warehouseFk = vMyWarehouse - AND t.id != vTicketid; - - SELECT COUNT(*) - INTO vRestTicketsPacking - FROM ticket t - LEFT JOIN ticketState ts on t.id = ts.ticket - WHERE ts.productionOrder = PACKING_ORDER - AND t.routeFk = vMyPath - AND t.warehouseFk = vMyWarehouse - AND t.id != vTicketid; - - IF vExpeditionsCount = 1 THEN - SET vPosition = 'FIRST'; - ELSEIF vRestTicketsMinOrder > PACKING_ORDER THEN - SET vPosition = 'LAST'; - ELSEIF vRestTicketsPacking THEN - SET vPosition = 'SHARED'; - ELSE - SET vPosition = 'MID'; - END IF; - -ELSE - SET vPosition = 'MID'; - -END IF; - -RETURN vPosition; - +BEGIN + + DECLARE vRestTicketsMaxOrder INT; + DECLARE vRestTicketsMinOrder INT; + DECLARE vRestTicketsPacking INT; + DECLARE vMyProductionOrder INT; + DECLARE vPosition VARCHAR(10) DEFAULT 'MID'; + DECLARE vMyPath INT; + DECLARE vMyWarehouse INT; + DECLARE PACKING_ORDER INT; + DECLARE vExpeditionsCount INT; + DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE; + +SELECT `order` + INTO PACKING_ORDER + FROM state + WHERE code = 'PACKING'; + +SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0) + INTO vMyPath, vMyWarehouse, vMyProductionOrder + FROM ticket t + LEFT JOIN ticketState ts on ts.ticket = t.id + WHERE t.id = vTicketId; + +SELECT (ag.`name` = 'VN_VALENCIA') + INTO vIsValenciaPath + FROM vn2008.Rutas r + JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia + JOIN vn2008.agency ag on ag.agency_id = a.agency_id + WHERE r.Id_Ruta = vMyPath; + +IF vIsValenciaPath THEN -- Rutas Valencia + + SELECT COUNT(*) + INTO vExpeditionsCount + FROM expedition e + JOIN ticket t ON t.id = e.ticketFk + WHERE t.routeFk = vMyPath; + + SELECT MAX(ts.productionOrder), MIN(ts.productionOrder) + INTO vRestTicketsMaxOrder, vRestTicketsMinOrder + FROM ticket t + LEFT JOIN ticketState ts on t.id = ts.ticket + WHERE t.routeFk = vMyPath + AND t.warehouseFk = vMyWarehouse + AND t.id != vTicketid; + + SELECT COUNT(*) + INTO vRestTicketsPacking + FROM ticket t + LEFT JOIN ticketState ts on t.id = ts.ticket + WHERE ts.productionOrder = PACKING_ORDER + AND t.routeFk = vMyPath + AND t.warehouseFk = vMyWarehouse + AND t.id != vTicketid; + + IF vExpeditionsCount = 1 THEN + SET vPosition = 'FIRST'; + ELSEIF vRestTicketsMinOrder > PACKING_ORDER THEN + SET vPosition = 'LAST'; + ELSEIF vRestTicketsPacking THEN + SET vPosition = 'SHARED'; + ELSE + SET vPosition = 'MID'; + END IF; + +ELSE + SET vPosition = 'MID'; + +END IF; + +RETURN vPosition; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -49267,21 +49267,21 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_CC_volume`(vTicketFk INT) RETURNS decimal(10,1) READS SQL DATA -BEGIN - - DECLARE vCC DECIMAL(10,1); - - SELECT sum(sv.volume * IF(i.itemPackingTypeFk = 'H', vc.dutchCompressionRate, 1)) / (p.volume / 1000000) - INTO vCC - FROM vn.saleVolume sv - JOIN vn.sale s ON s.id = sv.saleFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.packaging p ON p.id = 'CC' - JOIN vn.volumeConfig vc - WHERE sv.ticketFk = vTicketFk; - - RETURN vCC; - +BEGIN + + DECLARE vCC DECIMAL(10,1); + + SELECT sum(sv.volume * IF(i.itemPackingTypeFk = 'H', vc.dutchCompressionRate, 1)) / (p.volume / 1000000) + INTO vCC + FROM vn.saleVolume sv + JOIN vn.sale s ON s.id = sv.saleFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.packaging p ON p.id = 'CC' + JOIN vn.volumeConfig vc + WHERE sv.ticketFk = vTicketFk; + + RETURN vCC; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -49415,21 +49415,21 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_getWeight`(vTicketFk INT) RETURNS decimal(10,3) READS SQL DATA -BEGIN -/** - * Devuelve el peso total del ticket - * - * @return Total peso - */ - - DECLARE vWeight DECIMAL(10,3); - - SELECT sum(weight) INTO vWeight - FROM saleVolume - WHERE ticketFk = vTicketFk; - - RETURN vWeight; - +BEGIN +/** + * Devuelve el peso total del ticket + * + * @return Total peso + */ + + DECLARE vWeight DECIMAL(10,3); + + SELECT sum(weight) INTO vWeight + FROM saleVolume + WHERE ticketFk = vTicketFk; + + RETURN vWeight; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -49507,18 +49507,18 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `ticket_HasUbication`(vTicketFk INT) RETURNS tinyint(1) READS SQL DATA -BEGIN - - DECLARE hasUbication BOOL; - - SELECT COUNT(*) INTO hasUbication - FROM vn.ticket t - JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk - WHERE rm.beachFk - AND t.id = vTicketFk; - - RETURN hasUbication; - +BEGIN + + DECLARE hasUbication BOOL; + + SELECT COUNT(*) INTO hasUbication + FROM vn.ticket t + JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk + WHERE rm.beachFk + AND t.id = vTicketFk; + + RETURN hasUbication; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -49934,24 +49934,24 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` FUNCTION `workerMachinery_isRegistered`(vWorkerFk VARCHAR(10)) RETURNS tinyint(1) READS SQL DATA -BEGIN -/** - * Comprueba si existen registros en las últimas horas (maxHours de machineWorkerConfig) del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo) - * - * @param vWorkerFk id del trabajador - * @return Devuelve TRUE/FALSE en caso de que haya o no registros - */ - - IF (SELECT COUNT(*) - FROM machineWorker m - WHERE m.workerFk = vWorkerFk - AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), NOW()) AND ISNULL(m.outTimed)) - THEN - RETURN TRUE; - ELSE - RETURN FALSE; - END IF; - +BEGIN +/** + * Comprueba si existen registros en las últimas horas (maxHours de machineWorkerConfig) del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo) + * + * @param vWorkerFk id del trabajador + * @return Devuelve TRUE/FALSE en caso de que haya o no registros + */ + + IF (SELECT COUNT(*) + FROM machineWorker m + WHERE m.workerFk = vWorkerFk + AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), NOW()) AND ISNULL(m.outTimed)) + THEN + RETURN TRUE; + ELSE + RETURN FALSE; + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50570,23 +50570,23 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `agencyVolume__`(vDated DATE, vAgency INT) -BEGIN - - SELECT ELT(it.temperature + 1,'Calientes','Frios','Secos') AS Temp, - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.carro / 1000000 ,1) AS DECIMAL(10,2)) AS carros , - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.espai / 1000000,1) AS DECIMAL(10,2)) AS espais - FROM vn.buy b - INNER JOIN vn.entry e ON e.id = b.entryFk - INNER JOIN vn.travel tr ON tr.id = e.travelFk - INNER JOIN vn.volumeConfig vc - INNER JOIN vn.item i ON i.id = b.itemFk - INNER JOIN vn.itemType it ON it.id = i.typeFk - WHERE tr.landed = vDated - AND tr.agencyFk IN (0, vAgency) - GROUP BY Temp; - +BEGIN + + SELECT ELT(it.temperature + 1,'Calientes','Frios','Secos') AS Temp, + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.carro / 1000000 ,1) AS DECIMAL(10,2)) AS carros , + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.espai / 1000000,1) AS DECIMAL(10,2)) AS espais + FROM vn.buy b + INNER JOIN vn.entry e ON e.id = b.entryFk + INNER JOIN vn.travel tr ON tr.id = e.travelFk + INNER JOIN vn.volumeConfig vc + INNER JOIN vn.item i ON i.id = b.itemFk + INNER JOIN vn.itemType it ON it.id = i.typeFk + WHERE tr.landed = vDated + AND tr.agencyFk IN (0, vAgency) + GROUP BY Temp; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50779,39 +50779,39 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimate`(vWarehouseFk SMALLINT, vDated DATE) -BEGIN -/** - * Calcula las últimas compras realizadas hasta una fecha - * - * @param vWarehouseFk Id del almacén - * @param vDated Compras hasta fecha - * @return tmp.buyUltimate - */ - CALL cache.last_buy_refresh (FALSE); - - DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; - CREATE TEMPORARY TABLE tmp.buyUltimate - (PRIMARY KEY (itemFk, warehouseFk), - INDEX(itemFk)) - ENGINE = MEMORY - SELECT item_id itemFk, buy_id buyFk, warehouse_id warehouseFk, landing - FROM cache.last_buy - WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL; - - CALL buyUltimateFromInterval(vWarehouseFk, CURDATE(), vDated); - - REPLACE INTO tmp.buyUltimate - SELECT itemFk, buyFk, warehouseFk, landed landing - FROM tmp.buyUltimateFromInterval - WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) - AND landed <= vDated; - - INSERT IGNORE INTO tmp.buyUltimate - SELECT itemFk, buyFk, warehouseFk, landed landing - FROM tmp.buyUltimateFromInterval - WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) - AND landed > vDated; - +BEGIN +/** + * Calcula las últimas compras realizadas hasta una fecha + * + * @param vWarehouseFk Id del almacén + * @param vDated Compras hasta fecha + * @return tmp.buyUltimate + */ + CALL cache.last_buy_refresh (FALSE); + + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimate; + CREATE TEMPORARY TABLE tmp.buyUltimate + (PRIMARY KEY (itemFk, warehouseFk), + INDEX(itemFk)) + ENGINE = MEMORY + SELECT item_id itemFk, buy_id buyFk, warehouse_id warehouseFk, landing + FROM cache.last_buy + WHERE warehouse_id = vWarehouseFk OR vWarehouseFk IS NULL; + + CALL buyUltimateFromInterval(vWarehouseFk, CURDATE(), vDated); + + REPLACE INTO tmp.buyUltimate + SELECT itemFk, buyFk, warehouseFk, landed landing + FROM tmp.buyUltimateFromInterval + WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) + AND landed <= vDated; + + INSERT IGNORE INTO tmp.buyUltimate + SELECT itemFk, buyFk, warehouseFk, landed landing + FROM tmp.buyUltimateFromInterval + WHERE (warehouseFk = vWarehouseFk OR vWarehouseFk IS NULL) + AND landed > vDated; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -50829,126 +50829,126 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buyUltimateFromInterval`(vWarehouseFk SMALLINT, vStarted DATE, vEnded DATE) -BEGIN -/** - * Calcula las últimas compras realizadas - * desde un rango de fechas. - * - * @param vWarehouseFk Id del almacén si es NULL se actualizan todos - * @param vStarted Fecha inicial - * @param vEnded Fecha fin - * @return tmp.buyUltimateFromInterval - */ - IF vEnded IS NULL THEN - SET vEnded = vStarted; - END IF; - - IF vEnded < vStarted THEN - SET vStarted = TIMESTAMPADD(MONTH, -1, vEnded); - END IF; - - -- Item - - DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval; - CREATE TEMPORARY TABLE tmp.buyUltimateFromInterval - (PRIMARY KEY (itemFk, warehouseFk), INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk)) - ENGINE = MEMORY - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - MULTIMAX(t.landed, b.id) buyFk, - MAX(t.landed) landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vStarted AND vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.price2 > 0 - AND NOT b.isIgnored - AND b.quantity > 0 - GROUP BY itemFk, warehouseInFk; - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed > vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.price2 > 0 - AND NOT b.isIgnored - GROUP BY itemFk, warehouseInFk; - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vStarted AND vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.quantity = 0 - GROUP BY itemFk, warehouseInFk; - - - - -- ItemOriginal - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - MULTIMAX(t.landed, b.id) buyFk, - MAX(t.landed) landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vStarted AND vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.price2 > 0 - AND NOT b.isIgnored - AND b.quantity > 0 - AND itemOriginalFk - GROUP BY itemOriginalFk, warehouseInFk; - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed > vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.price2 > 0 - AND NOT b.isIgnored - AND itemOriginalFk - GROUP BY itemOriginalFk, warehouseInFk; - - INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) - SELECT - b.itemFk, - t.warehouseInFk warehouseFk, - b.id buyFk, - t.landed - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel t ON t.id = e.travelFk - WHERE t.landed BETWEEN vStarted AND vEnded - AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) - AND b.quantity = 0 - AND itemOriginalFk - GROUP BY itemOriginalFk, warehouseInFk; - +BEGIN +/** + * Calcula las últimas compras realizadas + * desde un rango de fechas. + * + * @param vWarehouseFk Id del almacén si es NULL se actualizan todos + * @param vStarted Fecha inicial + * @param vEnded Fecha fin + * @return tmp.buyUltimateFromInterval + */ + IF vEnded IS NULL THEN + SET vEnded = vStarted; + END IF; + + IF vEnded < vStarted THEN + SET vStarted = TIMESTAMPADD(MONTH, -1, vEnded); + END IF; + + -- Item + + DROP TEMPORARY TABLE IF EXISTS tmp.buyUltimateFromInterval; + CREATE TEMPORARY TABLE tmp.buyUltimateFromInterval + (PRIMARY KEY (itemFk, warehouseFk), INDEX(buyFk), INDEX(landed), INDEX(warehouseFk), INDEX(itemFk)) + ENGINE = MEMORY + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + MULTIMAX(t.landed, b.id) buyFk, + MAX(t.landed) landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vStarted AND vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.price2 > 0 + AND NOT b.isIgnored + AND b.quantity > 0 + GROUP BY itemFk, warehouseInFk; + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed > vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.price2 > 0 + AND NOT b.isIgnored + GROUP BY itemFk, warehouseInFk; + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vStarted AND vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.quantity = 0 + GROUP BY itemFk, warehouseInFk; + + + + -- ItemOriginal + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + MULTIMAX(t.landed, b.id) buyFk, + MAX(t.landed) landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vStarted AND vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.price2 > 0 + AND NOT b.isIgnored + AND b.quantity > 0 + AND itemOriginalFk + GROUP BY itemOriginalFk, warehouseInFk; + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed > vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.price2 > 0 + AND NOT b.isIgnored + AND itemOriginalFk + GROUP BY itemOriginalFk, warehouseInFk; + + INSERT IGNORE INTO tmp.buyUltimateFromInterval(itemFk, warehouseFk, buyFk, landed) + SELECT + b.itemFk, + t.warehouseInFk warehouseFk, + b.id buyFk, + t.landed + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel t ON t.id = e.travelFk + WHERE t.landed BETWEEN vStarted AND vEnded + AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk) + AND b.quantity = 0 + AND itemOriginalFk + GROUP BY itemOriginalFk, warehouseInFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51017,67 +51017,67 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_afterUpsert`(vSelf INT) -BEGIN -/** - * Triggered actions when a buy is updated or inserted. - * - * @param vSelf The buy reference - */ - DECLARE vEntryFk INT; - DECLARE vItemFk INT; - DECLARE vPackingOut DECIMAL(10,2); - DECLARE vWarehouse INT; - DECLARE vStandardFlowerBox INT; - DECLARE vWarehouseOut INT; - DECLARE vIsMerchandise BOOL; - DECLARE vIsFeedStock BOOL; - - SELECT b.entryFk, b.itemFk, i.packingOut, ic.merchandise, vc.standardFlowerBox - INTO vEntryFk, vItemFk, vPackingOut, vIsMerchandise, vStandardFlowerBox - FROM buy b - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN itemType it ON it.id = i.typeFk - LEFT JOIN itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox - JOIN volumeConfig vc ON TRUE - WHERE b.id = vSelf; - - SELECT t.warehouseInFk, t.warehouseOutFk - INTO vWarehouse, vWarehouseOut - FROM entry e - JOIN travel t ON t.id = e.travelFk - WHERE e.id = vEntryFk; - - IF vIsMerchandise THEN - - REPLACE itemCost SET - itemFk = vItemFk, - warehouseFk = vWarehouse, - cm3 = buy_getUnitVolume(vSelf), - cm3Delivery = IFNULL((vStandardFlowerBox * 1000) / vPackingOut, buy_getUnitVolume(vSelf)); - - UPDATE vn.itemCost ic - JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - SET ic.grams = b.weight * 1000 / b.packing - WHERE ic.itemFk = vItemFk AND - ic.warehouseFk = vWarehouse; - - END IF; - - SELECT isFeedStock INTO vIsFeedStock - FROM warehouse WHERE id = vWarehouseOut AND id <> 13; - - IF vIsFeedStock THEN - INSERT IGNORE INTO producer(`name`) - SELECT es.company_name - FROM buy b - JOIN edi.ekt be ON be.id = b.ektFk - JOIN edi.supplier es ON es.supplier_id = be.pro - WHERE b.id = vSelf; - - END IF; - +BEGIN +/** + * Triggered actions when a buy is updated or inserted. + * + * @param vSelf The buy reference + */ + DECLARE vEntryFk INT; + DECLARE vItemFk INT; + DECLARE vPackingOut DECIMAL(10,2); + DECLARE vWarehouse INT; + DECLARE vStandardFlowerBox INT; + DECLARE vWarehouseOut INT; + DECLARE vIsMerchandise BOOL; + DECLARE vIsFeedStock BOOL; + + SELECT b.entryFk, b.itemFk, i.packingOut, ic.merchandise, vc.standardFlowerBox + INTO vEntryFk, vItemFk, vPackingOut, vIsMerchandise, vStandardFlowerBox + FROM buy b + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN itemType it ON it.id = i.typeFk + LEFT JOIN itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN packaging p ON p.id = b.packageFk AND NOT p.isBox + JOIN volumeConfig vc ON TRUE + WHERE b.id = vSelf; + + SELECT t.warehouseInFk, t.warehouseOutFk + INTO vWarehouse, vWarehouseOut + FROM entry e + JOIN travel t ON t.id = e.travelFk + WHERE e.id = vEntryFk; + + IF vIsMerchandise THEN + + REPLACE itemCost SET + itemFk = vItemFk, + warehouseFk = vWarehouse, + cm3 = buy_getUnitVolume(vSelf), + cm3Delivery = IFNULL((vStandardFlowerBox * 1000) / vPackingOut, buy_getUnitVolume(vSelf)); + + UPDATE vn.itemCost ic + JOIN cache.last_buy lb ON lb.item_id = ic.itemFk AND lb.warehouse_id = ic.warehouseFk + JOIN vn.buy b ON b.id = lb.buy_id + SET ic.grams = b.weight * 1000 / b.packing + WHERE ic.itemFk = vItemFk AND + ic.warehouseFk = vWarehouse; + + END IF; + + SELECT isFeedStock INTO vIsFeedStock + FROM warehouse WHERE id = vWarehouseOut AND id <> 13; + + IF vIsFeedStock THEN + INSERT IGNORE INTO producer(`name`) + SELECT es.company_name + FROM buy b + JOIN edi.ekt be ON be.id = b.ektFk + JOIN edi.supplier es ON es.supplier_id = be.pro + WHERE b.id = vSelf; + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -51343,24 +51343,24 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `buy_updateGrouping`(vWarehouseFk INT, vItemFk INT, vGrouping INT) -BEGIN -/** - * Actualiza el grouping de las últimas compras de un artículo - * - * @param vWarehouseFk Id del almacén - * @param vItemFk Id del Artículo - * @param vGrouping Cantidad de grouping - */ - - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); - - UPDATE vn.buy b - JOIN tmp.buyUltimate bu ON b.id = bu.buyFk - SET b.`grouping` = vGrouping - WHERE bu.warehouseFk = vWarehouseFk - AND bu.itemFk = vItemFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; +BEGIN +/** + * Actualiza el grouping de las últimas compras de un artículo + * + * @param vWarehouseFk Id del almacén + * @param vItemFk Id del Artículo + * @param vGrouping Cantidad de grouping + */ + + CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + + UPDATE vn.buy b + JOIN tmp.buyUltimate bu ON b.id = bu.buyFk + SET b.`grouping` = vGrouping + WHERE bu.warehouseFk = vWarehouseFk + AND bu.itemFk = vItemFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52682,87 +52682,87 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clean_logiflora`() -BEGIN - /* partir en 2 procedimientos, uno que borre compras y otro articulos - * item_clean, buy_clean - * */ - - DECLARE vMaxDated DATE DEFAULT TIMESTAMPADD(DAY, - 7, CURDATE()); - DECLARE vDone INT DEFAULT FALSE; - DECLARE vBuyFk INT; - DECLARE cur1 CURSOR FOR SELECT id FROM tmp.buy; - DECLARE cur2 CURSOR FOR SELECT id FROM tmp.item; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.buy; - - CREATE TEMPORARY TABLE tmp.buy - ENGINE = MEMORY - SELECT b.id - FROM vn.buy b - JOIN vn.entry e ON e.id = b.entryFk - JOIN vn.travel tr ON tr.id = e.travelFk - JOIN vn.agencyMode am ON am.id = tr.agencyFk - WHERE b.quantity = 0 - AND am.name = 'LOGIFLORA' - AND e.isRaid; - - OPEN cur1; - - read_loop: LOOP - - SET vDone = FALSE; - - FETCH cur1 INTO vBuyFk; - - IF vDone THEN - LEAVE read_loop; - END IF; - - DELETE FROM vn.buy WHERE id = vBuyFk; - - END LOOP; - - CLOSE cur1; - - DROP TEMPORARY TABLE tmp.buy; - - DROP TEMPORARY TABLE IF EXISTS tmp.item; - - CREATE TEMPORARY TABLE tmp.item - ENGINE = MEMORY - SELECT DISTINCT i.id - FROM vn.item i - LEFT JOIN hedera.orderRow o ON o.itemFk = i.id - LEFT JOIN vn.sale s ON s.itemFk = i.id - LEFT JOIN vn.buy b ON b.itemFk = i.id - WHERE i.supplyResponseFk - AND o.id IS NULL - AND b.id IS NULL - AND s.id IS NULL - AND i.created < vMaxDated; - - OPEN cur2; - - read_loop: LOOP - - SET vDone = FALSE; - - FETCH cur2 INTO vBuyFk; - - IF vDone THEN - LEAVE read_loop; - END IF; - - DELETE FROM vn.item WHERE id = vBuyFk; - - END LOOP; - - CLOSE cur2; - - DROP TEMPORARY TABLE tmp.item; - +BEGIN + /* partir en 2 procedimientos, uno que borre compras y otro articulos + * item_clean, buy_clean + * */ + + DECLARE vMaxDated DATE DEFAULT TIMESTAMPADD(DAY, - 7, CURDATE()); + DECLARE vDone INT DEFAULT FALSE; + DECLARE vBuyFk INT; + DECLARE cur1 CURSOR FOR SELECT id FROM tmp.buy; + DECLARE cur2 CURSOR FOR SELECT id FROM tmp.item; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.buy; + + CREATE TEMPORARY TABLE tmp.buy + ENGINE = MEMORY + SELECT b.id + FROM vn.buy b + JOIN vn.entry e ON e.id = b.entryFk + JOIN vn.travel tr ON tr.id = e.travelFk + JOIN vn.agencyMode am ON am.id = tr.agencyFk + WHERE b.quantity = 0 + AND am.name = 'LOGIFLORA' + AND e.isRaid; + + OPEN cur1; + + read_loop: LOOP + + SET vDone = FALSE; + + FETCH cur1 INTO vBuyFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + DELETE FROM vn.buy WHERE id = vBuyFk; + + END LOOP; + + CLOSE cur1; + + DROP TEMPORARY TABLE tmp.buy; + + DROP TEMPORARY TABLE IF EXISTS tmp.item; + + CREATE TEMPORARY TABLE tmp.item + ENGINE = MEMORY + SELECT DISTINCT i.id + FROM vn.item i + LEFT JOIN hedera.orderRow o ON o.itemFk = i.id + LEFT JOIN vn.sale s ON s.itemFk = i.id + LEFT JOIN vn.buy b ON b.itemFk = i.id + WHERE i.supplyResponseFk + AND o.id IS NULL + AND b.id IS NULL + AND s.id IS NULL + AND i.created < vMaxDated; + + OPEN cur2; + + read_loop: LOOP + + SET vDone = FALSE; + + FETCH cur2 INTO vBuyFk; + + IF vDone THEN + LEAVE read_loop; + END IF; + + DELETE FROM vn.item WHERE id = vBuyFk; + + END LOOP; + + CLOSE cur2; + + DROP TEMPORARY TABLE tmp.item; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52802,76 +52802,76 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `clientCreate`( - vFirstname VARCHAR(50), - vSurnames VARCHAR(50), - vFi VARCHAR(9), - vAddress TEXT, - vPostcode CHAR(5), - vCity VARCHAR(25), - vProvinceFk SMALLINT(5), - vCompanyFk SMALLINT(5), - vPhone VARCHAR(11), - vEmail VARCHAR(255), +CREATE DEFINER=`root`@`localhost` PROCEDURE `clientCreate`( + vFirstname VARCHAR(50), + vSurnames VARCHAR(50), + vFi VARCHAR(9), + vAddress TEXT, + vPostcode CHAR(5), + vCity VARCHAR(25), + vProvinceFk SMALLINT(5), + vCompanyFk SMALLINT(5), + vPhone VARCHAR(11), + vEmail VARCHAR(255), vUserFk INT) -BEGIN -/** - * Create new client - * - */ - DECLARE vPayMethodFk INT DEFAULT 4; - DECLARE vDueDay INT DEFAULT 5; - DECLARE vDefaultCredit DECIMAL(10, 2) DEFAULT 300.00; - DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1; - DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE; - DECLARE vMandateTypeFk INT DEFAULT 2; - - INSERT INTO `client` ( - id, - name, - street, - fi, - phone, - email, - provinceFk, - city, - postcode, - socialName, - payMethodFk, - dueDay, - credit, - isTaxDataChecked, - hasCoreVnl, - isEqualizated) - VALUES ( - vUserFk, - CONCAT('TR ', vFirstname, ' ', vSurnames), - vAddress, - TRIM(vFi), - vPhone, - vEmail, - vProvinceFk, - vCity, - vPostcode, - CONCAT(vSurnames, ' ', vFirstname), - vPayMethodFk, - vDueDay, - vDefaultCredit, - vIsTaxDataChecked, - vHasCoreVnl, - FALSE - ) ON duplicate key update - payMethodFk = vPayMethodFk, - dueDay = vDueDay, - credit = vDefaultCredit, - isTaxDataChecked = vIsTaxDataChecked, - hasCoreVnl = vHasCoreVnl, - isActive = TRUE; - - IF (SELECT COUNT(*) FROM mandate WHERE clientFk = vUserFk AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk) = 0 THEN - INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) - VALUES (vUserFk, vCompanyFk, vMandateTypeFk); - END IF; +BEGIN +/** + * Create new client + * + */ + DECLARE vPayMethodFk INT DEFAULT 4; + DECLARE vDueDay INT DEFAULT 5; + DECLARE vDefaultCredit DECIMAL(10, 2) DEFAULT 300.00; + DECLARE vIsTaxDataChecked TINYINT(1) DEFAULT 1; + DECLARE vHasCoreVnl BOOLEAN DEFAULT TRUE; + DECLARE vMandateTypeFk INT DEFAULT 2; + + INSERT INTO `client` ( + id, + name, + street, + fi, + phone, + email, + provinceFk, + city, + postcode, + socialName, + payMethodFk, + dueDay, + credit, + isTaxDataChecked, + hasCoreVnl, + isEqualizated) + VALUES ( + vUserFk, + CONCAT('TR ', vFirstname, ' ', vSurnames), + vAddress, + TRIM(vFi), + vPhone, + vEmail, + vProvinceFk, + vCity, + vPostcode, + CONCAT(vSurnames, ' ', vFirstname), + vPayMethodFk, + vDueDay, + vDefaultCredit, + vIsTaxDataChecked, + vHasCoreVnl, + FALSE + ) ON duplicate key update + payMethodFk = vPayMethodFk, + dueDay = vDueDay, + credit = vDefaultCredit, + isTaxDataChecked = vIsTaxDataChecked, + hasCoreVnl = vHasCoreVnl, + isActive = TRUE; + + IF (SELECT COUNT(*) FROM mandate WHERE clientFk = vUserFk AND companyFk = vCompanyFk AND mandateTypeFk = vMandateTypeFk) = 0 THEN + INSERT INTO mandate (clientFk, companyFk, mandateTypeFk) + VALUES (vUserFk, vCompanyFk, vMandateTypeFk); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52931,50 +52931,50 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientFreeze`() -BEGIN -/** - * Congela diariamente aquellos clientes que son morosos sin recobro, - * pero que no sean trabajadores, - * y que el riesgo no sea menor que cero - * hasta que no se gire la remesa no se congelan a los clientes de giro - */ - - DECLARE vIsRemittanced BOOLEAN; - - SELECT id into vIsRemittanced - FROM receipt - WHERE invoiceFk LIKE 'REMESA%' - AND payed > util.firstDayOfMonth(CURDATE()) - limit 1; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - SELECT clientFk - FROM bs.defaulter - WHERE created = CURDATE() - AND amount; - - CALL clientGetDebt(CURDATE()); - - UPDATE client c - JOIN bi.defaulters d ON d.client = c.id AND d.date = CURDATE() - JOIN config ON TRUE - LEFT JOIN account.`user` u ON u.id = c.id AND u.active - LEFT JOIN worker w ON w.id = u.id - LEFT JOIN recovery r ON r.clientFk = c.id AND r.finished IS NULL - LEFT JOIN payMethod pm ON pm.id = c.payMethodFk - LEFT JOIN tmp.risk rk ON rk.clientFk = c.id - SET c.isFreezed = TRUE, - d.frozened = CURDATE(), - u.active = FALSE - WHERE (d.amount > config.defaultersMaxAmount - AND rk.risk > 0) - AND c.typeFk = 'normal' - AND r.id IS NULL - AND w.id IS NULL - AND (vIsRemittanced OR pm.code <> 'bankDraft'); - - DROP TEMPORARY TABLE tmp.clientGetDebt; +BEGIN +/** + * Congela diariamente aquellos clientes que son morosos sin recobro, + * pero que no sean trabajadores, + * y que el riesgo no sea menor que cero + * hasta que no se gire la remesa no se congelan a los clientes de giro + */ + + DECLARE vIsRemittanced BOOLEAN; + + SELECT id into vIsRemittanced + FROM receipt + WHERE invoiceFk LIKE 'REMESA%' + AND payed > util.firstDayOfMonth(CURDATE()) + limit 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + SELECT clientFk + FROM bs.defaulter + WHERE created = CURDATE() + AND amount; + + CALL clientGetDebt(CURDATE()); + + UPDATE client c + JOIN bi.defaulters d ON d.client = c.id AND d.date = CURDATE() + JOIN config ON TRUE + LEFT JOIN account.`user` u ON u.id = c.id AND u.active + LEFT JOIN worker w ON w.id = u.id + LEFT JOIN recovery r ON r.clientFk = c.id AND r.finished IS NULL + LEFT JOIN payMethod pm ON pm.id = c.payMethodFk + LEFT JOIN tmp.risk rk ON rk.clientFk = c.id + SET c.isFreezed = TRUE, + d.frozened = CURDATE(), + u.active = FALSE + WHERE (d.amount > config.defaultersMaxAmount + AND rk.risk > 0) + AND c.typeFk = 'normal' + AND r.id IS NULL + AND w.id IS NULL + AND (vIsRemittanced OR pm.code <> 'bankDraft'); + + DROP TEMPORARY TABLE tmp.clientGetDebt; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -52992,59 +52992,59 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `clientGetDebt`(vDate DATE) -BEGIN -/** - * Calcula el riesgo para los clientes activos - * - * @table tmp.clientGetDebt(clientFk) - * @param vDate Fecha maxima de los registros - * @return tmp.risk - */ - DECLARE vStarted DATETIME DEFAULT TIMESTAMPADD(DAY, -35, CURDATE()); - DECLARE vEnded DATETIME; - - SET vEnded = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); - - DROP TEMPORARY TABLE IF EXISTS tClientRisk; - CREATE TEMPORARY TABLE tClientRisk - ENGINE = MEMORY - SELECT cr.clientFk, SUM(cr.amount) amount - FROM clientRisk cr - JOIN tmp.clientGetDebt c ON c.clientFk = cr.clientFk - GROUP BY cr.clientFk; - - INSERT INTO tClientRisk - SELECT c.clientFk, SUM(r.amountPaid) - FROM receipt r - JOIN tmp.clientGetDebt c ON c.clientFk = r.clientFk - WHERE r.payed > vEnded - GROUP BY c.clientFk; - - INSERT INTO tClientRisk - SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) - FROM hedera.tpvTransaction t - JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk - WHERE t.receiptFk IS NULL - AND t.status = 'ok' - GROUP BY t.clientFk; - - INSERT INTO tClientRisk - SELECT t.clientFk, totalWithVat - FROM ticket t - JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk - WHERE refFk IS NULL - AND shipped BETWEEN vStarted AND vEnded; - - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - CREATE TEMPORARY TABLE tmp.risk - (PRIMARY KEY (clientFk)) - ENGINE = MEMORY - SELECT clientFk, SUM(amount) risk - FROM client c - JOIN tClientRisk cr ON cr.clientFk = c.id - GROUP BY c.id; - - DROP TEMPORARY TABLE tClientRisk; +BEGIN +/** + * Calcula el riesgo para los clientes activos + * + * @table tmp.clientGetDebt(clientFk) + * @param vDate Fecha maxima de los registros + * @return tmp.risk + */ + DECLARE vStarted DATETIME DEFAULT TIMESTAMPADD(DAY, -35, CURDATE()); + DECLARE vEnded DATETIME; + + SET vEnded = TIMESTAMP(IFNULL(vDate, CURDATE()), '23:59:59'); + + DROP TEMPORARY TABLE IF EXISTS tClientRisk; + CREATE TEMPORARY TABLE tClientRisk + ENGINE = MEMORY + SELECT cr.clientFk, SUM(cr.amount) amount + FROM clientRisk cr + JOIN tmp.clientGetDebt c ON c.clientFk = cr.clientFk + GROUP BY cr.clientFk; + + INSERT INTO tClientRisk + SELECT c.clientFk, SUM(r.amountPaid) + FROM receipt r + JOIN tmp.clientGetDebt c ON c.clientFk = r.clientFk + WHERE r.payed > vEnded + GROUP BY c.clientFk; + + INSERT INTO tClientRisk + SELECT t.clientFk, CAST(-SUM(t.amount) / 100 AS DECIMAL(10,2)) + FROM hedera.tpvTransaction t + JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk + WHERE t.receiptFk IS NULL + AND t.status = 'ok' + GROUP BY t.clientFk; + + INSERT INTO tClientRisk + SELECT t.clientFk, totalWithVat + FROM ticket t + JOIN tmp.clientGetDebt c ON c.clientFk = t.clientFk + WHERE refFk IS NULL + AND shipped BETWEEN vStarted AND vEnded; + + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + CREATE TEMPORARY TABLE tmp.risk + (PRIMARY KEY (clientFk)) + ENGINE = MEMORY + SELECT clientFk, SUM(amount) risk + FROM client c + JOIN tClientRisk cr ON cr.clientFk = c.id + GROUP BY c.id; + + DROP TEMPORARY TABLE tClientRisk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54017,33 +54017,33 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collectionOrTicket_printSticker`(vParam INT, vSectorFk INT) -BEGIN - - /*Imprime una etiqueta amarilla a partir de una colección o ticket - * - * @param vParam colección o ticket a imprimir - * @param vSectorFk id del sector - */ - - DECLARE vLabelReport INT; - - SELECT labelReportFk INTO vLabelReport - FROM sector - WHERE id = vSectorFk; - - IF vLabelReport THEN - - INSERT INTO ticketTrolley(ticket, labelCount) - SELECT ticketFk, 1 - FROM ticketCollection - WHERE collectionFk = vParam OR ticketFK = vParam - ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; - - INSERT INTO printServerQueue(labelReportFk, param1, workerFk) - SELECT vLabelReport, vParam, getUser(); - - END IF; - +BEGIN + + /*Imprime una etiqueta amarilla a partir de una colección o ticket + * + * @param vParam colección o ticket a imprimir + * @param vSectorFk id del sector + */ + + DECLARE vLabelReport INT; + + SELECT labelReportFk INTO vLabelReport + FROM sector + WHERE id = vSectorFk; + + IF vLabelReport THEN + + INSERT INTO ticketTrolley(ticket, labelCount) + SELECT ticketFk, 1 + FROM ticketCollection + WHERE collectionFk = vParam OR ticketFK = vParam + ON DUPLICATE KEY UPDATE labelCount = labelCount + 1; + + INSERT INTO printServerQueue(labelReportFk, param1, workerFk) + SELECT vLabelReport, vParam, getUser(); + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54436,20 +54436,20 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_get_`(vWorkerFk INT) -BEGIN - - /* Obtiene colección del sacador si tiene líneas pendientes - * - * @param vWorkerFk id del worker - */ - - SELECT c.id AS collectionFk, date(c.created) AS created - FROM vn.collection c - LEFT JOIN vn.state s ON c.stateFk = s.id - WHERE c.workerFk = vWorkerFk AND s.code = 'ON_PREPARATION' - AND created >= TIMESTAMPADD(HOUR , -6,NOW()); - - +BEGIN + + /* Obtiene colección del sacador si tiene líneas pendientes + * + * @param vWorkerFk id del worker + */ + + SELECT c.id AS collectionFk, date(c.created) AS created + FROM vn.collection c + LEFT JOIN vn.state s ON c.stateFk = s.id + WHERE c.workerFk = vWorkerFk AND s.code = 'ON_PREPARATION' + AND created >= TIMESTAMPADD(HOUR , -6,NOW()); + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -54467,21 +54467,21 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `collection_kill`(vSelf INT) -BEGIN - - /* Elimina una coleccion y coloca sus tickets en OK - * - */ - - INSERT INTO vncontrol.inter(state_id, Id_Ticket) - SELECT s.id, ticketFk - FROM vn.ticketCollection tc - JOIN vn.state s ON s.code = 'OK' - WHERE tc.collectionFk = vSelf; - - DELETE FROM vn.collection - WHERE id = vSelf; - +BEGIN + + /* Elimina una coleccion y coloca sus tickets en OK + * + */ + + INSERT INTO vncontrol.inter(state_id, Id_Ticket) + SELECT s.id, ticketFk + FROM vn.ticketCollection tc + JOIN vn.state s ON s.code = 'OK' + WHERE tc.collectionFk = vSelf; + + DELETE FROM vn.collection + WHERE id = vSelf; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -56428,27 +56428,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `company_getFiscaldata`(workerFk INT) -BEGIN - -DECLARE vCompanyFk INT; - - SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk) - INTO vCompanyFk - FROM vn.routeConfig rc - LEFT JOIN userConfig uc ON uc.userFk = workerFk; - - - SELECT - s.name AS name , - s.NIF AS nif , - s.street AS street , - s.city AS city , - s.postCode AS postCode - - FROM vn.company c - JOIN vn.worker w ON w.id = c.workerManagerFk - JOIN vn.supplier s ON s.id = c.id - WHERE c.id = vCompanyFk; +BEGIN + +DECLARE vCompanyFk INT; + + SELECT IFNULL(uc.companyFk, rc.defaultCompanyFk) + INTO vCompanyFk + FROM vn.routeConfig rc + LEFT JOIN userConfig uc ON uc.userFk = workerFk; + + + SELECT + s.name AS name , + s.NIF AS nif , + s.street AS street , + s.city AS city , + s.postCode AS postCode + + FROM vn.company c + JOIN vn.worker w ON w.id = c.workerManagerFk + JOIN vn.supplier s ON s.id = c.id + WHERE c.id = vCompanyFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -57101,18 +57101,18 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `department_getHasMistake`() -BEGIN - -/** - * Obtiene los sectores a los cuales les ponemos errores - * - */ - - SELECT id, name - FROM department - WHERE hasToMistake <> FALSE; - - +BEGIN + +/** + * Obtiene los sectores a los cuales les ponemos errores + * + */ + + SELECT id, name + FROM department + WHERE hasToMistake <> FALSE; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -57221,18 +57221,18 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceLog_add`(vWorkerFk INT, vAppName VARCHAR(45), vAppVersion VARCHAR(45), vAndroid_id VARCHAR(100)) -BEGIN -/* - * Inserta registro en tabla devicelog el log del usuario conectado - * @param vAppName es el nombre de la app - * @param vAppVersion es la versión de la app - * @param vAndroid_id es el android_id del dispositivo que se ha logueado - */ - - INSERT INTO deviceLog (userFK, nameApp, versionApp, android_id) - VALUES(vWorkerFk, vAppName, vAppVersion, vAndroid_id); - - +BEGIN +/* + * Inserta registro en tabla devicelog el log del usuario conectado + * @param vAppName es el nombre de la app + * @param vAppVersion es la versión de la app + * @param vAndroid_id es el android_id del dispositivo que se ha logueado + */ + + INSERT INTO deviceLog (userFK, nameApp, versionApp, android_id) + VALUES(vWorkerFk, vAppName, vAppVersion, vAndroid_id); + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -57274,19 +57274,19 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProductionUser_getWorker`(vAndroid_id VARCHAR(50)) -BEGIN -/** - * Selecciona si hay registrado un device con un android_id - * - * @param vAndroid_id el número android_id del dispositivo - * - */ - SELECT 103; -/* SELECT account.user_getNameFromId(dpu.userFk) - FROM deviceProductionUser dpu - JOIN deviceProduction dp ON dpu.deviceProductionFk = dp.id - WHERE dp.android_id = vAndroid_id;*/ - +BEGIN +/** + * Selecciona si hay registrado un device con un android_id + * + * @param vAndroid_id el número android_id del dispositivo + * + */ + SELECT 103; +/* SELECT account.user_getNameFromId(dpu.userFk) + FROM deviceProductionUser dpu + JOIN deviceProduction dp ON dpu.deviceProductionFk = dp.id + WHERE dp.android_id = vAndroid_id;*/ + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -57304,18 +57304,18 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `deviceProduction_getnameDevice`(vAndroid_id VARCHAR(50)) -BEGIN -/** - * Selecciona el id del dispositivo que corresponde al vAndroid_id - * - * @param vAndroid_id el número android_id del dispositivo - * - */ - - SELECT dp.id - FROM deviceProduction dp - WHERE dp.android_id = vAndroid_id; - +BEGIN +/** + * Selecciona el id del dispositivo que corresponde al vAndroid_id + * + * @param vAndroid_id el número android_id del dispositivo + * + */ + + SELECT dp.id + FROM deviceProduction dp + WHERE dp.android_id = vAndroid_id; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -58137,15 +58137,15 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ediTables_Update`() -BEGIN - - INSERT IGNORE INTO vn.genus(name) - SELECT latin_genus_name - FROM edi.genus ; - - INSERT IGNORE INTO vn.specie(name) - SELECT LCASE(latin_species_name) - FROM edi.specie ; +BEGIN + + INSERT IGNORE INTO vn.genus(name) + SELECT latin_genus_name + FROM edi.genus ; + + INSERT IGNORE INTO vn.specie(name) + SELECT LCASE(latin_species_name) + FROM edi.specie ; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -58288,65 +58288,65 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ekt_add__`(vPutOrderFk INT) -BEGIN - -/** - * Añade ekt para las ordenes de compra de proveedores que no envian el ekt por email - * - * @param vPutOrderFk PutOrderId de donde coger los datos - **/ - - INSERT INTO edi.ekt(entryYear, - deliveryNumber, - fec, - hor, - item, - pac, - qty, - ori, - cat, - pro, - pri, - package, - s1, - s2, - s3, - s4, - s5, - s6, - putOrderFk, - `ref`, - kop) - SELECT year(curdate()) entryYear, - p.id deliveryNumber , - CURDATE() fec, - CURTIME() hor, - i.longName item, - sr.NumberOfItemsPerCask pac, - p.quantity qty, - o.code ori, - i.category cat, - mp.supplierFk pro, - sr.Price pri, - sr.EmbalageCode package, - i.value5 s1, - i.value6 s2, - i.value7 s3, - i.value8 s4, - i.value9 s5, - i.value10 s6, - p.id putOrderFk, - sr.Item_ArticleCode, - sr.vmpID - FROM edi.putOrder p - JOIN edi.supplyResponse sr ON sr.ID = p.supplyResponseID - JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID - JOIN vn.item i ON i.supplyResponseFk = sr.ID - JOIN vn.origin o ON o.id = i.originFk - WHERE p.id = vPutOrderFk; - - CALL edi.ekt_load(LAST_INSERT_ID()); - +BEGIN + +/** + * Añade ekt para las ordenes de compra de proveedores que no envian el ekt por email + * + * @param vPutOrderFk PutOrderId de donde coger los datos + **/ + + INSERT INTO edi.ekt(entryYear, + deliveryNumber, + fec, + hor, + item, + pac, + qty, + ori, + cat, + pro, + pri, + package, + s1, + s2, + s3, + s4, + s5, + s6, + putOrderFk, + `ref`, + kop) + SELECT year(curdate()) entryYear, + p.id deliveryNumber , + CURDATE() fec, + CURTIME() hor, + i.longName item, + sr.NumberOfItemsPerCask pac, + p.quantity qty, + o.code ori, + i.category cat, + mp.supplierFk pro, + sr.Price pri, + sr.EmbalageCode package, + i.value5 s1, + i.value6 s2, + i.value7 s3, + i.value8 s4, + i.value9 s5, + i.value10 s6, + p.id putOrderFk, + sr.Item_ArticleCode, + sr.vmpID + FROM edi.putOrder p + JOIN edi.supplyResponse sr ON sr.ID = p.supplyResponseID + JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID + JOIN vn.item i ON i.supplyResponseFk = sr.ID + JOIN vn.origin o ON o.id = i.originFk + WHERE p.id = vPutOrderFk; + + CALL edi.ekt_load(LAST_INSERT_ID()); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -58397,216 +58397,216 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entryConverter__`(IN `vEntry` INT) -BEGIN - - DECLARE vWarehouseIn INT; - DECLARE vWarehouseOut INT; - DECLARE vTravel INT; - - DECLARE done BOOL DEFAULT FALSE; - - DECLARE vId_Entrada INT; - DECLARE vId_Article INT; - DECLARE vEtiquetas INT; - DECLARE vId_Cubo VARCHAR(10); - DECLARE vPacking INT; - DECLARE vGrouping INT; - DECLARE vCantidad INT; - DECLARE vCostefijo DECIMAL(10,3); - DECLARE vPortefijo DECIMAL(10,3); - DECLARE vEmbalajefijo DECIMAL(10); - DECLARE vComisionfija DECIMAL(10,3); - DECLARE vCaja INT; - DECLARE vNicho VARCHAR(5); - DECLARE vTarifa1 DECIMAL(10,2); - DECLARE vTarifa2 DECIMAL(10,2); - DECLARE vTarifa3 DECIMAL(10,2); - DECLARE vPVP DECIMAL(10,2); - DECLARE vCompra INT; - - DECLARE rs CURSOR FOR - SELECT - b.Id_Entrada, - b.Id_Article, - b.Etiquetas, - b.Id_Cubo, - b.Packing, - b.`grouping`, - b.Cantidad, - b.Costefijo, - b.Portefijo, - b.Embalajefijo, - b.Comisionfija, - b.caja, - b.Nicho, - b.Tarifa1, - b.Tarifa2, - b.Tarifa3, - b.PVP - FROM vn2008.Compres b - JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article - WHERE Id_Entrada = vEntry; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT warehouseInFk, warehouseOutFk, tr.id - INTO vWarehouseIn, vWarehouseOut, vTravel - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - WHERE e.id = vEntry; - - UPDATE travel - SET warehouseInFk = vWarehouseOut, - warehouseOutFk = vWarehouseIn - WHERE id = vTravel; - - UPDATE vn2008.Compres c - LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article - SET Etiquetas = 0, Cantidad = 0 - WHERE c.Id_Entrada = vEntry - AND ic.espItemFk IS NULL; - - OPEN rs; - - DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry; - - FETCH rs INTO - vId_Entrada, - vId_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP; - - WHILE NOT done DO - - -- Primero la linea original con las cantidades invertidas - INSERT INTO vn2008.Compres - ( - Id_Entrada, - Id_Article, - Etiquetas, - Id_Cubo, - Packing, - `grouping`, - Cantidad, - Costefijo, - Portefijo, - Embalajefijo, - Comisionfija, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP - ) - VALUES - ( - vId_Entrada, - vId_Article, - - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP); - - -- Ahora la linea nueva, con el item genérico - INSERT INTO vn2008.Compres - ( - Id_Entrada, - Id_Article, - Etiquetas, - Id_Cubo, - Packing, - `grouping`, - Cantidad, - Costefijo, - Portefijo, - Embalajefijo, - Comisionfija, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP - ) - SELECT - vId_Entrada, - genItemFk as Id_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP - FROM itemConversor - WHERE espItemFk = vId_Article; - - SELECT LAST_INSERT_ID() - INTO vCompra; - - REPLACE vn2008.Compres_mark(Id_Compra,`comment`) - SELECT vCompra, vId_Article; - - - FETCH rs INTO - vId_Entrada, - vId_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP; - - END WHILE; - - - CLOSE rs; - - - +BEGIN + + DECLARE vWarehouseIn INT; + DECLARE vWarehouseOut INT; + DECLARE vTravel INT; + + DECLARE done BOOL DEFAULT FALSE; + + DECLARE vId_Entrada INT; + DECLARE vId_Article INT; + DECLARE vEtiquetas INT; + DECLARE vId_Cubo VARCHAR(10); + DECLARE vPacking INT; + DECLARE vGrouping INT; + DECLARE vCantidad INT; + DECLARE vCostefijo DECIMAL(10,3); + DECLARE vPortefijo DECIMAL(10,3); + DECLARE vEmbalajefijo DECIMAL(10); + DECLARE vComisionfija DECIMAL(10,3); + DECLARE vCaja INT; + DECLARE vNicho VARCHAR(5); + DECLARE vTarifa1 DECIMAL(10,2); + DECLARE vTarifa2 DECIMAL(10,2); + DECLARE vTarifa3 DECIMAL(10,2); + DECLARE vPVP DECIMAL(10,2); + DECLARE vCompra INT; + + DECLARE rs CURSOR FOR + SELECT + b.Id_Entrada, + b.Id_Article, + b.Etiquetas, + b.Id_Cubo, + b.Packing, + b.`grouping`, + b.Cantidad, + b.Costefijo, + b.Portefijo, + b.Embalajefijo, + b.Comisionfija, + b.caja, + b.Nicho, + b.Tarifa1, + b.Tarifa2, + b.Tarifa3, + b.PVP + FROM vn2008.Compres b + JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article + WHERE Id_Entrada = vEntry; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + SELECT warehouseInFk, warehouseOutFk, tr.id + INTO vWarehouseIn, vWarehouseOut, vTravel + FROM travel tr + JOIN entry e ON e.travelFk = tr.id + WHERE e.id = vEntry; + + UPDATE travel + SET warehouseInFk = vWarehouseOut, + warehouseOutFk = vWarehouseIn + WHERE id = vTravel; + + UPDATE vn2008.Compres c + LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article + SET Etiquetas = 0, Cantidad = 0 + WHERE c.Id_Entrada = vEntry + AND ic.espItemFk IS NULL; + + OPEN rs; + + DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry; + + FETCH rs INTO + vId_Entrada, + vId_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP; + + WHILE NOT done DO + + -- Primero la linea original con las cantidades invertidas + INSERT INTO vn2008.Compres + ( + Id_Entrada, + Id_Article, + Etiquetas, + Id_Cubo, + Packing, + `grouping`, + Cantidad, + Costefijo, + Portefijo, + Embalajefijo, + Comisionfija, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP + ) + VALUES + ( + vId_Entrada, + vId_Article, + - vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + - vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP); + + -- Ahora la linea nueva, con el item genérico + INSERT INTO vn2008.Compres + ( + Id_Entrada, + Id_Article, + Etiquetas, + Id_Cubo, + Packing, + `grouping`, + Cantidad, + Costefijo, + Portefijo, + Embalajefijo, + Comisionfija, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP + ) + SELECT + vId_Entrada, + genItemFk as Id_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP + FROM itemConversor + WHERE espItemFk = vId_Article; + + SELECT LAST_INSERT_ID() + INTO vCompra; + + REPLACE vn2008.Compres_mark(Id_Compra,`comment`) + SELECT vCompra, vId_Article; + + + FETCH rs INTO + vId_Entrada, + vId_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP; + + END WHILE; + + + CLOSE rs; + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -58668,62 +58668,62 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entryPrepare__`(IN `idE` BIGINT) -BEGIN - SELECT - b.quantity / b.packing AS Paquetes, - b.packing AS `Grouping`, - barcode, - 'ASEGURADO' AS asegurado, - ic.name, - ic.order, - s.name AS Consignatario, - e.supplierFk AS Id_Cliente, - e.isOrdered, - e.isConfirmed, - 10 AS Calidad, - LPAD(IFNULL(cpd.id, ip.code), - 5, - '0') AS path, - b.entryFk AS Id_Ticket, - t.landed AS Fecha, - b.itemFk, - b.quantity, - i.name AS Concepte, - i.size, - i.inkFk, - i.category, - o.code AS Origen, - 0 AS Bultos, - wIn.`name` AS Tipo, - 0 AS OK, - 0 AS Reservado, - i.stems, - b.id AS Id_Movimiento, - ip.code, - 'PEDIDO ASEGURADO' AS MSG, - 0 AS Seguro, - i.image, - pr.name AS producer - FROM vn.buy b - JOIN vn.entry e ON b.entryFk = e.id - JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk - JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk - JOIN vn.item i ON i.id = b.itemFk - JOIN vn.itemType it ON it.id =i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.packaging pkg ON pkg.id = b.packageFk - LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk - LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.supplier s ON s.id = e.supplierFk - LEFT JOIN vn.producer pr on pr.id = i.producerFk - LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway - WHERE - NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid - AND e.id = 158772 - AND i.typeFk IS NOT NULL - AND ic.display IS NOT FALSE; +BEGIN + SELECT + b.quantity / b.packing AS Paquetes, + b.packing AS `Grouping`, + barcode, + 'ASEGURADO' AS asegurado, + ic.name, + ic.order, + s.name AS Consignatario, + e.supplierFk AS Id_Cliente, + e.isOrdered, + e.isConfirmed, + 10 AS Calidad, + LPAD(IFNULL(cpd.id, ip.code), + 5, + '0') AS path, + b.entryFk AS Id_Ticket, + t.landed AS Fecha, + b.itemFk, + b.quantity, + i.name AS Concepte, + i.size, + i.inkFk, + i.category, + o.code AS Origen, + 0 AS Bultos, + wIn.`name` AS Tipo, + 0 AS OK, + 0 AS Reservado, + i.stems, + b.id AS Id_Movimiento, + ip.code, + 'PEDIDO ASEGURADO' AS MSG, + 0 AS Seguro, + i.image, + pr.name AS producer + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk + JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk + JOIN vn.item i ON i.id = b.itemFk + JOIN vn.itemType it ON it.id =i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.packaging pkg ON pkg.id = b.packageFk + LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk + LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN vn.supplier s ON s.id = e.supplierFk + LEFT JOIN vn.producer pr on pr.id = i.producerFk + LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway + WHERE + NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid + AND e.id = 158772 + AND i.typeFk IS NOT NULL + AND ic.display IS NOT FALSE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -58814,22 +58814,22 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entryVolume__`(vEntryFk INT) -BEGIN - - SELECT ELT(it.temperature + 1,'Calientes','Frios','Secos') AS Temp, - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.carro / 1000000 ,1) AS DECIMAL(10,2)) AS carros , - CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * - vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.espai / 1000000,1) AS DECIMAL(10,2)) AS espais - FROM vn.buy b - INNER JOIN vn.entry e ON e.id = b.entryFk - INNER JOIN vn.travel tr ON tr.id = e.travelFk - INNER JOIN vn.volumeConfig vc - INNER JOIN vn.item i ON i.id = b.itemFk - INNER JOIN vn.itemType it ON it.id = i.typeFk - WHERE e.id = vEntryFk - GROUP BY Temp; - +BEGIN + + SELECT ELT(it.temperature + 1,'Calientes','Frios','Secos') AS Temp, + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.carro / 1000000 ,1) AS DECIMAL(10,2)) AS carros , + CAST(ROUND(SUM(GREATEST(b.stickers ,b.quantity /b.packing ) * + vn.item_getVolume(b.itemFk ,b.packageFk)) / vc.espai / 1000000,1) AS DECIMAL(10,2)) AS espais + FROM vn.buy b + INNER JOIN vn.entry e ON e.id = b.entryFk + INNER JOIN vn.travel tr ON tr.id = e.travelFk + INNER JOIN vn.volumeConfig vc + INNER JOIN vn.item i ON i.id = b.itemFk + INNER JOIN vn.itemType it ON it.id = i.typeFk + WHERE e.id = vEntryFk + GROUP BY Temp; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -58983,67 +58983,67 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_clone`(vSelf INT) -BEGIN - -/* - * Clona una entrada - * - * @param vSelf Identificador de vn.entry - */ - - DECLARE vNewEntryFk INT; - - CALL vn.entry_cloneWithoutBuy(vSelf, vNewEntryFk); - - INSERT INTO vn.buy( entryFk, - itemFk, - quantity, - buyingValue, - freightValue, - isIgnored, - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - workerFk, - weight, - itemOriginalFk) - SELECT vNewEntryFk, - itemFk, - quantity, - buyingValue, - freightValue, - isIgnored, - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - packageFk, - price1, - price2, - price3, - minPrice, - producer, - workerFk, - weight, - itemOriginalFk - FROM vn.buy b - WHERE b.entryFk = vSelf; - - SELECT vNewEntryFk; - +BEGIN + +/* + * Clona una entrada + * + * @param vSelf Identificador de vn.entry + */ + + DECLARE vNewEntryFk INT; + + CALL vn.entry_cloneWithoutBuy(vSelf, vNewEntryFk); + + INSERT INTO vn.buy( entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + workerFk, + weight, + itemOriginalFk) + SELECT vNewEntryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + packageFk, + price1, + price2, + price3, + minPrice, + producer, + workerFk, + weight, + itemOriginalFk + FROM vn.buy b + WHERE b.entryFk = vSelf; + + SELECT vNewEntryFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59061,45 +59061,45 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_cloneWithoutBuy`(vSelf INT, OUT vNewEntryFk INT) -BEGIN - -/** - * Clona una entrada sin compras - * - * @param vSelf Identificador de vn.entry - * - * @return vNewEntryFk Identificador de la nueva entrada - */ - - START TRANSACTION; - - INSERT INTO vn.entry(supplierFk, - dated, - isInventory, - notes, - isRaid, - commission, - travelFk, - currencyFk, - companyFk, - loadPriority) - SELECT supplierFk, - dated, - isInventory, - notes, - isRaid, - commission, - travelFk, - currencyFk, - companyFk, - loadPriority - FROM vn.entry e - WHERE e.id = vSelf; - - SET vNewEntryFk = LAST_INSERT_ID(); - - COMMIT; - +BEGIN + +/** + * Clona una entrada sin compras + * + * @param vSelf Identificador de vn.entry + * + * @return vNewEntryFk Identificador de la nueva entrada + */ + + START TRANSACTION; + + INSERT INTO vn.entry(supplierFk, + dated, + isInventory, + notes, + isRaid, + commission, + travelFk, + currencyFk, + companyFk, + loadPriority) + SELECT supplierFk, + dated, + isInventory, + notes, + isRaid, + commission, + travelFk, + currencyFk, + companyFk, + loadPriority + FROM vn.entry e + WHERE e.id = vSelf; + + SET vNewEntryFk = LAST_INSERT_ID(); + + COMMIT; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59117,62 +59117,62 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_fixMisfit`(vSelf INT) -BEGIN -/** - * Arregla el descuadre de una entrada, agregando registros en vn.buy - * para compensar la diferencia * entre las etiquetas impresas y las esperadas - * - * @param vSelf Identificador de la entrada - */ - INSERT INTO vn.buy(entryFk, itemFk) - SELECT vSelf, i.id - FROM vn.item i - WHERE i.description = 'MISFIT' - LIMIT 1; - - INSERT INTO vn.buy(entryFk, - itemFk, - quantity, - buyingValue, - freightValue, - isIgnored, - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - location, - packageFk, - price1, - price2, - price3, - minPrice, - producer) - SELECT vSelf, - itemFk, - (printedStickers - stickers) * packing quantity, - buyingValue, - freightValue, - TRUE isIgnored, - printedStickers - stickers, - packing, - `grouping`, - groupingMode, - containerFk, - comissionValue, - packageValue, - location, - packageFk, - price1, - price2, - price3, - minPrice, - producer - FROM vn.buy b - WHERE b.entryFk = vSelf - AND b.printedStickers != b.stickers; +BEGIN +/** + * Arregla el descuadre de una entrada, agregando registros en vn.buy + * para compensar la diferencia * entre las etiquetas impresas y las esperadas + * + * @param vSelf Identificador de la entrada + */ + INSERT INTO vn.buy(entryFk, itemFk) + SELECT vSelf, i.id + FROM vn.item i + WHERE i.description = 'MISFIT' + LIMIT 1; + + INSERT INTO vn.buy(entryFk, + itemFk, + quantity, + buyingValue, + freightValue, + isIgnored, + stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + producer) + SELECT vSelf, + itemFk, + (printedStickers - stickers) * packing quantity, + buyingValue, + freightValue, + TRUE isIgnored, + printedStickers - stickers, + packing, + `grouping`, + groupingMode, + containerFk, + comissionValue, + packageValue, + location, + packageFk, + price1, + price2, + price3, + minPrice, + producer + FROM vn.buy b + WHERE b.entryFk = vSelf + AND b.printedStickers != b.stickers; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -59585,36 +59585,36 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `entry_splitMisfit`(vSelf INT) -BEGIN - - /* Divide una entrada, pasando los registros que ha insertado vn.entry_fixMisfit de la entrada original - * a la nueva - */ - - DECLARE vNewEntryFk INT; - DECLARE vBuyFk INT; - - SELECT MAX(b.id) INTO vBuyFk - FROM vn.buy b - JOIN vn.item i ON i.id = b.itemFk - WHERE b.entryFk = vSelf - AND i.description = 'MISFIT'; - - INSERT INTO vn.entry(supplierFk, dated, notes, travelFk, currencyFk, companyFk) - SELECT supplierFk, dated, CONCAT('E:',vSelf), travelFk, currencyFk, companyFk - FROM vn.entry e - WHERE e.id = vSelf; - - SET vNewEntryFk = LAST_INSERT_ID(); - - UPDATE vn.buy b - SET b.entryFk = vNewEntryFk - WHERE b.entryFk = vSelf - AND b.id > vBuyFk; - - SELECT vNewEntryFk; - - +BEGIN + + /* Divide una entrada, pasando los registros que ha insertado vn.entry_fixMisfit de la entrada original + * a la nueva + */ + + DECLARE vNewEntryFk INT; + DECLARE vBuyFk INT; + + SELECT MAX(b.id) INTO vBuyFk + FROM vn.buy b + JOIN vn.item i ON i.id = b.itemFk + WHERE b.entryFk = vSelf + AND i.description = 'MISFIT'; + + INSERT INTO vn.entry(supplierFk, dated, notes, travelFk, currencyFk, companyFk) + SELECT supplierFk, dated, CONCAT('E:',vSelf), travelFk, currencyFk, companyFk + FROM vn.entry e + WHERE e.id = vSelf; + + SET vNewEntryFk = LAST_INSERT_ID(); + + UPDATE vn.buy b + SET b.entryFk = vNewEntryFk + WHERE b.entryFk = vSelf + AND b.id > vBuyFk; + + SELECT vNewEntryFk; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60245,33 +60245,33 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_add`(vParam INT, vStateCode VARCHAR(100)) -BEGIN - - /** - * Inserta nuevos registros en la tabla vn.expeditionState, segun el parámetro - * - * @param vParam Identificador de vn.expedition o de vn.route - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - - IF (SELECT COUNT(*) FROM vn.route r WHERE r.id = vParam) THEN - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT e.id, est.id - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.expeditionStateType est ON est.code = vStateCode - WHERE t.routeFk = vParam; - - ELSE - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT vParam, est.id - FROM vn.expeditionStateType est - WHERE est.code = vStateCode; - - END IF; - +BEGIN + + /** + * Inserta nuevos registros en la tabla vn.expeditionState, segun el parámetro + * + * @param vParam Identificador de vn.expedition o de vn.route + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + + IF (SELECT COUNT(*) FROM vn.route r WHERE r.id = vParam) THEN + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT e.id, est.id + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.expeditionStateType est ON est.code = vStateCode + WHERE t.routeFk = vParam; + + ELSE + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT vParam, est.id + FROM vn.expeditionStateType est + WHERE est.code = vStateCode; + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60289,23 +60289,23 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByAdress`(vAdressFk INT, vRouteFk INT, vStateCode VARCHAR(100)) -BEGIN - - /** - * Inserta nuevos registros en la tabla vn.expeditionState - * - * @param vAdressFk Identificador de vn.ticket - * @param vRouteFk Identificador de vn.route - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT e.id, est.id - FROM vn.expedition e - JOIN vn.expeditionStateType est ON est.code = vStateCode - JOIN vn.ticket t ON t.id = e.ticketFk - WHERE t.addressFk = vAdressFk AND t.routeFk = vRouteFk; - +BEGIN + + /** + * Inserta nuevos registros en la tabla vn.expeditionState + * + * @param vAdressFk Identificador de vn.ticket + * @param vRouteFk Identificador de vn.route + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT e.id, est.id + FROM vn.expedition e + JOIN vn.expeditionStateType est ON est.code = vStateCode + JOIN vn.ticket t ON t.id = e.ticketFk + WHERE t.addressFk = vAdressFk AND t.routeFk = vRouteFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60323,20 +60323,20 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByExpedition`(vExpeditionFk INT, vStateCode VARCHAR(100)) -BEGIN - - /** - * Inserta nuevos registros en la tabla vn.expeditionState - * - * @param vExpeditionFk Identificador de vn.expedition - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT vExpeditionFk, est.id - FROM vn.expeditionStateType est - WHERE est.code = vStateCode; - +BEGIN + + /** + * Inserta nuevos registros en la tabla vn.expeditionState + * + * @param vExpeditionFk Identificador de vn.expedition + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT vExpeditionFk, est.id + FROM vn.expeditionStateType est + WHERE est.code = vStateCode; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60390,22 +60390,22 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `expeditionState_addByRoute`(vRouteFk INT, vStateCode VARCHAR(100)) -BEGIN - - /** - * Inserta nuevos registros en la tabla vn.expeditionState, por rutas - * - * @param vRouteFk Identificador de vn.route - * @param vStateCode Corresponde a vn.expeditionStateType.code - */ - - INSERT INTO vn.expeditionState(expeditionFk, typeFk) - SELECT e.id, est.id - FROM vn.expedition e - JOIN vn.ticket t ON t.id = e.ticketFk - JOIN vn.expeditionStateType est ON est.code = vStateCode - WHERE t.routeFk = vRouteFk; - +BEGIN + + /** + * Inserta nuevos registros en la tabla vn.expeditionState, por rutas + * + * @param vRouteFk Identificador de vn.route + * @param vStateCode Corresponde a vn.expeditionStateType.code + */ + + INSERT INTO vn.expeditionState(expeditionFk, typeFk) + SELECT e.id, est.id + FROM vn.expedition e + JOIN vn.ticket t ON t.id = e.ticketFk + JOIN vn.expeditionStateType est ON est.code = vStateCode + WHERE t.routeFk = vRouteFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60792,15 +60792,15 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `freelance_getInfo`(workerFk INT) -BEGIN - SELECT s.name, s.street, s.city, s.nif, s.postCode - FROM route r - JOIN agencyMode am ON r.agencyModeFk = am.id - JOIN agency a ON am.agencyFk = a.id - JOIN supplier s ON a.supplierFk = s.id - WHERE r.workerFk = workerFk - ORDER BY r.id DESC - LIMIT 1; +BEGIN + SELECT s.name, s.street, s.city, s.nif, s.postCode + FROM route r + JOIN agencyMode am ON r.agencyModeFk = am.id + JOIN agency a ON am.agencyFk = a.id + JOIN supplier s ON a.supplierFk = s.id + WHERE r.workerFk = workerFk + ORDER BY r.id DESC + LIMIT 1; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60818,81 +60818,81 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControl`(vFromDated DATE, vToDated DATE) -BEGIN - - DECLARE vSijsnerClientFk INT DEFAULT 19752; - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SET vDateStart = vFromDated; - SET vDateEnd = util.Dayend(vToDated); - - SELECT p.id FustCode, - CAST(sent.stucks AS DECIMAL(10,0)) FH, - CAST(tp.stucks AS DECIMAL(10,0)) Tickets, - CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner, - CAST(IFNULL(sent.stucks,0) - IFNULL(tp.stucks,0) + IFNULL(sj.stucks,0) AS DECIMAL(10,0)) saldo - FROM vn.packaging p - LEFT JOIN ( - SELECT FustCode, sum(fustQuantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,b.packageFk) FustCode, s.quantity / b.packing AS fustQuantity - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - JOIN vn.packaging p ON p.id = b.packageFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA') sub - GROUP BY FustCode) sent ON sent.FustCode = p.id - LEFT JOIN ( - SELECT FustCode, sum(quantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vDateStart AND vDateEnd - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA' - AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0) sub - GROUP BY FustCode) tp ON tp.FustCode = p.id - LEFT JOIN ( - SELECT FustCode, sum(quantity) stucks - FROM ( - SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, 1, vDateStart ) AND TIMESTAMPADD(DAY, 1, vDateEnd ) - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND t.clientFk = vSijsnerClientFk) sub - GROUP BY FustCode) sj ON sj.FustCode = p.id - WHERE sent.stucks - OR tp.stucks - OR sj.stucks; - +BEGIN + + DECLARE vSijsnerClientFk INT DEFAULT 19752; + + DECLARE vDateStart DATETIME; + DECLARE vDateEnd DATETIME; + + SET vDateStart = vFromDated; + SET vDateEnd = util.Dayend(vToDated); + + SELECT p.id FustCode, + CAST(sent.stucks AS DECIMAL(10,0)) FH, + CAST(tp.stucks AS DECIMAL(10,0)) Tickets, + CAST(-sj.stucks AS DECIMAL(10,0)) Sijsner, + CAST(IFNULL(sent.stucks,0) - IFNULL(tp.stucks,0) + IFNULL(sj.stucks,0) AS DECIMAL(10,0)) saldo + FROM vn.packaging p + LEFT JOIN ( + SELECT FustCode, sum(fustQuantity) stucks + FROM ( + SELECT IFNULL(pe.equivalentFk ,b.packageFk) FustCode, s.quantity / b.packing AS fustQuantity + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk + JOIN vn.buy b ON b.id = lb.buy_id + JOIN vn.packaging p ON p.id = b.packageFk + LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk + WHERE t.shipped BETWEEN vDateStart AND vDateEnd + AND wa.name = 'VNH' + AND p.isPackageReturnable + AND c.country = 'FRANCIA') sub + GROUP BY FustCode) sent ON sent.FustCode = p.id + LEFT JOIN ( + SELECT FustCode, sum(quantity) stucks + FROM ( + SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk + LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk + WHERE t.shipped BETWEEN vDateStart AND vDateEnd + AND wa.name = 'VNH' + AND p.isPackageReturnable + AND c.country = 'FRANCIA' + AND t.clientFk != vSijsnerClientFk + AND tp.quantity > 0) sub + GROUP BY FustCode) tp ON tp.FustCode = p.id + LEFT JOIN ( + SELECT FustCode, sum(quantity) stucks + FROM ( + SELECT IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, tp.quantity + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk + LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id + WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, 1, vDateStart ) AND TIMESTAMPADD(DAY, 1, vDateEnd ) + AND wa.name = 'VNH' + AND p.isPackageReturnable + AND t.clientFk = vSijsnerClientFk) sub + GROUP BY FustCode) sj ON sj.FustCode = p.id + WHERE sent.stucks + OR tp.stucks + OR sj.stucks; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -60910,38 +60910,38 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `fustControlDetail`(vFromDated DATE, vToDated DATE) -BEGIN - - DECLARE vSijsnerClientFk INT DEFAULT 19752; - - DECLARE vDateStart DATETIME; - DECLARE vDateEnd DATETIME; - - SET vDateStart = vFromDated; - SET vDateEnd = util.Dayend(vToDated); - - SELECT a.nickname shopName, - a.city , - IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, - tp.quantity, - tp.ticketFk, - CONCAT('From ', vFromDated,' to ', vToDated) AS dateRange - FROM vn.ticketPackaging tp - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk - JOIN vn.packaging p ON p.id = tp.packagingFk - LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p2 ON p2.id = a.provinceFk - JOIN vn.country c ON c.id = p2.countryFk - WHERE t.shipped BETWEEN vFromDated AND util.dayend(vToDated) - AND wa.name = 'VNH' - AND p.isPackageReturnable - AND c.country = 'FRANCIA' - AND t.clientFk != vSijsnerClientFk - AND tp.quantity > 0; - +BEGIN + + DECLARE vSijsnerClientFk INT DEFAULT 19752; + + DECLARE vDateStart DATETIME; + DECLARE vDateEnd DATETIME; + + SET vDateStart = vFromDated; + SET vDateEnd = util.Dayend(vToDated); + + SELECT a.nickname shopName, + a.city , + IFNULL(pe.equivalentFk ,tp.packagingFk) FustCode, + tp.quantity, + tp.ticketFk, + CONCAT('From ', vFromDated,' to ', vToDated) AS dateRange + FROM vn.ticketPackaging tp + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.warehouseAlias wa ON wa.id = w.aliasFk + JOIN vn.packaging p ON p.id = tp.packagingFk + LEFT JOIN vn.packageEquivalent pe ON pe.packagingFk = p.id + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p2 ON p2.id = a.provinceFk + JOIN vn.country c ON c.id = p2.countryFk + WHERE t.shipped BETWEEN vFromDated AND util.dayend(vToDated) + AND wa.name = 'VNH' + AND p.isPackageReturnable + AND c.country = 'FRANCIA' + AND t.clientFk != vSijsnerClientFk + AND tp.quantity > 0; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -61232,25 +61232,25 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `intrastat_data_neto_Update`(IN vInvoiceInFk INT) -BEGIN - - UPDATE vn2008.intrastat_data id - JOIN ( - SELECT i.intrastatFk, - LEAST(SUM(b.quantity) * IFNULL(it.gramsMax,100000) / 1000, - SUM(ic.cm3 * b.quantity) * IF(i.density, i.density, it.density) / 1000000) as neto - FROM entry e - JOIN travel tr ON tr.id = e.travelFk - JOIN buy b ON b.entryFk = e.id - JOIN item i ON i.id = b.itemFk - join itemType it ON it.id = i.typeFk - JOIN itemCost ic ON ic.itemFk = i.id AND tr.warehouseInFk = ic.warehouseFk - WHERE e.invoiceInFk = vinvoiceInFk - GROUP BY i.intrastatFk) sub ON sub.intrastatFk = id.intrastat_id - SET id.neto = ROUND(sub.neto, 1) - WHERE id.recibida_id = vInvoiceInFk; - - +BEGIN + + UPDATE vn2008.intrastat_data id + JOIN ( + SELECT i.intrastatFk, + LEAST(SUM(b.quantity) * IFNULL(it.gramsMax,100000) / 1000, + SUM(ic.cm3 * b.quantity) * IF(i.density, i.density, it.density) / 1000000) as neto + FROM entry e + JOIN travel tr ON tr.id = e.travelFk + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + join itemType it ON it.id = i.typeFk + JOIN itemCost ic ON ic.itemFk = i.id AND tr.warehouseInFk = ic.warehouseFk + WHERE e.invoiceInFk = vinvoiceInFk + GROUP BY i.intrastatFk) sub ON sub.intrastatFk = id.intrastat_id + SET id.neto = ROUND(sub.neto, 1) + WHERE id.recibida_id = vInvoiceInFk; + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63024,46 +63024,46 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceInDueDay_calculate`(vInvoiceInFk INT) -BEGIN - - IF !(SELECT COUNT(*) - FROM invoiceInDueDay iid - WHERE iid.invoiceInFk = vInvoiceInFk) THEN - - INSERT INTO invoiceInDueDay (invoiceInFk, - dueDated, - amount, - foreignValue) - SELECT vInvoiceInFk, - IF(payDay, - IF(vn.getNextDueDate(issued, detail, payDay) < DATE_ADD(created, INTERVAL 2 DAY), - DATE_ADD(created, INTERVAL 2 DAY), - vn.getNextDueDate(issued, detail, payDay)), - GREATEST(TIMESTAMPADD(DAY, 2, created), TIMESTAMPADD(DAY, detail, issued))), - IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), - IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) - FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detail)) venc, - SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detail)) foreignValue, - s.payDemFk, - ii.companyFk, - COUNT(DISTINCT(pdd.detail)) cont, - s.payDay, - ii.issued, - DATE(ii.created) created - FROM invoiceIn ii - JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id - LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk - JOIN supplier s ON s.id = ii.supplierFk - JOIN supplier s2 ON s2.id = ii.companyFk - JOIN vn.payDemDetail pdd ON pdd.id = s.payDemFk - WHERE ii.id = vInvoiceInFk - GROUP BY ii.id - ) sub - JOIN (SELECT @cont:=0) sub2 - JOIN vn.payDemDetail pdd ON pdd.id = sub.payDemFk - GROUP BY detail; - END IF; - +BEGIN + + IF !(SELECT COUNT(*) + FROM invoiceInDueDay iid + WHERE iid.invoiceInFk = vInvoiceInFk) THEN + + INSERT INTO invoiceInDueDay (invoiceInFk, + dueDated, + amount, + foreignValue) + SELECT vInvoiceInFk, + IF(payDay, + IF(vn.getNextDueDate(issued, detail, payDay) < DATE_ADD(created, INTERVAL 2 DAY), + DATE_ADD(created, INTERVAL 2 DAY), + vn.getNextDueDate(issued, detail, payDay)), + GREATEST(TIMESTAMPADD(DAY, 2, created), TIMESTAMPADD(DAY, detail, issued))), + IF((@cont:=@cont + 1) < cont, TRUNCATE(venc / cont, 2),venc-(TRUNCATE(venc / cont, 2) * (cont - 1))), + IF(@cont < cont, TRUNCATE(foreignValue / cont, 2), foreignValue - (TRUNCATE(foreignValue / cont, 2) * (cont - 1))) + FROM ( SELECT SUM((1 + (IFNULL(ti.PorcentajeIva, 0) / 100)*(s.countryFk = s2.countryFk)) * iit.taxableBase)/COUNT(DISTINCT(pdd.detail)) venc, + SUM(iit.foreignValue)/COUNT(DISTINCT(pdd.detail)) foreignValue, + s.payDemFk, + ii.companyFk, + COUNT(DISTINCT(pdd.detail)) cont, + s.payDay, + ii.issued, + DATE(ii.created) created + FROM invoiceIn ii + JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id + LEFT JOIN sage.TiposIva AS ti ON ti.CodigoIva= iit.taxTypeSageFk + JOIN supplier s ON s.id = ii.supplierFk + JOIN supplier s2 ON s2.id = ii.companyFk + JOIN vn.payDemDetail pdd ON pdd.id = s.payDemFk + WHERE ii.id = vInvoiceInFk + GROUP BY ii.id + ) sub + JOIN (SELECT @cont:=0) sub2 + JOIN vn.payDemDetail pdd ON pdd.id = sub.payDemFk + GROUP BY detail; + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -63970,225 +63970,225 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new`( - vSerial VARCHAR(255), - vInvoiceDate DATETIME, - vTaxArea VARCHAR(25), +CREATE DEFINER=`root`@`localhost` PROCEDURE `invoiceOut_new`( + vSerial VARCHAR(255), + vInvoiceDate DATETIME, + vTaxArea VARCHAR(25), OUT vNewInvoiceId INT) -BEGIN - -/* Creación de facturas emitidas. -* requiere previamente tabla ticketToInvoice(id). -* -* @param vSerial serie a la cual se hace la factura -* @param vInvoiceDate fecha de la factura -* @param vTaxArea tipo de iva en relacion a la empresa y al cliente -* @param vNewInvoiceId id de la factura que se acaba de generar -* -* @return vNewInvoiceId -*/ - - DECLARE vSpainCountryCode INT DEFAULT 1; - DECLARE vIsAnySaleToInvoice BOOL; - DECLARE vIsAnyServiceToInvoice BOOL; - DECLARE vNewRef VARCHAR(255); - DECLARE vWorker INT DEFAULT account.myUser_getId(); - DECLARE vCompany INT; - DECLARE vSupplier 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 vNewInvoiceInId INT; - DECLARE vIsInterCompany BOOL; - - 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; - - -- 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 - OR t.isDeleted - OR c.hasToInvoice = FALSE; - - SELECT SUM(s.quantity * s.price * (100 - s.discount)/100), ts.id - INTO vIsAnySaleToInvoice, vIsAnyServiceToInvoice - FROM ticketToInvoice t - LEFT JOIN sale s ON s.ticketFk = t.id - LEFT JOIN ticketService ts ON ts.ticketFk = t.id; - - IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice) - AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase()) - THEN - - -- 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 - LEFT 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,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; - - DROP TEMPORARY TABLE tmp.updateInter; - - SELECT ios.isCEE INTO vIsInterCompany - FROM vn.ticket t - JOIN vn.company c ON c.clientFk = t.clientFk - JOIN vn.invoiceOut io ON io.`ref` = t.refFk - JOIN vn.invoiceOutSerial ios ON ios.code = io.serial - WHERE t.refFk = vNewRef; - - IF (vIsInterCompany) THEN - - SELECT vCompany INTO vSupplier; - SELECT id INTO vCompany FROM company WHERE clientFk = vClient; - - INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk) - SELECT vSupplier, vNewRef, vInvoiceDate, vCompany; - - SET vNewInvoiceInId = LAST_INSERT_ID(); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - (KEY (ticketFk)) - ENGINE = MEMORY - SELECT id ticketFk - FROM ticketToInvoice; - - CALL `ticket_getTax`('NATIONAL'); - - SET @vTaxableBaseServices := 0.00; - SET @vTaxCodeGeneral := NULL; - - INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) - SELECT vNewInvoiceInId, @vTaxableBaseServices, sub.expenceFk, sub.taxTypeSageFk , sub.transactionTypeSageFk - FROM ( - SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk, @vTaxCodeGeneral := i.taxClassCodeFk - FROM tmp.ticketServiceTax tst - JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code - WHERE i.isService - HAVING taxableBase - ) sub; - - INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) - SELECT vNewInvoiceInId, SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, @vTaxableBaseServices, 0) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk - FROM tmp.ticketTax tt - JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code - WHERE !i.isService - GROUP BY tt.pgcFk - HAVING taxableBase - ORDER BY tt.priority; - - CALL `vn`.`invoiceInDueDay_calculate`(vNewInvoiceInId); - - INSERT INTO vn2008.intrastat_data (recibida_id, intrastat_id, importe, unidades, Paises_Id, neto) - SELECT - vNewInvoiceInId, - i.intrastatFk, - CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100)) AS DECIMAL(10,2)) importe, - CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL (10 , 2 )) stems, - s2.countryFk, - CAST(SUM(IF(sv.physicalWeight, sv.physicalWeight, i.density * sub.cm3delivery/1000000)) AS DECIMAL(10,2)) neto - FROM vn.sale s - LEFT JOIN (SELECT ic.itemFk, ic.cm3delivery - FROM vn.itemCost ic - WHERE ic.cm3 - GROUP BY ic.itemFk) sub ON s.itemFk = sub.itemFk - LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id - LEFT JOIN vn.ticket t ON s.ticketFk = t.id - LEFT JOIN vn.supplier s2 ON s2.id = t.companyFk - LEFT JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.intrastat it ON it.id = i.intrastatFk - JOIN vn.invoiceOut iOut ON iOut.ref = t.refFk - WHERE iOut.`ref` = vNewRef - GROUP BY i.intrastatFk - ORDER BY i.intrastatFk; - - - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticketAmount; - DROP TEMPORARY TABLE tmp.ticketTax; - DROP TEMPORARY TABLE tmp.ticketServiceTax; - - END IF; - - END IF; - - DROP TEMPORARY TABLE `ticketToInvoice`; +BEGIN + +/* Creación de facturas emitidas. +* requiere previamente tabla ticketToInvoice(id). +* +* @param vSerial serie a la cual se hace la factura +* @param vInvoiceDate fecha de la factura +* @param vTaxArea tipo de iva en relacion a la empresa y al cliente +* @param vNewInvoiceId id de la factura que se acaba de generar +* +* @return vNewInvoiceId +*/ + + DECLARE vSpainCountryCode INT DEFAULT 1; + DECLARE vIsAnySaleToInvoice BOOL; + DECLARE vIsAnyServiceToInvoice BOOL; + DECLARE vNewRef VARCHAR(255); + DECLARE vWorker INT DEFAULT account.myUser_getId(); + DECLARE vCompany INT; + DECLARE vSupplier 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 vNewInvoiceInId INT; + DECLARE vIsInterCompany BOOL; + + 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; + + -- 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 + OR t.isDeleted + OR c.hasToInvoice = FALSE; + + SELECT SUM(s.quantity * s.price * (100 - s.discount)/100), ts.id + INTO vIsAnySaleToInvoice, vIsAnyServiceToInvoice + FROM ticketToInvoice t + LEFT JOIN sale s ON s.ticketFk = t.id + LEFT JOIN ticketService ts ON ts.ticketFk = t.id; + + IF (vIsAnySaleToInvoice OR vIsAnyServiceToInvoice) + AND (vCorrectingSerial = vSerial OR NOT hasAnyNegativeBase()) + THEN + + -- 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 + LEFT 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,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; + + DROP TEMPORARY TABLE tmp.updateInter; + + SELECT ios.isCEE INTO vIsInterCompany + FROM vn.ticket t + JOIN vn.company c ON c.clientFk = t.clientFk + JOIN vn.invoiceOut io ON io.`ref` = t.refFk + JOIN vn.invoiceOutSerial ios ON ios.code = io.serial + WHERE t.refFk = vNewRef; + + IF (vIsInterCompany) THEN + + SELECT vCompany INTO vSupplier; + SELECT id INTO vCompany FROM company WHERE clientFk = vClient; + + INSERT INTO invoiceIn(supplierFk, supplierRef, issued, companyFk) + SELECT vSupplier, vNewRef, vInvoiceDate, vCompany; + + SET vNewInvoiceInId = LAST_INSERT_ID(); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (KEY (ticketFk)) + ENGINE = MEMORY + SELECT id ticketFk + FROM ticketToInvoice; + + CALL `ticket_getTax`('NATIONAL'); + + SET @vTaxableBaseServices := 0.00; + SET @vTaxCodeGeneral := NULL; + + INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInId, @vTaxableBaseServices, sub.expenceFk, sub.taxTypeSageFk , sub.transactionTypeSageFk + FROM ( + SELECT @vTaxableBaseServices := SUM(tst.taxableBase) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk, @vTaxCodeGeneral := i.taxClassCodeFk + FROM tmp.ticketServiceTax tst + JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tst.code + WHERE i.isService + HAVING taxableBase + ) sub; + + INSERT INTO vn.invoiceInTax(invoiceInFk, taxableBase, expenceFk, taxTypeSageFk, transactionTypeSageFk) + SELECT vNewInvoiceInId, SUM(tt.taxableBase) - IF(tt.code = @vTaxCodeGeneral, @vTaxableBaseServices, 0) taxableBase, i.expenceFk, i.taxTypeSageFk , i.transactionTypeSageFk + FROM tmp.ticketTax tt + JOIN vn.invoiceOutTaxConfig i ON i.taxClassCodeFk = tt.code + WHERE !i.isService + GROUP BY tt.pgcFk + HAVING taxableBase + ORDER BY tt.priority; + + CALL `vn`.`invoiceInDueDay_calculate`(vNewInvoiceInId); + + INSERT INTO vn2008.intrastat_data (recibida_id, intrastat_id, importe, unidades, Paises_Id, neto) + SELECT + vNewInvoiceInId, + i.intrastatFk, + CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100)) AS DECIMAL(10,2)) importe, + CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL (10 , 2 )) stems, + s2.countryFk, + CAST(SUM(IF(sv.physicalWeight, sv.physicalWeight, i.density * sub.cm3delivery/1000000)) AS DECIMAL(10,2)) neto + FROM vn.sale s + LEFT JOIN (SELECT ic.itemFk, ic.cm3delivery + FROM vn.itemCost ic + WHERE ic.cm3 + GROUP BY ic.itemFk) sub ON s.itemFk = sub.itemFk + LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id + LEFT JOIN vn.ticket t ON s.ticketFk = t.id + LEFT JOIN vn.supplier s2 ON s2.id = t.companyFk + LEFT JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.intrastat it ON it.id = i.intrastatFk + JOIN vn.invoiceOut iOut ON iOut.ref = t.refFk + WHERE iOut.`ref` = vNewRef + GROUP BY i.intrastatFk + ORDER BY i.intrastatFk; + + + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketAmount; + DROP TEMPORARY TABLE tmp.ticketTax; + DROP TEMPORARY TABLE tmp.ticketServiceTax; + + END IF; + + END IF; + + DROP TEMPORARY TABLE `ticketToInvoice`; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -64596,84 +64596,84 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemCard`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT, IN isBarcode BOOL) -BEGIN - - /* - * @deprecated: Utilizar item_getInfo - */ - - DECLARE vCacheVisibleFk INT; - DECLARE vCacheAvailableFk INT; - DECLARE vVisibleAltillo INT; - DECLARE vItemFk INT; - - IF isBarcode THEN - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - ELSE - SELECT i.id INTO vItemFk - FROM vn.item i - WHERE i.name LIKE CONCAT('%',vBarcode,'%') - ORDER BY i.id ASC - LIMIT 1; - END IF; - - IF vItemFk IS NULL THEN - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - END IF; - - CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); - CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); - - SELECT SUM(visible) INTO vVisibleAltillo - FROM vn.itemShelvingStock - WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); - - SELECT i.id, - i.longName, - i.tag5, - i.value5, - i.tag6, - i.value6, - i.tag7, - i.value7, - i.image, - i.size, - i.stems, - i.category, - i.minimum as min, - i.upToDown as repo, - p.name as producer, - o.code as origin, - ip.code as nicho, - ip.reserve as reserva, - v.visible - IFNULL(vVisibleAltillo,0) as enNicho, - a.available, - vVisibleAltillo as enAltillo, - v.visible as total, - c.`grouping` as `grouping`, - c.Packing as packing, - CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, - CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, - i.itemPackingTypeFk, - i.comment as referencia - FROM vn.item i - LEFT JOIN vn.producer p ON p.id = i.producerFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.itemPlacement ip ON ip.itemFk = i.id - LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id - LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id - LEFT JOIN ( - SELECT b.itemFk, b2.`grouping`, b2.packing - FROM tmp.buyUltimate b - JOIN vn.buy b2 ON b2.id = b.buyFk - WHERE b.warehouseFk = vWarehouseFk - ) c ON i.id = c.itemFk - WHERE i.id = vItemFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; - +BEGIN + + /* + * @deprecated: Utilizar item_getInfo + */ + + DECLARE vCacheVisibleFk INT; + DECLARE vCacheAvailableFk INT; + DECLARE vVisibleAltillo INT; + DECLARE vItemFk INT; + + IF isBarcode THEN + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + ELSE + SELECT i.id INTO vItemFk + FROM vn.item i + WHERE i.name LIKE CONCAT('%',vBarcode,'%') + ORDER BY i.id ASC + LIMIT 1; + END IF; + + IF vItemFk IS NULL THEN + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + END IF; + + CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); + CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); + + SELECT SUM(visible) INTO vVisibleAltillo + FROM vn.itemShelvingStock + WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; + + CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + + SELECT i.id, + i.longName, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.image, + i.size, + i.stems, + i.category, + i.minimum as min, + i.upToDown as repo, + p.name as producer, + o.code as origin, + ip.code as nicho, + ip.reserve as reserva, + v.visible - IFNULL(vVisibleAltillo,0) as enNicho, + a.available, + vVisibleAltillo as enAltillo, + v.visible as total, + c.`grouping` as `grouping`, + c.Packing as packing, + CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, + CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, + i.itemPackingTypeFk, + i.comment as referencia + FROM vn.item i + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN vn.itemPlacement ip ON ip.itemFk = i.id + LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id + LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id + LEFT JOIN ( + SELECT b.itemFk, b2.`grouping`, b2.packing + FROM tmp.buyUltimate b + JOIN vn.buy b2 ON b2.id = b.buyFk + WHERE b.warehouseFk = vWarehouseFk + ) c ON i.id = c.itemFk + WHERE i.id = vItemFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -64781,119 +64781,119 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemDiary__`(IN vItemId INT, IN vWarehouse INT) -BEGIN - DECLARE vDateInventory DATETIME; - DECLARE vCurdate DATE DEFAULT CURDATE(); - DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); - - SELECT vn.barcodeToItem(vItemId) INTO vItemId; - - -- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance - SELECT inventoried INTO vDateInventory FROM config; - SET @a = 0; - SELECT DATE(date) AS date, - alertLevel, - stateName, - origin, - reference, - clientFk, - name, - `in`, - `out`, - @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, - isPicked, - isTicket, - `in` as invalue - FROM - ( SELECT tr.landed as date, - b.quantity as `in`, - NULL as `out`, - IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, - st.name AS stateName, - s.name as name, - e.ref as reference, - e.id as origin, - s.id as clientFk, - TRUE isPicked, - FALSE AS isTicket - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.id = - CASE - WHEN tr.isReceived != FALSE THEN 3 - WHEN tr.isDelivered THEN 1 - ELSE 0 - END - JOIN state st ON st.code = al.code - WHERE tr.landed >= vDateInventory - AND vWarehouse = tr.warehouseInFk - AND b.itemFk = vItemId - AND e.isInventory = 0 - AND e.isRaid = 0 - UNION ALL - - SELECT tr.shipped as date, - NULL as `in`, - b.quantity as `out`, - IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, - st.name AS stateName, - s.name as name, - e.ref as reference, - e.id as origin, - s.id as clientFk, - TRUE isPicked, - FALSE AS isTicket - FROM buy b - JOIN entry e ON e.id = b.entryFk - JOIN travel tr ON tr.id = e.travelFk - JOIN warehouse w ON w.id = tr.warehouseOutFk - JOIN supplier s ON s.id = e.supplierFk - JOIN alertLevel al ON al.id = - CASE - WHEN tr.isReceived != FALSE THEN 3 - WHEN tr.isDelivered THEN 1 - ELSE 0 - END - JOIN state st ON st.code = al.code - WHERE tr.shipped >= vDateInventory - AND vWarehouse =tr.warehouseOutFk - AND s.id <> 4 - AND b.itemFk = vItemId - AND e.isInventory = 0 - AND w.isFeedStock = 0 - AND e.isRaid = 0 - UNION ALL - - SELECT t.shipped as date, - NULL as `in`, - s.quantity as `out`, - al.id as alertLevel, - st.name AS stateName, - t.nickname as name, - t.refFk as reference, - t.id as origin, - t.clientFk, - stk.id as isPicked, -- TRUE as isPicked - TRUE as isTicket - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - LEFT JOIN ticketState ts ON ts.ticket = t.id - LEFT JOIN state st ON st.code = ts.code - JOIN client c ON c.id = t.clientFk - JOIN alertLevel al ON al.id = - CASE - WHEN t.shipped < vCurdate THEN 3 - WHEN t.shipped > vDayEnd THEN 0 - ELSE IFNULL(ts.alertLevel, 0) - END - LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14 -- comentar - WHERE t.shipped >= vDateInventory - AND s.itemFk = vItemId - AND vWarehouse =t.warehouseFk - ) AS itemDiary - ORDER BY date, isTicket, alertLevel DESC, isPicked DESC, `in` DESC, `out` DESC; +BEGIN + DECLARE vDateInventory DATETIME; + DECLARE vCurdate DATE DEFAULT CURDATE(); + DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); + + SELECT vn.barcodeToItem(vItemId) INTO vItemId; + + -- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance + SELECT inventoried INTO vDateInventory FROM config; + SET @a = 0; + SELECT DATE(date) AS date, + alertLevel, + stateName, + origin, + reference, + clientFk, + name, + `in`, + `out`, + @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, + isPicked, + isTicket, + `in` as invalue + FROM + ( SELECT tr.landed as date, + b.quantity as `in`, + NULL as `out`, + IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, + st.name AS stateName, + s.name as name, + e.ref as reference, + e.id as origin, + s.id as clientFk, + TRUE isPicked, + FALSE AS isTicket + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.id = + CASE + WHEN tr.isReceived != FALSE THEN 3 + WHEN tr.isDelivered THEN 1 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.landed >= vDateInventory + AND vWarehouse = tr.warehouseInFk + AND b.itemFk = vItemId + AND e.isInventory = 0 + AND e.isRaid = 0 + UNION ALL + + SELECT tr.shipped as date, + NULL as `in`, + b.quantity as `out`, + IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel, + st.name AS stateName, + s.name as name, + e.ref as reference, + e.id as origin, + s.id as clientFk, + TRUE isPicked, + FALSE AS isTicket + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.id = + CASE + WHEN tr.isReceived != FALSE THEN 3 + WHEN tr.isDelivered THEN 1 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.shipped >= vDateInventory + AND vWarehouse =tr.warehouseOutFk + AND s.id <> 4 + AND b.itemFk = vItemId + AND e.isInventory = 0 + AND w.isFeedStock = 0 + AND e.isRaid = 0 + UNION ALL + + SELECT t.shipped as date, + NULL as `in`, + s.quantity as `out`, + al.id as alertLevel, + st.name AS stateName, + t.nickname as name, + t.refFk as reference, + t.id as origin, + t.clientFk, + stk.id as isPicked, -- TRUE as isPicked + TRUE as isTicket + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN ticketState ts ON ts.ticket = t.id + LEFT JOIN state st ON st.code = ts.code + JOIN client c ON c.id = t.clientFk + JOIN alertLevel al ON al.id = + CASE + WHEN t.shipped < vCurdate THEN 3 + WHEN t.shipped > vDayEnd THEN 0 + ELSE IFNULL(ts.alertLevel, 0) + END + LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14 -- comentar + WHERE t.shipped >= vDateInventory + AND s.itemFk = vItemId + AND vWarehouse =t.warehouseFk + ) AS itemDiary + ORDER BY date, isTicket, alertLevel DESC, isPicked DESC, `in` DESC, `out` DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -66882,31 +66882,31 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelvingSaleSupplyAdd`(vItemShelvingFk INT, saleFk INT, vQuantity INT) -BEGIN -/** - * Añade línea a itemShelvingSale y regulariza el carro - * - * @param vItemShelvingFk Id itemShelving - * @param saleFk Id de sale - * @param vQuantity cantidad a regularizar - */ - INSERT INTO itemShelvingSale(itemShelvingFk, - saleFk, - quantity, - userFk) - VALUES (vItemShelvingFk, - saleFk, - vQuantity, - getUser()); - - UPDATE itemShelving - SET visible = visible - vQuantity - WHERE id = vItemShelvingFk; - - UPDATE vn2008.Movimientos_mark - SET valor = 1 - WHERE Id_Movimiento = saleFk; - +BEGIN +/** + * Añade línea a itemShelvingSale y regulariza el carro + * + * @param vItemShelvingFk Id itemShelving + * @param saleFk Id de sale + * @param vQuantity cantidad a regularizar + */ + INSERT INTO itemShelvingSale(itemShelvingFk, + saleFk, + quantity, + userFk) + VALUES (vItemShelvingFk, + saleFk, + vQuantity, + getUser()); + + UPDATE itemShelving + SET visible = visible - vQuantity + WHERE id = vItemShelvingFk; + + UPDATE vn2008.Movimientos_mark + SET valor = 1 + WHERE Id_Movimiento = saleFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67415,46 +67415,46 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemShelving_inventory`(vParkingFromFk INT, vParkingToFk INT) -BEGIN - - /** - * Devuelve un listado de ubicaciones a revisar - * - * @param vParkingFromFk Parking de partida, identificador de vn.parking - * @param vParkingToFk Parking de llegada, identificador de vn.parking - */ - - DECLARE vSectorFk INT; - DECLARE vPickingOrderFrom INT; - DECLARE vPickingOrderTo INT; - - SELECT p.sectorFk, p.pickingOrder INTO vSectorFk, vPickingOrderFrom - FROM vn.parking p - WHERE p.id = vParkingFromFk; - - SELECT p.pickingOrder INTO vPickingOrderTo - FROM vn.parking p - WHERE p.id = vParkingToFk; - - CALL vn.visible_getMisfit(vSectorFk); - - SELECT p.code parking , - ish.shelvingFk , - ish.itemFk, - i.longName, - ish.visible , - ish.visible / ish.packing packs, - ish.packing, - sm.visible - sm.parked faltan - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo - AND p.sectorFk = vSectorFk - ORDER BY p.pickingOrder ; - +BEGIN + + /** + * Devuelve un listado de ubicaciones a revisar + * + * @param vParkingFromFk Parking de partida, identificador de vn.parking + * @param vParkingToFk Parking de llegada, identificador de vn.parking + */ + + DECLARE vSectorFk INT; + DECLARE vPickingOrderFrom INT; + DECLARE vPickingOrderTo INT; + + SELECT p.sectorFk, p.pickingOrder INTO vSectorFk, vPickingOrderFrom + FROM vn.parking p + WHERE p.id = vParkingFromFk; + + SELECT p.pickingOrder INTO vPickingOrderTo + FROM vn.parking p + WHERE p.id = vParkingToFk; + + CALL vn.visible_getMisfit(vSectorFk); + + SELECT p.code parking , + ish.shelvingFk , + ish.itemFk, + i.longName, + ish.visible , + ish.visible / ish.packing packs, + ish.packing, + sm.visible - sm.parked faltan + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + JOIN tmp.stockMisfit sm ON sm.itemFk = ish.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + WHERE p.pickingOrder BETWEEN vPickingOrderFrom AND vPickingOrderTo + AND p.sectorFk = vSectorFk + ORDER BY p.pickingOrder ; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67595,74 +67595,74 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemStockUpdate__`( - vItemFk INT, - vWarehouseFk INT, - vNewVisible INT, +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemStockUpdate__`( + vItemFk INT, + vWarehouseFk INT, + vNewVisible INT, vIsTrash BOOLEAN) -BEGIN - - DECLARE vTicketFk INT; - DECLARE vClientFk INT; - DECLARE vCompanyVnlFk INT DEFAULT 442; - DECLARE vVisible INT DEFAULT 0; - DECLARE vCalc INT; - DECLARE vParkedStuff INT; - - SELECT barcodeToItem(vItemFk) INTO vItemFk; - - CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); - - SELECT IFNULL(visible,0) INTO vVisible - FROM cache.visible - WHERE calc_id = vCalc - AND item_id = vItemFk; - - SELECT sum(visible) INTO vParkedStuff - FROM itemShelvingStock - WHERE warehouseFk = vWarehouseFk - AND itemFk = vItemFk; - - SET vNewVisible = vNewVisible + IFNULL(vParkedStuff,0); - - SELECT IF(vIsTrash, 200, 400) INTO vClientFk; - - SELECT t.id INTO vTicketFk - FROM ticket t - JOIN address a ON a.id=t.addressFk - WHERE t.warehouseFk = vWarehouseFk - AND t.clientFk = vClientFk - AND DATE(t.shipped) = CURDATE() - AND a.isDefaultAddress - LIMIT 1; - - IF vTicketFk IS NULL THEN - - CALL ticket_add( - vClientFk, - CURDATE(), - vWarehouseFk, - vCompanyVnlFk, - NULL, - NULL, - NULL, - CURDATE(), - account.userGetId(), - FALSE, - vTicketFk); - - END IF; - - INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vTicketFk, vItemFk, CONCAT(longName,' ', getWorkerCode(), ' ',LEFT(CAST(NOW() AS TIME),5)), vVisible - vNewVisible, 0, 0 - FROM item - WHERE id = vItemFk; - - UPDATE cache.visible - SET visible = vNewVisible - WHERE calc_id = vCalc - AND item_id = vItemFk; - +BEGIN + + DECLARE vTicketFk INT; + DECLARE vClientFk INT; + DECLARE vCompanyVnlFk INT DEFAULT 442; + DECLARE vVisible INT DEFAULT 0; + DECLARE vCalc INT; + DECLARE vParkedStuff INT; + + SELECT barcodeToItem(vItemFk) INTO vItemFk; + + CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); + + SELECT IFNULL(visible,0) INTO vVisible + FROM cache.visible + WHERE calc_id = vCalc + AND item_id = vItemFk; + + SELECT sum(visible) INTO vParkedStuff + FROM itemShelvingStock + WHERE warehouseFk = vWarehouseFk + AND itemFk = vItemFk; + + SET vNewVisible = vNewVisible + IFNULL(vParkedStuff,0); + + SELECT IF(vIsTrash, 200, 400) INTO vClientFk; + + SELECT t.id INTO vTicketFk + FROM ticket t + JOIN address a ON a.id=t.addressFk + WHERE t.warehouseFk = vWarehouseFk + AND t.clientFk = vClientFk + AND DATE(t.shipped) = CURDATE() + AND a.isDefaultAddress + LIMIT 1; + + IF vTicketFk IS NULL THEN + + CALL ticket_add( + vClientFk, + CURDATE(), + vWarehouseFk, + vCompanyVnlFk, + NULL, + NULL, + NULL, + CURDATE(), + account.userGetId(), + FALSE, + vTicketFk); + + END IF; + + INSERT INTO sale(ticketFk, itemFk, concept, quantity, price, discount) + SELECT vTicketFk, vItemFk, CONCAT(longName,' ', getWorkerCode(), ' ',LEFT(CAST(NOW() AS TIME),5)), vVisible - vNewVisible, 0, 0 + FROM item + WHERE id = vItemFk; + + UPDATE cache.visible + SET visible = vNewVisible + WHERE calc_id = vCalc + AND item_id = vItemFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -67965,37 +67965,37 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTag_replace`(vItemFromFk INT, vItemToFk INT, vPicture VARCHAR(100)) -BEGIN - - /* Reemplaza los tags de un artículo por los de otro, así como su imagen - * - * @param vItemFromFk id de vn.item con el artículo del que se toman los tags - * @param vItemToFk id de vn.item con el artículo del que se toman los tags - * @param vPicture imagen del artículo. Opcional. Si no se especifica, hereada la del vItemFromFk - */ - - DELETE FROM vn.itemTag - WHERE itemFk = vItemToFk; - - INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) - SELECT vItemToFk, tagFk, value, priority - FROM vn.itemTag - WHERE itemFk = vItemFromFk; - - IF ISNULL(vPicture) THEN - - SELECT image INTO vPicture - FROM vn.item - WHERE id = vItemFromFk; - - END IF; - - UPDATE vn.item i - SET i.image = vPicture - WHERE i.id = vItemToFk; - - CALL vn.itemRefreshTags(vItemToFk); - +BEGIN + + /* Reemplaza los tags de un artículo por los de otro, así como su imagen + * + * @param vItemFromFk id de vn.item con el artículo del que se toman los tags + * @param vItemToFk id de vn.item con el artículo del que se toman los tags + * @param vPicture imagen del artículo. Opcional. Si no se especifica, hereada la del vItemFromFk + */ + + DELETE FROM vn.itemTag + WHERE itemFk = vItemToFk; + + INSERT INTO vn.itemTag(itemFk, tagFk, value, priority) + SELECT vItemToFk, tagFk, value, priority + FROM vn.itemTag + WHERE itemFk = vItemFromFk; + + IF ISNULL(vPicture) THEN + + SELECT image INTO vPicture + FROM vn.item + WHERE id = vItemFromFk; + + END IF; + + UPDATE vn.item i + SET i.image = vPicture + WHERE i.id = vItemToFk; + + CALL vn.itemRefreshTags(vItemToFk); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68088,62 +68088,62 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTrash`( - vItemFk INT, - vWarehouseFk INT, - vQuantity INT, +CREATE DEFINER=`root`@`localhost` PROCEDURE `itemTrash`( + vItemFk INT, + vWarehouseFk INT, + vQuantity INT, vIsTrash BOOLEAN) -BEGIN - - DECLARE vTicketFk INT; - DECLARE vClientFk INT; - DECLARE vCompanyVnlFk INT DEFAULT 442; - DECLARE vCalc INT; - - SELECT barcodeToItem(vItemFk) INTO vItemFk; - - SELECT IF(vIsTrash, 200, 400) INTO vClientFk; - - SELECT t.id INTO vTicketFk - FROM ticket t - JOIN address a ON a.id=t.addressFk - WHERE t.warehouseFk = vWarehouseFk - AND t.clientFk = vClientFk - AND DATE(t.shipped) = CURDATE() - AND a.isDefaultAddress - LIMIT 1; - - CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); - - IF vTicketFk IS NULL THEN - - CALL ticket_add( - vClientFk, - CURDATE(), - vWarehouseFk, - vCompanyVnlFk, - NULL, - NULL, - NULL, - CURDATE(), - account.userGetId(), - FALSE, - vTicketFk); - END IF; - - INSERT INTO sale(ticketFk, itemFk, concept, quantity) - SELECT vTicketFk, - vItemFk, - CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(NOW() AS TIME),5)), - vQuantity - FROM item - WHERE id = vItemFk; - - UPDATE cache.visible - SET visible = visible - vQuantity - WHERE calc_id = vCalc - AND item_id = vItemFk; - +BEGIN + + DECLARE vTicketFk INT; + DECLARE vClientFk INT; + DECLARE vCompanyVnlFk INT DEFAULT 442; + DECLARE vCalc INT; + + SELECT barcodeToItem(vItemFk) INTO vItemFk; + + SELECT IF(vIsTrash, 200, 400) INTO vClientFk; + + SELECT t.id INTO vTicketFk + FROM ticket t + JOIN address a ON a.id=t.addressFk + WHERE t.warehouseFk = vWarehouseFk + AND t.clientFk = vClientFk + AND DATE(t.shipped) = CURDATE() + AND a.isDefaultAddress + LIMIT 1; + + CALL cache.visible_refresh(vCalc, TRUE, vWarehouseFk); + + IF vTicketFk IS NULL THEN + + CALL ticket_add( + vClientFk, + CURDATE(), + vWarehouseFk, + vCompanyVnlFk, + NULL, + NULL, + NULL, + CURDATE(), + account.userGetId(), + FALSE, + vTicketFk); + END IF; + + INSERT INTO sale(ticketFk, itemFk, concept, quantity) + SELECT vTicketFk, + vItemFk, + CONCAT(longName,' ',getWorkerCode(), ' ', LEFT(CAST(NOW() AS TIME),5)), + vQuantity + FROM item + WHERE id = vItemFk; + + UPDATE cache.visible + SET visible = visible - vQuantity + WHERE calc_id = vCalc + AND item_id = vItemFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68215,126 +68215,126 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_clean`(vItemFrom INT, vItemTo INT) -BEGIN - -/* - * Elimina todos los items repetidos y los sustituye por el que tiene menor id - */ - - START TRANSACTION; - - SET @isModeInventory:= TRUE; - - -- Deletes - - UPDATE IGNORE vn.itemCost ic - JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld - SET ic.itemFk = itr.idNew; - - DELETE ic.* - FROM vn.itemCost ic - JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld; - - DELETE rt.* - FROM vn2008.rec_translator rt - JOIN tmp.itemsToReplace itr ON rt.Id_Article = itr.idOld; - - DELETE w.* - FROM bs.waste w - JOIN tmp.itemsToReplace itr ON w.itemFk = itr.idOld; - - DELETE pf.* - FROM vn.priceFixed pf - JOIN tmp.itemsToReplace itr ON pf.itemFk = itr.idOld; - - DELETE imp.* - FROM vn.itemMatchProperties imp - JOIN tmp.itemsToReplace itr ON imp.itemFk = itr.idOld; - - DELETE ib.* - FROM vn.itemBotanical ib - JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; - - DELETE ip.* - FROM vn.itemProposal ip - JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; - - DELETE it.* - FROM vn.itemTag it - JOIN tmp.itemsToReplace itr ON it.itemFk = itr.idOld; - - DELETE ib.* - FROM vn.itemBarcode ib - JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; - - DELETE itc.* - FROM vn.itemTaxCountry itc - JOIN tmp.itemsToReplace itr ON itc.itemFk = itr.idOld; - - DELETE ip.* - FROM vn.itemPlacement ip - JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; - - -- Updates - - UPDATE vn.buy b - JOIN tmp.itemsToReplace itr ON b.itemFk = itr.idOld - SET b.itemFk = itr.idNew; - - UPDATE vn.sale s - JOIN tmp.itemsToReplace itr ON s.itemFk = itr.idOld - SET s.itemFk = itr.idNew; - - UPDATE vn.specialPrice sp - JOIN tmp.itemsToReplace itr ON sp.itemFk = itr.idOld - SET sp.itemFk = itr.idNew; - - UPDATE vn.packaging p - JOIN tmp.itemsToReplace itr ON p.itemFk = itr.idOld - SET p.itemFk = itr.idNew; - - UPDATE vn.packaging p - JOIN tmp.itemsToReplace itr ON p.freightItemFk = itr.idOld - SET p.freightItemFk = itr.idNew; - - UPDATE hedera.orderRow o - JOIN tmp.itemsToReplace itr ON o.itemFk = itr.idOld - SET o.itemFk = itr.idNew; - - UPDATE vn.itemLog il - JOIN tmp.itemsToReplace itr ON il.originFk = itr.idOld - SET il.originFk = itr.idNew; - - UPDATE vn.itemShelving ish - JOIN tmp.itemsToReplace itr ON ish.itemFk = itr.idOld - SET ish.itemFk = itr.idNew; - - UPDATE vn.ticketPackagingStartingStock tpss - JOIN tmp.itemsToReplace itr ON tpss.itemFk = itr.idOld - SET tpss.itemFk = itr.idNew; - - UPDATE vn.inventoryFailure ifa - JOIN tmp.itemsToReplace itr ON ifa.itemFk = itr.idOld - SET ifa.itemFk = itr.idNew; - - UPDATE vn.genericAllocation ga - JOIN tmp.itemsToReplace itr ON ga.itemFk = itr.idOld - SET ga.itemFk = itr.idNew; - - UPDATE vn.itemPlacementSupply ips - JOIN tmp.itemsToReplace itr ON ips.itemFk = itr.idOld - SET ips.itemFk = itr.idNew; - - -- Eliminamos los items repetidos - - DELETE i.* - FROM vn.item i - JOIN tmp.itemsToReplace itr ON i.id = itr.idOld; - - SET @isModeInventory:= FALSE; - - COMMIT; - +BEGIN + +/* + * Elimina todos los items repetidos y los sustituye por el que tiene menor id + */ + + START TRANSACTION; + + SET @isModeInventory:= TRUE; + + -- Deletes + + UPDATE IGNORE vn.itemCost ic + JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld + SET ic.itemFk = itr.idNew; + + DELETE ic.* + FROM vn.itemCost ic + JOIN tmp.itemsToReplace itr ON ic.itemFk = itr.idOld; + + DELETE rt.* + FROM vn2008.rec_translator rt + JOIN tmp.itemsToReplace itr ON rt.Id_Article = itr.idOld; + + DELETE w.* + FROM bs.waste w + JOIN tmp.itemsToReplace itr ON w.itemFk = itr.idOld; + + DELETE pf.* + FROM vn.priceFixed pf + JOIN tmp.itemsToReplace itr ON pf.itemFk = itr.idOld; + + DELETE imp.* + FROM vn.itemMatchProperties imp + JOIN tmp.itemsToReplace itr ON imp.itemFk = itr.idOld; + + DELETE ib.* + FROM vn.itemBotanical ib + JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; + + DELETE ip.* + FROM vn.itemProposal ip + JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; + + DELETE it.* + FROM vn.itemTag it + JOIN tmp.itemsToReplace itr ON it.itemFk = itr.idOld; + + DELETE ib.* + FROM vn.itemBarcode ib + JOIN tmp.itemsToReplace itr ON ib.itemFk = itr.idOld; + + DELETE itc.* + FROM vn.itemTaxCountry itc + JOIN tmp.itemsToReplace itr ON itc.itemFk = itr.idOld; + + DELETE ip.* + FROM vn.itemPlacement ip + JOIN tmp.itemsToReplace itr ON ip.itemFk = itr.idOld; + + -- Updates + + UPDATE vn.buy b + JOIN tmp.itemsToReplace itr ON b.itemFk = itr.idOld + SET b.itemFk = itr.idNew; + + UPDATE vn.sale s + JOIN tmp.itemsToReplace itr ON s.itemFk = itr.idOld + SET s.itemFk = itr.idNew; + + UPDATE vn.specialPrice sp + JOIN tmp.itemsToReplace itr ON sp.itemFk = itr.idOld + SET sp.itemFk = itr.idNew; + + UPDATE vn.packaging p + JOIN tmp.itemsToReplace itr ON p.itemFk = itr.idOld + SET p.itemFk = itr.idNew; + + UPDATE vn.packaging p + JOIN tmp.itemsToReplace itr ON p.freightItemFk = itr.idOld + SET p.freightItemFk = itr.idNew; + + UPDATE hedera.orderRow o + JOIN tmp.itemsToReplace itr ON o.itemFk = itr.idOld + SET o.itemFk = itr.idNew; + + UPDATE vn.itemLog il + JOIN tmp.itemsToReplace itr ON il.originFk = itr.idOld + SET il.originFk = itr.idNew; + + UPDATE vn.itemShelving ish + JOIN tmp.itemsToReplace itr ON ish.itemFk = itr.idOld + SET ish.itemFk = itr.idNew; + + UPDATE vn.ticketPackagingStartingStock tpss + JOIN tmp.itemsToReplace itr ON tpss.itemFk = itr.idOld + SET tpss.itemFk = itr.idNew; + + UPDATE vn.inventoryFailure ifa + JOIN tmp.itemsToReplace itr ON ifa.itemFk = itr.idOld + SET ifa.itemFk = itr.idNew; + + UPDATE vn.genericAllocation ga + JOIN tmp.itemsToReplace itr ON ga.itemFk = itr.idOld + SET ga.itemFk = itr.idNew; + + UPDATE vn.itemPlacementSupply ips + JOIN tmp.itemsToReplace itr ON ips.itemFk = itr.idOld + SET ips.itemFk = itr.idNew; + + -- Eliminamos los items repetidos + + DELETE i.* + FROM vn.item i + JOIN tmp.itemsToReplace itr ON i.id = itr.idOld; + + SET @isModeInventory:= FALSE; + + COMMIT; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -68618,71 +68618,71 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_getInfo`(IN `vBarcode` VARCHAR(22), IN `vWarehouseFk` INT) -BEGIN - - /* - * Devuelve información relativa al item correspondiente del vBarcode pasado - * - * @param vBarcode código relativo al ítem - * @param vWarehouseFk código del almacén - */ - - DECLARE vCacheVisibleFk INT; - DECLARE vCacheAvailableFk INT; - DECLARE vVisibleItemShelving INT; - DECLARE vItemFk INT; - - SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; - - CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); - CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); - - SELECT SUM(visible) INTO vVisibleItemShelving - FROM vn.itemShelvingStock - WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; - - CALL vn.buyUltimate(vWarehouseFk, CURDATE()); - - SELECT i.id, - i.longName, - i.tag5, - i.value5, - i.tag6, - i.value6, - i.tag7, - i.value7, - i.image, - i.size, - i.stems, - i.category, - i.minimum as min, - p.name as producer, - o.code as origin, - v.visible - IFNULL(vVisibleItemShelving,0) as unlocated, - a.available, - vVisibleItemShelving, - v.visible, - c.`grouping`, - c.packing, - CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, - CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, - i.itemPackingTypeFk, - i.comment as reference - FROM vn.item i - LEFT JOIN vn.producer p ON p.id = i.producerFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id - LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id - LEFT JOIN ( - SELECT b.itemFk, b2.`grouping`, b2.packing - FROM tmp.buyUltimate b - JOIN vn.buy b2 ON b2.id = b.buyFk - WHERE b.warehouseFk = vWarehouseFk - ) c ON i.id = c.itemFk - WHERE i.id = vItemFk; - - DROP TEMPORARY TABLE tmp.buyUltimate; - +BEGIN + + /* + * Devuelve información relativa al item correspondiente del vBarcode pasado + * + * @param vBarcode código relativo al ítem + * @param vWarehouseFk código del almacén + */ + + DECLARE vCacheVisibleFk INT; + DECLARE vCacheAvailableFk INT; + DECLARE vVisibleItemShelving INT; + DECLARE vItemFk INT; + + SELECT vn.barcodeToItem(vBarcode) INTO vItemFk; + + CALL cache.visible_refresh(vCacheVisibleFk, FALSE,vWarehouseFk); + CALL cache.available_refresh(vCacheAvailableFk, FALSE,vWarehouseFk, CURDATE()); + + SELECT SUM(visible) INTO vVisibleItemShelving + FROM vn.itemShelvingStock + WHERE itemFk = vItemFk AND warehouseFk = vWarehouseFk; + + CALL vn.buyUltimate(vWarehouseFk, CURDATE()); + + SELECT i.id, + i.longName, + i.tag5, + i.value5, + i.tag6, + i.value6, + i.tag7, + i.value7, + i.image, + i.size, + i.stems, + i.category, + i.minimum as min, + p.name as producer, + o.code as origin, + v.visible - IFNULL(vVisibleItemShelving,0) as unlocated, + a.available, + vVisibleItemShelving, + v.visible, + c.`grouping`, + c.packing, + CONCAT('https://verdnatura.es/vn-image-data/catalog/200x200/', i.image) as urlImage200, + CONCAT('https://verdnatura.es/vn-image-data/catalog/1600x900/', i.image) as urlImage, + i.itemPackingTypeFk, + i.comment as reference + FROM vn.item i + LEFT JOIN vn.producer p ON p.id = i.producerFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN cache.visible v ON v.calc_id = vCacheVisibleFk AND v.item_id = i.id + LEFT JOIN cache.available a ON a.calc_id = vCacheAvailableFk AND a.item_id = i.id + LEFT JOIN ( + SELECT b.itemFk, b2.`grouping`, b2.packing + FROM tmp.buyUltimate b + JOIN vn.buy b2 ON b2.id = b.buyFk + WHERE b.warehouseFk = vWarehouseFk + ) c ON i.id = c.itemFk + WHERE i.id = vItemFk; + + DROP TEMPORARY TABLE tmp.buyUltimate; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -69547,21 +69547,21 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_saveReference`(vBarcode VARCHAR(22), vReference VARCHAR(150)) -BEGIN - -/** - * Actualiza la referencia del item - * - * @param vBarcode del item - * @param vReference referencia a actualizar - */ - - DECLARE vItemFk INT; - - SELECT barcodeToItem(vBarcode) INTO vItemFk; - - UPDATE item SET comment = vReference WHERE id = vItemFk; - +BEGIN + +/** + * Actualiza la referencia del item + * + * @param vBarcode del item + * @param vReference referencia a actualizar + */ + + DECLARE vItemFk INT; + + SELECT barcodeToItem(vBarcode) INTO vItemFk; + + UPDATE item SET comment = vReference WHERE id = vItemFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -69643,47 +69643,47 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_setGeneric`(vSelf INT) -BEGIN -/** - * Asigna el código genérico a un item, salvo que sea un código de item genérico. - * - * @param vSelf identificador de vn.item - */ - DECLARE vGenericFk INT; - - SELECT itemFk INTO vGenericFk - FROM ( - SELECT itemFk, (sum(matches) = maxMatches) `match` - FROM ( - SELECT ga.id gaid, - ga.itemFk, - (it.value <=> ga.origin) - + (it.value <=> ga.color) - + (it.value <=> ga.quality) - + (it.value <=> ga.numFlores) - + (it.value <=> ga.category) - + (it.value <=> ga.productor) matches, - !ISNULL(ga.origin) - +!ISNULL(ga.color) - +!ISNULL(ga.quality) - +!ISNULL(ga.numFlores) - +!ISNULL(ga.category) - +!ISNULL(ga.productor) maxMatches - FROM vn.item i - JOIN vn.itemTag it ON it.itemFk = i.id - JOIN vn.genericAllocation ga - ON (i.typeFk = ga.typeFk OR ga.typeFk IS NULL) - AND (i.longName = ga.longName OR ga.longName IS NULL) - AND (i.`size` = ga.`size` OR ga.`size` IS NULL) - AND i.id != ga.itemFk - WHERE i.id = vSelf - AND NOT i.isFloramondo) sub - GROUP BY gaid - HAVING `match`) sub2; - - UPDATE vn.item - SET genericFk = vGenericFk - WHERE id = vSelf; +BEGIN +/** + * Asigna el código genérico a un item, salvo que sea un código de item genérico. + * + * @param vSelf identificador de vn.item + */ + DECLARE vGenericFk INT; + + SELECT itemFk INTO vGenericFk + FROM ( + SELECT itemFk, (sum(matches) = maxMatches) `match` + FROM ( + SELECT ga.id gaid, + ga.itemFk, + (it.value <=> ga.origin) + + (it.value <=> ga.color) + + (it.value <=> ga.quality) + + (it.value <=> ga.numFlores) + + (it.value <=> ga.category) + + (it.value <=> ga.productor) matches, + !ISNULL(ga.origin) + +!ISNULL(ga.color) + +!ISNULL(ga.quality) + +!ISNULL(ga.numFlores) + +!ISNULL(ga.category) + +!ISNULL(ga.productor) maxMatches + FROM vn.item i + JOIN vn.itemTag it ON it.itemFk = i.id + JOIN vn.genericAllocation ga + ON (i.typeFk = ga.typeFk OR ga.typeFk IS NULL) + AND (i.longName = ga.longName OR ga.longName IS NULL) + AND (i.`size` = ga.`size` OR ga.`size` IS NULL) + AND i.id != ga.itemFk + WHERE i.id = vSelf + AND NOT i.isFloramondo) sub + GROUP BY gaid + HAVING `match`) sub2; + + UPDATE vn.item + SET genericFk = vGenericFk + WHERE id = vSelf; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -69701,19 +69701,19 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingShelve`(vSelf INT, vPacking INT) -BEGIN - +BEGIN + /** - * Actualiza el valor de item.packingShelve - * - * @param vSelf Identificador de vn.item - * @param vPacking Cantidad de unidades de venta que caben en una bandeja - */ - - UPDATE vn.item i - SET i.packingShelve = vPacking - WHERE i.id = vSelf; - + * Actualiza el valor de item.packingShelve + * + * @param vSelf Identificador de vn.item + * @param vPacking Cantidad de unidades de venta que caben en una bandeja + */ + + UPDATE vn.item i + SET i.packingShelve = vPacking + WHERE i.id = vSelf; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -69731,15 +69731,15 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `item_updatePackingType`(vItem INT, vItemPackingTypeFk VARCHAR(1)) -BEGIN -/** - * Update the packing type of an item - * - * @param vItem id del item a actualizar - * @param vItemPackingTypeFk packing type - */ - UPDATE item SET itemPackingTypeFk = vItemPackingTypeFk WHERE id = vItem; - +BEGIN +/** + * Update the packing type of an item + * + * @param vItem id del item a actualizar + * @param vItemPackingTypeFk packing type + */ + UPDATE item SET itemPackingTypeFk = vItemPackingTypeFk WHERE id = vItem; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -70556,22 +70556,22 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `machine_getWorkerPlate`(vWorkerFk INT) -BEGIN -/** - * Selecciona la matrícula del vehículo del workerfk - * - * @param vWorkerFk el id del trabajador - * - * - **/ - - SELECT m.plate - FROM machine m - JOIN machineWorker mw ON mw.machineFk = m.id - WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) - AND ISNULL(mw.outTimed) - AND mw.workerFk = vWorkerFk; - +BEGIN +/** + * Selecciona la matrícula del vehículo del workerfk + * + * @param vWorkerFk el id del trabajador + * + * + **/ + + SELECT m.plate + FROM machine m + JOIN machineWorker mw ON mw.machineFk = m.id + WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,NOW()) + AND ISNULL(mw.outTimed) + AND mw.workerFk = vWorkerFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -71897,29 +71897,29 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `parking_setOrder`(vWarehouseFk INT) -BEGIN - - /* - * Ordena el orden de preparacion de los parking de acuerdo con la tabla vn.corridor - */ - - UPDATE vn.parking p - JOIN ( - SELECT code, - @orden := @orden + 10 AS po - FROM ( - SELECT c.prepOrder, - p.code, - @orden := 0, - IF(c.isAscendent, 1,-1) * CAST(SUBSTRING(p.code,3,2) AS DECIMAL(2,0)) subCorridor , - CAST(IF(LENGTH(p.code) > 5, SUBSTRING(p.code,6,2), 0) AS DECIMAL(2,0)) ubication - FROM vn.parking p - JOIN vn.sector s ON s.id = p.sectorFk - JOIN vn.corridor c ON c.code = LEFT(p.code,1) COLLATE utf8_general_ci - WHERE s.warehouseFk = vWarehouseFk) sub - ORDER BY sub.prepOrder, subCorridor, ubication) sub2 ON sub2.code = p.code - SET p.pickingOrder = sub2.po; - +BEGIN + + /* + * Ordena el orden de preparacion de los parking de acuerdo con la tabla vn.corridor + */ + + UPDATE vn.parking p + JOIN ( + SELECT code, + @orden := @orden + 10 AS po + FROM ( + SELECT c.prepOrder, + p.code, + @orden := 0, + IF(c.isAscendent, 1,-1) * CAST(SUBSTRING(p.code,3,2) AS DECIMAL(2,0)) subCorridor , + CAST(IF(LENGTH(p.code) > 5, SUBSTRING(p.code,6,2), 0) AS DECIMAL(2,0)) ubication + FROM vn.parking p + JOIN vn.sector s ON s.id = p.sectorFk + JOIN vn.corridor c ON c.code = LEFT(p.code,1) COLLATE utf8_general_ci + WHERE s.warehouseFk = vWarehouseFk) sub + ORDER BY sub.prepOrder, subCorridor, ubication) sub2 ON sub2.code = p.code + SET p.pickingOrder = sub2.po; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72012,180 +72012,180 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `placement_test`(vParamFk INT(11)) -BEGIN - - DECLARE vCalcFk INT; - DECLARE vWarehouseFk INT; - DECLARE vWarehouseAliasFk INT; - DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - ENGINE = MEMORY - SELECT 0000000 as ticketFk, - 0000000 as saleFk, - 0000000 as itemFk, - FALSE as isStowaway, - 0 as quantity; - - INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) - SELECT s.ticketFk, s.id, s.itemFk, FALSE - FROM vn.ticketCollection tc - JOIN vn.collection c ON c.id = tc.collectionFk - JOIN vn.sale s ON s.ticketFk = tc.ticketFk - JOIN vn.item i ON i.id = s.itemFk - WHERE tc.collectionFk = vParamFk - AND (i.itemPackingTypeFk = c.itemPackingTypeFk OR ISNULL(c.itemPackingTypeFk)) - UNION ALL - SELECT s.ticketFk, s.id, s.itemFk, FALSE - FROM vn.sale s - WHERE s.ticketFk = vParamFk; - - - /* UNION ALL - SELECT sw.shipFk, s.id, s.itemFk, TRUE - FROM vn.sale s - JOIN vn.stowaway sw ON sw.id = s.ticketFk - JOIN vn.ticketCollection tc ON tc.ticketFk = sw.shipFk - WHERE tc.collectionFk = vParamFk; - - INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) - SELECT s.ticketFk, s.id, s.itemFk, FALSE - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - WHERE s.ticketFk = vParamFk - AND t.shipped > '2020-01-01' - UNION ALL - SELECT sw.shipFk, s.id, s.itemFk, TRUE - FROM vn.sale s - JOIN vn.stowaway sw ON sw.id = s.ticketFk - WHERE sw.shipFk = vParamFk; - - DELETE FROM tmp.sale - WHERE saleFk = 0; - */ - SELECT t.warehouseFk, w.aliasFk - INTO vWarehouseFk, vWarehouseAliasFk - FROM vn.ticket t - JOIN tmp.sale ts ON ts.ticketFk = t.id - JOIN vn.warehouse w ON w.id = t.warehouseFk - LIMIT 1; - - CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); - - UPDATE tmp.sale ts - JOIN ( SELECT itemFk, sum(visible) as visible - FROM vn.itemShelvingStock iss - JOIN vn.warehouse w ON w.id = iss.warehouseFk - WHERE w.aliasFk = vWarehouseAliasFk - GROUP BY iss.itemFk ) iss ON iss.itemFk = ts.itemFk - SET ts.quantity = iss.visible; - - DROP TEMPORARY TABLE IF EXISTS tmp.sale2; - CREATE TEMPORARY TABLE tmp.sale2 - ENGINE = MEMORY - SELECT * FROM tmp.sale; - - - DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; - CREATE TEMPORARY TABLE tmp.`grouping` - (PRIMARY KEY (itemFk)) - ENGINE = MEMORY - SELECT b.itemFk, - CASE b.groupingMode - WHEN 0 THEN 1 - WHEN 2 THEN b.packing - ELSE b.`grouping` - END AS `grouping` - FROM buy b - JOIN cache.last_buy lb ON lb.buy_id = b.id - WHERE lb.warehouse_id = vWarehouseFk - ; - - DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; - CREATE TEMPORARY TABLE tmp.grouping2 - ENGINE = MEMORY - SELECT * FROM tmp.`grouping`; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList; - CREATE TEMPORARY TABLE tmp.salePlacementList - ENGINE = MEMORY - - SELECT ts.saleFk, - ts.itemFk, - CONCAT( - IF( iss.id, - CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), - ''), - p.`code`) COLLATE utf8_general_ci as placement , - sh.code COLLATE utf8_general_ci as shelving, - ish.created, - ish.visible, - IF(ts.isStowaway, - 100000, IF(ish.visible > 0 OR iss.id, 1, 100000)) * p.pickingOrder as `order`, - IFNULL(IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`),1) as `grouping`, - IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW()))) as priority, - 0 as saleOrder, - sc.isPreviousPrepared, - iss.id as itemShelvingSaleFk, - ts.ticketFk - ,iss.id - , st.saleFk as salePreviousPrepared - , iss.userFk - FROM tmp.sale ts - LEFT JOIN (SELECT DISTINCT saleFk - FROM vn.saleTracking st - JOIN vn.state s ON s.id = st.stateFk - WHERE st.isChecked - AND s.semaphore = 1) st ON st.saleFk = ts.saleFk - JOIN vn.itemShelving ish ON ish.itemFk = ts.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - JOIN vn.warehouse w ON w.id = sc.warehouseFk - LEFT JOIN tmp.`grouping` g ON g.itemFk = ts.itemFk - LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = ts.saleFk AND iss.itemShelvingFk = ish.id - LEFT JOIN vn.worker wk ON wk.id = iss.userFk - WHERE w.aliasFk = vWarehouseAliasFk - HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL - ; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_2; - CREATE TEMPORARY TABLE tmp.salePlacementList_2 - ENGINE MEMORY - SELECT saleFk, priority as olderPriority - FROM (SELECT saleFk, priority - FROM tmp.salePlacementList - ORDER BY IF(isPreviousPrepared,2,1), IF(visible > 0 OR itemShelvingSaleFk,1,2), priority - ) sub - GROUP BY saleFk; - - DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_3; - CREATE TEMPORARY TABLE tmp.salePlacementList_3 - ENGINE MEMORY - SELECT s1.saleFk, `order`as saleOrder - FROM tmp.salePlacementList s1 - JOIN tmp.salePlacementList_2 s2 ON s2.saleFk = s1.saleFk AND s2.olderPriority = s1.priority; - - UPDATE tmp.salePlacementList s1 - JOIN tmp.salePlacementList_3 s3 ON s3.saleFk = s1.saleFk - SET s1.saleOrder = s3.saleOrder; - /* - -- Anula el orden de antigüedad y ordena por ubicación */ - UPDATE tmp.salePlacementList - SET saleOrder = `order`; - - SELECT * - FROM tmp.salePlacementList - ORDER BY visible <> 0 DESC,saleOrder, IF(isPreviousPrepared,2,1), IF(itemShelvingSaleFk,1,2),priority; - - DROP TEMPORARY TABLE - tmp.sale, - tmp.sale2, - tmp.`grouping`, - tmp.grouping2, - tmp.salePlacementList_2, - tmp.salePlacementList_3; - +BEGIN + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + DECLARE vWarehouseAliasFk INT; + DECLARE vCurrentYear INT DEFAULT YEAR(NOW()); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + ENGINE = MEMORY + SELECT 0000000 as ticketFk, + 0000000 as saleFk, + 0000000 as itemFk, + FALSE as isStowaway, + 0 as quantity; + + INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.ticketCollection tc + JOIN vn.collection c ON c.id = tc.collectionFk + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.item i ON i.id = s.itemFk + WHERE tc.collectionFk = vParamFk + AND (i.itemPackingTypeFk = c.itemPackingTypeFk OR ISNULL(c.itemPackingTypeFk)) + UNION ALL + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.sale s + WHERE s.ticketFk = vParamFk; + + + /* UNION ALL + SELECT sw.shipFk, s.id, s.itemFk, TRUE + FROM vn.sale s + JOIN vn.stowaway sw ON sw.id = s.ticketFk + JOIN vn.ticketCollection tc ON tc.ticketFk = sw.shipFk + WHERE tc.collectionFk = vParamFk; + + INSERT INTO tmp.sale(ticketFk, saleFk, itemFk, isStowaway) + SELECT s.ticketFk, s.id, s.itemFk, FALSE + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + WHERE s.ticketFk = vParamFk + AND t.shipped > '2020-01-01' + UNION ALL + SELECT sw.shipFk, s.id, s.itemFk, TRUE + FROM vn.sale s + JOIN vn.stowaway sw ON sw.id = s.ticketFk + WHERE sw.shipFk = vParamFk; + + DELETE FROM tmp.sale + WHERE saleFk = 0; + */ + SELECT t.warehouseFk, w.aliasFk + INTO vWarehouseFk, vWarehouseAliasFk + FROM vn.ticket t + JOIN tmp.sale ts ON ts.ticketFk = t.id + JOIN vn.warehouse w ON w.id = t.warehouseFk + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + UPDATE tmp.sale ts + JOIN ( SELECT itemFk, sum(visible) as visible + FROM vn.itemShelvingStock iss + JOIN vn.warehouse w ON w.id = iss.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + GROUP BY iss.itemFk ) iss ON iss.itemFk = ts.itemFk + SET ts.quantity = iss.visible; + + DROP TEMPORARY TABLE IF EXISTS tmp.sale2; + CREATE TEMPORARY TABLE tmp.sale2 + ENGINE = MEMORY + SELECT * FROM tmp.sale; + + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + (PRIMARY KEY (itemFk)) + ENGINE = MEMORY + SELECT b.itemFk, + CASE b.groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN b.packing + ELSE b.`grouping` + END AS `grouping` + FROM buy b + JOIN cache.last_buy lb ON lb.buy_id = b.id + WHERE lb.warehouse_id = vWarehouseFk + ; + + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE = MEMORY + SELECT * FROM tmp.`grouping`; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList; + CREATE TEMPORARY TABLE tmp.salePlacementList + ENGINE = MEMORY + + SELECT ts.saleFk, + ts.itemFk, + CONCAT( + IF( iss.id, + CONCAT('< ', IFNULL(wk.`code`, '---'),' > '), + ''), + p.`code`) COLLATE utf8_general_ci as placement , + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + ish.visible, + IF(ts.isStowaway, - 100000, IF(ish.visible > 0 OR iss.id, 1, 100000)) * p.pickingOrder as `order`, + IFNULL(IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`),1) as `grouping`, + IF(iss.id, TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,iss.created)), TO_SECONDS(TIMESTAMPADD(YEAR,- year(ish.created),ish.created)) + TO_SECONDS(TIMESTAMPADD(YEAR,-vCurrentYear,NOW()))) as priority, + 0 as saleOrder, + sc.isPreviousPrepared, + iss.id as itemShelvingSaleFk, + ts.ticketFk + ,iss.id + , st.saleFk as salePreviousPrepared + , iss.userFk + FROM tmp.sale ts + LEFT JOIN (SELECT DISTINCT saleFk + FROM vn.saleTracking st + JOIN vn.state s ON s.id = st.stateFk + WHERE st.isChecked + AND s.semaphore = 1) st ON st.saleFk = ts.saleFk + JOIN vn.itemShelving ish ON ish.itemFk = ts.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + LEFT JOIN tmp.`grouping` g ON g.itemFk = ts.itemFk + LEFT JOIN vn.itemShelvingSale iss ON iss.saleFk = ts.saleFk AND iss.itemShelvingFk = ish.id + LEFT JOIN vn.worker wk ON wk.id = iss.userFk + WHERE w.aliasFk = vWarehouseAliasFk + HAVING (iss.id AND st.saleFk) OR salePreviousPrepared IS NULL + ; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_2; + CREATE TEMPORARY TABLE tmp.salePlacementList_2 + ENGINE MEMORY + SELECT saleFk, priority as olderPriority + FROM (SELECT saleFk, priority + FROM tmp.salePlacementList + ORDER BY IF(isPreviousPrepared,2,1), IF(visible > 0 OR itemShelvingSaleFk,1,2), priority + ) sub + GROUP BY saleFk; + + DROP TEMPORARY TABLE IF EXISTS tmp.salePlacementList_3; + CREATE TEMPORARY TABLE tmp.salePlacementList_3 + ENGINE MEMORY + SELECT s1.saleFk, `order`as saleOrder + FROM tmp.salePlacementList s1 + JOIN tmp.salePlacementList_2 s2 ON s2.saleFk = s1.saleFk AND s2.olderPriority = s1.priority; + + UPDATE tmp.salePlacementList s1 + JOIN tmp.salePlacementList_3 s3 ON s3.saleFk = s1.saleFk + SET s1.saleOrder = s3.saleOrder; + /* + -- Anula el orden de antigüedad y ordena por ubicación */ + UPDATE tmp.salePlacementList + SET saleOrder = `order`; + + SELECT * + FROM tmp.salePlacementList + ORDER BY visible <> 0 DESC,saleOrder, IF(isPreviousPrepared,2,1), IF(itemShelvingSaleFk,1,2),priority; + + DROP TEMPORARY TABLE + tmp.sale, + tmp.sale2, + tmp.`grouping`, + tmp.grouping2, + tmp.salePlacementList_2, + tmp.salePlacementList_3; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72203,18 +72203,18 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareClientList`() -BEGIN - - /* - * Require la tabla tmp.ticket(id,clientFk) - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.client; - CREATE TEMPORARY TABLE tmp.client - (PRIMARY KEY (id)) - ENGINE = MEMORY - SELECT DISTINCT clientFk id - FROM tmp.ticket; +BEGIN + + /* + * Require la tabla tmp.ticket(id,clientFk) + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.client; + CREATE TEMPORARY TABLE tmp.client + (PRIMARY KEY (id)) + ENGINE = MEMORY + SELECT DISTINCT clientFk id + FROM tmp.ticket; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72232,25 +72232,25 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME) -BEGIN - - DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket; - CREATE TEMPORARY TABLE tmp.productionTicket - (PRIMARY KEY (ticketFk)) - ENGINE = MEMORY - SELECT t.id ticketFk, t.clientFk - FROM vn.ticket t - LEFT JOIN vn.ticketState ts ON ts.ticket = t.id - JOIN vn.client c ON c.id = t.clientFk - WHERE c.typeFk IN ('normal','handMaking','internalUse') - AND ( - t.shipped BETWEEN CURDATE() AND vEndingDate - OR ( - ts.alertLevel < 3 - AND t.shipped >= vStartingDate - AND t.shipped < CURDATE() - ) - ); +BEGIN + + DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket; + CREATE TEMPORARY TABLE tmp.productionTicket + (PRIMARY KEY (ticketFk)) + ENGINE = MEMORY + SELECT t.id ticketFk, t.clientFk + FROM vn.ticket t + LEFT JOIN vn.ticketState ts ON ts.ticket = t.id + JOIN vn.client c ON c.id = t.clientFk + WHERE c.typeFk IN ('normal','handMaking','internalUse') + AND ( + t.shipped BETWEEN CURDATE() AND vEndingDate + OR ( + ts.alertLevel < 3 + AND t.shipped >= vStartingDate + AND t.shipped < CURDATE() + ) + ); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -72424,225 +72424,225 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `prod`(vWarehouseFk INT, vScopeDays INT) -proc: BEGIN - - DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); - - DECLARE vIsTodayRelative BOOLEAN; - - SELECT isTodayRelative INTO vIsTodayRelative - FROM vn.worker - WHERE userFk = vn.getUser(); - - CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT * FROM tmp.productionTicket; - - CALL vn.prepareClientList(); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems; - CREATE TEMPORARY TABLE tmp.ticketGetProblems - (INDEX (ticketFk)) ENGINE = MEMORY - SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped - FROM tmp.productionTicket tt - JOIN vn.ticket t ON t.id = tt.ticketFk; - - CALL vn.ticketGetProblems(vIsTodayRelative); - - DROP TEMPORARY TABLE IF EXISTS tmp.productionBuffer; - CREATE TEMPORARY TABLE tmp.productionBuffer - (PRIMARY KEY(ticketFk)) - ENGINE = MEMORY - SELECT tt.ticketFk - , tt.clientFk - , t.warehouseFk - , t.nickname - , t.packages - , IF(HOUR(t.shipped), HOUR(t.shipped), IFNULL(HOUR(zc.hour),HOUR(z.hour))) as HH - , IFNULL(HOUR(zc.hour),HOUR(z.hour)) as Departure - , IF(MINUTE(t.shipped), MINUTE(t.shipped), IFNULL(MINUTE(zc.hour), MINUTE(z.hour))) as mm - , t.routeFk - , IF(am.deliveryMethodFk = 2,z.`id`,0) as zona - , t.nickname addressNickname - , a.postalCode - , a.city - , p.name province - , CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency - , am.id agencyModeFk - , 0 AS `lines` - , CAST( 0 AS DECIMAL(5,2)) AS m3 - , CAST( 0 AS DECIMAL(5,2)) AS preparationRate - , "" as problem - , IFNULL(tls.state,2) AS state - , w.code workerCode - , DATE(t.shipped) shipped - , wk.code AS salesPersonCode - , p.id provinceFk - , tls.productionOrder - , ifnull(tls.alertLevel,0) alertLevel - , t.isBoxed as palletized - , rg.deviceId ubicacion - , tlu.lastUpdated - -- , tls.updated lastUpdated - , ifnull(st.graphCategory,0) graphCategory - , pk.code as parking - , 0 AS H - , 0 AS V - , 0 AS F - , 0 AS P - , st.isOk - , ag.isOwn - FROM tmp.productionTicket tt - JOIN vn.ticket t on tt.ticketFk = t.id - LEFT JOIN vn.ticketStateToday tst ON tst.ticket = t.id - LEFT JOIN vn.state st ON st.id = tst.state - LEFT JOIN vn.client c ON c.id = t.clientFk - LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk - JOIN vn.address a on a.id = t.addressFk - LEFT JOIN vn.province p on p.id = a.provinceFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.agency ag ON ag.id = am.agencyFk - LEFT JOIN vn.ticketState tls on tls.ticket = tt.ticketFk - LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk - LEFT JOIN vn.worker w on w.id = tls.worker - LEFT JOIN vn.routeGate rg ON rg.routeFk = t.routeFk - LEFT JOIN vn.zone z ON z.id = t.zoneFk - LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND date(t.shipped) = zc.dated - LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id - LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk - WHERE t.warehouseFk = vWarehouseFk - AND am.deliveryMethodFk IN (1,2,3); - - ALTER TABLE tmp.productionBuffer - CHANGE COLUMN `problem` `problem` VARCHAR(255), - ADD COLUMN `collectionH` INT, - ADD COLUMN `collectionV` INT, - ADD COLUMN `collectionF` INT, - ADD COLUMN `collectionP` INT; - - -- Líneas y volumen por ticket - UPDATE tmp.productionBuffer pb - JOIN ( - SELECT tt.ticketFk, - COUNT(*) as `lines`, - sum(sv.volume) as m3, - IFNULL(sum(IF(sv.isPicked,sv.volume,0)) / sum(sv.volume),0) as rate - FROM tmp.productionTicket tt - JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk - GROUP BY tt.ticketFk - ) m on m.ticketFk = pb.ticketFk - SET pb.`lines` = m.`lines`, - pb.m3 = m.m3, - pb.preparationRate = m.rate; - - DELETE FROM tmp.productionBuffer - WHERE `lines`= 0; - - -- Lineas por linea de encajado - UPDATE tmp.productionBuffer pb - JOIN ( SELECT ticketFk, - sum(sub.H) H, - sum(sub.V) V, - sum(sub.F) F, - sum(sub.P) P - FROM ( - SELECT t.ticketFk, - sum(i.itemPackingTypeFk = 'H') H, - sum(i.itemPackingTypeFk = 'V') V, - sum(i.itemPackingTypeFk = 'F') F, - sum(i.itemPackingTypeFk = 'P') P - FROM tmp.productionTicket t - JOIN vn.sale s ON s.ticketFk = t.ticketFk - JOIN vn.item i ON i.id = s.itemFk - GROUP BY t.ticketFk, i.itemPackingTypeFk) sub - GROUP BY ticketFk - ) sub2 ON sub2.ticketFk = pb.ticketFk - SET pb.H = sub2.H, - pb.V = sub2.V, - pb.F = sub2.F, - pb.P = sub2.P; - - -- Colecciones segun tipo de encajado - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionH = c.id - WHERE c.itemPackingTypeFk = 'H' OR ISNULL(c.itemPackingTypeFk); - - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionV = c.id - WHERE c.itemPackingTypeFk = 'V' OR ISNULL(c.itemPackingTypeFk); - - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionF = c.id - WHERE c.itemPackingTypeFk = 'F' OR ISNULL(c.itemPackingTypeFk); - - UPDATE tmp.productionBuffer pb - JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk - JOIN vn.collection c ON c.id = tc.collectionFk - SET pb.collectionP = c.id - WHERE c.itemPackingTypeFk = 'P' OR ISNULL(c.itemPackingTypeFk); - - -- Cajas - ALTER TABLE tmp.productionBuffer - ADD Cajas DOUBLE DEFAULT NULL; - /* - -- Problemas por ticket - UPDATE tmp.productionBuffer pb - JOIN tmp.ticketProblems tp ON tp.ticketFk = pb.ticketFk - SET pb.problem = CAST(CONCAT( IFNULL(tp.itemShortage,''), - IFNULL(tp.itemDelay,''), - IF(tp.isFreezed,' CONGELADO',''), - IF(tp.risk,' RIESGO',''), - IF(tp.hasTicketRequest, ' COD 100',''), - IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), - IF(tp.componentLack,' COMPONENTES', '') - ) as char(255)); - */ - -- Refresca la caché para el cierre dinámico de agencias - -- CALL cache.departure_timing(vWarehouseFk); -/* - -- Tickets de recogida - REPLACE tmp.productionBuffer( - shipped - , ticketFk - , agency - , clientFk - , addressNickname - , state - , workerCode - , alertLevel - , warehouseFk - ) - SELECT DATE(t.shipped) - , t.id - , am.name - , t.clientFk - , a.nickname - , s.id as state - , w.code - , ifnull(tls.alertLevel,0) alert_level - , vWarehouseFk - FROM vn.ticket t - JOIN vn.address a on a.id = t.addressFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = am.id - LEFT JOIN vn.ticketState tls on tls.ticket = t.id - LEFT JOIN vn.state s ON s.id = tls.state - LEFT JOIN vn.worker w on w.id = tls.worker - WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) - AND wp.warehouse_id = vWarehouseFk; -*/ - DROP TEMPORARY TABLE tmp.productionTicket; - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE IF EXISTS tmp.risk; - +proc: BEGIN + + DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,util.dayEnd(CURDATE())); + + DECLARE vIsTodayRelative BOOLEAN; + + SELECT isTodayRelative INTO vIsTodayRelative + FROM vn.worker + WHERE userFk = vn.getUser(); + + CALL vn.prepareTicketList(TIMESTAMPADD(DAY,-1,CURDATE()), vEndingDate); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT * FROM tmp.productionTicket; + + CALL vn.prepareClientList(); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketGetProblems; + CREATE TEMPORARY TABLE tmp.ticketGetProblems + (INDEX (ticketFk)) ENGINE = MEMORY + SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped + FROM tmp.productionTicket tt + JOIN vn.ticket t ON t.id = tt.ticketFk; + + CALL vn.ticketGetProblems(vIsTodayRelative); + + DROP TEMPORARY TABLE IF EXISTS tmp.productionBuffer; + CREATE TEMPORARY TABLE tmp.productionBuffer + (PRIMARY KEY(ticketFk)) + ENGINE = MEMORY + SELECT tt.ticketFk + , tt.clientFk + , t.warehouseFk + , t.nickname + , t.packages + , IF(HOUR(t.shipped), HOUR(t.shipped), IFNULL(HOUR(zc.hour),HOUR(z.hour))) as HH + , IFNULL(HOUR(zc.hour),HOUR(z.hour)) as Departure + , IF(MINUTE(t.shipped), MINUTE(t.shipped), IFNULL(MINUTE(zc.hour), MINUTE(z.hour))) as mm + , t.routeFk + , IF(am.deliveryMethodFk = 2,z.`id`,0) as zona + , t.nickname addressNickname + , a.postalCode + , a.city + , p.name province + , CONCAT(z.`name`,' ',IFNULL(RIGHT(t.routeFk,3),'')) agency + , am.id agencyModeFk + , 0 AS `lines` + , CAST( 0 AS DECIMAL(5,2)) AS m3 + , CAST( 0 AS DECIMAL(5,2)) AS preparationRate + , "" as problem + , IFNULL(tls.state,2) AS state + , w.code workerCode + , DATE(t.shipped) shipped + , wk.code AS salesPersonCode + , p.id provinceFk + , tls.productionOrder + , ifnull(tls.alertLevel,0) alertLevel + , t.isBoxed as palletized + , rg.deviceId ubicacion + , tlu.lastUpdated + -- , tls.updated lastUpdated + , ifnull(st.graphCategory,0) graphCategory + , pk.code as parking + , 0 AS H + , 0 AS V + , 0 AS F + , 0 AS P + , st.isOk + , ag.isOwn + FROM tmp.productionTicket tt + JOIN vn.ticket t on tt.ticketFk = t.id + LEFT JOIN vn.ticketStateToday tst ON tst.ticket = t.id + LEFT JOIN vn.state st ON st.id = tst.state + LEFT JOIN vn.client c ON c.id = t.clientFk + LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk + JOIN vn.address a on a.id = t.addressFk + LEFT JOIN vn.province p on p.id = a.provinceFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.agency ag ON ag.id = am.agencyFk + LEFT JOIN vn.ticketState tls on tls.ticket = tt.ticketFk + LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk + LEFT JOIN vn.worker w on w.id = tls.worker + LEFT JOIN vn.routeGate rg ON rg.routeFk = t.routeFk + LEFT JOIN vn.zone z ON z.id = t.zoneFk + LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk AND date(t.shipped) = zc.dated + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk + WHERE t.warehouseFk = vWarehouseFk + AND am.deliveryMethodFk IN (1,2,3); + + ALTER TABLE tmp.productionBuffer + CHANGE COLUMN `problem` `problem` VARCHAR(255), + ADD COLUMN `collectionH` INT, + ADD COLUMN `collectionV` INT, + ADD COLUMN `collectionF` INT, + ADD COLUMN `collectionP` INT; + + -- Líneas y volumen por ticket + UPDATE tmp.productionBuffer pb + JOIN ( + SELECT tt.ticketFk, + COUNT(*) as `lines`, + sum(sv.volume) as m3, + IFNULL(sum(IF(sv.isPicked,sv.volume,0)) / sum(sv.volume),0) as rate + FROM tmp.productionTicket tt + JOIN vn.saleVolume sv on sv.ticketFk = tt.ticketFk + GROUP BY tt.ticketFk + ) m on m.ticketFk = pb.ticketFk + SET pb.`lines` = m.`lines`, + pb.m3 = m.m3, + pb.preparationRate = m.rate; + + DELETE FROM tmp.productionBuffer + WHERE `lines`= 0; + + -- Lineas por linea de encajado + UPDATE tmp.productionBuffer pb + JOIN ( SELECT ticketFk, + sum(sub.H) H, + sum(sub.V) V, + sum(sub.F) F, + sum(sub.P) P + FROM ( + SELECT t.ticketFk, + sum(i.itemPackingTypeFk = 'H') H, + sum(i.itemPackingTypeFk = 'V') V, + sum(i.itemPackingTypeFk = 'F') F, + sum(i.itemPackingTypeFk = 'P') P + FROM tmp.productionTicket t + JOIN vn.sale s ON s.ticketFk = t.ticketFk + JOIN vn.item i ON i.id = s.itemFk + GROUP BY t.ticketFk, i.itemPackingTypeFk) sub + GROUP BY ticketFk + ) sub2 ON sub2.ticketFk = pb.ticketFk + SET pb.H = sub2.H, + pb.V = sub2.V, + pb.F = sub2.F, + pb.P = sub2.P; + + -- Colecciones segun tipo de encajado + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionH = c.id + WHERE c.itemPackingTypeFk = 'H' OR ISNULL(c.itemPackingTypeFk); + + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionV = c.id + WHERE c.itemPackingTypeFk = 'V' OR ISNULL(c.itemPackingTypeFk); + + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionF = c.id + WHERE c.itemPackingTypeFk = 'F' OR ISNULL(c.itemPackingTypeFk); + + UPDATE tmp.productionBuffer pb + JOIN vn.ticketCollection tc ON pb.ticketFk = tc.ticketFk + JOIN vn.collection c ON c.id = tc.collectionFk + SET pb.collectionP = c.id + WHERE c.itemPackingTypeFk = 'P' OR ISNULL(c.itemPackingTypeFk); + + -- Cajas + ALTER TABLE tmp.productionBuffer + ADD Cajas DOUBLE DEFAULT NULL; + /* + -- Problemas por ticket + UPDATE tmp.productionBuffer pb + JOIN tmp.ticketProblems tp ON tp.ticketFk = pb.ticketFk + SET pb.problem = CAST(CONCAT( IFNULL(tp.itemShortage,''), + IFNULL(tp.itemDelay,''), + IF(tp.isFreezed,' CONGELADO',''), + IF(tp.risk,' RIESGO',''), + IF(tp.hasTicketRequest, ' COD 100',''), + IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'), + IF(tp.componentLack,' COMPONENTES', '') + ) as char(255)); + */ + -- Refresca la caché para el cierre dinámico de agencias + -- CALL cache.departure_timing(vWarehouseFk); +/* + -- Tickets de recogida + REPLACE tmp.productionBuffer( + shipped + , ticketFk + , agency + , clientFk + , addressNickname + , state + , workerCode + , alertLevel + , warehouseFk + ) + SELECT DATE(t.shipped) + , t.id + , am.name + , t.clientFk + , a.nickname + , s.id as state + , w.code + , ifnull(tls.alertLevel,0) alert_level + , vWarehouseFk + FROM vn.ticket t + JOIN vn.address a on a.id = t.addressFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN vn2008.warehouse_pickup wp ON wp.agency_id = am.id + LEFT JOIN vn.ticketState tls on tls.ticket = t.id + LEFT JOIN vn.state s ON s.id = tls.state + LEFT JOIN vn.worker w on w.id = tls.worker + WHERE t.shipped between TIMESTAMPADD(WEEK,-1,CURDATE()) AND util.dayend(TIMESTAMPADD(DAY,-1,CURDATE())) + AND wp.warehouse_id = vWarehouseFk; +*/ + DROP TEMPORARY TABLE tmp.productionTicket; + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE IF EXISTS tmp.risk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -73915,52 +73915,52 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `reportLabelCollection_get`(vParam INT) -BEGIN -/** - * Obtiene los datos de etiquetas a partir de de un ticket o colección. - * - * @param vParam Ticket/Colección del que sacar los datos - */ - DECLARE vIsTicket BOOL; - - SELECT IF(id, TRUE, FALSE) INTO vIsTicket - FROM ticket - WHERE created > (CURRENT_DATE() - INTERVAL 1 MONTH) - AND id = vParam; - - SELECT c.itemPackingTypeFk, - CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color, - CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV, - tc.ticketFk, - LEFT(IF(t.routeFk IS NULL, am.name, zo.name ), 12) agencyDescription, - am.name, - t.clientFk, - CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), 'm³') m3 , - CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) size, - w.code workerCode, - tt.labelCount, - IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) agencyHour, - t.shipped, - COUNT(*) lineCount, - t.nickName - FROM ticket t - JOIN ticketCollection tc ON tc.ticketFk = t.id - JOIN collection c ON c.id = tc.collectionFk - JOIN collectionColors cc ON cc.shelve = tc.`level` - AND cc.wagon = tc.wagon - AND cc.trainFk = c.trainFk - JOIN sale s ON s.ticketFk = t.id - LEFT JOIN saleVolume sv ON sv.saleFk = s.id - JOIN item i ON i.id = s.itemFk - JOIN itemType it ON it.id = i.typeFk - JOIN itemCategory ic ON ic.id = it.categoryFk - JOIN worker w ON w.id = c.workerFk - JOIN agencyMode am ON am.id = t.agencyModeFk - LEFT JOIN ticketTrolley tt ON tt.ticket = t.id - LEFT JOIN `zone` zo ON t.zoneFk = zo.id - WHERE IF(vIsTicket, tc.ticketFk = vParam, tc.collectionFk = vParam) - GROUP BY t.id - ORDER BY cc.`code`; +BEGIN +/** + * Obtiene los datos de etiquetas a partir de de un ticket o colección. + * + * @param vParam Ticket/Colección del que sacar los datos + */ + DECLARE vIsTicket BOOL; + + SELECT IF(id, TRUE, FALSE) INTO vIsTicket + FROM ticket + WHERE created > (CURRENT_DATE() - INTERVAL 1 MONTH) + AND id = vParam; + + SELECT c.itemPackingTypeFk, + CONCAT(tc.collectionFk, ' ', LEFT(cc.code, 4)) color, + CONCAT(tc.collectionFk, ' ', SUBSTRING('ABCDEFGH',tc.wagon, 1), '-', tc.`level`) levelV, + tc.ticketFk, + LEFT(IF(t.routeFk IS NULL, am.name, zo.name ), 12) agencyDescription, + am.name, + t.clientFk, + CONCAT(CAST(SUM(sv.volume) AS DECIMAL(5, 2)), 'm³') m3 , + CAST(IF(ic.code = 'plant', CONCAT(MAX(i.`size`),' cm'), COUNT(*)) AS CHAR) size, + w.code workerCode, + tt.labelCount, + IF(HOUR(t.shipped), TIME(t.shipped), TIME(zo.`hour`)) agencyHour, + t.shipped, + COUNT(*) lineCount, + t.nickName + FROM ticket t + JOIN ticketCollection tc ON tc.ticketFk = t.id + JOIN collection c ON c.id = tc.collectionFk + JOIN collectionColors cc ON cc.shelve = tc.`level` + AND cc.wagon = tc.wagon + AND cc.trainFk = c.trainFk + JOIN sale s ON s.ticketFk = t.id + LEFT JOIN saleVolume sv ON sv.saleFk = s.id + JOIN item i ON i.id = s.itemFk + JOIN itemType it ON it.id = i.typeFk + JOIN itemCategory ic ON ic.id = it.categoryFk + JOIN worker w ON w.id = c.workerFk + JOIN agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN ticketTrolley tt ON tt.ticket = t.id + LEFT JOIN `zone` zo ON t.zoneFk = zo.id + WHERE IF(vIsTicket, tc.ticketFk = vParam, tc.collectionFk = vParam) + GROUP BY t.id + ORDER BY cc.`code`; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74112,25 +74112,25 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `routeGate_assignDevice`(vDevice VARCHAR(30), vRouteFk INT) -BEGIN -/** - * Asigna el dispositivo la ruta - * - * @param vDevice Dispositivo a remplazar - * @param vRouteFk Ruta a la cual asignarlo - */ - IF ISNULL(vDevice) THEN - - DELETE FROM routeGate - WHERE routeFk = vRouteFk; - - ELSE - - REPLACE routeGate(routeFk, deviceId) - VALUES(vRouteFk, vDevice); - - END IF; - +BEGIN +/** + * Asigna el dispositivo la ruta + * + * @param vDevice Dispositivo a remplazar + * @param vRouteFk Ruta a la cual asignarlo + */ + IF ISNULL(vDevice) THEN + + DELETE FROM routeGate + WHERE routeFk = vRouteFk; + + ELSE + + REPLACE routeGate(routeFk, deviceId) + VALUES(vRouteFk, vDevice); + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74447,64 +74447,64 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `route_getTickets`(vRouteFk INT) -BEGIN -/** - * Pasado un RouteFk devuelve la información - * de sus tickets. - * - * @param vRouteFk - * - * @select Información de los tickets - */ - - SELECT - t.id AS Id, - t.clientFk AS Client, - a.id AS Address, - a.nickname AS ClientName, - t.packages AS Packages, - a.street AS AddressName, - a.postalCode AS PostalCode, - a.city AS City, - sub2.itemPackingTypeFk AS PackingType, - c.phone AS ClientPhone, - c.mobile AS ClientMobile, - a.phone AS AddressPhone, - a.mobile AS AddressMobile, - tl.longitude AS Longitude, - tl.latitude AS Latitude, - wm.mediaValue AS SalePersonPhone, - tob.Note AS Note, - t.isSigned AS Signed, - st.id AS Polizon - FROM ticket t - JOIN client c ON t.clientFk = c.id - JOIN address a ON t.addressFk = a.id - LEFT JOIN ticketLocation tl ON tl.ticketFk = t.id - LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk - LEFT JOIN - (SELECT tob.description AS Note, t.id - FROM ticketObservation tob - JOIN ticket t ON tob.ticketFk = t.id - JOIN observationType ot ON ot.id = tob.observationTypeFk - WHERE t.routeFk = vRouteFk - AND ot.code = 'delivery' - )tob ON tob.id = t.id - LEFT JOIN stowaway st ON st.shipFk = t.id - LEFT JOIN - (SELECT sub.ticketFk, - CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeFk - FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items - FROM ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN item i ON i.id = s.itemFk - WHERE t.routeFk = vRouteFk - GROUP BY t.id,i.itemPackingTypeFk)sub - GROUP BY sub.ticketFk - ) sub2 ON sub2.ticketFk = t.id - WHERE t.routeFk = vRouteFk - GROUP BY t.id - ORDER BY t.priority; +BEGIN +/** + * Pasado un RouteFk devuelve la información + * de sus tickets. + * + * @param vRouteFk + * + * @select Información de los tickets + */ + + SELECT + t.id AS Id, + t.clientFk AS Client, + a.id AS Address, + a.nickname AS ClientName, + t.packages AS Packages, + a.street AS AddressName, + a.postalCode AS PostalCode, + a.city AS City, + sub2.itemPackingTypeFk AS PackingType, + c.phone AS ClientPhone, + c.mobile AS ClientMobile, + a.phone AS AddressPhone, + a.mobile AS AddressMobile, + tl.longitude AS Longitude, + tl.latitude AS Latitude, + wm.mediaValue AS SalePersonPhone, + tob.Note AS Note, + t.isSigned AS Signed, + st.id AS Polizon + FROM ticket t + JOIN client c ON t.clientFk = c.id + JOIN address a ON t.addressFk = a.id + LEFT JOIN ticketLocation tl ON tl.ticketFk = t.id + LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk + LEFT JOIN + (SELECT tob.description AS Note, t.id + FROM ticketObservation tob + JOIN ticket t ON tob.ticketFk = t.id + JOIN observationType ot ON ot.id = tob.observationTypeFk + WHERE t.routeFk = vRouteFk + AND ot.code = 'delivery' + )tob ON tob.id = t.id + LEFT JOIN stowaway st ON st.shipFk = t.id + LEFT JOIN + (SELECT sub.ticketFk, + CONCAT('(', GROUP_CONCAT(DISTINCT sub.itemPackingTypeFk ORDER BY sub.items DESC SEPARATOR ','), ') ') itemPackingTypeFk + FROM (SELECT s.ticketFk , i.itemPackingTypeFk, COUNT(*) items + FROM ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN item i ON i.id = s.itemFk + WHERE t.routeFk = vRouteFk + GROUP BY t.id,i.itemPackingTypeFk)sub + GROUP BY sub.ticketFk + ) sub2 ON sub2.ticketFk = t.id + WHERE t.routeFk = vRouteFk + GROUP BY t.id + ORDER BY t.priority; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74727,28 +74727,28 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleBuy_Add`(vSaleFk INT, vBuyFk INT) -BEGIN - - /* Añade un registro a la tabla saleBuy en el caso de que sea posible mantener la trazabilidad - * - * @param vSaleFk clave primaria de vn.sale - * @param vBuyFk clave primaria de vn.buy - */ - /*IF (SELECT COUNT(*) - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - WHERE s.id = vSaleFk - AND ic.code = 'fruit') THEN */ - - IF (SELECT COUNT(*) FROM vn.buy WHERE id = vBuyFk AND itemOriginalFk) THEN - - INSERT INTO vn.saleBuy (saleFk, buyFk) - VALUES(vSaleFk, vBuyFk); - - END IF; - +BEGIN + + /* Añade un registro a la tabla saleBuy en el caso de que sea posible mantener la trazabilidad + * + * @param vSaleFk clave primaria de vn.sale + * @param vBuyFk clave primaria de vn.buy + */ + /*IF (SELECT COUNT(*) + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + WHERE s.id = vSaleFk + AND ic.code = 'fruit') THEN */ + + IF (SELECT COUNT(*) FROM vn.buy WHERE id = vBuyFk AND itemOriginalFk) THEN + + INSERT INTO vn.saleBuy (saleFk, buyFk) + VALUES(vSaleFk, vBuyFk); + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74766,16 +74766,16 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleGroup_add`(vSectorFk INT) -BEGIN -/** - * Añade un nuevo registro a la tabla y devuelve su id. - * - * @param vSectorFk Identificador de vn.sector - */ - INSERT INTO vn.saleGroup(userFk, sectorFk) - VALUES (account.myUser_getId(), vSectorFk); - - SELECT LAST_INSERT_ID(); +BEGIN +/** + * Añade un nuevo registro a la tabla y devuelve su id. + * + * @param vSectorFk Identificador de vn.sector + */ + INSERT INTO vn.saleGroup(userFk, sectorFk) + VALUES (account.myUser_getId(), vSectorFk); + + SELECT LAST_INSERT_ID(); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -74857,77 +74857,77 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleItemShelvingMake__`(IN `vTicketFk` INT, IN `vSectorFk` INT) -BEGIN - - SET @rest:= CAST(0 AS DECIMAL(10,0)); - SET @saleFk := CAST(0 AS DECIMAL(10,0)); - SET @reserved := CAST(0 AS DECIMAL(10,0)); - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN sale s ON s.id = sis.saleFk - SET ish.visible = sis.quantity + ish.visible, - ish.available = sis.quantity + ish.visible - WHERE s.ticketFk = vTicketFk; - - DELETE sis.* - FROM saleItemShelving sis - JOIN sale s ON s.id = sis.saleFk - WHERE s.ticketFk = vTicketFk; - - INSERT INTO saleItemShelving( saleFk, - itemShelvingFk, - quantity, - ubication) - SELECT saleFk, - itemShelvingFk, - CAST(Reserved as DECIMAL(10,0)) as Reserved, - ubication - FROM - (SELECT saleFk, - itemShelvingFk, - ubication, - @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, - @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, - @rest := @rest - @reserved, - @saleFk := saleFk - FROM - ( SELECT s.id as saleFk, - ish.created, - ish.id as itemShelvingFk, - ish.available, - s.quantity, - ish.packing, - CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk - JOIN vn.parking p ON p.sectorFk = sc.id - JOIN vn.shelving sh ON sh.parkingFk = p.id - JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk - WHERE t.id = vTicketFk - AND sc.id = vSectorFk - AND s.quantity MOD ish.packing = 0 - AND s.quantity >= ish.packing - ORDER BY s.id, - sh.priority DESC, - ish.packing DESC, - ish.created - ) sub - ) sub2 - WHERE Reserved > 0; - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN vn.sale s ON s.id = sis.saleFk - SET ish.available = ish.visible - sis.quantity, - ish.visible = ish.visible - sis.quantity - WHERE s.ticketFk = vTicketFk - AND s.isPicked = FALSE; - - CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE); - - +BEGIN + + SET @rest:= CAST(0 AS DECIMAL(10,0)); + SET @saleFk := CAST(0 AS DECIMAL(10,0)); + SET @reserved := CAST(0 AS DECIMAL(10,0)); + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN sale s ON s.id = sis.saleFk + SET ish.visible = sis.quantity + ish.visible, + ish.available = sis.quantity + ish.visible + WHERE s.ticketFk = vTicketFk; + + DELETE sis.* + FROM saleItemShelving sis + JOIN sale s ON s.id = sis.saleFk + WHERE s.ticketFk = vTicketFk; + + INSERT INTO saleItemShelving( saleFk, + itemShelvingFk, + quantity, + ubication) + SELECT saleFk, + itemShelvingFk, + CAST(Reserved as DECIMAL(10,0)) as Reserved, + ubication + FROM + (SELECT saleFk, + itemShelvingFk, + ubication, + @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, + @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, + @rest := @rest - @reserved, + @saleFk := saleFk + FROM + ( SELECT s.id as saleFk, + ish.created, + ish.id as itemShelvingFk, + ish.available, + s.quantity, + ish.packing, + CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk + JOIN vn.parking p ON p.sectorFk = sc.id + JOIN vn.shelving sh ON sh.parkingFk = p.id + JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk + WHERE t.id = vTicketFk + AND sc.id = vSectorFk + AND s.quantity MOD ish.packing = 0 + AND s.quantity >= ish.packing + ORDER BY s.id, + sh.priority DESC, + ish.packing DESC, + ish.created + ) sub + ) sub2 + WHERE Reserved > 0; + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN vn.sale s ON s.id = sis.saleFk + SET ish.available = ish.visible - sis.quantity, + ish.visible = ish.visible - sis.quantity + WHERE s.ticketFk = vTicketFk + AND s.isPicked = FALSE; + + CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE); + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75058,20 +75058,20 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleParking_add__`(vSaleFk INT, vParkingCode VARCHAR(10)) -BEGIN - - /* - * Inserta registro en saleParking - * - * vSaleFk Identificador de vn.sale - * vParkingCode Code de vn.parking - */ - - INSERT INTO vn.saleParking(saleFk, parkingFk, userFk) - SELECT vSaleFk, p.id, account.myUser_getId() - FROM vn.parking p - WHERE p.code = vParkingCode COLLATE utf8_unicode_ci; - +BEGIN + + /* + * Inserta registro en saleParking + * + * vSaleFk Identificador de vn.sale + * vParkingCode Code de vn.parking + */ + + INSERT INTO vn.saleParking(saleFk, parkingFk, userFk) + SELECT vSaleFk, p.id, account.myUser_getId() + FROM vn.parking p + WHERE p.code = vParkingCode COLLATE utf8_unicode_ci; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75295,28 +75295,28 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_add`(vSaleGroupFk INT) -BEGIN - - /* Inserta en vn.saleTracking las lineas de una previa - * - * @param vSaleGroupFk Identificador de vn.saleGroup - */ - - REPLACE vn.saleTracking(saleFk, - isChecked, - workerFk, - actionFk, - stateFk) - SELECT sgd.saleFk , - TRUE, - account.myUser_getId(), - a.accion_id, - s.id - FROM vn.saleGroupDetail sgd - JOIN vncontrol.accion a ON a.accion = 'SACAR' - JOIN vn.state s ON s.code = 'ON_PREPARATION' - WHERE sgd.saleGroupFk = vSaleGroupFk; - +BEGIN + + /* Inserta en vn.saleTracking las lineas de una previa + * + * @param vSaleGroupFk Identificador de vn.saleGroup + */ + + REPLACE vn.saleTracking(saleFk, + isChecked, + workerFk, + actionFk, + stateFk) + SELECT sgd.saleFk , + TRUE, + account.myUser_getId(), + a.accion_id, + s.id + FROM vn.saleGroupDetail sgd + JOIN vncontrol.accion a ON a.accion = 'SACAR' + JOIN vn.state s ON s.code = 'ON_PREPARATION' + WHERE sgd.saleGroupFk = vSaleGroupFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75334,21 +75334,21 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_addPreparedSaleGroup`(vSaleGroupFk INT) -BEGIN - - /** - * Inserta lineas de vn.saleTracking para un saleGroup (previa) que escanea un sacador - * - * @param vSaleGroupFk Identificador de vn.saleGroup - */ - - REPLACE vn.saleTracking(saleFk, isChecked, workerFk, actionFk, stateFk) - SELECT sgd.saleFk, TRUE, account.myUser_getId(), a.accion_id id, s.id - FROM vn.saleGroupDetail sgd - JOIN vncontrol.accion a ON a.accion = 'SACAR' - JOIN vn.state s ON s.code = 'PREPARED' - WHERE sgd.saleGroupFk = vSaleGroupFk; - +BEGIN + + /** + * Inserta lineas de vn.saleTracking para un saleGroup (previa) que escanea un sacador + * + * @param vSaleGroupFk Identificador de vn.saleGroup + */ + + REPLACE vn.saleTracking(saleFk, isChecked, workerFk, actionFk, stateFk) + SELECT sgd.saleFk, TRUE, account.myUser_getId(), a.accion_id id, s.id + FROM vn.saleGroupDetail sgd + JOIN vncontrol.accion a ON a.accion = 'SACAR' + JOIN vn.state s ON s.code = 'PREPARED' + WHERE sgd.saleGroupFk = vSaleGroupFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75366,31 +75366,31 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `saleTracking_addPrevOK`(vSectorCollectionFk INT) -BEGIN - - /** - * Inserta los registros de la colección de sector con el estado PREVIA OK - * - * @param vSectorCollectionFk Identificador de vn.sectorCollection - */ - - REPLACE vn.saleTracking(saleFk, - isChecked, - workerFk, - actionFk, - stateFk) - SELECT sgd.saleFk, - TRUE, - sc.userFk, - a.accion_id, - s.id - FROM vn.sectorCollection sc - JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id - JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk - JOIN vn.state s ON s.code = 'OK PREVIOUS' - JOIN vncontrol.accion a ON a.accion = 'PRESACAR' - WHERE sc.id = vSectorCollectionFk; - +BEGIN + + /** + * Inserta los registros de la colección de sector con el estado PREVIA OK + * + * @param vSectorCollectionFk Identificador de vn.sectorCollection + */ + + REPLACE vn.saleTracking(saleFk, + isChecked, + workerFk, + actionFk, + stateFk) + SELECT sgd.saleFk, + TRUE, + sc.userFk, + a.accion_id, + s.id + FROM vn.sectorCollection sc + JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id + JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk + JOIN vn.state s ON s.code = 'OK PREVIOUS' + JOIN vncontrol.accion a ON a.accion = 'PRESACAR' + WHERE sc.id = vSectorCollectionFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75916,42 +75916,42 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getForSijsner__`(vDated DATE) -BEGIN - - /** - * Devuelve el listado de ventas que tiene que etiquetar Sijsner para la fecha dada - * - * @param vDated Fecha de preparación de los tickets - */ - - SELECT b.printedStickers OR s.isPicked isPrinted, - t.shipped , - t.nickname , - s.ticketFk , - s.itemFk , - FLOOR(s.quantity / e.pac) stickers, - CONCAT(FLOOR(s.quantity / e.pac) , ' x ', e.pac ) amount, - s.concept, - e.kop, - e.sub, - sp.company_name supplier, - b.id buyFk - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.warehouse w ON w.id = t.warehouseFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.item i ON i.id = s.itemFk - JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk - JOIN vn.buy b ON b.id = lb.buy_id - LEFT JOIN edi.ekt e ON e.id = b.ektFk - LEFT JOIN edi.supplier sp ON sp.supplier_id = e.pro - WHERE t.shipped BETWEEN vDated AND TIMESTAMPADD(HOUR,23,vDated) - AND c.code != 'ES' - AND w.code IN ('FLM','VNH') - AND s.quantity ; - +BEGIN + + /** + * Devuelve el listado de ventas que tiene que etiquetar Sijsner para la fecha dada + * + * @param vDated Fecha de preparación de los tickets + */ + + SELECT b.printedStickers OR s.isPicked isPrinted, + t.shipped , + t.nickname , + s.ticketFk , + s.itemFk , + FLOOR(s.quantity / e.pac) stickers, + CONCAT(FLOOR(s.quantity / e.pac) , ' x ', e.pac ) amount, + s.concept, + e.kop, + e.sub, + sp.company_name supplier, + b.id buyFk + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.warehouse w ON w.id = t.warehouseFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.item i ON i.id = s.itemFk + JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = t.warehouseFk + JOIN vn.buy b ON b.id = lb.buy_id + LEFT JOIN edi.ekt e ON e.id = b.ektFk + LEFT JOIN edi.supplier sp ON sp.supplier_id = e.pro + WHERE t.shipped BETWEEN vDated AND TIMESTAMPADD(HOUR,23,vDated) + AND c.code != 'ES' + AND w.code IN ('FLM','VNH') + AND s.quantity ; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -75969,115 +75969,115 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_getFromTicketOrCollection`(vParam INT) -BEGIN -/** - * Visualizar lineas de la tabla sale a través del parámetro vParam que puede - * ser ticket o collection. - * - * @param vParam Identificador de ticket o collection - */ - DECLARE vItemPackingTypeFk VARCHAR(1); - DECLARE vIsCollection BOOL; - - SELECT COUNT(*) INTO vIsCollection - FROM collection c - WHERE c.id = vParam; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; - - IF vIsCollection THEN - CREATE TEMPORARY TABLE tmp.ticket - (INDEX (id)) - ENGINE = MEMORY - SELECT tc.ticketFk id - FROM ticketCollection tc - JOIN ticket t ON t.id = tc.ticketFk - WHERE tc.collectionFk = vParam; - - CREATE TEMPORARY TABLE tmp.ticket2 - (INDEX (id)) - ENGINE = MEMORY - SELECT tc.ticketFk id - FROM ticketCollection tc - JOIN ticket t ON t.id = tc.ticketFk - WHERE tc.collectionFk = vParam; - ELSE - CREATE TEMPORARY TABLE tmp.ticket - (INDEX (id)) - ENGINE = MEMORY - SELECT vParam id; - - CREATE TEMPORARY TABLE tmp.ticket2 - (INDEX (id)) - ENGINE = MEMORY - SELECT vParam id; - END IF; - - SELECT s.ticketFk, - sgd.saleGroupFk, - s.id as saleFk, - s.itemFk, - s.quantity, - i.longName, - i.size, - s.reserved, - MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) as isPreviousPrepared, - MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) as isPrepared, - MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) as isControlled, - MAX(IF(st.semaphore <=> 4, TRUE, FALSE)) as isPreControlled, - ic.color, - ip.productor, - s.discount, - s.price, - i.stems, - i.category, - o.code origin, - tt.clientFk, - s.originalQuantity, - TRIM(CONCAT(LPAD(s.concept,30,' '), ' ', - RPAD(IFNULL(i.size,''),5,' '))) line1, - '' cel1, - TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) line2, - IF(s.quantity MOD IFNULL(b.packing,s.quantity + 1), - CONCAT(CAST(s.quantity/IFNULL(b.`grouping`,1) AS DECIMAL(10,0)),' x ',IFNULL(b.`grouping`,1)), - CONCAT(CAST(s.quantity / IFNULL(b.packing,1) AS DECIMAL(10,0)),' pack de ',IFNULL(b.packing,1))) cel2, - TRIM(CONCAT(ic.color)) line3, - p.code cel3, - s.isAdded, - sub2.originalQuantity as startQuantity, -- eliminar cuando tengamos la nueva apk - IFNULL(c.workerFk,getUser()) as workerFk, - IFNULL(SUM(iss.quantity),0) as pickedQuantity, - i.packingShelve, - MIN(iss.created) picked - FROM tmp.ticket t - JOIN sale s ON s.ticketFk = t.id - JOIN ticket tt ON tt.id = t.id - LEFT JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = tt.warehouseFk - LEFT JOIN buy b ON b.id = lb.buy_id - JOIN item i ON i.id = s.itemFk - LEFT JOIN ticketCollection tc ON tc.ticketFk = t.id - LEFT JOIN collection c ON c.id = tc.collectionFk - LEFT JOIN (SELECT sub.saleFk, sub.isChecked, sub.stateFk, sub.originalQuantity - FROM (SELECT DISTINCT st.id, st.saleFk, st.isChecked, st.stateFk, st.originalQuantity - FROM tmp.ticket2 t - JOIN sale s ON s.ticketFk = t.id - JOIN saleTracking st ON st.saleFk = s.id - ORDER BY st.id DESC) sub - GROUP BY sub.saleFk, sub.stateFK) sub2 ON sub2.saleFk = s.id AND sub2.isChecked = 1 - LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id - LEFT JOIN state st ON st.id = sub2.stateFk - LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk - LEFT JOIN itemProductor ip ON ip.itemFk = s.itemFk - LEFT JOIN origin o ON o.id = i.originFk - LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id - LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk - LEFT JOIN parking p ON p.id = sg.parkingFk - GROUP BY s.id; - - DROP TEMPORARY TABLE - tmp.ticket, - tmp.ticket2; +BEGIN +/** + * Visualizar lineas de la tabla sale a través del parámetro vParam que puede + * ser ticket o collection. + * + * @param vParam Identificador de ticket o collection + */ + DECLARE vItemPackingTypeFk VARCHAR(1); + DECLARE vIsCollection BOOL; + + SELECT COUNT(*) INTO vIsCollection + FROM collection c + WHERE c.id = vParam; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + DROP TEMPORARY TABLE IF EXISTS tmp.ticket2; + + IF vIsCollection THEN + CREATE TEMPORARY TABLE tmp.ticket + (INDEX (id)) + ENGINE = MEMORY + SELECT tc.ticketFk id + FROM ticketCollection tc + JOIN ticket t ON t.id = tc.ticketFk + WHERE tc.collectionFk = vParam; + + CREATE TEMPORARY TABLE tmp.ticket2 + (INDEX (id)) + ENGINE = MEMORY + SELECT tc.ticketFk id + FROM ticketCollection tc + JOIN ticket t ON t.id = tc.ticketFk + WHERE tc.collectionFk = vParam; + ELSE + CREATE TEMPORARY TABLE tmp.ticket + (INDEX (id)) + ENGINE = MEMORY + SELECT vParam id; + + CREATE TEMPORARY TABLE tmp.ticket2 + (INDEX (id)) + ENGINE = MEMORY + SELECT vParam id; + END IF; + + SELECT s.ticketFk, + sgd.saleGroupFk, + s.id as saleFk, + s.itemFk, + s.quantity, + i.longName, + i.size, + s.reserved, + MAX(IF(st.semaphore <=> 1, TRUE, FALSE)) as isPreviousPrepared, + MAX(IF(st.semaphore <=> 2, TRUE, FALSE)) as isPrepared, + MAX(IF(st.semaphore <=> 3, TRUE, FALSE)) as isControlled, + MAX(IF(st.semaphore <=> 4, TRUE, FALSE)) as isPreControlled, + ic.color, + ip.productor, + s.discount, + s.price, + i.stems, + i.category, + o.code origin, + tt.clientFk, + s.originalQuantity, + TRIM(CONCAT(LPAD(s.concept,30,' '), ' ', + RPAD(IFNULL(i.size,''),5,' '))) line1, + '' cel1, + TRIM(CONCAT(LPAD(IFNULL(ip.productor,''),30,' '), ' ',LPAD(IFNULL(o.code,''),4,' '))) line2, + IF(s.quantity MOD IFNULL(b.packing,s.quantity + 1), + CONCAT(CAST(s.quantity/IFNULL(b.`grouping`,1) AS DECIMAL(10,0)),' x ',IFNULL(b.`grouping`,1)), + CONCAT(CAST(s.quantity / IFNULL(b.packing,1) AS DECIMAL(10,0)),' pack de ',IFNULL(b.packing,1))) cel2, + TRIM(CONCAT(ic.color)) line3, + p.code cel3, + s.isAdded, + sub2.originalQuantity as startQuantity, -- eliminar cuando tengamos la nueva apk + IFNULL(c.workerFk,getUser()) as workerFk, + IFNULL(SUM(iss.quantity),0) as pickedQuantity, + i.packingShelve, + MIN(iss.created) picked + FROM tmp.ticket t + JOIN sale s ON s.ticketFk = t.id + JOIN ticket tt ON tt.id = t.id + LEFT JOIN cache.last_buy lb ON lb.item_id = s.itemFk AND lb.warehouse_id = tt.warehouseFk + LEFT JOIN buy b ON b.id = lb.buy_id + JOIN item i ON i.id = s.itemFk + LEFT JOIN ticketCollection tc ON tc.ticketFk = t.id + LEFT JOIN collection c ON c.id = tc.collectionFk + LEFT JOIN (SELECT sub.saleFk, sub.isChecked, sub.stateFk, sub.originalQuantity + FROM (SELECT DISTINCT st.id, st.saleFk, st.isChecked, st.stateFk, st.originalQuantity + FROM tmp.ticket2 t + JOIN sale s ON s.ticketFk = t.id + JOIN saleTracking st ON st.saleFk = s.id + ORDER BY st.id DESC) sub + GROUP BY sub.saleFk, sub.stateFK) sub2 ON sub2.saleFk = s.id AND sub2.isChecked = 1 + LEFT JOIN itemShelvingSale iss ON iss.saleFk = s.id + LEFT JOIN state st ON st.id = sub2.stateFk + LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk + LEFT JOIN itemProductor ip ON ip.itemFk = s.itemFk + LEFT JOIN origin o ON o.id = i.originFk + LEFT JOIN saleGroupDetail sgd ON sgd.saleFk = s.id + LEFT JOIN saleGroup sg ON sg.id = sgd.saleGroupFk + LEFT JOIN parking p ON p.id = sg.parkingFk + GROUP BY s.id; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticket2; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76627,24 +76627,24 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_PriceFix`(vTicketFk INT) -BEGIN - - DELETE sc.* - FROM vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk - WHERE s.ticketFk = vTicketFk - AND ct.`type` = 'otros'; - - UPDATE vn.sale s - JOIN ( - SELECT sc.saleFk, sum(sc.value ) price - FROM vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk - WHERE s.ticketFk = vTicketFk - GROUP BY sc.saleFk) sub ON sub.saleFk = s.id - SET s.price = sub.price; +BEGIN + + DELETE sc.* + FROM vn.saleComponent sc + JOIN vn.sale s ON s.id = sc.saleFk + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + WHERE s.ticketFk = vTicketFk + AND ct.`type` = 'otros'; + + UPDATE vn.sale s + JOIN ( + SELECT sc.saleFk, sum(sc.value ) price + FROM vn.saleComponent sc + JOIN vn.sale s ON s.id = sc.saleFk + WHERE s.ticketFk = vTicketFk + GROUP BY sc.saleFk) sub ON sub.saleFk = s.id + SET s.price = sub.price; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76791,31 +76791,31 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sale_setQuantity`(vSaleFk INT, vQuantity INT) -BEGIN -/* - * Actualiza la cantidad de la línea de venta - * - * @vSaleFk id de la línea de venta - * @vQuantity cantidad a modificar - * - */ - - DECLARE vDescription VARCHAR(100); - DECLARE vOrigin INT; - - SELECT CONCAT("Cambio cantidad ",concept," de ", quantity," a ", vQuantity) INTO vDescription - FROM sale - WHERE id = vSaleFk; - - SELECT ticketFk INTO vOrigin FROM sale WHERE id = vSaleFk; - - CALL logAdd(vOrigin, 'update', 'ticket', vDescription); - - UPDATE sale - SET originalQuantity = quantity, - quantity = vQuantity - WHERE id = vSaleFk; - +BEGIN +/* + * Actualiza la cantidad de la línea de venta + * + * @vSaleFk id de la línea de venta + * @vQuantity cantidad a modificar + * + */ + + DECLARE vDescription VARCHAR(100); + DECLARE vOrigin INT; + + SELECT CONCAT("Cambio cantidad ",concept," de ", quantity," a ", vQuantity) INTO vDescription + FROM sale + WHERE id = vSaleFk; + + SELECT ticketFk INTO vOrigin FROM sale WHERE id = vSaleFk; + + CALL logAdd(vOrigin, 'update', 'ticket', vDescription); + + UPDATE sale + SET originalQuantity = quantity, + quantity = vQuantity + WHERE id = vSaleFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -76880,33 +76880,33 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `scanTreeCreate__`() -BEGIN - CALL nestTree( - 'vn2008', - 'scan', - 'vn2008', - 'scanTree' - ); - - 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 expedition e ON e.id = sl.`code` - JOIN 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; +BEGIN + CALL nestTree( + 'vn2008', + 'scan', + 'vn2008', + 'scanTree' + ); + + 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 expedition e ON e.id = sl.`code` + JOIN 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 */ ; @@ -76983,27 +76983,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_get`(vSectorFk INT) -BEGIN - - /** - * Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas - * - * @param vSectorFk Identificador de vn.sector - */ - - SELECT DISTINCT sc.id collectionFk, sc.created - FROM vn.sectorCollection sc - JOIN vn.state s ON s.code = 'PREVIOUS_PREPARATION' - LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id - LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk +BEGIN + + /** + * Devuelve las colecciones del sector que corresponden al usuario conectado, y que estan incompletas + * + * @param vSectorFk Identificador de vn.sector + */ + + SELECT DISTINCT sc.id collectionFk, sc.created + FROM vn.sectorCollection sc + JOIN vn.state s ON s.code = 'PREVIOUS_PREPARATION' + LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id + LEFT JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk LEFT JOIN vn.saleTracking st ON st.saleFk = sgd.saleFk AND st.stateFk = s.id AND st.workerFk = sc.userFk - LEFT JOIN vn.sale sl ON sl.id = st.saleFk - WHERE sc.userFk = account.myUser_getId() - AND (ISNULL(scsg.sectorCollectionFk) + LEFT JOIN vn.sale sl ON sl.id = st.saleFk + WHERE sc.userFk = account.myUser_getId() + AND (ISNULL(scsg.sectorCollectionFk) OR (NOT st.isChecked AND sl.quantity > 0)) - AND sc.created > CURDATE(); - + AND sc.created > CURDATE(); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -77021,36 +77021,36 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_getSale`(vSelf INT) -BEGIN - - /** - * Devuelve las lineas de venta correspondientes a esa coleccion de sector - * - * @param vSelf Identificador de vn.sectorCollection - */ - - SELECT s.ticketFk, - s.itemFk, - i.longName, - IFNULL(i.itemPackingTypeFk,' ') itemPackingTypeFk, - IFNULL(i.subName ,' ') subName, - s.quantity, - w.code workerCode, - sgd.saleFk, - IFNULL(iss.quantity,0) pickedQuantity, - c.salesPersonFk - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk - JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.state stt ON stt.id = st.stateFk AND stt.code = 'PREVIOUS_PREPARATION' - JOIN vn.worker w ON w.id = st.workerFk - JOIN vn.ticket t ON t.id= s.ticketFk - JOIN vn.client c ON c.id=t.clientFk - LEFT JOIN vn.itemShelvingSaleSum iss ON iss.saleFk = s.id - WHERE scsg.sectorCollectionFk = vSelf; - +BEGIN + + /** + * Devuelve las lineas de venta correspondientes a esa coleccion de sector + * + * @param vSelf Identificador de vn.sectorCollection + */ + + SELECT s.ticketFk, + s.itemFk, + i.longName, + IFNULL(i.itemPackingTypeFk,' ') itemPackingTypeFk, + IFNULL(i.subName ,' ') subName, + s.quantity, + w.code workerCode, + sgd.saleFk, + IFNULL(iss.quantity,0) pickedQuantity, + c.salesPersonFk + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.sectorCollectionSaleGroup scsg ON scsg.saleGroupFk = sgd.saleGroupFk + JOIN vn.saleTracking st ON st.saleFk = s.id + JOIN vn.state stt ON stt.id = st.stateFk AND stt.code = 'PREVIOUS_PREPARATION' + JOIN vn.worker w ON w.id = st.workerFk + JOIN vn.ticket t ON t.id= s.ticketFk + JOIN vn.client c ON c.id=t.clientFk + LEFT JOIN vn.itemShelvingSaleSum iss ON iss.saleFk = s.id + WHERE scsg.sectorCollectionFk = vSelf; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -77068,31 +77068,31 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `sectorCollection_new`(vSectorFk INT) -BEGIN - -/** - * Inserta una nueva colección, si el usuario no tiene ninguna vacia. - * Esto se hace para evitar que por error se generen colecciones sin sentido. - * - * @param vSectorFk Identificador de vn.sector - */ - DECLARE hasEmptyCollections BOOL; - DECLARE vUserFk INT; - - SET vUserFk = account.myUser_getId(); - - SELECT (COUNT(sc.id) > 0) INTO hasEmptyCollections - FROM vn.sectorCollection sc - LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id - WHERE ISNULL(scsg.id) - AND sc.userFk = vUserFk - AND sc.sectorFk = vSectorFk - AND sc.created >= CURDATE(); - - IF NOT hasEmptyCollections THEN - INSERT INTO vn.sectorCollection(userFk, sectorFk) - VALUES(vUserFk, vSectorFk); - END IF; +BEGIN + +/** + * Inserta una nueva colección, si el usuario no tiene ninguna vacia. + * Esto se hace para evitar que por error se generen colecciones sin sentido. + * + * @param vSectorFk Identificador de vn.sector + */ + DECLARE hasEmptyCollections BOOL; + DECLARE vUserFk INT; + + SET vUserFk = account.myUser_getId(); + + SELECT (COUNT(sc.id) > 0) INTO hasEmptyCollections + FROM vn.sectorCollection sc + LEFT JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id + WHERE ISNULL(scsg.id) + AND sc.userFk = vUserFk + AND sc.sectorFk = vSectorFk + AND sc.created >= CURDATE(); + + IF NOT hasEmptyCollections THEN + INSERT INTO vn.sectorCollection(userFk, sectorFk) + VALUES(vUserFk, vSectorFk); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -77879,88 +77879,88 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `shelving_getSpam`(vDated DATE, vWarehouseFk INT) -BEGIN - - /** - * Devuelve las matrículas con productos que no son necesarios para la venta hasta la fecha señalada - * - * @param vDated Fecha hasta la que se puede pasar sin esos productos. - * @param vWarehouse Identificador único de vn.warehouse - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.stock; - - CALL cache.stock_refresh(FALSE); - - CREATE TEMPORARY TABLE tmp.stock - SELECT i.id itemFk, - v.amount - IFNULL(fue.reserva,0) as visible, - fue.reserva, - sale.venta, - IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, - IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) - IFNULL(fue.reserva,0) as saldo - FROM vn.item i - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN ( - SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS reserva - FROM vn.itemShelving ish - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - WHERE s.code = 'FUENTES_PICASSE' - OR sh.isSpam - GROUP BY ish.itemFk - ) fue ON fue.itemFk = i.id - LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta - FROM vn2008.item_out - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id - ) sale ON sale.item_id = i.id - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra - FROM vn2008.item_entry_in - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - AND isVirtualStock = FALSE - GROUP BY item_id - ) buy ON buy.item_id = i.id - LEFT JOIN ( - SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado - FROM vn2008.item_entry_out - WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) - AND warehouse_id = vWarehouseFk - GROUP BY item_id - ) mov ON mov.item_id = i.id - WHERE v.amount; - - SELECT ish.shelvingFk matricula, - i.longName articulo, - ish.visible, - count(*) lineas, - sum(ish.visible <= s.saldo) spam, - p.code parking, - s.description sector , - w.name AS almacen, - sh.isSpam - FROM vn.itemShelving ish - JOIN vn.item i ON i.id = ish.itemFk - JOIN vn.shelving sh ON sh.code = ish.shelvingFk - JOIN vn.parking p ON p.id = sh.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - JOIN vn.warehouse w ON w.id = s.warehouseFk - LEFT JOIN tmp.stock s ON s.itemFk = ish.itemFk - WHERE (w.name = 'Algemesi' - OR (w.name = 'NuncaJamas' AND ish.created < curdate())) - AND ish.visible - GROUP BY ish.shelvingFk - HAVING lineas = spam OR isSpam; - - DROP TEMPORARY TABLE tmp.stock; - +BEGIN + + /** + * Devuelve las matrículas con productos que no son necesarios para la venta hasta la fecha señalada + * + * @param vDated Fecha hasta la que se puede pasar sin esos productos. + * @param vWarehouse Identificador único de vn.warehouse + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.stock; + + CALL cache.stock_refresh(FALSE); + + CREATE TEMPORARY TABLE tmp.stock + SELECT i.id itemFk, + v.amount - IFNULL(fue.reserva,0) as visible, + fue.reserva, + sale.venta, + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) as compra, + IFNULL(v.amount,0) + IFNULL(sale.venta,0) + IFNULL(buy.compra,0) + IFNULL(mov.traslado,0) - IFNULL(fue.reserva,0) as saldo + FROM vn.item i + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN ( + SELECT ish.itemFk, CAST(SUM(ish.visible) AS DECIMAL(10,0)) AS reserva + FROM vn.itemShelving ish + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + WHERE s.code = 'FUENTES_PICASSE' + OR sh.isSpam + GROUP BY ish.itemFk + ) fue ON fue.itemFk = i.id + LEFT JOIN cache.stock v ON i.id = v.item_id AND v.warehouse_id = vWarehouseFk + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as venta + FROM vn2008.item_out + WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + AND warehouse_id = vWarehouseFk + GROUP BY item_id + ) sale ON sale.item_id = i.id + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as compra + FROM vn2008.item_entry_in + WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + AND warehouse_id = vWarehouseFk + AND isVirtualStock = FALSE + GROUP BY item_id + ) buy ON buy.item_id = i.id + LEFT JOIN ( + SELECT item_id, CAST(sum(amount)AS DECIMAL(10,0)) as traslado + FROM vn2008.item_entry_out + WHERE dat BETWEEN CURDATE() AND util.dayend(vDated) + AND warehouse_id = vWarehouseFk + GROUP BY item_id + ) mov ON mov.item_id = i.id + WHERE v.amount; + + SELECT ish.shelvingFk matricula, + i.longName articulo, + ish.visible, + count(*) lineas, + sum(ish.visible <= s.saldo) spam, + p.code parking, + s.description sector , + w.name AS almacen, + sh.isSpam + FROM vn.itemShelving ish + JOIN vn.item i ON i.id = ish.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + JOIN vn.warehouse w ON w.id = s.warehouseFk + LEFT JOIN tmp.stock s ON s.itemFk = ish.itemFk + WHERE (w.name = 'Algemesi' + OR (w.name = 'NuncaJamas' AND ish.created < curdate())) + AND ish.visible + GROUP BY ish.shelvingFk + HAVING lineas = spam OR isSpam; + + DROP TEMPORARY TABLE tmp.stock; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -79840,19 +79840,19 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketCollection_setUsedShelves`(vTicketFk INT, vUsedShelves INT) -BEGIN - - /* - * Inserta número de baldas que ocupa un ticket - * - * @param vTicketFk Identificador de ticket - * @param vUsedShelves Número de baldas - */ - - UPDATE ticketCollection tc - SET tc.usedShelves = vUsedShelves - WHERE tc.ticketFk = vTicketFk; - +BEGIN + + /* + * Inserta número de baldas que ocupa un ticket + * + * @param vTicketFk Identificador de ticket + * @param vUsedShelves Número de baldas + */ + + UPDATE ticketCollection tc + SET tc.usedShelves = vUsedShelves + WHERE tc.ticketFk = vTicketFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -80832,25 +80832,25 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketManaToPromo`(vTicketFk INT) -BEGIN - - DECLARE vManaComponent INT; - - DECLARE vPromoComponent INT; - - SELECT id INTO vManaComponent - FROM vn.component c - WHERE c.code = 'mana'; - - SELECT id INTO vPromoComponent - FROM vn.component c - WHERE c.code = 'floramondoPromo'; - - UPDATE vn.saleComponent sc - JOIN vn.sale s ON s.id = sc.saleFk - SET componentFk = vPromoComponent - WHERE componentFk = vManaComponent - AND s.ticketFk = vTicketFk; +BEGIN + + DECLARE vManaComponent INT; + + DECLARE vPromoComponent INT; + + SELECT id INTO vManaComponent + FROM vn.component c + WHERE c.code = 'mana'; + + SELECT id INTO vPromoComponent + FROM vn.component c + WHERE c.code = 'floramondoPromo'; + + UPDATE vn.saleComponent sc + JOIN vn.sale s ON s.id = sc.saleFk + SET componentFk = vPromoComponent + WHERE componentFk = vManaComponent + AND s.ticketFk = vTicketFk; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -80973,22 +80973,22 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketObservation_addNewBorn`(vTicketFk INT) -BEGIN - - /** - * Inserta observaciones para los tickets con clientes nuevos o recuperados - * - * @param vTicketFk Identificador de vn.ticket - */ - - DECLARE vDescription VARCHAR(20) DEFAULT '¡Cliente NUEVO! '; - +BEGIN + + /** + * Inserta observaciones para los tickets con clientes nuevos o recuperados + * + * @param vTicketFk Identificador de vn.ticket + */ + + DECLARE vDescription VARCHAR(20) DEFAULT '¡Cliente NUEVO! '; + INSERT INTO vn.ticketObservation(ticketFk, observationTypeFk, description) SELECT vTicketFk, ot.id, vDescription FROM vn.observationType ot WHERE ot.hasNewBornMessage ON DUPLICATE KEY UPDATE description = CONCAT(vDescription, ticketObservation.description); - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81075,66 +81075,66 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1)) -BEGIN - -/** - * Averigua los tickets que se han saltado por un error en el proceso encajado - * @param vTicketFk Ticket - * @param vItemPackingTypeFk Modo de encajado - * @return un select con los tickets afectados - */ - - DECLARE vParkingFk INT; - DECLARE vParked DATETIME; - DECLARE vLevel INT; - DECLARE vWagon INT; - DECLARE vCollectionFk INT; - - SELECT IFNULL(`level`,0), IFNULL(`wagon`,0),IFNULL(collectionFk,0) - INTO vLevel, vWagon, vCollectionFk - FROM vn.ticketCollection tc - JOIN vn.collection c ON c.id = tc.collectionFk AND c.itemPackingTypeFk = vItemPackingTypeFk - WHERE ticketFk = vTicketFk - ORDER BY c.id DESC - LIMIT 1; - - SELECT created, parkingFk - INTO vParked, vParkingFk - FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk - WHERE ticketFk = vTicketFk - AND s.itemPackingTypeFk = vItemPackingTypeFk - AND s.isPackagingArea ; - - SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' ', tc.wagon, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia - FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.zone z ON z.id = t.zoneFk - JOIN vn.agencyMode am ON am.id = z.agencyModeFk - JOIN vn.state s ON s.id = tst.state - WHERE (s.alertLevel < 2 - AND tp.parkingFk = vParkingFk - AND sc.isPackagingArea - AND ( - ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) - OR - ( tc.collectionFk = vCollectionFk - AND (LEFT(tc.wagon,1) < LEFT(vWagon,1) - OR (LEFT(tc.wagon,1) = LEFT(vWagon,1) AND LEFT(tc.level,1) < LEFT(vLevel,1))) - ) - ) - ) -- Etiquetas que no se han escaneado y ya estamos con una posterior - OR - (s.alertLevel > 1 - AND tp.parkingFk = vParkingFk - AND sc.isPackagingArea - AND tp.created < vParked - AND t.packages <=> 0); +BEGIN + +/** + * Averigua los tickets que se han saltado por un error en el proceso encajado + * @param vTicketFk Ticket + * @param vItemPackingTypeFk Modo de encajado + * @return un select con los tickets afectados + */ + + DECLARE vParkingFk INT; + DECLARE vParked DATETIME; + DECLARE vLevel INT; + DECLARE vWagon INT; + DECLARE vCollectionFk INT; + + SELECT IFNULL(`level`,0), IFNULL(`wagon`,0),IFNULL(collectionFk,0) + INTO vLevel, vWagon, vCollectionFk + FROM vn.ticketCollection tc + JOIN vn.collection c ON c.id = tc.collectionFk AND c.itemPackingTypeFk = vItemPackingTypeFk + WHERE ticketFk = vTicketFk + ORDER BY c.id DESC + LIMIT 1; + + SELECT created, parkingFk + INTO vParked, vParkingFk + FROM vn.ticketParking tp + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk + WHERE ticketFk = vTicketFk + AND s.itemPackingTypeFk = vItemPackingTypeFk + AND s.isPackagingArea ; + + SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' ', tc.wagon, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia + FROM vn.ticketParking tp + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticket = tp.ticketFk + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.zone z ON z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + JOIN vn.state s ON s.id = tst.state + WHERE (s.alertLevel < 2 + AND tp.parkingFk = vParkingFk + AND sc.isPackagingArea + AND ( + ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) + OR + ( tc.collectionFk = vCollectionFk + AND (LEFT(tc.wagon,1) < LEFT(vWagon,1) + OR (LEFT(tc.wagon,1) = LEFT(vWagon,1) AND LEFT(tc.level,1) < LEFT(vLevel,1))) + ) + ) + ) -- Etiquetas que no se han escaneado y ya estamos con una posterior + OR + (s.alertLevel > 1 + AND tp.parkingFk = vParkingFk + AND sc.isPackagingArea + AND tp.created < vParked + AND t.packages <=> 0); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81279,25 +81279,25 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setOnchecking__`(vParamFk INT) -BEGIN - /* - * @deprecated:utilizar ticketStateToday_setState - */ - - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM vn.state s - JOIN vn.ticketStateToday tst ON tst.state = s.id - WHERE tst.ticket = vParamFk - LIMIT 1; - - IF vAlertLevel < 2 THEN - - CALL vn.ticketStateUpdate(vParamFk, 'ON_CHECKING'); - - END IF; - +BEGIN + /* + * @deprecated:utilizar ticketStateToday_setState + */ + + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM vn.state s + JOIN vn.ticketStateToday tst ON tst.state = s.id + WHERE tst.ticket = vParamFk + LIMIT 1; + + IF vAlertLevel < 2 THEN + + CALL vn.ticketStateUpdate(vParamFk, 'ON_CHECKING'); + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81315,33 +81315,33 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setOnPreviousChecking__`(vParamFk INT) -BEGIN - - /* - * @deprecated:utilizar ticketStateToday_setState - */ - - - /* - * Cambia el estado del ticket al estado de "control previa" - * - * @param vParamFk ticket a cambiar el estado - * - */ - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM state s - JOIN ticketStateToday tst ON tst.state = s.id - WHERE tst.ticket = vParamFk - LIMIT 1; - - IF vAlertLevel < 2 THEN - - CALL ticketStateUpdate(vParamFk, 'PREVIOUS_CONTROL'); - - END IF; - +BEGIN + + /* + * @deprecated:utilizar ticketStateToday_setState + */ + + + /* + * Cambia el estado del ticket al estado de "control previa" + * + * @param vParamFk ticket a cambiar el estado + * + */ + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM state s + JOIN ticketStateToday tst ON tst.state = s.id + WHERE tst.ticket = vParamFk + LIMIT 1; + + IF vAlertLevel < 2 THEN + + CALL ticketStateUpdate(vParamFk, 'PREVIOUS_CONTROL'); + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81359,29 +81359,29 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45)) -BEGIN - - /* Modifica el estado de un ticket de hoy - * - * @param vTicketFk el id del ticket - * @param vStateCode estado a modificar del ticket - * - */ - - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM state s - JOIN ticketStateToday tst ON tst.state = s.id - WHERE tst.ticket = vTicketFk - LIMIT 1; - - IF vAlertLevel < 2 THEN - - CALL vn.ticket_setState(vTicketFk, vStateCode); - - END IF; - +BEGIN + + /* Modifica el estado de un ticket de hoy + * + * @param vTicketFk el id del ticket + * @param vStateCode estado a modificar del ticket + * + */ + + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM state s + JOIN ticketStateToday tst ON tst.state = s.id + WHERE tst.ticket = vTicketFk + LIMIT 1; + + IF vAlertLevel < 2 THEN + + CALL vn.ticket_setState(vTicketFk, vStateCode); + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81570,63 +81570,63 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticketToPrePrepare`(IN vSaleGroupFk INT, IN vSectorFk INT) -BEGIN - -/* Devuelve las lineas de vn.sale para preparación previa según el saleGroup - * - * - * @param vSaleGroupFk Identificador de vn.saleGroup -*/ - DECLARE vIsResetCode BOOLEAN; - - SELECT (vSaleGroupFk = 2000000) INTO vIsResetCode; - - IF vIsResetCode THEN - - UPDATE vn.saleTracking st - JOIN vn.state s ON s.code = 'OK PREVIOUS' - JOIN vn.state s2 ON s2.id = st.stateFk - SET st.stateFk = s.id - WHERE workerFk = vn.getUser() - AND s2.code = 'PREVIOUS_PREPARATION'; - - ELSE - - UPDATE vn.saleTracking st - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = st.saleFk - SET workerFk = vn.getUser() - WHERE sgd.saleGroupFk = vSaleGroupFk; - - UPDATE vn.saleGroup sg - SET sg.userFk = vn.getUser() - WHERE sg.id = vSaleGroupFk; - - SELECT s.ticketFk, - s.itemFk, - i.longName, - IFNULL(i.itemPackingTypeFk,' ') itemPackingTypeFk, - IFNULL(i.subName ,' ') subName, - s.quantity originalQuantity , - s.quantity, - w.code workerCode, - sgd.saleFk, - IFNULL(iss.quantity,0) pickedQuantity, - vSectorFk, - c.salesPersonFk - FROM vn.sale s - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id - JOIN vn.saleTracking st ON st.saleFk = s.id - JOIN vn.state stt ON stt.id = st.stateFk - JOIN vn.worker w ON w.id = st.workerFk - LEFT JOIN vn.itemShelvingSaleSum iss ON iss.saleFk = s.id - JOIN vn.ticket t ON t.id= s.ticketFk - JOIN vn.client c ON c.id=t.clientFk - WHERE st.workerFk = account.myUser_getId() - AND stt.code = 'PREVIOUS_PREPARATION'; - - END IF; - +BEGIN + +/* Devuelve las lineas de vn.sale para preparación previa según el saleGroup + * + * + * @param vSaleGroupFk Identificador de vn.saleGroup +*/ + DECLARE vIsResetCode BOOLEAN; + + SELECT (vSaleGroupFk = 2000000) INTO vIsResetCode; + + IF vIsResetCode THEN + + UPDATE vn.saleTracking st + JOIN vn.state s ON s.code = 'OK PREVIOUS' + JOIN vn.state s2 ON s2.id = st.stateFk + SET st.stateFk = s.id + WHERE workerFk = vn.getUser() + AND s2.code = 'PREVIOUS_PREPARATION'; + + ELSE + + UPDATE vn.saleTracking st + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = st.saleFk + SET workerFk = vn.getUser() + WHERE sgd.saleGroupFk = vSaleGroupFk; + + UPDATE vn.saleGroup sg + SET sg.userFk = vn.getUser() + WHERE sg.id = vSaleGroupFk; + + SELECT s.ticketFk, + s.itemFk, + i.longName, + IFNULL(i.itemPackingTypeFk,' ') itemPackingTypeFk, + IFNULL(i.subName ,' ') subName, + s.quantity originalQuantity , + s.quantity, + w.code workerCode, + sgd.saleFk, + IFNULL(iss.quantity,0) pickedQuantity, + vSectorFk, + c.salesPersonFk + FROM vn.sale s + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.saleGroupDetail sgd ON sgd.saleFk = s.id + JOIN vn.saleTracking st ON st.saleFk = s.id + JOIN vn.state stt ON stt.id = st.stateFk + JOIN vn.worker w ON w.id = st.workerFk + LEFT JOIN vn.itemShelvingSaleSum iss ON iss.saleFk = s.id + JOIN vn.ticket t ON t.id= s.ticketFk + JOIN vn.client c ON c.id=t.clientFk + WHERE st.workerFk = account.myUser_getId() + AND stt.code = 'PREVIOUS_PREPARATION'; + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81873,102 +81873,102 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_add`( - vClientId INT - ,vShipped DATE - ,vWarehouseFk INT - ,vCompanyFk INT - ,vAddressFk INT - ,vAgencyModeFk INT - ,vRouteFk INT - ,vlanded DATE - ,vUserId INT - ,vIsRequiredZone INT +CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_add`( + vClientId INT + ,vShipped DATE + ,vWarehouseFk INT + ,vCompanyFk INT + ,vAddressFk INT + ,vAgencyModeFk INT + ,vRouteFk INT + ,vlanded DATE + ,vUserId INT + ,vIsRequiredZone INT ,OUT vNewTicket INT) -BEGIN - - DECLARE vZoneFk INT; - DECLARE vPrice DECIMAL(10,2); - DECLARE vBonus DECIMAL(10,2); - - IF vClientId IS NULL THEN - CALL util.throw ('CLIENT_NOT_ESPECIFIED'); - END IF; - - IF NOT vAddressFk OR vAddressFk IS NULL THEN - SELECT id INTO vAddressFk - FROM address - WHERE clientFk = vClientId AND isDefaultAddress; - END IF; - - IF vAgencyModeFk IS NOT NULL THEN - - CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE); - - SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus - FROM tmp.zoneGetShipped - WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; - - IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN - CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); - END IF; - END IF; - INSERT INTO ticket ( - clientFk, - shipped, - addressFk, - agencyModeFk, - nickname, - warehouseFk, - routeFk, - companyFk, - landed, - zoneFk, - zonePrice, - zoneBonus - ) - SELECT - vClientId, - vShipped, - a.id, - vAgencyModeFk, - a.nickname, - vWarehouseFk, - IF(vRouteFk,vRouteFk,NULL), - vCompanyFk, - vlanded, - vZoneFk, - vPrice, - vBonus - FROM address a - JOIN agencyMode am ON am.id = a.agencyModeFk - WHERE a.id = vAddressFk; - - 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.id = vAddressFk; - - IF (SELECT COUNT(*) FROM bs.clientNewBorn cnb - WHERE cnb.clientFk = vClientId - AND NOT cnb.isRookie) = 0 THEN - - CALL vn.ticketObservation_addNewBorn(vNewTicket); - - END IF; - - INSERT INTO vn.ticketLog - SET originFk = vNewTicket, userFk = vUserId, `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vNewTicket); - - IF (SELECT ct.isCreatedAsServed FROM vn.clientType ct JOIN vn.client c ON c.typeFk = ct.code WHERE c.id = vClientId ) <> FALSE THEN - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vNewTicket, account.myUser_getId() - FROM state - WHERE `code` = 'DELIVERED'; - END IF; +BEGIN + + DECLARE vZoneFk INT; + DECLARE vPrice DECIMAL(10,2); + DECLARE vBonus DECIMAL(10,2); + + IF vClientId IS NULL THEN + CALL util.throw ('CLIENT_NOT_ESPECIFIED'); + END IF; + + IF NOT vAddressFk OR vAddressFk IS NULL THEN + SELECT id INTO vAddressFk + FROM address + WHERE clientFk = vClientId AND isDefaultAddress; + END IF; + + IF vAgencyModeFk IS NOT NULL THEN + + CALL vn.zone_getShipped (vlanded, vAddressFk, vAgencyModeFk, TRUE); + + SELECT zoneFk, price, bonus INTO vZoneFk, vPrice, vBonus + FROM tmp.zoneGetShipped + WHERE shipped = vShipped AND warehouseFk = vWarehouseFk LIMIT 1; + + IF (vZoneFk IS NULL OR vZoneFk = 0) AND vIsRequiredZone THEN + CALL util.throw ('NOT_ZONE_WITH_THIS_PARAMETERS'); + END IF; + END IF; + INSERT INTO ticket ( + clientFk, + shipped, + addressFk, + agencyModeFk, + nickname, + warehouseFk, + routeFk, + companyFk, + landed, + zoneFk, + zonePrice, + zoneBonus + ) + SELECT + vClientId, + vShipped, + a.id, + vAgencyModeFk, + a.nickname, + vWarehouseFk, + IF(vRouteFk,vRouteFk,NULL), + vCompanyFk, + vlanded, + vZoneFk, + vPrice, + vBonus + FROM address a + JOIN agencyMode am ON am.id = a.agencyModeFk + WHERE a.id = vAddressFk; + + 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.id = vAddressFk; + + IF (SELECT COUNT(*) FROM bs.clientNewBorn cnb + WHERE cnb.clientFk = vClientId + AND NOT cnb.isRookie) = 0 THEN + + CALL vn.ticketObservation_addNewBorn(vNewTicket); + + END IF; + + INSERT INTO vn.ticketLog + SET originFk = vNewTicket, userFk = vUserId, `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vNewTicket); + + IF (SELECT ct.isCreatedAsServed FROM vn.clientType ct JOIN vn.client c ON c.typeFk = ct.code WHERE c.id = vClientId ) <> FALSE THEN + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, vNewTicket, account.myUser_getId() + FROM state + WHERE `code` = 'DELIVERED'; + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -81986,21 +81986,21 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_administrativeCopy`(vOriginalTicket INT, OUT vNewTicket INT) -BEGIN - - INSERT INTO vn.ticket(clientFk, addressFk, shipped, warehouseFk, companyFk, landed) - SELECT t.clientFk , t.addressFk , t.shipped ,w.id, t.companyFk , t.landed - FROM vn.ticket t - JOIN vn.warehouse w ON w.name = 'INVENTARIO' - WHERE t.id = vOriginalTicket; - - SELECT LAST_INSERT_ID() INTO vNewTicket; - - INSERT INTO vn.sale(ticketFk, itemFk, concept, quantity, price, discount) - SELECT vNewTicket, s.itemFk , s.concept , s.quantity , s.price , s.discount - FROM vn.sale s - WHERE s.ticketFk = vOriginalTicket; - +BEGIN + + INSERT INTO vn.ticket(clientFk, addressFk, shipped, warehouseFk, companyFk, landed) + SELECT t.clientFk , t.addressFk , t.shipped ,w.id, t.companyFk , t.landed + FROM vn.ticket t + JOIN vn.warehouse w ON w.name = 'INVENTARIO' + WHERE t.id = vOriginalTicket; + + SELECT LAST_INSERT_ID() INTO vNewTicket; + + INSERT INTO vn.sale(ticketFk, itemFk, concept, quantity, price, discount) + SELECT vNewTicket, s.itemFk , s.concept , s.quantity , s.price , s.discount + FROM vn.sale s + WHERE s.ticketFk = vOriginalTicket; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -82111,62 +82111,62 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) -BEGIN -/** - * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro - * - * @param vDated Fecha en cuestión - * @param vScopeDays Dias en el futuro a sondear - * @param vLitersMax Volumen máximo de los tickets a catapultar - * @param vLinesMax Número máximo de lineas de los tickets a catapultar - * @param vWarehouseFk Identificador de vn.warehouse - */ - SELECT sv.ticketFk , - GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, - CAST(sum(litros) AS DECIMAL(10,0)) liters, - CAST(count(*) AS DECIMAL(10,0)) `lines`, - st.name state, - sub2.id ticketFuture, - sub2.shipped, - sub2.iptd tfIpt, - sub2.state tfState - FROM vn.saleVolume sv - JOIN vn.sale s ON s.id = sv.saleFk - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.ticket t ON t.id = sv.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.state st ON st.id = ts.stateFk - JOIN vn.alertLevel al ON al.id = ts.alertLevel - LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id - LEFT JOIN ( - SELECT * FROM ( - SELECT - t.addressFk , - t.id, - t.shipped, - st.name state, - GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd - FROM vn.ticket t - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.state st ON st.id = ts.stateFk - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) - AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) - AND t.warehouseFk = vWarehouseFk - GROUP BY t.id - ) sub - GROUP BY sub.addressFk - ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id - WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) - AND t.warehouseFk = vWarehouseFk - AND al.code = 'FREE' - AND tp.ticketFk IS NULL - GROUP BY sv.ticketFk - HAVING liters <= vLitersMax AND `lines` <= vLinesMax AND ticketFuture; +BEGIN +/** + * Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vDated Fecha en cuestión + * @param vScopeDays Dias en el futuro a sondear + * @param vLitersMax Volumen máximo de los tickets a catapultar + * @param vLinesMax Número máximo de lineas de los tickets a catapultar + * @param vWarehouseFk Identificador de vn.warehouse + */ + SELECT sv.ticketFk , + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt, + CAST(sum(litros) AS DECIMAL(10,0)) liters, + CAST(count(*) AS DECIMAL(10,0)) `lines`, + st.name state, + sub2.id ticketFuture, + sub2.shipped, + sub2.iptd tfIpt, + sub2.state tfState + FROM vn.saleVolume sv + JOIN vn.sale s ON s.id = sv.saleFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.ticket t ON t.id = sv.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.alertLevel al ON al.id = ts.alertLevel + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN ( + SELECT * FROM ( + SELECT + t.addressFk , + t.id, + t.shipped, + st.name state, + GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd + FROM vn.ticket t + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.state st ON st.id = ts.stateFk + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) + AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) + AND t.warehouseFk = vWarehouseFk + GROUP BY t.id + ) sub + GROUP BY sub.addressFk + ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id + WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) + AND t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + AND tp.ticketFk IS NULL + GROUP BY sv.ticketFk + HAVING liters <= vLitersMax AND `lines` <= vLinesMax AND ticketFuture; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -82184,49 +82184,49 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_canMerge__`(vDated DATE, vScopeDays INT, vLitersMax INT, vLinesMax INT, vWarehouseFk INT) -BEGIN - - /* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro - * - * @param vDated Fecha en cuestión - * @param vScopeDays Dias en el futuro a sondear - * @param vLitersMax Volumen máximo de los tickets a catapultar - * @param vLinesMax Número máximo de lineas de los tickets a catapultar - * @param vWarehouseFk Identificador de vn.warehouse - */ - - SELECT sv.ticketFk , - CAST(sum(litros) AS DECIMAL(10,0)) liters, - CAST(count(*) AS DECIMAL(10,0)) `lines`, - sub2.id ticketFuture, - sub2.shipped - FROM vn.saleVolume sv - JOIN vn.ticket t ON t.id = sv.ticketFk - JOIN vn.address a ON a.id = t.addressFk - JOIN vn.province p ON p.id = a.provinceFk - JOIN vn.country c ON c.id = p.countryFk - JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.alertLevel al ON al.id = ts.alertLevel - LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id - LEFT JOIN tmp.routeDayMove ra ON ra.routeFk = t.routeFk - LEFT JOIN ( - SELECT * FROM ( - SELECT t.addressFk , t.id, t.shipped - FROM vn.ticket t - WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) - AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) - AND t.warehouseFk = vWarehouseFk - ) sub - GROUP BY sub.addressFk - ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id - WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) - AND t.warehouseFk = vWarehouseFk - AND al.code = 'FREE' - AND tp.ticketFk IS NULL - AND ra.routeFk IS NULL - GROUP BY sv.ticketFk - HAVING liters <= vLitersMax AND `lines` <= vLinesMax AND ticketFuture; - +BEGIN + + /* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro + * + * @param vDated Fecha en cuestión + * @param vScopeDays Dias en el futuro a sondear + * @param vLitersMax Volumen máximo de los tickets a catapultar + * @param vLinesMax Número máximo de lineas de los tickets a catapultar + * @param vWarehouseFk Identificador de vn.warehouse + */ + + SELECT sv.ticketFk , + CAST(sum(litros) AS DECIMAL(10,0)) liters, + CAST(count(*) AS DECIMAL(10,0)) `lines`, + sub2.id ticketFuture, + sub2.shipped + FROM vn.saleVolume sv + JOIN vn.ticket t ON t.id = sv.ticketFk + JOIN vn.address a ON a.id = t.addressFk + JOIN vn.province p ON p.id = a.provinceFk + JOIN vn.country c ON c.id = p.countryFk + JOIN vn.ticketState ts ON ts.ticketFk = t.id + JOIN vn.alertLevel al ON al.id = ts.alertLevel + LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id + LEFT JOIN tmp.routeDayMove ra ON ra.routeFk = t.routeFk + LEFT JOIN ( + SELECT * FROM ( + SELECT t.addressFk , t.id, t.shipped + FROM vn.ticket t + WHERE t.shipped BETWEEN TIMESTAMPADD(DAY, vScopeDays,vDated) + AND util.dayend(TIMESTAMPADD(DAY, vScopeDays,vDated)) + AND t.warehouseFk = vWarehouseFk + ) sub + GROUP BY sub.addressFk + ) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id + WHERE t.shipped BETWEEN vDated AND util.dayend(vDated) + AND t.warehouseFk = vWarehouseFk + AND al.code = 'FREE' + AND tp.ticketFk IS NULL + AND ra.routeFk IS NULL + GROUP BY sv.ticketFk + HAVING liters <= vLitersMax AND `lines` <= vLinesMax AND ticketFuture; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -82244,36 +82244,36 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_changeClient`(vNewClient INT, vUserFk INT) -BEGIN - -/** - * Dado un conjunto de tickets - * cambia el cliente al nuevo cliente dado - * - * params @vNewClient nuevo cliente - * params @vUserFk usuario que realiza el cambio - * - * table @tmp.ticket(ticketFk) conjunto de tickets - */ - - INSERT INTO ticketLog (originFk, userFk, `action`, changedModel, oldInstance, newInstance) - SELECT t.id, vUserFk, 'update', 'Ticket', CONCAT('{"clientFk":',t.clientFk,'}'), CONCAT('{"clientFk":',vNewClient,'}') - FROM ticket t - JOIN tmp.ticket tt - ON t.id = tt.ticketFk; - - UPDATE ticket t - JOIN tmp.ticket tt - ON t.id = tt.ticketFk - SET t.clientFk = vNewClient; - - UPDATE ticket t - JOIN tmp.ticket tt - ON t.id = tt.ticketFk - JOIN stowaway s - ON s.shipFk = tt.ticketFk - SET t.clientFk = vNewClient; - +BEGIN + +/** + * Dado un conjunto de tickets + * cambia el cliente al nuevo cliente dado + * + * params @vNewClient nuevo cliente + * params @vUserFk usuario que realiza el cambio + * + * table @tmp.ticket(ticketFk) conjunto de tickets + */ + + INSERT INTO ticketLog (originFk, userFk, `action`, changedModel, oldInstance, newInstance) + SELECT t.id, vUserFk, 'update', 'Ticket', CONCAT('{"clientFk":',t.clientFk,'}'), CONCAT('{"clientFk":',vNewClient,'}') + FROM ticket t + JOIN tmp.ticket tt + ON t.id = tt.ticketFk; + + UPDATE ticket t + JOIN tmp.ticket tt + ON t.id = tt.ticketFk + SET t.clientFk = vNewClient; + + UPDATE ticket t + JOIN tmp.ticket tt + ON t.id = tt.ticketFk + JOIN stowaway s + ON s.shipFk = tt.ticketFk + SET t.clientFk = vNewClient; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -83359,41 +83359,41 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT) -BEGIN - - DECLARE done INT DEFAULT FALSE; - DECLARE vTicketFk INT; - DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tmp.ticket; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - CALL vn.productionControl(vWarehouserFk,0) ; - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - SELECT ticketFk - FROM tmp.productionBuffer - WHERE shipped = curdate() - AND problem LIKE '%I:%' - AND (HH <= vHour OR HH = vHour AND mm < vMinute) - AND alertLevel = 0; - - OPEN cur1; - - read_loop: LOOP - - FETCH cur1 INTO vTicketFk; - - IF done THEN - LEAVE read_loop; - END IF; - - CALL vn.ticket_DelayTruckSplit(vTicketFk); - - END LOOP; - - CLOSE cur1; - +BEGIN + + DECLARE done INT DEFAULT FALSE; + DECLARE vTicketFk INT; + DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tmp.ticket; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + CALL vn.productionControl(vWarehouserFk,0) ; + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + SELECT ticketFk + FROM tmp.productionBuffer + WHERE shipped = curdate() + AND problem LIKE '%I:%' + AND (HH <= vHour OR HH = vHour AND mm < vMinute) + AND alertLevel = 0; + + OPEN cur1; + + read_loop: LOOP + + FETCH cur1 INTO vTicketFk; + + IF done THEN + LEAVE read_loop; + END IF; + + CALL vn.ticket_DelayTruckSplit(vTicketFk); + + END LOOP; + + CLOSE cur1; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -83665,106 +83665,106 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_getFromFloramondo`(vDateFrom DATE, vDateTo DATE) -BEGIN - -/** - * Genera una tabla con la lista de tickets de Floramondo para una fecha determinada - * @param vDated Fecha de preparación de los pedidos - * @return tmp.ticketFloramondo(ticketFk, clientName, agencyName, freight, expeditionCount, margin, trolleys, pallets) - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketFloramondo; - CREATE TEMPORARY TABLE tmp.ticketFloramondo - (ticketFk INT PRIMARY KEY, - clientName VARCHAR(50), - agencyName VARCHAR(50), - freight DECIMAL(10,2) DEFAULT 0, - expeditionCount INT, - margin DECIMAL(10,3) DEFAULT 0, - trolleys INT DEFAULT 0, - shipped DATE, - pallets INT DEFAULT 0) - ENGINE = MEMORY; - - INSERT INTO tmp.ticketFloramondo(ticketFk, clientName, agencyName, shipped) - SELECT t.id ticketFk, t.nickname , am.name, t.shipped - FROM vn.ticket t - JOIN vn.agencyMode am ON am.id = t.agencyModeFk - JOIN vn.warehouse w ON w.id = t.warehouseFk AND w.code IN ('VNH','FLM') - AND t.shipped BETWEEN vDateFrom AND TIMESTAMPADD(HOUR, 23, vDateTo); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - (ticketFk INT(11) PRIMARY KEY) - SELECT ticketFk - FROM tmp.ticketFloramondo; - - -- Freight - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(sc.value * s.quantity) freight, t.ticketFk - FROM vn.saleComponent sc - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk - JOIN vn.sale s ON s.id = sc.saleFk - JOIN tmp.ticket t ON t.ticketFk = s.ticketFk - WHERE ct.code = 'FREIGHT' - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.freight = sb.freight; - - -- Freight service - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(ts.price * ts.quantity) service, t.ticketFk - FROM vn.ticketService ts - JOIN tmp.ticket t ON t.ticketFk = ts.ticketFk - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.freight = tf.freight + sb.service; - - -- Expedition Count - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT COUNT(e.id) expeditionCount, t.ticketFk - FROM vn.expedition e - RIGHT JOIN tmp.ticket t ON t.ticketFk = e.ticketFk - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.expeditionCount = sb.expeditionCount; - - -- Margin - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(IF(ct.code = 'COST',sc.value, 0)) cost, - SUM(IF(ct.isMargin, sc.value, 0)) margin, - t.ticketFk - FROM vn.saleComponent sc - JOIN vn.component c ON c.id = sc.componentFk - JOIN vn.componentType ct ON ct.id = c.typeFk - JOIN vn.sale s ON s.id = sc.saleFk - JOIN tmp.ticket t ON t.ticketFk = s.ticketFk - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.margin = sb.margin / sb.cost; - - -- Trolleys - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(tp.quantity) trolleys, t.ticketFk - FROM vn.ticketPackaging tp - JOIN tmp.ticket t ON t.ticketFk = tp.ticketFk - JOIN vn.packaging p ON p.id = tp.packagingFk - WHERE p.isTrolley - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.trolleys = sb.trolleys; - - -- Pallets - UPDATE tmp.ticketFloramondo tf - JOIN (SELECT SUM(tp.quantity) pallets, t.ticketFk - FROM vn.ticketPackaging tp - JOIN tmp.ticket t ON t.ticketFk = tp.ticketFk - JOIN vn.packaging p ON p.id = tp.packagingFk - WHERE p.isPallet - GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk - SET tf.pallets = sb.pallets; - - SELECT * FROM tmp.ticketFloramondo; - - DROP TEMPORARY TABLE tmp.ticket; - DROP TEMPORARY TABLE tmp.ticketFloramondo; - +BEGIN + +/** + * Genera una tabla con la lista de tickets de Floramondo para una fecha determinada + * @param vDated Fecha de preparación de los pedidos + * @return tmp.ticketFloramondo(ticketFk, clientName, agencyName, freight, expeditionCount, margin, trolleys, pallets) + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketFloramondo; + CREATE TEMPORARY TABLE tmp.ticketFloramondo + (ticketFk INT PRIMARY KEY, + clientName VARCHAR(50), + agencyName VARCHAR(50), + freight DECIMAL(10,2) DEFAULT 0, + expeditionCount INT, + margin DECIMAL(10,3) DEFAULT 0, + trolleys INT DEFAULT 0, + shipped DATE, + pallets INT DEFAULT 0) + ENGINE = MEMORY; + + INSERT INTO tmp.ticketFloramondo(ticketFk, clientName, agencyName, shipped) + SELECT t.id ticketFk, t.nickname , am.name, t.shipped + FROM vn.ticket t + JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.warehouse w ON w.id = t.warehouseFk AND w.code IN ('VNH','FLM') + AND t.shipped BETWEEN vDateFrom AND TIMESTAMPADD(HOUR, 23, vDateTo); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + (ticketFk INT(11) PRIMARY KEY) + SELECT ticketFk + FROM tmp.ticketFloramondo; + + -- Freight + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(sc.value * s.quantity) freight, t.ticketFk + FROM vn.saleComponent sc + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + JOIN vn.sale s ON s.id = sc.saleFk + JOIN tmp.ticket t ON t.ticketFk = s.ticketFk + WHERE ct.code = 'FREIGHT' + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.freight = sb.freight; + + -- Freight service + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(ts.price * ts.quantity) service, t.ticketFk + FROM vn.ticketService ts + JOIN tmp.ticket t ON t.ticketFk = ts.ticketFk + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.freight = tf.freight + sb.service; + + -- Expedition Count + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT COUNT(e.id) expeditionCount, t.ticketFk + FROM vn.expedition e + RIGHT JOIN tmp.ticket t ON t.ticketFk = e.ticketFk + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.expeditionCount = sb.expeditionCount; + + -- Margin + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(IF(ct.code = 'COST',sc.value, 0)) cost, + SUM(IF(ct.isMargin, sc.value, 0)) margin, + t.ticketFk + FROM vn.saleComponent sc + JOIN vn.component c ON c.id = sc.componentFk + JOIN vn.componentType ct ON ct.id = c.typeFk + JOIN vn.sale s ON s.id = sc.saleFk + JOIN tmp.ticket t ON t.ticketFk = s.ticketFk + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.margin = sb.margin / sb.cost; + + -- Trolleys + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(tp.quantity) trolleys, t.ticketFk + FROM vn.ticketPackaging tp + JOIN tmp.ticket t ON t.ticketFk = tp.ticketFk + JOIN vn.packaging p ON p.id = tp.packagingFk + WHERE p.isTrolley + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.trolleys = sb.trolleys; + + -- Pallets + UPDATE tmp.ticketFloramondo tf + JOIN (SELECT SUM(tp.quantity) pallets, t.ticketFk + FROM vn.ticketPackaging tp + JOIN tmp.ticket t ON t.ticketFk = tp.ticketFk + JOIN vn.packaging p ON p.id = tp.packagingFk + WHERE p.isPallet + GROUP BY t.ticketFk) sb ON sb.ticketFk = tf.ticketFk + SET tf.pallets = sb.pallets; + + SELECT * FROM tmp.ticketFloramondo; + + DROP TEMPORARY TABLE tmp.ticket; + DROP TEMPORARY TABLE tmp.ticketFloramondo; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84404,24 +84404,24 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_merge`(vSelf INT, vTicketTargetFk INT) -BEGIN - - /** - * Fusiona el primer ticket al segundo - * - * @param vSelf Número de ticket a fusionar - * @param vTicketTargetFk Ticket destino - * - */ - - UPDATE vn.sale s - SET s.ticketFk = vTicketTargetFk - WHERE s.ticketFk = vSelf; - - UPDATE vn.ticket t - SET t.shipped = TIMESTAMPADD(YEAR, - YEAR(NOW()) MOD 2000, t.shipped ) - WHERE t.id = vSelf; - +BEGIN + + /** + * Fusiona el primer ticket al segundo + * + * @param vSelf Número de ticket a fusionar + * @param vTicketTargetFk Ticket destino + * + */ + + UPDATE vn.sale s + SET s.ticketFk = vTicketTargetFk + WHERE s.ticketFk = vSelf; + + UPDATE vn.ticket t + SET t.shipped = TIMESTAMPADD(YEAR, - YEAR(NOW()) MOD 2000, t.shipped ) + WHERE t.id = vSelf; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84496,28 +84496,28 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalc`(vTicketId INT) -BEGIN -/** - * Calcula y guarda el total con/sin IVA en un ticket. - * - * @param vTicketId Identificador del ticket - */ - - DROP TEMPORARY TABLE IF EXISTS tmp.ticket; - CREATE TEMPORARY TABLE tmp.ticket - ENGINE = MEMORY - SELECT vTicketId ticketFk; - - CALL ticketGetTotal; - - UPDATE ticket t - JOIN tmp.ticketTotal tt ON tt.ticketFk = t.id - SET t.totalWithVat = tt.total, - t.totalWithoutVat = tt.totalWithoutVat; - - DROP TEMPORARY TABLE - tmp.ticket, - tmp.ticketTotal; +BEGIN +/** + * Calcula y guarda el total con/sin IVA en un ticket. + * + * @param vTicketId Identificador del ticket + */ + + DROP TEMPORARY TABLE IF EXISTS tmp.ticket; + CREATE TEMPORARY TABLE tmp.ticket + ENGINE = MEMORY + SELECT vTicketId ticketFk; + + CALL ticketGetTotal; + + UPDATE ticket t + JOIN tmp.ticketTotal tt ON tt.ticketFk = t.id + SET t.totalWithVat = tt.total, + t.totalWithoutVat = tt.totalWithoutVat; + + DROP TEMPORARY TABLE + tmp.ticket, + tmp.ticketTotal; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84535,91 +84535,91 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_recalcComponents`(IN vTicketFk BIGINT, vIsTicketEditable BOOLEAN) -proc: BEGIN - -/** - * Este procedimiento recalcula los componentes de un ticket, - * eliminando los componentes existentes e insertandolos de nuevo - * - * @param vTicketFk Id del ticket - * @param vIsTicketEditable si no se quiere forzar llamar con NULL - */ - DECLARE vShipped DATE; - DECLARE vWarehouseFk SMALLINT; - DECLARE vAgencyModeFk INT; - DECLARE vAddressFk INT; - DECLARE vLanded DATE; - DECLARE vZoneFk INTEGER; - - IF vIsTicketEditable IS NULL THEN - SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = '' - INTO vIsTicketEditable - FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket - WHERE id = vTicketFk; - END IF; - - SELECT t.warehouseFk, - t.shipped, - t.addressFk, - t.agencyModeFk, - t.landed, - t.zoneFk - INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk - FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket - WHERE t.id = vTicketFk; - - CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); - - IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN - CALL util.throw('There is no zone for these parameters'); - END IF; - - IF vLanded IS NULL OR vZoneFk IS NULL THEN - - UPDATE ticket t - SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) - WHERE t.id = vTicketFk AND t.landed IS NULL; - - IF vZoneFk IS NULL THEN - SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; - UPDATE ticket t - SET t.zoneFk = vZoneFk - WHERE t.id = vTicketFk AND t.zoneFk IS NULL; - END IF; - - END IF; - - DROP TEMPORARY TABLE tmp.zoneGetLanded; - - -- rellena la tabla buyUltimate con la ultima compra - CALL buyUltimate (vWarehouseFk, vShipped); - - DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; - CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, - s.itemFk, bu.buyFk, vZoneFk zoneFk - FROM sale s - LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk - WHERE s.ticketFk = vTicketFk - GROUP BY s.itemFk; - - CALL catalog_componentPrepare(); - CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); - - DROP TEMPORARY TABLE IF EXISTS tmp.sale; - CREATE TEMPORARY TABLE tmp.sale - (PRIMARY KEY (saleFk)) ENGINE = MEMORY - SELECT id saleFk, vWarehouseFk warehouseFk - FROM sale s - WHERE s.ticketFk = vTicketFk; - - -- si el ticket esta facturado, respeta los precios - CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6)); - - CALL catalog_componentPurge(); - DROP TEMPORARY TABLE - tmp.buyUltimate, - tmp.sale; +proc: BEGIN + +/** + * Este procedimiento recalcula los componentes de un ticket, + * eliminando los componentes existentes e insertandolos de nuevo + * + * @param vTicketFk Id del ticket + * @param vIsTicketEditable si no se quiere forzar llamar con NULL + */ + DECLARE vShipped DATE; + DECLARE vWarehouseFk SMALLINT; + DECLARE vAgencyModeFk INT; + DECLARE vAddressFk INT; + DECLARE vLanded DATE; + DECLARE vZoneFk INTEGER; + + IF vIsTicketEditable IS NULL THEN + SELECT IFNULL(ts.alertLevel,0) = 0 AND IFNULL(t.refFk,'') = '' + INTO vIsTicketEditable + FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket + WHERE id = vTicketFk; + END IF; + + SELECT t.warehouseFk, + t.shipped, + t.addressFk, + t.agencyModeFk, + t.landed, + t.zoneFk + INTO vWarehouseFk, vShipped, vAddressFk, vAgencyModeFk, vLanded, vZoneFk + FROM ticket t LEFT JOIN ticketState ts ON t.id = ts.ticket + WHERE t.id = vTicketFk; + + CALL zone_getLanded(vShipped, vAddressFk, vAgencyModeFk, vWarehouseFk, TRUE); + + IF (SELECT COUNT(*) FROM tmp.zoneGetLanded LIMIT 1) = 0 THEN + CALL util.throw('There is no zone for these parameters'); + END IF; + + IF vLanded IS NULL OR vZoneFk IS NULL THEN + + UPDATE ticket t + SET t.landed = (SELECT landed FROM tmp.zoneGetLanded LIMIT 1) + WHERE t.id = vTicketFk AND t.landed IS NULL; + + IF vZoneFk IS NULL THEN + SELECT zoneFk INTO vZoneFk FROM tmp.zoneGetLanded LIMIT 1; + UPDATE ticket t + SET t.zoneFk = vZoneFk + WHERE t.id = vTicketFk AND t.zoneFk IS NULL; + END IF; + + END IF; + + DROP TEMPORARY TABLE tmp.zoneGetLanded; + + -- rellena la tabla buyUltimate con la ultima compra + CALL buyUltimate (vWarehouseFk, vShipped); + + DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; + CREATE TEMPORARY TABLE tmp.ticketLot + SELECT vWarehouseFk warehouseFk, NULL available, + s.itemFk, bu.buyFk, vZoneFk zoneFk + FROM sale s + LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk + WHERE s.ticketFk = vTicketFk + GROUP BY s.itemFk; + + CALL catalog_componentPrepare(); + CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.sale; + CREATE TEMPORARY TABLE tmp.sale + (PRIMARY KEY (saleFk)) ENGINE = MEMORY + SELECT id saleFk, vWarehouseFk warehouseFk + FROM sale s + WHERE s.ticketFk = vTicketFk; + + -- si el ticket esta facturado, respeta los precios + CALL ticketComponentUpdateSale(IF(vIsTicketEditable, 1, 6)); + + CALL catalog_componentPurge(); + DROP TEMPORARY TABLE + tmp.buyUltimate, + tmp.sale; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84832,17 +84832,17 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_requestRecalc`(vSelf INT) -proc: BEGIN -/** - * Adds a request to recalculate the ticket total. - * - * @param vSelf The ticket identifier - */ - IF vSelf IS NULL THEN - LEAVE proc; - END IF; - - INSERT IGNORE INTO ticketRecalc SET ticketFk = vSelf; +proc: BEGIN +/** + * Adds a request to recalculate the ticket total. + * + * @param vSelf The ticket identifier + */ + IF vSelf IS NULL THEN + LEAVE proc; + END IF; + + INSERT IGNORE INTO ticketRecalc SET ticketFk = vSelf; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84860,27 +84860,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setNextState`(vSelf INT) -BEGIN -/** - * Cambia el estado del ticket al siguiente estado según la tabla state - * - * @param vSelf id dle ticket - */ - DECLARE vStateFk INT; - DECLARE vNewStateFk INT; - - SELECT stateFk INTO vStateFk - FROM ticketState - WHERE ticketFk = vSelf; - - SELECT nextStateFk INTO vNewStateFk - FROM state - WHERE id = vStateFk; - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - VALUES (vNewStateFk, vSelf, account.myUser_getId()); - - SELECT TRUE AS IsUpdated; +BEGIN +/** + * Cambia el estado del ticket al siguiente estado según la tabla state + * + * @param vSelf id dle ticket + */ + DECLARE vStateFk INT; + DECLARE vNewStateFk INT; + + SELECT stateFk INTO vStateFk + FROM ticketState + WHERE ticketFk = vSelf; + + SELECT nextStateFk INTO vNewStateFk + FROM state + WHERE id = vStateFk; + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + VALUES (vNewStateFk, vSelf, account.myUser_getId()); + + SELECT TRUE AS IsUpdated; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84898,40 +84898,40 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setPreviousState`(vTicketFk INT) -BEGIN - - DECLARE vControlFk INT; - - SELECT MAX(inter_id) INTO vControlFk - FROM vncontrol.inter - WHERE Id_Ticket = vTicketFk; - - IF (SELECT s.code - FROM vn.state s - JOIN vncontrol.inter i ON i.state_id = s.id - WHERE i.inter_id = vControlFk) - = 'PREVIOUS_PREPARATION' THEN - - SELECT inter_id - INTO vControlFk - FROM vncontrol.inter i - JOIN vn.state s ON i.state_id = s.id - WHERE Id_Ticket = vTicketFk - AND inter_id < vControlFk - AND s.code != 'PREVIOUS_PREPARATION' - ORDER BY inter_id DESC - LIMIT 1; - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT s.nextStateFk, i.Id_Ticket, account.myUser_getId() - FROM vncontrol.inter i - JOIN vn.state s ON i.state_id = s.id - WHERE inter_id = vControlFk; - - END IF; - - SELECT TRUE AS IsUpdated; - +BEGIN + + DECLARE vControlFk INT; + + SELECT MAX(inter_id) INTO vControlFk + FROM vncontrol.inter + WHERE Id_Ticket = vTicketFk; + + IF (SELECT s.code + FROM vn.state s + JOIN vncontrol.inter i ON i.state_id = s.id + WHERE i.inter_id = vControlFk) + = 'PREVIOUS_PREPARATION' THEN + + SELECT inter_id + INTO vControlFk + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE Id_Ticket = vTicketFk + AND inter_id < vControlFk + AND s.code != 'PREVIOUS_PREPARATION' + ORDER BY inter_id DESC + LIMIT 1; + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT s.nextStateFk, i.Id_Ticket, account.myUser_getId() + FROM vncontrol.inter i + JOIN vn.state s ON i.state_id = s.id + WHERE inter_id = vControlFk; + + END IF; + + SELECT TRUE AS IsUpdated; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -84949,30 +84949,30 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `ticket_setState`(vTicketFk INT, vStateCode VARCHAR(45)) -BEGIN - - /* Modifica el estado de un ticket - * - * @param vTicketFk el id del ticket - * @param vStateCode estado a modificar del ticket - * - */ - - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM vn.state s - JOIN vn.ticketState ts ON ts.stateFk = s.id - WHERE ts.ticketFk = vTicketFk; - - IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN - - INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) - SELECT id, vTicketFk, account.myUser_getId() - FROM vn.state - WHERE `code` = vStateCode collate utf8_unicode_ci; - - END IF; +BEGIN + + /* Modifica el estado de un ticket + * + * @param vTicketFk el id del ticket + * @param vStateCode estado a modificar del ticket + * + */ + + DECLARE vAlertLevel INT; + + SELECT s.alertLevel INTO vAlertLevel + FROM vn.state s + JOIN vn.ticketState ts ON ts.stateFk = s.id + WHERE ts.ticketFk = vTicketFk; + + IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN + + INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador) + SELECT id, vTicketFk, account.myUser_getId() + FROM vn.state + WHERE `code` = vStateCode collate utf8_unicode_ci; + + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -86192,27 +86192,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `tpvTransaction_checkStatus`() -BEGIN -/** - * - * Envia mail con los cobros web no - * trasladados a la ficha del cliente. - * - */ - INSERT INTO mail (receiver,replyTo,subject,body) - SELECT 'administracion@verdnatura.es', - 'noreply@verdnatura.es', - CONCAT('Cobro web no trasladado a la ficha del cliente ', t.clientFk), - CONCAT('Hay un importe de ', t.amount/100, '€ del cliente ', t.clientFk, ' con fecha ', t.created, - ', que no se ha trasladado a recibos. Si nos ha llegado el importe al banco confirme el pago en - - https://salix.verdnatura.es/#!/client/',t.clientFk,'/web-payment') - FROM hedera.tpvTransaction t - WHERE t.receiptFk IS NULL - AND t.status = 'ok' - AND t.created < DATE_ADD(NOW(),INTERVAL - 2 DAY) - GROUP BY t.clientFk; - +BEGIN +/** + * + * Envia mail con los cobros web no + * trasladados a la ficha del cliente. + * + */ + INSERT INTO mail (receiver,replyTo,subject,body) + SELECT 'administracion@verdnatura.es', + 'noreply@verdnatura.es', + CONCAT('Cobro web no trasladado a la ficha del cliente ', t.clientFk), + CONCAT('Hay un importe de ', t.amount/100, '€ del cliente ', t.clientFk, ' con fecha ', t.created, + ', que no se ha trasladado a recibos. Si nos ha llegado el importe al banco confirme el pago en + + https://salix.verdnatura.es/#!/client/',t.clientFk,'/web-payment') + FROM hedera.tpvTransaction t + WHERE t.receiptFk IS NULL + AND t.status = 'ok' + AND t.created < DATE_ADD(NOW(),INTERVAL - 2 DAY) + GROUP BY t.clientFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -86273,21 +86273,21 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travelVolume_get`(vFromDated DATE, vToDated DATE, vWarehouseFk INT) -BEGIN - - SELECT tr.landed Fecha, - a.name Agencia, - count(DISTINCT e.id) numEntradas, - FLOOR(sum(item_getVolume(b.itemFk, b.packageFk) * b.stickers / 1000000 )) AS m3 - FROM vn.travel tr - JOIN vn.agencyMode a ON a.id = tr.agencyFk - JOIN vn.entry e ON e.travelFk = tr.id - JOIN vn.buy b ON b.entryFk = e.id - WHERE tr.landed BETWEEN vFromDated AND vToDated - AND e.isRaid = FALSE - AND tr.warehouseInFk = vWarehouseFk - GROUP BY tr.landed , a.name ; - +BEGIN + + SELECT tr.landed Fecha, + a.name Agencia, + count(DISTINCT e.id) numEntradas, + FLOOR(sum(item_getVolume(b.itemFk, b.packageFk) * b.stickers / 1000000 )) AS m3 + FROM vn.travel tr + JOIN vn.agencyMode a ON a.id = tr.agencyFk + JOIN vn.entry e ON e.travelFk = tr.id + JOIN vn.buy b ON b.entryFk = e.id + WHERE tr.landed BETWEEN vFromDated AND vToDated + AND e.isRaid = FALSE + AND tr.warehouseInFk = vWarehouseFk + GROUP BY tr.landed , a.name ; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -86335,54 +86335,54 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_clone`(vSelf INT, vDays INT, OUT vNewTravelFk INT) -BEGIN - - /** - * Clona un travel el número de dias indicado y devuelve su Id - * - * @param vSelf Identificador de vn.travel - * @param vDays Número de dias a futuro - * - * @return vNewTravelFk Nuevo número de travel - */ - - SELECT tr.id INTO vNewTravelFk - FROM vn.travel tr - JOIN vn.travel tr2 USING(shipped, warehouseInFk, warehouseOutFk, agencyFk, `ref`) - WHERE tr2.id = vSelf - AND tr.landed = TIMESTAMPADD(DAY, vDays, tr2.landed); - - IF ISNULL(vNewTravelFk) THEN - - START TRANSACTION; - - INSERT INTO vn.travel( shipped, - shipmentHour, - landed, - landingHour, - warehouseInFk, - warehouseOutFk, - agencyFk, - `ref`, - cargoSupplierFk) - SELECT shipped, - shipmentHour, - TIMESTAMPADD(DAY, vDays, landed), - landingHour, - warehouseInFk, - warehouseOutFk, - agencyFk, - `ref`, - cargoSupplierFk - FROM vn.travel - WHERE id = vSelf; - - SELECT LAST_INSERT_ID() INTO vNewTravelFk; - - COMMIT; - - END IF; - +BEGIN + + /** + * Clona un travel el número de dias indicado y devuelve su Id + * + * @param vSelf Identificador de vn.travel + * @param vDays Número de dias a futuro + * + * @return vNewTravelFk Nuevo número de travel + */ + + SELECT tr.id INTO vNewTravelFk + FROM vn.travel tr + JOIN vn.travel tr2 USING(shipped, warehouseInFk, warehouseOutFk, agencyFk, `ref`) + WHERE tr2.id = vSelf + AND tr.landed = TIMESTAMPADD(DAY, vDays, tr2.landed); + + IF ISNULL(vNewTravelFk) THEN + + START TRANSACTION; + + INSERT INTO vn.travel( shipped, + shipmentHour, + landed, + landingHour, + warehouseInFk, + warehouseOutFk, + agencyFk, + `ref`, + cargoSupplierFk) + SELECT shipped, + shipmentHour, + TIMESTAMPADD(DAY, vDays, landed), + landingHour, + warehouseInFk, + warehouseOutFk, + agencyFk, + `ref`, + cargoSupplierFk + FROM vn.travel + WHERE id = vSelf; + + SELECT LAST_INSERT_ID() INTO vNewTravelFk; + + COMMIT; + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -86399,146 +86399,146 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`( - IN vTravelFk INT, - IN vDateStart DATE, - IN vDateEnd DATE, - IN vWarehouseOutFk INT, - IN vWarehouseInFk INT, - IN vRef VARCHAR(255), - IN vAgencyModeFk INT, +CREATE DEFINER=`root`@`localhost` PROCEDURE `travel_cloneWithEntries`( + IN vTravelFk INT, + IN vDateStart DATE, + IN vDateEnd DATE, + IN vWarehouseOutFk INT, + IN vWarehouseInFk INT, + IN vRef VARCHAR(255), + IN vAgencyModeFk INT, OUT vNewTravelFk INT) -BEGIN -/** - * Clona un travel junto con sus entradas y compras - * - * @param vTravelFk travel plantilla a clonar - * @param vDateStart fecha del shipment del nuevo travel - * @param vDateEnd fecha del landing del nuevo travel - * @param vWarehouseOutFk fecha del salida del nuevo travel - * @param vWarehouseInFk warehouse de landing del nuevo travel - * @param vRef referencia del nuevo travel - * @param vAgencyModeFk del nuevo travel - * @param vNewTravelFk id del nuevo travel - */ - DECLARE vEntryNew INT; - DECLARE vDone BOOLEAN DEFAULT FALSE; - DECLARE vAuxEntryFk INT; - DECLARE vRsEntry CURSOR FOR - SELECT e.id - FROM entry e - JOIN travel t - ON t.id = e.travelFk - WHERE e.travelFk = vTravelFk; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION/*, 1062 Duplicate key*/ - BEGIN - ROLLBACK; - - END; - - START TRANSACTION; - INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyFk, `ref`, isDelivered, isReceived, m3, kg) - SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3, kg - FROM travel - WHERE id = vTravelFk; - - SET vNewTravelFk = LAST_INSERT_ID(); - CALL logAdd(vNewTravelFk, 'insert', 'travel', CONCAT('clona travel ',vTravelFk)); - SET vDone = FALSE; - SET @isModeInventory = TRUE; - OPEN vRsEntry ; - FETCH vRsEntry INTO vAuxEntryFk; - - WHILE NOT vDone DO - INSERT INTO entry ( - supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - travelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk) - SELECT supplierFk, - ref, - isInventory, - isConfirmed, - isOrdered, - isRaid, - commission, - created, - evaNotes, - vNewTravelFk, - currencyFk, - companyFk, - gestDocFk, - invoiceInFk - FROM entry - WHERE id = vAuxEntryFk; - - SET vEntryNew = LAST_INSERT_ID(); - - CALL logAdd(vEntryNew, 'insert', 'entry', CONCAT('clona entrada ',vAuxEntryFk)); - INSERT INTO buy ( - entryFk, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked, - weight) - SELECT vEntryNew, - itemFk, - quantity, - buyingValue, - packageFk, - stickers, - freightValue, - packageValue, - comissionValue, - packing, - `grouping`, - groupingMode, - location, - price1, - price2, - price3, - minPrice, - producer, - printedStickers, - isChecked, - weight - FROM buy - WHERE entryFk = vAuxEntryFk; - - FETCH vRsEntry INTO vAuxEntryFk; - END WHILE; - SET @isModeInventory = FALSE; - CLOSE vRsEntry; - COMMIT; +BEGIN +/** + * Clona un travel junto con sus entradas y compras + * + * @param vTravelFk travel plantilla a clonar + * @param vDateStart fecha del shipment del nuevo travel + * @param vDateEnd fecha del landing del nuevo travel + * @param vWarehouseOutFk fecha del salida del nuevo travel + * @param vWarehouseInFk warehouse de landing del nuevo travel + * @param vRef referencia del nuevo travel + * @param vAgencyModeFk del nuevo travel + * @param vNewTravelFk id del nuevo travel + */ + DECLARE vEntryNew INT; + DECLARE vDone BOOLEAN DEFAULT FALSE; + DECLARE vAuxEntryFk INT; + DECLARE vRsEntry CURSOR FOR + SELECT e.id + FROM entry e + JOIN travel t + ON t.id = e.travelFk + WHERE e.travelFk = vTravelFk; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION/*, 1062 Duplicate key*/ + BEGIN + ROLLBACK; + + END; + + START TRANSACTION; + INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyFk, `ref`, isDelivered, isReceived, m3, kg) + SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3, kg + FROM travel + WHERE id = vTravelFk; + + SET vNewTravelFk = LAST_INSERT_ID(); + CALL logAdd(vNewTravelFk, 'insert', 'travel', CONCAT('clona travel ',vTravelFk)); + SET vDone = FALSE; + SET @isModeInventory = TRUE; + OPEN vRsEntry ; + FETCH vRsEntry INTO vAuxEntryFk; + + WHILE NOT vDone DO + INSERT INTO entry ( + supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + travelFk, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk) + SELECT supplierFk, + ref, + isInventory, + isConfirmed, + isOrdered, + isRaid, + commission, + created, + evaNotes, + vNewTravelFk, + currencyFk, + companyFk, + gestDocFk, + invoiceInFk + FROM entry + WHERE id = vAuxEntryFk; + + SET vEntryNew = LAST_INSERT_ID(); + + CALL logAdd(vEntryNew, 'insert', 'entry', CONCAT('clona entrada ',vAuxEntryFk)); + INSERT INTO buy ( + entryFk, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight) + SELECT vEntryNew, + itemFk, + quantity, + buyingValue, + packageFk, + stickers, + freightValue, + packageValue, + comissionValue, + packing, + `grouping`, + groupingMode, + location, + price1, + price2, + price3, + minPrice, + producer, + printedStickers, + isChecked, + weight + FROM buy + WHERE entryFk = vAuxEntryFk; + + FETCH vRsEntry INTO vAuxEntryFk; + END WHILE; + SET @isModeInventory = FALSE; + CLOSE vRsEntry; + COMMIT; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -86944,60 +86944,60 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `typeTagMake`(vTypeFk INT) -BEGIN -/* - * Plantilla para modificar reemplazar todos los tags - * por los valores que tienen los articulos - * - * @param vTypeFk tipo a modificar - * - */ - DELETE it.* - FROM itemTag it - JOIN item i ON i.id = it.itemFk - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, CONCAT(i.size,' cm'), 1 - FROM item i - JOIN tag t ON t.name = 'Longitud' COLLATE utf8_general_ci - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, i.category, 5 - FROM item i - JOIN tag t ON t.name = 'Categoria' COLLATE utf8_general_ci - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, ink.name, 2 - FROM item i - JOIN tag t ON t.name = 'Color' COLLATE utf8_general_ci - JOIN ink ON ink.id = i.inkFk - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, p.name, 3 - FROM item i - JOIN tag t ON t.name = 'Productor' COLLATE utf8_general_ci - JOIN producer p ON p.id = i.producerFk - WHERE i.typeFk = vTypeFk; - - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, o.name, 4 - FROM item i - JOIN tag t ON t.name = 'Origen' COLLATE utf8_general_ci - JOIN origin o ON o.id = i.originFk - WHERE i.typeFk = vTypeFk; - /* - INSERT INTO itemTag(itemFk, tagFk, value, priority) - SELECT i.id, t.id, i.stems, 6 - FROM item i - JOIN tag t ON t.name = 'Tallos' COLLATE utf8_general_ci - WHERE i.typeFk = vTypeFk; - */ --- CALL itemTagArrangedUpdate(NULL); - +BEGIN +/* + * Plantilla para modificar reemplazar todos los tags + * por los valores que tienen los articulos + * + * @param vTypeFk tipo a modificar + * + */ + DELETE it.* + FROM itemTag it + JOIN item i ON i.id = it.itemFk + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, CONCAT(i.size,' cm'), 1 + FROM item i + JOIN tag t ON t.name = 'Longitud' COLLATE utf8_general_ci + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, i.category, 5 + FROM item i + JOIN tag t ON t.name = 'Categoria' COLLATE utf8_general_ci + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, ink.name, 2 + FROM item i + JOIN tag t ON t.name = 'Color' COLLATE utf8_general_ci + JOIN ink ON ink.id = i.inkFk + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, p.name, 3 + FROM item i + JOIN tag t ON t.name = 'Productor' COLLATE utf8_general_ci + JOIN producer p ON p.id = i.producerFk + WHERE i.typeFk = vTypeFk; + + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, o.name, 4 + FROM item i + JOIN tag t ON t.name = 'Origen' COLLATE utf8_general_ci + JOIN origin o ON o.id = i.originFk + WHERE i.typeFk = vTypeFk; + /* + INSERT INTO itemTag(itemFk, tagFk, value, priority) + SELECT i.id, t.id, i.stems, 6 + FROM item i + JOIN tag t ON t.name = 'Tallos' COLLATE utf8_general_ci + WHERE i.typeFk = vTypeFk; + */ +-- CALL itemTagArrangedUpdate(NULL); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -88547,16 +88547,16 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistakeType_get`() -BEGIN - -/** - * Obtiene los tipos de error para los trabajadores - */ - - SELECT code, description - FROM workerMistakeType - ORDER BY description; - +BEGIN + +/** + * Obtiene los tipos de error para los trabajadores + */ + + SELECT code, description + FROM workerMistakeType + ORDER BY description; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -88574,27 +88574,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerMistake_add`(vWorkerFk INT, vWorkerMistakeTypeFk VARCHAR(10), vUserFk INT ) -BEGIN - -/** - * Añade error al trabajador - * - * @param vWorkerFk id del trabajador al cual se le va a añadir error - * @param vWorkerMistakeTypeFk code del tipo de error - * @param vUserFk id del usuario que pone el error - * - */ - DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vUserFk); - - IF(account.user_hasRole(vWorkerName,'coolerBoss')) - THEN - INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk) - VALUES(vWorkerFk, vWorkerMistakeTypeFk); - ELSE - CALL util.throw('No tienes permisos para realizar la acción'); - - END IF; - +BEGIN + +/** + * Añade error al trabajador + * + * @param vWorkerFk id del trabajador al cual se le va a añadir error + * @param vWorkerMistakeTypeFk code del tipo de error + * @param vUserFk id del usuario que pone el error + * + */ + DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vUserFk); + + IF(account.user_hasRole(vWorkerName,'coolerBoss')) + THEN + INSERT INTO vn.workerMistake(userFk, workerMistakeTypeFk) + VALUES(vWorkerFk, vWorkerMistakeTypeFk); + ELSE + CALL util.throw('No tienes permisos para realizar la acción'); + + END IF; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -88612,28 +88612,28 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerShelving_Add`(vWorkerFk INT, vBarcode VARCHAR(12)) -BEGIN -/* - * Inserta en workerShelving asociando los carros al trabajador - * @Param vWorkerFk es id del trabajador - * @Param vBarcode se puede pasar tanto el smarttag como el shelving - */ - DECLARE vIsShelvingFk BOOL; - - SELECT COUNT(*) > 0 INTO vIsShelvingFk - FROM vn.shelving s - WHERE s.code = vBarcode COLLATE utf8_general_ci; - - IF NOT vIsShelvingFk THEN - - SELECT st.shelvingFk INTO vBarcode - FROM vn.smartTag st - WHERE st.code = vBarcode COLLATE utf8_general_ci; - - END IF; - - INSERT INTO vn.workerShelving (workerFk, shelvingFk) - VALUES(vWorkerFk, vBarcode); +BEGIN +/* + * Inserta en workerShelving asociando los carros al trabajador + * @Param vWorkerFk es id del trabajador + * @Param vBarcode se puede pasar tanto el smarttag como el shelving + */ + DECLARE vIsShelvingFk BOOL; + + SELECT COUNT(*) > 0 INTO vIsShelvingFk + FROM vn.shelving s + WHERE s.code = vBarcode COLLATE utf8_general_ci; + + IF NOT vIsShelvingFk THEN + + SELECT st.shelvingFk INTO vBarcode + FROM vn.smartTag st + WHERE st.code = vBarcode COLLATE utf8_general_ci; + + END IF; + + INSERT INTO vn.workerShelving (workerFk, shelvingFk) + VALUES(vWorkerFk, vBarcode); END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -88651,32 +88651,32 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerShelving_delete`(vWorkerFk INT, vBarcode VARCHAR(12)) -BEGIN -/* - * Borra de workerShelving el carro o etiqueta insertado por el trabajador - * @param vWorkerFk es id del trabajador - * @param vBarcode se puede pasar tanto el smarttag como el shelving - */ - DECLARE vIsShelvingFk BOOL; - - - SELECT COUNT(*) > 0 INTO vIsShelvingFk - FROM vn.shelving s - WHERE s.code = vBarcode COLLATE utf8_general_ci; - - - IF NOT vIsShelvingFk THEN - - SELECT st.shelvingFk INTO vBarcode - FROM vn.smartTag st - WHERE st.code = vBarcode COLLATE utf8_general_ci; - - END IF; - - DELETE FROM vn.workerShelving - WHERE shelvingFk = vBarcode COLLATE utf8_general_ci - AND workerFk = vWorkerFk ; - +BEGIN +/* + * Borra de workerShelving el carro o etiqueta insertado por el trabajador + * @param vWorkerFk es id del trabajador + * @param vBarcode se puede pasar tanto el smarttag como el shelving + */ + DECLARE vIsShelvingFk BOOL; + + + SELECT COUNT(*) > 0 INTO vIsShelvingFk + FROM vn.shelving s + WHERE s.code = vBarcode COLLATE utf8_general_ci; + + + IF NOT vIsShelvingFk THEN + + SELECT st.shelvingFk INTO vBarcode + FROM vn.smartTag st + WHERE st.code = vBarcode COLLATE utf8_general_ci; + + END IF; + + DELETE FROM vn.workerShelving + WHERE shelvingFk = vBarcode COLLATE utf8_general_ci + AND workerFk = vWorkerFk ; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -88954,32 +88954,32 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_calculateOddDays`() -BEGIN -/* - * Calculo de las fichadas impares por empleado y dia - * @return tmp.workerTimeControlOddDays (userFk, dated) - */ - SET @cont := FALSE; - SET @lastUserFk:= NULL; - DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlOddDays; - CREATE TEMPORARY TABLE tmp.workerTimeControlOddDays - SELECT sub2.userFk workerFk, sub2.dated - FROM (SELECT userFk, - dated, - COUNT(*) cont2 - FROM (SELECT DATE(wtc.timed) dated, - userFk, - IFNULL(@cont, @cont := TRUE ), - IF(direction = 'in' OR userFk <> @lastUserFk, @cont := @cont+1, TRUE), - @cont cont, - @lastUserFk := userFk - FROM workerTimeControl wtc - WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND util.dayEnd(CURDATE()) - ORDER BY userFk, timed)sub - GROUP BY cont - HAVING cont2 MOD 2 = 1)sub2 - JOIN worker w ON w.userFk = sub2.userFk; - +BEGIN +/* + * Calculo de las fichadas impares por empleado y dia + * @return tmp.workerTimeControlOddDays (userFk, dated) + */ + SET @cont := FALSE; + SET @lastUserFk:= NULL; + DROP TEMPORARY TABLE IF EXISTS tmp.workerTimeControlOddDays; + CREATE TEMPORARY TABLE tmp.workerTimeControlOddDays + SELECT sub2.userFk workerFk, sub2.dated + FROM (SELECT userFk, + dated, + COUNT(*) cont2 + FROM (SELECT DATE(wtc.timed) dated, + userFk, + IFNULL(@cont, @cont := TRUE ), + IF(direction = 'in' OR userFk <> @lastUserFk, @cont := @cont+1, TRUE), + @cont cont, + @lastUserFk := userFk + FROM workerTimeControl wtc + WHERE wtc.timed BETWEEN TIMESTAMPADD(YEAR,-1,CURDATE()) AND util.dayEnd(CURDATE()) + ORDER BY userFk, timed)sub + GROUP BY cont + HAVING cont2 MOD 2 = 1)sub2 + JOIN worker w ON w.userFk = sub2.userFk; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -89565,314 +89565,314 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `workerTimeControl_clockIn`(vWorker INT, vTimed DATETIME, vDirection VARCHAR(10)) -BEGIN -/** - * Verifica si el empleado puede fichar - * @param vWorker Identificador del trabajador - * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW() - * @param vDirection solo se pueden pasa los valores del campo workerTimeControl.direction ENUM('in', 'out', 'middle') - * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. Si hay algún problema, devuelve el mesaje a que se debe mostrar al usuario - * Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá fichada a la tabla vn.workerTimeControl - */ - DECLARE vLastIn DATETIME; - DECLARE vLastOut DATETIME; - DECLARE vNextIn DATETIME; - DECLARE vLastDirection VARCHAR(6); - DECLARE vNextDirection VARCHAR(6); - DECLARE vDayBreak INT; - DECLARE vShortWeekBreak INT; - DECLARE vLongWeekBreak INT; - DECLARE vWeekScope INT; - DECLARE vGap INT; - DECLARE vMailTo VARCHAR(50) DEFAULT NULL; - DECLARE vUserName VARCHAR(50) DEFAULT NULL; - DECLARE vIsError BOOLEAN DEFAULT FALSE; - DECLARE vErrorMessage VARCHAR(255) DEFAULT NULL; - DECLARE vErrorCode VARCHAR(50); - DECLARE vDated DATE; - DECLARE vIsAllowedToWork VARCHAR(50); - DECLARE vDepartmentFk INT; - DECLARE vTimedLoop INT; - DECLARE vTimedLoopPrevious INT; - DECLARE vHasBreakWeek BOOLEAN DEFAULT FALSE; - DECLARE vManual BOOLEAN DEFAULT TRUE; - DECLARE vDone INT DEFAULT FALSE; - - DECLARE vCursor CURSOR FOR - SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) - UNION - SELECT UNIX_TIMESTAMP(NOW()) - UNION - (SELECT UNIX_TIMESTAMP(timed) - FROM workerTimeControl - WHERE timed BETWEEN (vTimed - INTERVAL vGap SECOND) AND vTimed AND - userFk = vWorker AND - direction IN ('in', 'out') - ORDER BY timed ASC); - - DECLARE vCursor2 CURSOR FOR - SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) - UNION - SELECT UNIX_TIMESTAMP(NOW()) - UNION - SELECT UNIX_TIMESTAMP(timed) - FROM workerTimeControl - WHERE timed BETWEEN vTimed AND (vTimed - INTERVAL vGap SECOND) AND - userFk = vWorker AND - direction IN ('in', 'out') - ORDER BY timed ASC; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - DECLARE EXIT HANDLER FOR SQLSTATE '45000' - BEGIN - - SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT(w.firstName, ' ', w.lastName) - INTO vMailTo, vUserName - FROM account.user u - JOIN worker w ON w.bossFk = u.id - WHERE w.id = vWorker; - - CASE vErrorCode - WHEN 'IS_NOT_ALLOWED_FUTURE' THEN - SELECT 'No se permite fichar a futuro' INTO vErrorMessage; - WHEN 'INACTIVE_BUSINESS' THEN - SELECT 'No hay un contrato en vigor' INTO vErrorMessage; - WHEN 'IS_NOT_ALLOWED_WORK' THEN - SELECT 'No está permitido trabajar' INTO vErrorMessage; - WHEN 'ODD_WORKERTIMECONTROL' THEN - SELECT 'Fichadas impares' INTO vErrorMessage; - WHEN 'BREAK_DAY' THEN - SELECT CONCAT('Descanso diario ', FORMAT(vDayBreak/3600, 0) , 'h.') INTO vErrorMessage; - WHEN 'BREAK_WEEK' THEN - SELECT CONCAT('Descanso semanal ', - FORMAT(vShortWeekBreak / 3600,0) ,'h. / ', - FORMAT(vLongWeekBreak / 3600, 0) ,'h.') INTO vErrorMessage; - WHEN 'WRONG_DIRECTION' THEN - SELECT 'Dirección incorrecta' INTO vErrorMessage; - ELSE - SELECT 'Error sin definir'INTO vErrorMessage; - END CASE; - - SELECT vErrorMessage `error`; - SELECT CONCAT(vUserName, ' no ha podido fichar por el siguiente problema: ', vErrorMessage) INTO vErrorMessage; - CALL mail_insert( vMailTo, vMailTo, 'Error al fichar', vErrorMessage); - - END; - - IF (vTimed IS NULL) THEN - SET vTimed = NOW(); - SET vManual = FALSE; - END IF; - - SET vDated = DATE(vTimed); - - SELECT IF(pc.category_name = 'Conductor +3500kg', wc.dayBreakDriver, wc.dayBreak), - wc.shortWeekBreak, - wc.longWeekBreak, - wc.weekScope - INTO vDayBreak, - vShortWeekBreak, - vLongWeekBreak, - vWeekScope - FROM workerLabour w - JOIN postgresql.business_labour bl ON bl.business_id = w.businessFk - JOIN postgresql.professional_category pc ON pc.professional_category_id = bl.professional_category_id - JOIN workerTimeControlConfig wc ON TRUE - WHERE w.workerFk = vWorker - AND vDated BETWEEN w.started AND IFNULL(w.ended, vDated); - - SELECT timed INTO vLastIn - FROM workerTimeControl - WHERE userFk = vWorker - AND direction = 'in' - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - SELECT timed INTO vLastOut - FROM workerTimeControl - WHERE userFk = vWorker - AND direction = 'out' - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - SELECT timed INTO vNextIn - FROM workerTimeControl - WHERE userFk = vWorker - AND direction = 'in' - AND timed > vTimed - ORDER BY timed ASC - LIMIT 1; - - SELECT direction INTO vNextDirection - FROM workerTimeControl - WHERE userFk = vWorker - AND timed > vTimed - ORDER BY timed ASC - LIMIT 1; - - SELECT direction INTO vLastDirection - FROM workerTimeControl - WHERE userFk = vWorker - AND timed < vTimed - ORDER BY timed DESC - LIMIT 1; - - -- FICHADAS A FUTURO - IF vTimed > DATE_ADD(NOW(), INTERVAL 60 SECOND) THEN - SET vErrorCode = 'IS_NOT_ALLOWED_FUTURE'; - CALL util.throw(vErrorCode); - END IF; - - -- CONTRATO EN VIGOR - IF vDayBreak IS NULL THEN - SET vErrorCode = 'INACTIVE_BUSINESS'; - CALL util.throw(vErrorCode); - END IF; - - -- VERIFICAR SI ESTÁ PERMITIDO TRABAJAR - CALL timeBusiness_calculateByWorker(vWorker, vDated, vDated); - SELECT isAllowedToWork INTO vIsAllowedToWork - FROM tmp.timeBusinessCalculate; - DROP TEMPORARY TABLE tmp.timeBusinessCalculate; - - IF NOT vIsAllowedToWork THEN - SET vErrorCode = 'IS_NOT_ALLOWED_WORK'; - CALL util.throw(vErrorCode); - END IF; - - -- DIRECCION CORRECTA - CALL vn.workerTimeControl_direction(vWorker, vTimed); - IF (SELECT IF(IF(option1 IN ('inMiddle', 'outMiddle'), 'middle', option1) <> vDirection - AND IF(option2 IN ('inMiddle', 'outMiddle'), 'middle', IFNULL(option2, '')) <> vDirection, TRUE , FALSE) - FROM tmp.workerTimeControlDirection) THEN - SET vIsError = TRUE; - END IF; - - DROP TEMPORARY TABLE tmp.workerTimeControlDirection; - IF vIsError = TRUE THEN - SET vErrorCode = 'WRONG_DIRECTION'; - CALL util.throw(vErrorCode); - END IF; - - -- FICHADAS IMPARES - IF (SELECT IF(vDirection = 'in', MOD(COUNT(*), 2) , IF (vDirection = 'out', NOT MOD(COUNT(*), 2), FALSE)) - FROM workerTimeControl - WHERE userFk = vWorker - AND timed BETWEEN vLastIn AND vTimed - ) THEN - SET vErrorCode = 'ODD_WORKERTIMECONTROL'; - CALL util.throw(vErrorCode); - END IF; - - -- DESCANSO DIARIO - CASE vDirection - WHEN 'in' THEN - IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) <= vDayBreak THEN - SET vIsError = TRUE; - END IF; - WHEN 'out' THEN - IF UNIX_TIMESTAMP(vNextIn) - UNIX_TIMESTAMP(vTimed) <= vDayBreak THEN - SET vIsError = TRUE; - END IF; - ELSE BEGIN END; - END CASE; - - IF vIsError THEN - SET vErrorCode = 'BREAK_DAY'; - CALL util.throw(vErrorCode); - END IF; - - -- VERIFICAR DESCANSO SEMANAL - IF (vDirection IN('in', 'out')) THEN - -- VERIFICA DESCANSO CORTO EN LA ÚLTIMA SEMANA - SET vGap = vWeekScope; - SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND)); - SET vDone = FALSE; - OPEN vCursor; - l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN - LEAVE l; - END IF; - IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN - SET vHasBreakWeek = TRUE; - LEAVE l; - END IF; - SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; - -- VERIFICA DESCANSO LARGO EN LA ÚLTIMAS 2 SEMANAS - IF NOT vHasBreakWeek THEN - SET vGap = vWeekScope * 2; - SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND)); - SET vDone = FALSE; - OPEN vCursor; - l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN - LEAVE l; - END IF; - IF vLongWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN - SET vHasBreakWeek = TRUE; - LEAVE l; - END IF; - SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; - END IF; - - IF vManual THEN - -- VERIFICA DESCANSO CORTO EN LA PRÓXIMA SEMANA - SET vGap = vWeekScope; - SET vTimedLoopPrevious = vTimed; - SET vDone = FALSE; - OPEN vCursor; - l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN - LEAVE l; - END IF; - IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN - SET vHasBreakWeek = TRUE; - LEAVE l; - END IF; - SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; - -- VERIFICA DESCANSO LARGO EN LAS PRÓXIMAS 2 SEMANAS - IF NOT vHasBreakWeek THEN - SET vGap = vWeekScope * 2; - SET vTimedLoopPrevious = vTimed; - SET vDone = FALSE; - OPEN vCursor; - l:LOOP - FETCH vCursor INTO vTimedLoop; - IF vDone THEN - LEAVE l; - END IF; - IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN - SET vHasBreakWeek = TRUE; - LEAVE l; - END IF; - SET vTimedLoopPrevious = vTimedLoop; - END LOOP l; - CLOSE vCursor; - END IF; - END IF; - IF NOT vHasBreakWeek THEN - SET vErrorCode = 'BREAK_WEEK'; - CALL util.throw(vErrorCode); - END IF; - END IF; - - -- SE PERMITE FICHAR - INSERT INTO workerTimeControl(userFk, timed, direction, manual) - VALUES(vWorker, vTimed, vDirection, vManual); - - SELECT LAST_INSERT_ID() id; +BEGIN +/** + * Verifica si el empleado puede fichar + * @param vWorker Identificador del trabajador + * @param vTimed valor de la fichada, IF vTimed IS NULL vTimed = NOW() + * @param vDirection solo se pueden pasa los valores del campo workerTimeControl.direction ENUM('in', 'out', 'middle') + * @return Si todo es correcto, retorna el número de id la tabla workerTimeControl. Si hay algún problema, devuelve el mesaje a que se debe mostrar al usuario + * Solo retorna el primer problema, en caso de no ocurrir ningún error se añadirá fichada a la tabla vn.workerTimeControl + */ + DECLARE vLastIn DATETIME; + DECLARE vLastOut DATETIME; + DECLARE vNextIn DATETIME; + DECLARE vLastDirection VARCHAR(6); + DECLARE vNextDirection VARCHAR(6); + DECLARE vDayBreak INT; + DECLARE vShortWeekBreak INT; + DECLARE vLongWeekBreak INT; + DECLARE vWeekScope INT; + DECLARE vGap INT; + DECLARE vMailTo VARCHAR(50) DEFAULT NULL; + DECLARE vUserName VARCHAR(50) DEFAULT NULL; + DECLARE vIsError BOOLEAN DEFAULT FALSE; + DECLARE vErrorMessage VARCHAR(255) DEFAULT NULL; + DECLARE vErrorCode VARCHAR(50); + DECLARE vDated DATE; + DECLARE vIsAllowedToWork VARCHAR(50); + DECLARE vDepartmentFk INT; + DECLARE vTimedLoop INT; + DECLARE vTimedLoopPrevious INT; + DECLARE vHasBreakWeek BOOLEAN DEFAULT FALSE; + DECLARE vManual BOOLEAN DEFAULT TRUE; + DECLARE vDone INT DEFAULT FALSE; + + DECLARE vCursor CURSOR FOR + SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) + UNION + SELECT UNIX_TIMESTAMP(NOW()) + UNION + (SELECT UNIX_TIMESTAMP(timed) + FROM workerTimeControl + WHERE timed BETWEEN (vTimed - INTERVAL vGap SECOND) AND vTimed AND + userFk = vWorker AND + direction IN ('in', 'out') + ORDER BY timed ASC); + + DECLARE vCursor2 CURSOR FOR + SELECT UNIX_TIMESTAMP(NOW() - INTERVAL vGap SECOND) + UNION + SELECT UNIX_TIMESTAMP(NOW()) + UNION + SELECT UNIX_TIMESTAMP(timed) + FROM workerTimeControl + WHERE timed BETWEEN vTimed AND (vTimed - INTERVAL vGap SECOND) AND + userFk = vWorker AND + direction IN ('in', 'out') + ORDER BY timed ASC; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; + + DECLARE EXIT HANDLER FOR SQLSTATE '45000' + BEGIN + + SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT(w.firstName, ' ', w.lastName) + INTO vMailTo, vUserName + FROM account.user u + JOIN worker w ON w.bossFk = u.id + WHERE w.id = vWorker; + + CASE vErrorCode + WHEN 'IS_NOT_ALLOWED_FUTURE' THEN + SELECT 'No se permite fichar a futuro' INTO vErrorMessage; + WHEN 'INACTIVE_BUSINESS' THEN + SELECT 'No hay un contrato en vigor' INTO vErrorMessage; + WHEN 'IS_NOT_ALLOWED_WORK' THEN + SELECT 'No está permitido trabajar' INTO vErrorMessage; + WHEN 'ODD_WORKERTIMECONTROL' THEN + SELECT 'Fichadas impares' INTO vErrorMessage; + WHEN 'BREAK_DAY' THEN + SELECT CONCAT('Descanso diario ', FORMAT(vDayBreak/3600, 0) , 'h.') INTO vErrorMessage; + WHEN 'BREAK_WEEK' THEN + SELECT CONCAT('Descanso semanal ', + FORMAT(vShortWeekBreak / 3600,0) ,'h. / ', + FORMAT(vLongWeekBreak / 3600, 0) ,'h.') INTO vErrorMessage; + WHEN 'WRONG_DIRECTION' THEN + SELECT 'Dirección incorrecta' INTO vErrorMessage; + ELSE + SELECT 'Error sin definir'INTO vErrorMessage; + END CASE; + + SELECT vErrorMessage `error`; + SELECT CONCAT(vUserName, ' no ha podido fichar por el siguiente problema: ', vErrorMessage) INTO vErrorMessage; + CALL mail_insert( vMailTo, vMailTo, 'Error al fichar', vErrorMessage); + + END; + + IF (vTimed IS NULL) THEN + SET vTimed = NOW(); + SET vManual = FALSE; + END IF; + + SET vDated = DATE(vTimed); + + SELECT IF(pc.category_name = 'Conductor +3500kg', wc.dayBreakDriver, wc.dayBreak), + wc.shortWeekBreak, + wc.longWeekBreak, + wc.weekScope + INTO vDayBreak, + vShortWeekBreak, + vLongWeekBreak, + vWeekScope + FROM workerLabour w + JOIN postgresql.business_labour bl ON bl.business_id = w.businessFk + JOIN postgresql.professional_category pc ON pc.professional_category_id = bl.professional_category_id + JOIN workerTimeControlConfig wc ON TRUE + WHERE w.workerFk = vWorker + AND vDated BETWEEN w.started AND IFNULL(w.ended, vDated); + + SELECT timed INTO vLastIn + FROM workerTimeControl + WHERE userFk = vWorker + AND direction = 'in' + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + SELECT timed INTO vLastOut + FROM workerTimeControl + WHERE userFk = vWorker + AND direction = 'out' + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + SELECT timed INTO vNextIn + FROM workerTimeControl + WHERE userFk = vWorker + AND direction = 'in' + AND timed > vTimed + ORDER BY timed ASC + LIMIT 1; + + SELECT direction INTO vNextDirection + FROM workerTimeControl + WHERE userFk = vWorker + AND timed > vTimed + ORDER BY timed ASC + LIMIT 1; + + SELECT direction INTO vLastDirection + FROM workerTimeControl + WHERE userFk = vWorker + AND timed < vTimed + ORDER BY timed DESC + LIMIT 1; + + -- FICHADAS A FUTURO + IF vTimed > DATE_ADD(NOW(), INTERVAL 60 SECOND) THEN + SET vErrorCode = 'IS_NOT_ALLOWED_FUTURE'; + CALL util.throw(vErrorCode); + END IF; + + -- CONTRATO EN VIGOR + IF vDayBreak IS NULL THEN + SET vErrorCode = 'INACTIVE_BUSINESS'; + CALL util.throw(vErrorCode); + END IF; + + -- VERIFICAR SI ESTÁ PERMITIDO TRABAJAR + CALL timeBusiness_calculateByWorker(vWorker, vDated, vDated); + SELECT isAllowedToWork INTO vIsAllowedToWork + FROM tmp.timeBusinessCalculate; + DROP TEMPORARY TABLE tmp.timeBusinessCalculate; + + IF NOT vIsAllowedToWork THEN + SET vErrorCode = 'IS_NOT_ALLOWED_WORK'; + CALL util.throw(vErrorCode); + END IF; + + -- DIRECCION CORRECTA + CALL vn.workerTimeControl_direction(vWorker, vTimed); + IF (SELECT IF(IF(option1 IN ('inMiddle', 'outMiddle'), 'middle', option1) <> vDirection + AND IF(option2 IN ('inMiddle', 'outMiddle'), 'middle', IFNULL(option2, '')) <> vDirection, TRUE , FALSE) + FROM tmp.workerTimeControlDirection) THEN + SET vIsError = TRUE; + END IF; + + DROP TEMPORARY TABLE tmp.workerTimeControlDirection; + IF vIsError = TRUE THEN + SET vErrorCode = 'WRONG_DIRECTION'; + CALL util.throw(vErrorCode); + END IF; + + -- FICHADAS IMPARES + IF (SELECT IF(vDirection = 'in', MOD(COUNT(*), 2) , IF (vDirection = 'out', NOT MOD(COUNT(*), 2), FALSE)) + FROM workerTimeControl + WHERE userFk = vWorker + AND timed BETWEEN vLastIn AND vTimed + ) THEN + SET vErrorCode = 'ODD_WORKERTIMECONTROL'; + CALL util.throw(vErrorCode); + END IF; + + -- DESCANSO DIARIO + CASE vDirection + WHEN 'in' THEN + IF UNIX_TIMESTAMP(vTimed) - UNIX_TIMESTAMP(vLastOut) <= vDayBreak THEN + SET vIsError = TRUE; + END IF; + WHEN 'out' THEN + IF UNIX_TIMESTAMP(vNextIn) - UNIX_TIMESTAMP(vTimed) <= vDayBreak THEN + SET vIsError = TRUE; + END IF; + ELSE BEGIN END; + END CASE; + + IF vIsError THEN + SET vErrorCode = 'BREAK_DAY'; + CALL util.throw(vErrorCode); + END IF; + + -- VERIFICAR DESCANSO SEMANAL + IF (vDirection IN('in', 'out')) THEN + -- VERIFICA DESCANSO CORTO EN LA ÚLTIMA SEMANA + SET vGap = vWeekScope; + SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND)); + SET vDone = FALSE; + OPEN vCursor; + l:LOOP + FETCH vCursor INTO vTimedLoop; + IF vDone THEN + LEAVE l; + END IF; + IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + SET vHasBreakWeek = TRUE; + LEAVE l; + END IF; + SET vTimedLoopPrevious = vTimedLoop; + END LOOP l; + CLOSE vCursor; + -- VERIFICA DESCANSO LARGO EN LA ÚLTIMAS 2 SEMANAS + IF NOT vHasBreakWeek THEN + SET vGap = vWeekScope * 2; + SET vTimedLoopPrevious = UNIX_TIMESTAMP((vTimed - INTERVAL vGap SECOND)); + SET vDone = FALSE; + OPEN vCursor; + l:LOOP + FETCH vCursor INTO vTimedLoop; + IF vDone THEN + LEAVE l; + END IF; + IF vLongWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + SET vHasBreakWeek = TRUE; + LEAVE l; + END IF; + SET vTimedLoopPrevious = vTimedLoop; + END LOOP l; + CLOSE vCursor; + END IF; + + IF vManual THEN + -- VERIFICA DESCANSO CORTO EN LA PRÓXIMA SEMANA + SET vGap = vWeekScope; + SET vTimedLoopPrevious = vTimed; + SET vDone = FALSE; + OPEN vCursor; + l:LOOP + FETCH vCursor INTO vTimedLoop; + IF vDone THEN + LEAVE l; + END IF; + IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + SET vHasBreakWeek = TRUE; + LEAVE l; + END IF; + SET vTimedLoopPrevious = vTimedLoop; + END LOOP l; + CLOSE vCursor; + -- VERIFICA DESCANSO LARGO EN LAS PRÓXIMAS 2 SEMANAS + IF NOT vHasBreakWeek THEN + SET vGap = vWeekScope * 2; + SET vTimedLoopPrevious = vTimed; + SET vDone = FALSE; + OPEN vCursor; + l:LOOP + FETCH vCursor INTO vTimedLoop; + IF vDone THEN + LEAVE l; + END IF; + IF vShortWeekBreak - (vTimedLoop - vTimedLoopPrevious) < 0 THEN + SET vHasBreakWeek = TRUE; + LEAVE l; + END IF; + SET vTimedLoopPrevious = vTimedLoop; + END LOOP l; + CLOSE vCursor; + END IF; + END IF; + IF NOT vHasBreakWeek THEN + SET vErrorCode = 'BREAK_WEEK'; + CALL util.throw(vErrorCode); + END IF; + END IF; + + -- SE PERMITE FICHAR + INSERT INTO workerTimeControl(userFk, timed, direction, manual) + VALUES(vWorker, vTimed, vDirection, vManual); + + SELECT LAST_INSERT_ID() id; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -91831,21 +91831,21 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getFromHasMistake`(vDepartmentFk INT) -BEGIN - -/** - * Obtiene los trabajadores de los departamentos que se les puede poner error - * @param vDepartmentFk id del departamento - * - */ - - SELECT w.id,w.firstName, w.lastName,d.name - FROM worker w - JOIN workerDepartment wd ON wd.workerFk = w.id - JOIN department d ON d.id = wd.departmentFk - WHERE d.id = vDepartmentFk - ORDER BY firstName; - +BEGIN + +/** + * Obtiene los trabajadores de los departamentos que se les puede poner error + * @param vDepartmentFk id del departamento + * + */ + + SELECT w.id,w.firstName, w.lastName,d.name + FROM worker w + JOIN workerDepartment wd ON wd.workerFk = w.id + JOIN department d ON d.id = wd.departmentFk + WHERE d.id = vDepartmentFk + ORDER BY firstName; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -92057,17 +92057,17 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_getSector`() -BEGIN - -/** - * Obtiene el sector del usuario conectado -*/ - - SELECT s.id,s.description,s.warehouseFk - FROM sector s - JOIN worker w ON w.sectorFk = s.id - WHERE w.id = account.userGetId(); - +BEGIN + +/** + * Obtiene el sector del usuario conectado +*/ + + SELECT s.id,s.description,s.warehouseFk + FROM sector s + JOIN worker w ON w.sectorFk = s.id + WHERE w.id = account.userGetId(); + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -92085,18 +92085,18 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `worker_updateSector`(vSectorFk INT) -BEGIN - -/** - * ACtualiza el sector del usuario conectado - * - * @param vSectorFk id del sector -*/ - UPDATE worker - SET sectorFk = vSectorFk - WHERE id = account.userGetId(); - - +BEGIN + +/** + * ACtualiza el sector del usuario conectado + * + * @param vSectorFk id del sector +*/ + UPDATE worker + SET sectorFk = vSectorFk + WHERE id = account.userGetId(); + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -92719,23 +92719,23 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_ETD_byTime`() -BEGIN - - SET @m := 0; - - DROP TEMPORARY TABLE IF EXISTS tmpZone; - CREATE TEMPORARY TABLE tmpZone - SELECT remainingVolume, - hourTheoretical, - @m := @m + minutesLess totalMinutes - FROM zoneEstimatedDelivery ze - WHERE ze.remainingVolume - ORDER BY ze.hourTheoretical DESC; - - SELECT * FROM tmpZone; - - DROP TABLE tmpZone; - +BEGIN + + SET @m := 0; + + DROP TEMPORARY TABLE IF EXISTS tmpZone; + CREATE TEMPORARY TABLE tmpZone + SELECT remainingVolume, + hourTheoretical, + @m := @m + minutesLess totalMinutes + FROM zoneEstimatedDelivery ze + WHERE ze.remainingVolume + ORDER BY ze.hourTheoretical DESC; + + SELECT * FROM tmpZone; + + DROP TABLE tmpZone; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -93317,106 +93317,106 @@ DELIMITER ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves2`(vSelf INT, vParentFk INT, vSearch VARCHAR(255)) -BEGIN -/** - * Devuelve los geoFk incluidos en la ruta y que sean hijos de parentFk - * @param vSelf Id de la zona - * @param vParentFk Id del geo a calcular - * @param vSearch cadena a buscar - * - * @return tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - * - */ - DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; - - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes - (UNIQUE (id)) - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - IF vIsSearch THEN - SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - - INSERT INTO tNodes - SELECT id - FROM zoneGeo - WHERE (vIsNumber AND `name` = vSearch) - OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) - LIMIT 1000; - - ELSEIF vParentFk IS NULL THEN - INSERT INTO tNodes - SELECT geoFk - FROM zoneIncluded - WHERE zoneFk = vSelf; - END IF; - - IF vParentFk IS NULL THEN - DROP TEMPORARY TABLE IF EXISTS tChilds; - CREATE TEMPORARY TABLE tChilds - (INDEX(id)) - ENGINE = MEMORY - SELECT id - FROM tNodes; - - DROP TEMPORARY TABLE IF EXISTS tParents; - CREATE TEMPORARY TABLE tParents - (INDEX(id)) - ENGINE = MEMORY - SELECT id - FROM zoneGeo - LIMIT 0; - - myLoop: LOOP - DELETE FROM tParents; - INSERT INTO tParents - SELECT parentFk id - FROM zoneGeo g - JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - - INSERT IGNORE INTO tNodes - SELECT id - FROM tParents; - - IF ROW_COUNT() = 0 THEN - LEAVE myLoop; - END IF; - - DELETE FROM tChilds; - INSERT INTO tChilds - SELECT id - FROM tParents; - END LOOP; - - DROP TEMPORARY TABLE tChilds, tParents; - END IF; - - IF !vIsSearch THEN - INSERT IGNORE INTO tNodes - SELECT id - FROM zoneGeo - WHERE parentFk <=> vParentFk; - END IF; - - INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - SELECT g.id, - g.`name`, - g.parentFk, - g.sons, - NOT g.sons OR type = 'country', - vSelf - FROM zoneGeo g - JOIN tNodes n ON n.id = g.id - LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf - WHERE i.isIncluded = TRUE - OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL); - - DROP TEMPORARY TABLE tNodes; +BEGIN +/** + * Devuelve los geoFk incluidos en la ruta y que sean hijos de parentFk + * @param vSelf Id de la zona + * @param vParentFk Id del geo a calcular + * @param vSearch cadena a buscar + * + * @return tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + * + */ + DECLARE vIsNumber BOOL; + DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; + + DROP TEMPORARY TABLE IF EXISTS tNodes; + CREATE TEMPORARY TABLE tNodes + (UNIQUE (id)) + ENGINE = MEMORY + SELECT id + FROM zoneGeo + LIMIT 0; + + IF vIsSearch THEN + SET vIsNumber = vSearch REGEXP '^[0-9]+$'; + + INSERT INTO tNodes + SELECT id + FROM zoneGeo + WHERE (vIsNumber AND `name` = vSearch) + OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) + LIMIT 1000; + + ELSEIF vParentFk IS NULL THEN + INSERT INTO tNodes + SELECT geoFk + FROM zoneIncluded + WHERE zoneFk = vSelf; + END IF; + + IF vParentFk IS NULL THEN + DROP TEMPORARY TABLE IF EXISTS tChilds; + CREATE TEMPORARY TABLE tChilds + (INDEX(id)) + ENGINE = MEMORY + SELECT id + FROM tNodes; + + DROP TEMPORARY TABLE IF EXISTS tParents; + CREATE TEMPORARY TABLE tParents + (INDEX(id)) + ENGINE = MEMORY + SELECT id + FROM zoneGeo + LIMIT 0; + + myLoop: LOOP + DELETE FROM tParents; + INSERT INTO tParents + SELECT parentFk id + FROM zoneGeo g + JOIN tChilds c ON c.id = g.id + WHERE g.parentFk IS NOT NULL; + + INSERT IGNORE INTO tNodes + SELECT id + FROM tParents; + + IF ROW_COUNT() = 0 THEN + LEAVE myLoop; + END IF; + + DELETE FROM tChilds; + INSERT INTO tChilds + SELECT id + FROM tParents; + END LOOP; + + DROP TEMPORARY TABLE tChilds, tParents; + END IF; + + IF !vIsSearch THEN + INSERT IGNORE INTO tNodes + SELECT id + FROM zoneGeo + WHERE parentFk <=> vParentFk; + END IF; + + INSERT IGNORE INTO tmp.zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + SELECT g.id, + g.`name`, + g.parentFk, + g.sons, + NOT g.sons OR type = 'country', + vSelf + FROM zoneGeo g + JOIN tNodes n ON n.id = g.id + LEFT JOIN zoneIncluded i ON i.geoFk = g.id AND i.zoneFk = vSelf + WHERE i.isIncluded = TRUE + OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL); + + DROP TEMPORARY TABLE tNodes; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -93433,94 +93433,94 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves___`( - vSelf INT, - vParentFk INT, - vSearch VARCHAR(255) +CREATE DEFINER=`root`@`localhost` PROCEDURE `zone_getLeaves___`( + vSelf INT, + vParentFk INT, + vSearch VARCHAR(255) ) -BEGIN - DECLARE vIsNumber BOOL; - DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; - - DROP TEMPORARY TABLE IF EXISTS tNodes; - CREATE TEMPORARY TABLE tNodes - (UNIQUE (id)) - ENGINE = MEMORY - SELECT id FROM zoneGeo LIMIT 0; - - IF vIsSearch THEN - SET vIsNumber = vSearch REGEXP '^[0-9]+$'; - - INSERT INTO tNodes - SELECT id FROM zoneGeo - WHERE (vIsNumber AND `name` = vSearch) - OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) - LIMIT 1000; - ELSEIF vParentFk IS NULL THEN - INSERT INTO tNodes - SELECT geoFk FROM zoneIncluded - WHERE zoneFk = vSelf; - END IF; - - IF vParentFk IS NULL THEN - DROP TEMPORARY TABLE IF EXISTS tChilds; - CREATE TEMPORARY TABLE tChilds - ENGINE = MEMORY - SELECT id FROM tNodes; - - DROP TEMPORARY TABLE IF EXISTS tParents; - CREATE TEMPORARY TABLE tParents - ENGINE = MEMORY - SELECT id FROM zoneGeo LIMIT 0; - - myLoop: LOOP - DELETE FROM tParents; - INSERT INTO tParents - SELECT parentFk id - FROM zoneGeo g - JOIN tChilds c ON c.id = g.id - WHERE g.parentFk IS NOT NULL; - - INSERT IGNORE INTO tNodes - SELECT id FROM tParents; - - IF ROW_COUNT() = 0 THEN - LEAVE myLoop; - END IF; - - DELETE FROM tChilds; - INSERT INTO tChilds - SELECT id FROM tParents; - END LOOP; - - DROP TEMPORARY TABLE - tChilds, - tParents; - END IF; - - IF !vIsSearch THEN - INSERT IGNORE INTO tNodes - SELECT id FROM zoneGeo - WHERE parentFk <=> vParentFk; - END IF; - - - INSERT IGNORE INTO zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) - SELECT g.id, - g.`name`, - g.parentFk, - g.sons, - NOT g.sons OR type = 'country', - vSelf - FROM zoneGeo g - JOIN tNodes n ON n.id = g.id - LEFT JOIN zoneIncluded i - ON i.geoFk = g.id AND i.zoneFk = vSelf - WHERE (i.isIncluded = TRUE - OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL)) - ; - - DROP TEMPORARY TABLE tNodes; +BEGIN + DECLARE vIsNumber BOOL; + DECLARE vIsSearch BOOL DEFAULT vSearch IS NOT NULL AND vSearch != ''; + + DROP TEMPORARY TABLE IF EXISTS tNodes; + CREATE TEMPORARY TABLE tNodes + (UNIQUE (id)) + ENGINE = MEMORY + SELECT id FROM zoneGeo LIMIT 0; + + IF vIsSearch THEN + SET vIsNumber = vSearch REGEXP '^[0-9]+$'; + + INSERT INTO tNodes + SELECT id FROM zoneGeo + WHERE (vIsNumber AND `name` = vSearch) + OR (!vIsNumber AND `name` LIKE CONCAT('%', vSearch, '%')) + LIMIT 1000; + ELSEIF vParentFk IS NULL THEN + INSERT INTO tNodes + SELECT geoFk FROM zoneIncluded + WHERE zoneFk = vSelf; + END IF; + + IF vParentFk IS NULL THEN + DROP TEMPORARY TABLE IF EXISTS tChilds; + CREATE TEMPORARY TABLE tChilds + ENGINE = MEMORY + SELECT id FROM tNodes; + + DROP TEMPORARY TABLE IF EXISTS tParents; + CREATE TEMPORARY TABLE tParents + ENGINE = MEMORY + SELECT id FROM zoneGeo LIMIT 0; + + myLoop: LOOP + DELETE FROM tParents; + INSERT INTO tParents + SELECT parentFk id + FROM zoneGeo g + JOIN tChilds c ON c.id = g.id + WHERE g.parentFk IS NOT NULL; + + INSERT IGNORE INTO tNodes + SELECT id FROM tParents; + + IF ROW_COUNT() = 0 THEN + LEAVE myLoop; + END IF; + + DELETE FROM tChilds; + INSERT INTO tChilds + SELECT id FROM tParents; + END LOOP; + + DROP TEMPORARY TABLE + tChilds, + tParents; + END IF; + + IF !vIsSearch THEN + INSERT IGNORE INTO tNodes + SELECT id FROM zoneGeo + WHERE parentFk <=> vParentFk; + END IF; + + + INSERT IGNORE INTO zoneNodes(geoFk, name, parentFk, sons, isChecked, zoneFk) + SELECT g.id, + g.`name`, + g.parentFk, + g.sons, + NOT g.sons OR type = 'country', + vSelf + FROM zoneGeo g + JOIN tNodes n ON n.id = g.id + LEFT JOIN zoneIncluded i + ON i.geoFk = g.id AND i.zoneFk = vSelf + WHERE (i.isIncluded = TRUE + OR (i.isIncluded IS NULL AND vParentFk IS NOT NULL)) + ; + + DROP TEMPORARY TABLE tNodes; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -94050,19 +94050,19 @@ DELIMITER ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; /*!50003 SET sql_mode = 'IGNORE_SPACE,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; -/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_afterInsert` - AFTER INSERT ON `inter` - FOR EACH ROW -BEGIN - - DECLARE vNumTicketsPrepared INT; - - REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) - SELECT NEW.Id_Ticket, NEW.inter_id, `name` - FROM vn.state - WHERE id = NEW.state_id; - - +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `vncontrol`.`ticketTracking_afterInsert` + AFTER INSERT ON `inter` + FOR EACH ROW +BEGIN + + DECLARE vNumTicketsPrepared INT; + + REPLACE vn.ticketLastState(ticketFk, ticketTrackingFk, name) + SELECT NEW.Id_Ticket, NEW.inter_id, `name` + FROM vn.state + WHERE id = NEW.state_id; + + END */;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; From 3fa86f0f15e48990f3069bc3c511bee93820de1a Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 6 May 2022 09:08:34 +0200 Subject: [PATCH 073/141] fix: backTest --- back/methods/docuware/specs/checkFile.spec.js | 4 ++-- back/methods/docuware/specs/download.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/back/methods/docuware/specs/checkFile.spec.js b/back/methods/docuware/specs/checkFile.spec.js index 2ebde0df4..0d0e4d71a 100644 --- a/back/methods/docuware/specs/checkFile.spec.js +++ b/back/methods/docuware/specs/checkFile.spec.js @@ -12,9 +12,9 @@ describe('docuware download()', () => { } }; - const fileCabinetName = 'deliveryClientTest'; + const fileCabinetName = 'deliveryClient'; const dialogDisplayName = 'find'; - const dialogName = 'findTest'; + const dialogName = 'findTicket'; const gotGetResponse = { body: JSON.stringify( diff --git a/back/methods/docuware/specs/download.spec.js b/back/methods/docuware/specs/download.spec.js index 436063fd8..dc80c67d8 100644 --- a/back/methods/docuware/specs/download.spec.js +++ b/back/methods/docuware/specs/download.spec.js @@ -14,9 +14,9 @@ describe('docuware download()', () => { }; it('should return the downloaded file name', async() => { - const fileCabinetName = 'deliveryClientTest'; + const fileCabinetName = 'deliveryClient'; const dialogDisplayName = 'find'; - const dialogName = 'findTest'; + const dialogName = 'findTicket'; const gotGetResponse = { body: JSON.stringify( { From bd7eb67aebfaf39fb64f0c5a90ab397686e3d7d9 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 9 May 2022 12:31:38 +0200 Subject: [PATCH 074/141] fix: add CAST DECIMAL(10,2) --- modules/invoiceIn/back/methods/invoice-in/getTotals.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/invoiceIn/back/methods/invoice-in/getTotals.js b/modules/invoiceIn/back/methods/invoice-in/getTotals.js index 918467010..f35c10617 100644 --- a/modules/invoiceIn/back/methods/invoice-in/getTotals.js +++ b/modules/invoiceIn/back/methods/invoice-in/getTotals.js @@ -30,7 +30,7 @@ module.exports = Self => { SUM(iidd.amount) totalDueDay FROM vn.invoiceIn ii LEFT JOIN (SELECT SUM(iit.taxableBase) totalTaxableBase, - SUM(iit.taxableBase * (1 + (ti.PorcentajeIva / 100))) totalVat + CAST(SUM(iit.taxableBase * (1 + (ti.PorcentajeIva / 100))) AS DECIMAL(10,2)) totalVat FROM vn.invoiceInTax iit LEFT JOIN sage.TiposIva ti ON ti.CodigoIva = iit.taxTypeSageFk WHERE iit.invoiceInFk = ?) iit ON TRUE From f806a598ea989ab9080da49f53728dcb0b2c19ab Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 9 May 2022 13:15:48 +0200 Subject: [PATCH 075/141] Updated method path --- modules/client/front/notification/index.js | 2 +- modules/client/front/notification/index.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/client/front/notification/index.js b/modules/client/front/notification/index.js index 12a1a4acb..0506ea4ba 100644 --- a/modules/client/front/notification/index.js +++ b/modules/client/front/notification/index.js @@ -81,7 +81,7 @@ export default class Controller extends Section { clientIds: clientIds }, this.campaign); - this.$http.post('notify/consumption', params) + this.$http.post('schedule/consumption', params) .then(() => this.$.filters.hide()) .then(() => this.vnApp.showSuccess(this.$t('Notifications sent!'))); } diff --git a/modules/client/front/notification/index.spec.js b/modules/client/front/notification/index.spec.js index 13c6bc513..8847357f7 100644 --- a/modules/client/front/notification/index.spec.js +++ b/modules/client/front/notification/index.spec.js @@ -74,7 +74,7 @@ describe('Client notification', () => { clientIds: [1101, 1102] }, controller.campaign); - $httpBackend.expect('POST', `notify/consumption`, params).respond(200, params); + $httpBackend.expect('POST', `schedule/consumption`, params).respond(200, params); controller.onSendClientConsumption(); $httpBackend.flush(); From 55574919d216584a3fdda873a629a937b178c83b Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 9 May 2022 13:19:34 +0200 Subject: [PATCH 076/141] rename --- .../{10460-MothersDay => 10460-mothersDay}/00-clientConfig.sql | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{10460-MothersDay => 10460-mothersDay}/00-clientConfig.sql (100%) diff --git a/db/changes/10460-MothersDay/00-clientConfig.sql b/db/changes/10460-mothersDay/00-clientConfig.sql similarity index 100% rename from db/changes/10460-MothersDay/00-clientConfig.sql rename to db/changes/10460-mothersDay/00-clientConfig.sql From a6b867430253eeff957d5a4dd55c6404291ccf05 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 9 May 2022 14:34:20 +0200 Subject: [PATCH 077/141] feat(invoiceIn.tax): add button for create an expence --- db/changes/10451-april/00-aclExpense.sql | 5 +++ modules/invoiceIn/front/tax/index.html | 45 ++++++++++++++++++++++- modules/invoiceIn/front/tax/index.js | 21 +++++++++++ modules/invoiceIn/front/tax/index.spec.js | 30 ++++++++++++++- modules/invoiceIn/front/tax/locale/es.yml | 6 +++ modules/item/back/models/expense.json | 13 +------ 6 files changed, 106 insertions(+), 14 deletions(-) create mode 100644 db/changes/10451-april/00-aclExpense.sql create mode 100644 modules/invoiceIn/front/tax/locale/es.yml diff --git a/db/changes/10451-april/00-aclExpense.sql b/db/changes/10451-april/00-aclExpense.sql new file mode 100644 index 000000000..55ca8c389 --- /dev/null +++ b/db/changes/10451-april/00-aclExpense.sql @@ -0,0 +1,5 @@ +INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES('Expense', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) + VALUES('Expense', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative'); diff --git a/modules/invoiceIn/front/tax/index.html b/modules/invoiceIn/front/tax/index.html index c495d44d2..7a3a9b333 100644 --- a/modules/invoiceIn/front/tax/index.html +++ b/modules/invoiceIn/front/tax/index.html @@ -33,6 +33,13 @@ show-field="id" rule> {{id}}: {{name}} + + + + - \ No newline at end of file + + + + + +
+
{{$ctrl.$t('New expence')}}
+ + + + + + + + + + +
+
+ + + + +
\ No newline at end of file diff --git a/modules/invoiceIn/front/tax/index.js b/modules/invoiceIn/front/tax/index.js index 53cfc5598..48fb98d4e 100644 --- a/modules/invoiceIn/front/tax/index.js +++ b/modules/invoiceIn/front/tax/index.js @@ -1,5 +1,6 @@ import ngModule from '../module'; import Section from 'salix/components/section'; +import UserError from 'core/lib/user-error'; class Controller extends Section { taxRate(invoiceInTax, taxRateSelection) { @@ -26,6 +27,26 @@ class Controller extends Section { this.card.reload(); }); } + + onResponse() { + if (!this.expence) + throw new UserError(`The fields can't be empty`); + else if (!this.expence.code) + throw new UserError(`The code can't be empty`); + else if (!this.expence.description) + throw new UserError(`The description can't be empty`); + + const params = []; + params.push({ + id: this.expence.code, + isWithheld: this.expence.isWithheld, + name: this.expence.description + }); + + this.$http.post(`Expenses`, params) .then(() => { + this.vnApp.showSuccess(this.$t('Expence saved!')); + }); + } } ngModule.vnComponent('vnInvoiceInTax', { diff --git a/modules/invoiceIn/front/tax/index.spec.js b/modules/invoiceIn/front/tax/index.spec.js index 20d5d40d8..bc7963899 100644 --- a/modules/invoiceIn/front/tax/index.spec.js +++ b/modules/invoiceIn/front/tax/index.spec.js @@ -7,10 +7,12 @@ describe('InvoiceIn', () => { let controller; let $scope; let vnApp; + let $httpBackend; beforeEach(ngModule('invoiceIn')); - beforeEach(inject(($componentController, $rootScope, _vnApp_) => { + beforeEach(inject(($componentController, $rootScope, _vnApp_, _$httpBackend_) => { + $httpBackend = _$httpBackend_; vnApp = _vnApp_; jest.spyOn(vnApp, 'showError'); $scope = $rootScope.$new(); @@ -19,6 +21,7 @@ describe('InvoiceIn', () => { const $element = angular.element(''); controller = $componentController('vnInvoiceInTax', {$element, $scope}); + controller.$.model = crudModel; controller.invoiceIn = {id: 1}; })); @@ -55,5 +58,30 @@ describe('InvoiceIn', () => { expect(controller.card.reload).toHaveBeenCalledWith(); }); }); + + describe('onResponse()', () => { + it('should return success message', () => { + controller.expence = { + code: 7050000005, + isWithheld: 0, + description: 'Test' + }; + + const params = [{ + id: controller.expence.code, + isWithheld: controller.expence.isWithheld, + name: controller.expence.description + }]; + + jest.spyOn(controller.vnApp, 'showSuccess'); + $httpBackend.expect('POST', `Expenses`, params).respond(); + + controller.onResponse(); + $httpBackend.flush(); + + expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Expence saved!'); + }); + }); }); }); + diff --git a/modules/invoiceIn/front/tax/locale/es.yml b/modules/invoiceIn/front/tax/locale/es.yml new file mode 100644 index 000000000..220802d9a --- /dev/null +++ b/modules/invoiceIn/front/tax/locale/es.yml @@ -0,0 +1,6 @@ +Create expence: Crear gasto +New expence: Nuevo gasto +It's a withholding: Es una retención +The fields can't be empty: Los campos no pueden estar vacíos +The code can't be empty: El código no puede estar vacío +The description can't be empty: La descripción no puede estar vacía \ No newline at end of file diff --git a/modules/item/back/models/expense.json b/modules/item/back/models/expense.json index 65af02013..5120f07bc 100644 --- a/modules/item/back/models/expense.json +++ b/modules/item/back/models/expense.json @@ -17,9 +17,6 @@ }, "isWithheld": { "type": "number" - }, - "taxTypeFk": { - "type": "number" } }, "relations": { @@ -28,13 +25,5 @@ "model": "TaxType", "foreignKey": "taxTypeFk" } - }, - "acls": [ - { - "accessType": "READ", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - } - ] + } } \ No newline at end of file From d9055abca90f2644368048991f285657fc0672ee Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 9 May 2022 14:44:30 +0200 Subject: [PATCH 078/141] fix(entry_summary): get entry.id --- modules/entry/front/summary/index.html | 2 +- modules/entry/front/summary/index.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/entry/front/summary/index.html b/modules/entry/front/summary/index.html index f443a94fe..a95b2f18a 100644 --- a/modules/entry/front/summary/index.html +++ b/modules/entry/front/summary/index.html @@ -1,6 +1,6 @@ diff --git a/modules/entry/front/summary/index.js b/modules/entry/front/summary/index.js index c949dba64..6e18bc959 100644 --- a/modules/entry/front/summary/index.js +++ b/modules/entry/front/summary/index.js @@ -4,6 +4,9 @@ import Summary from 'salix/components/summary'; class Controller extends Summary { get entry() { + if (!this._entry) + return this.$params; + return this._entry; } From f08a384a7cd304211272b55a3452011ac9305fb9 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 9 May 2022 14:49:37 +0200 Subject: [PATCH 079/141] fix: e2e test --- e2e/helpers/selectors.js | 2 +- modules/invoiceIn/front/tax/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 799eb8fe7..189b7be67 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -982,7 +982,7 @@ export default { save: 'vn-invoice-in-basic-data button[type=submit]' }, invoiceInTax: { - addTaxButton: 'vn-invoice-in-tax vn-icon-button[icon="add_circle"]', + addTaxButton: 'vn-invoice-in-tax vn-icon-button[vn-tooltip="Add tax"]', thirdExpence: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.expenseFk"]', thirdTaxableBase: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-input-number[ng-model="invoiceInTax.taxableBase"]', thirdTaxType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.taxTypeSageFk"]', diff --git a/modules/invoiceIn/front/tax/index.html b/modules/invoiceIn/front/tax/index.html index 7a3a9b333..44ceef807 100644 --- a/modules/invoiceIn/front/tax/index.html +++ b/modules/invoiceIn/front/tax/index.html @@ -105,7 +105,7 @@ - + From 5bad0592a542f2c852d52324ec5bdbbcb166bc17 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 10 May 2022 08:48:51 +0200 Subject: [PATCH 080/141] change errors --- e2e/paths/02-client/12_lock_of_verified_data.spec.js | 6 +++--- loopback/locale/en.json | 4 ++-- loopback/locale/es.json | 2 +- .../back/methods/client/specs/updateFiscalData.spec.js | 2 +- modules/client/back/methods/client/updateFiscalData.js | 2 +- modules/client/back/models/client.js | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/e2e/paths/02-client/12_lock_of_verified_data.spec.js b/e2e/paths/02-client/12_lock_of_verified_data.spec.js index b6b74b262..af42e2a4b 100644 --- a/e2e/paths/02-client/12_lock_of_verified_data.spec.js +++ b/e2e/paths/02-client/12_lock_of_verified_data.spec.js @@ -111,7 +111,7 @@ describe('Client lock verified data path', () => { await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); - expect(message.text).toContain(`You can't make changes on a client with verified data`); + expect(message.text).toContain(`Not enough privileges to edit a client with verified data`); }); }); @@ -126,7 +126,7 @@ describe('Client lock verified data path', () => { it('should confirm verified data button is disabled for salesAssistant', async() => { const isDisabled = await page.isDisabled(selectors.clientFiscalData.verifiedDataCheckbox); - expect(isDisabled).toBeTruthy(); + expect(isDisabled).toBeTrue(); }); it('should return error when edit the social name', async() => { @@ -135,7 +135,7 @@ describe('Client lock verified data path', () => { await page.waitToClick(selectors.clientFiscalData.saveButton); const message = await page.waitForSnackbar(); - expect(message.text).toContain(`You can't make changes on a client with verified data`); + expect(message.text).toContain(`Not enough privileges to edit a client with verified data`); }); it('should now confirm the social name have been edited once and for all', async() => { diff --git a/loopback/locale/en.json b/loopback/locale/en.json index b7242befb..b7e9b43d3 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -12,7 +12,6 @@ "That payment method requires an IBAN": "That payment method requires an IBAN", "That payment method requires a BIC": "That payment method requires a BIC", "The default consignee can not be unchecked": "The default consignee can not be unchecked", - "You can't make changes on a client with verified data": "You can't make changes on a client with verified data", "Enter an integer different to zero": "Enter an integer different to zero", "Package cannot be blank": "Package cannot be blank", "The new quantity should be smaller than the old one": "The new quantity should be smaller than the old one", @@ -123,5 +122,6 @@ "The type of business must be filled in basic data": "The type of business must be filled in basic data", "The worker has hours recorded that day": "The worker has hours recorded that day", "isWithoutNegatives": "isWithoutNegatives", - "routeFk": "routeFk" + "routeFk": "routeFk", + "Not enough privileges to edit a client with verified data": "Not enough privileges to edit a client with verified data" } \ No newline at end of file diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 77bd21780..a44ba2da8 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -50,7 +50,7 @@ "You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo", "Warehouse cannot be blank": "El almacén no puede quedar en blanco", "Agency cannot be blank": "La agencia no puede quedar en blanco", - "You can't make changes on a client with verified data": "No puedes hacer cambios en un cliente con datos comprobados", + "Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados", "This address doesn't exist": "Este consignatario no existe", "You must delete the claim id %d first": "Antes debes borrar la reclamación %d", "You don't have enough privileges": "No tienes suficientes permisos", diff --git a/modules/client/back/methods/client/specs/updateFiscalData.spec.js b/modules/client/back/methods/client/specs/updateFiscalData.spec.js index f608f6bd9..a08f97faf 100644 --- a/modules/client/back/methods/client/specs/updateFiscalData.spec.js +++ b/modules/client/back/methods/client/specs/updateFiscalData.spec.js @@ -39,7 +39,7 @@ describe('Client updateFiscalData', () => { error = e; } - expect(error.message).toEqual(`You can't make changes on a client with verified data`); + expect(error.message).toEqual(`Not enough privileges to edit a client with verified data`); }); it('should return an error if the salesAssistant did not fill the sage data before checking verified data', async() => { diff --git a/modules/client/back/methods/client/updateFiscalData.js b/modules/client/back/methods/client/updateFiscalData.js index 3a3479405..c2de8f927 100644 --- a/modules/client/back/methods/client/updateFiscalData.js +++ b/modules/client/back/methods/client/updateFiscalData.js @@ -129,7 +129,7 @@ module.exports = Self => { const client = await models.Client.findById(clientId, null, myOptions); if (!isAdministrative && client.isTaxDataChecked) - throw new UserError(`You can't make changes on a client with verified data`); + throw new UserError(`Not enough privileges to edit a client with verified data`); // Sage data validation const taxDataChecked = args.isTaxDataChecked; diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 2032f5d9c..5ed777ab5 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -245,10 +245,10 @@ module.exports = Self => { const sageTransactionType = hasChanges && (changes.sageTransactionTypeFk || orgData.sageTransactionTypeFk); const sageTransactionTypeChanged = hasChanges && orgData.sageTransactionTypeFk != sageTransactionType; - if (isTaxDataCheckedChanged && !isAdministrative) - throw new UserError(`You don't have enough privileges`); + const cantEditVerifiedData = isTaxDataCheckedChanged && !isAdministrative; + const cantChangeSageData = (sageTaxTypeChanged || sageTransactionTypeChanged) && !isSalesAssistant; - if ((sageTaxTypeChanged || sageTransactionTypeChanged) && !isSalesAssistant) + if (cantEditVerifiedData || cantChangeSageData) throw new UserError(`You don't have enough privileges`); }); From d9c8ed96e4b3a204eb7be4fc255b47c994663093 Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 10 May 2022 09:46:56 +0200 Subject: [PATCH 081/141] Added SQL version --- db/changes/10460-motherDay/delete.keep | 1 + 1 file changed, 1 insertion(+) create mode 100644 db/changes/10460-motherDay/delete.keep diff --git a/db/changes/10460-motherDay/delete.keep b/db/changes/10460-motherDay/delete.keep new file mode 100644 index 000000000..0e7498f40 --- /dev/null +++ b/db/changes/10460-motherDay/delete.keep @@ -0,0 +1 @@ +Delete file \ No newline at end of file From 946f1c1cb5f8addf4ac30138d95af60a7f613601 Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 10 May 2022 12:02:50 +0200 Subject: [PATCH 082/141] refactor test --- .../multi-check/multi-check.spec.js | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/front/core/components/multi-check/multi-check.spec.js b/front/core/components/multi-check/multi-check.spec.js index ee8a95c88..1c0adb9d8 100644 --- a/front/core/components/multi-check/multi-check.spec.js +++ b/front/core/components/multi-check/multi-check.spec.js @@ -5,11 +5,13 @@ describe('Component vnMultiCheck', () => { let controller; let $element; let $httpBackend; + let $httpParamSerializer; beforeEach(ngModule('vnCore')); - beforeEach(inject(($componentController, _$httpBackend_) => { + beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => { $httpBackend = _$httpBackend_; + $httpParamSerializer = _$httpParamSerializer_; $element = angular.element(`
`); controller = $componentController('vnMultiCheck', {$element: $element}); controller._model = crudModel; @@ -145,39 +147,44 @@ describe('Component vnMultiCheck', () => { describe('countRows()', () => { it(`should count visible rows and all rows of model`, () => { - const data = controller.model.data; controller.model.url = 'modelUrl/filter'; - const response = { - data: [ - {id: 1, name: 'My item 1'}, - {id: 2, name: 'My item 2'}, - {id: 3, name: 'My item 3'}, - {id: 4, name: 'My item 4'}, - {id: 5, name: 'My item 5'}, - {id: 6, name: 'My item 6'} - ] + const data = controller.model.data; + const filter = { + limit: null }; + const serializedParams = $httpParamSerializer({filter}); + + const response = [ + {id: 1, name: 'My item 1'}, + {id: 2, name: 'My item 2'}, + {id: 3, name: 'My item 3'}, + {id: 4, name: 'My item 4'}, + {id: 5, name: 'My item 5'}, + {id: 6, name: 'My item 6'} + ]; controller.countRows(); - - $httpBackend.expectGET('modelUrl/filter').respond(response); + $httpBackend.expectGET(`modelUrl/filter?${serializedParams}`).respond(response); + $httpBackend.flush(); expect(controller.rows).toEqual(data.length); - expect(controller.AllRowsCount).toEqual(response.length); + expect(controller.allRowsCount).toEqual(response.length); + expect(controller.allRowsCount).toBeGreaterThan(controller.rows); }); }); describe('checkDummy()', () => { - it(`should set checkedDummyCount allRowsCount`, () => { + const allRows = 1234; + it(`should set the checked dummy count to all rows count if there was no count yet`, () => { controller.checkedDummyCount = null; - controller.allRowsCount = 123; + controller.allRowsCount = allRows; controller.checkDummy(); expect(controller.checkedDummyCount).toEqual(controller.allRowsCount); }); - it(`should set checkedDummyCount to null`, () => { - controller.checkedDummyCount = 123; + it(`should remove the dummy count if there was an existing one`, () => { + controller.checkedDummyCount = allRows; controller.checkDummy(); expect(controller.checkedDummyCount).toBeNull(); From e0c0663e4195c4fd9f503e8a0d37df616ca48a2d Mon Sep 17 00:00:00 2001 From: joan Date: Tue, 10 May 2022 14:21:41 +0200 Subject: [PATCH 083/141] Renamed folder --- db/changes/{10460-motherDay => 10460-mothersDay}/delete.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename db/changes/{10460-motherDay => 10460-mothersDay}/delete.keep (100%) diff --git a/db/changes/10460-motherDay/delete.keep b/db/changes/10460-mothersDay/delete.keep similarity index 100% rename from db/changes/10460-motherDay/delete.keep rename to db/changes/10460-mothersDay/delete.keep From 833addcb752fbf4c06302d1f38c78395db746a97 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Wed, 11 May 2022 19:38:10 +0200 Subject: [PATCH 084/141] gulp-jasmine replaced by jasmine --- back/nodemonConfig.json | 24 + back/tests.js | 72 +- e2e/helpers/selectors.js | 2 +- e2e/paths/09-invoice-in/04_tax.spec.js | 6 +- gulpfile.js | 79 - .../client/back/models/specs/address.spec.js | 2 +- .../entry/specs/importBuysPreview.spec.js | 1 + .../methods/route/specs/guessPriority.spec.js | 19 +- package-lock.json | 42896 ++++++++++++++++ package.json | 6 +- 10 files changed, 42989 insertions(+), 118 deletions(-) create mode 100644 back/nodemonConfig.json create mode 100644 package-lock.json diff --git a/back/nodemonConfig.json b/back/nodemonConfig.json new file mode 100644 index 000000000..a1c9ca84f --- /dev/null +++ b/back/nodemonConfig.json @@ -0,0 +1,24 @@ +{ + "verbose": true, + "watch": [ + "back/**/*.js", + "modules/**/*.js" + ], + "ignore": [ + "modules/account/front/**/*", + "modules/claim/front/**/*", + "modules/client/front/**/*", + "modules/entry/front/**/*", + "modules/invoiceIn/front/**/*", + "modules/invoiceOut/front/**/*", + "modules/item/front/**/*", + "modules/monitor/front/**/*", + "modules/order/front/**/*", + "modules/route/front/**/*", + "modules/supplier/front/**/*", + "modules/ticket/front/**/*", + "modules/travel/front/**/*", + "modules/worker/front/**/*", + "modules/zone/front/**/*" + ] +} \ No newline at end of file diff --git a/back/tests.js b/back/tests.js index c715c96bf..f1ca40f5a 100644 --- a/back/tests.js +++ b/back/tests.js @@ -1,4 +1,5 @@ -require('require-yaml'); +const Docker = require('../db/docker.js'); +let dataSources = require('../loopback/server/datasources.json'); process.on('warning', warning => { console.log(warning.name); @@ -6,34 +7,53 @@ process.on('warning', warning => { console.log(warning.stack); }); -let verbose = false; +async function test() { + let verbose = false; -if (process.argv[2] === '--v') - verbose = true; + if (process.argv[2] === '--v') + verbose = true; -let Jasmine = require('jasmine'); -let jasmine = new Jasmine(); -let SpecReporter = require('jasmine-spec-reporter').SpecReporter; + const container = new Docker(); -let serviceSpecs = [ - `${__dirname}/**/*[sS]pec.js`, - `${__dirname}/../loopback/**/*[sS]pec.js`, - `${__dirname}/../modules/*/back/**/*.[sS]pec.js` -]; + await container.run(process.argv.ci); + dataSources = JSON.parse(JSON.stringify(dataSources)); -jasmine.loadConfig({ - spec_dir: '.', - spec_files: serviceSpecs, - helpers: [] -}); + Object.assign(dataSources.vn, { + host: container.dbConf.host, + port: container.dbConf.port + }); -jasmine.addReporter(new SpecReporter({ - spec: { - // displayStacktrace: 'summary', - displaySuccessful: verbose, - displayFailedSpec: true, - displaySpecDuration: true - } -})); + const bootOptions = {dataSources}; + const app = require('vn-loopback/server/server'); + app.boot(bootOptions); -jasmine.execute(); + const Jasmine = require('jasmine'); + const jasmine = new Jasmine(); + const SpecReporter = require('jasmine-spec-reporter').SpecReporter; + + const backSpecs = [ + './back/**/*[sS]pec.js', + './loopback/**/*[sS]pec.js', + './modules/*/back/**/*.[sS]pec.js' + ]; + + jasmine.loadConfig({ + spec_dir: '.', + spec_files: backSpecs, + helpers: [], + }); + + jasmine.addReporter(new SpecReporter({ + spec: { + displaySuccessful: verbose, + } + })); + + jasmine.exitOnCompletion = false, + await jasmine.execute(); + if (app) await app.disconnect(); + if (container) await container.rm(); + console.log('app disconnected & container removed'); +} + +test(); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 2ecb73960..8ac10005a 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -983,7 +983,7 @@ export default { }, invoiceInTax: { addTaxButton: 'vn-invoice-in-tax vn-icon-button[icon="add_circle"]', - thirdExpence: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.expenseFk"]', + thirdExpense: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.expenseFk"]', thirdTaxableBase: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-input-number[ng-model="invoiceInTax.taxableBase"]', thirdTaxType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.taxTypeSageFk"]', thirdTransactionType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.transactionTypeSageFk"]', diff --git a/e2e/paths/09-invoice-in/04_tax.spec.js b/e2e/paths/09-invoice-in/04_tax.spec.js index 364a25d7e..b1dbe2008 100644 --- a/e2e/paths/09-invoice-in/04_tax.spec.js +++ b/e2e/paths/09-invoice-in/04_tax.spec.js @@ -19,7 +19,7 @@ describe('InvoiceIn tax path', () => { it('should add a new tax', async() => { await page.waitToClick(selectors.invoiceInTax.addTaxButton); - await page.autocompleteSearch(selectors.invoiceInTax.thirdExpence, '6210000567'); + await page.autocompleteSearch(selectors.invoiceInTax.thirdExpense, '6210000567'); await page.write(selectors.invoiceInTax.thirdTaxableBase, '100'); await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, '6'); await page.autocompleteSearch(selectors.invoiceInTax.thirdTransactionType, 'Operaciones exentas'); @@ -37,9 +37,9 @@ describe('InvoiceIn tax path', () => { expect(result).toEqual('Taxable base €1,323.16'); }); - it('should navigate back to the tax section and check the reciently added line contains the expected expense', async() => { + it('should navigate back to tax section, check the reciently added line contains the expected expense', async() => { await page.accessToSection('invoiceIn.card.tax'); - const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpence, 'value'); + const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpense, 'value'); expect(result).toEqual('6210000567: Alquiler VNH'); }); diff --git a/gulpfile.js b/gulpfile.js index 102a8a0bf..cc946091f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -68,83 +68,6 @@ back.description = `Starts backend and database service`; const defaultTask = gulp.parallel(front, back); defaultTask.description = `Starts all application services`; -// Backend tests - Private method - -async function launchBackTest(done) { - let err; - let dataSources = require('./loopback/server/datasources.json'); - - const container = new Docker(); - await container.run(argv.ci); - - dataSources = JSON.parse(JSON.stringify(dataSources)); - - Object.assign(dataSources.vn, { - host: container.dbConf.host, - port: container.dbConf.port - }); - - let bootOptions = {dataSources}; - - let app = require(`./loopback/server/server`); - - try { - app.boot(bootOptions); - - await new Promise((resolve, reject) => { - const jasmine = require('gulp-jasmine'); - - const options = { - verbose: false, - includeStackTrace: false, - errorOnFail: false, - timeout: 5000, - config: {} - }; - - if (argv.ci) { - const reporters = require('jasmine-reporters'); - options.reporter = new reporters.JUnitXmlReporter(); - } - - let backSpecFiles = [ - 'back/**/*.spec.js', - 'loopback/**/*.spec.js', - 'modules/*/back/**/*.spec.js' - ]; - - gulp.src(backSpecFiles) - .pipe(jasmine(options)) - .on('end', resolve) - .on('error', reject) - .resume(); - }); - } catch (e) { - err = e; - } - await app.disconnect(); - await container.rm(); - done(); - if (err) - throw err; -} -launchBackTest.description = ` - Runs the backend tests once using a random container, can receive --ci arg to save reports on a xml file`; - -// Backend tests - -function backTest(done) { - const nodemon = require('gulp-nodemon'); - - nodemon({ - exec: ['node --tls-min-v1.0 ./node_modules/gulp/bin/gulp.js'], - args: ['launchBackTest'], - watch: backSources, - done: done - }); -} -backTest.description = `Watches for changes in modules to execute backTest task`; - // End to end tests function e2eSingleRun() { require('@babel/register')({presets: ['@babel/env']}); @@ -431,8 +354,6 @@ module.exports = { back, backOnly, backWatch, - backTest, - launchBackTest, e2e, i, install, diff --git a/modules/client/back/models/specs/address.spec.js b/modules/client/back/models/specs/address.spec.js index 81af6ee28..f0b421d35 100644 --- a/modules/client/back/models/specs/address.spec.js +++ b/modules/client/back/models/specs/address.spec.js @@ -14,7 +14,7 @@ describe('loopback model address', () => { } }; - beforeEach(() => { + beforeAll(() => { spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ active: activeCtx }); diff --git a/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js b/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js index edfdac988..41971a64c 100644 --- a/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js +++ b/modules/entry/back/methods/entry/specs/importBuysPreview.spec.js @@ -1,5 +1,6 @@ const models = require('vn-loopback/server/server').models; const LoopBackContext = require('loopback-context'); +const activeCtx = {accessToken: {userId: 9}}; describe('entry importBuysPreview()', () => { const entryId = 1; diff --git a/modules/route/back/methods/route/specs/guessPriority.spec.js b/modules/route/back/methods/route/specs/guessPriority.spec.js index 892324acf..902647ba1 100644 --- a/modules/route/back/methods/route/specs/guessPriority.spec.js +++ b/modules/route/back/methods/route/specs/guessPriority.spec.js @@ -1,9 +1,21 @@ const app = require('vn-loopback/server/server'); +const LoopBackContext = require('loopback-context'); describe('route guessPriority()', () => { const targetRouteId = 7; let routeTicketsToRestore; + const activeCtx = { + accessToken: {userId: 9}, + __: () => {} + }; + + beforeAll(() => { + spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({ + active: activeCtx + }); + }); + afterAll(async() => { let restoreFixtures = []; routeTicketsToRestore.forEach(ticket => { @@ -12,12 +24,9 @@ describe('route guessPriority()', () => { await Promise.all(restoreFixtures); }); - it('should call guessPriority() and then check the tickets in the target route now have their priorities defined', async() => { + it('should call guessPriority() then check all tickets in that route have their priorities defined', async() => { const ctx = { - req: { - accessToken: {userId: 9}, - __: () => {} - }, + req: activeCtx }; routeTicketsToRestore = await app.models.Ticket.find({where: {routeFk: targetRouteId}}); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..21fd11f23 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,42896 @@ +{ + "name": "salix-back", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "salix-back", + "version": "1.0.0", + "license": "GPL-3.0", + "dependencies": { + "adm-zip": "^0.5.9", + "axios": "^0.25.0", + "bmp-js": "^0.1.0", + "compression": "^1.7.3", + "fs-extra": "^5.0.0", + "ftps": "^1.2.0", + "got": "^10.7.0", + "helmet": "^3.21.2", + "i18n": "^0.8.4", + "image-type": "^4.1.0", + "imap": "^0.8.19", + "ldapjs": "^2.2.0", + "loopback": "^3.26.0", + "loopback-boot": "3.3.1", + "loopback-component-explorer": "^6.5.0", + "loopback-component-storage": "3.6.1", + "loopback-connector-mysql": "^5.4.3", + "loopback-connector-remote": "^3.4.1", + "loopback-context": "^3.4.0", + "mailparser": "^2.8.0", + "md5": "^2.2.1", + "node-ssh": "^11.0.0", + "object-diff": "0.0.4", + "object.pick": "^1.3.0", + "puppeteer": "^7.1.0", + "read-chunk": "^3.2.0", + "require-yaml": "0.0.1", + "sharp": "^0.27.1", + "smbhash": "0.0.1", + "strong-error-handler": "^2.3.2", + "uuid": "^3.3.3", + "vn-loopback": "file:./loopback", + "vn-print": "file:./print", + "xml2js": "^0.4.23" + }, + "devDependencies": { + "@babel/core": "^7.7.7", + "@babel/plugin-syntax-dynamic-import": "^7.7.4", + "@babel/preset-env": "^7.11.0", + "@babel/register": "^7.7.7", + "angular-mocks": "^1.7.9", + "babel-jest": "^26.0.1", + "babel-loader": "^8.0.6", + "core-js": "^3.9.1", + "css-loader": "^2.1.0", + "del": "^2.2.2", + "eslint": "^7.11.0", + "eslint-config-google": "^0.11.0", + "eslint-plugin-jasmine": "^2.10.1", + "fancy-log": "^1.3.2", + "file-loader": "^1.1.11", + "gulp": "^4.0.2", + "gulp-concat": "^2.6.1", + "gulp-env": "^0.4.0", + "gulp-file": "^0.4.0", + "gulp-install": "^1.1.0", + "gulp-merge-json": "^1.3.1", + "gulp-nodemon": "^2.5.0", + "gulp-print": "^2.0.1", + "gulp-wrap": "^0.15.0", + "gulp-yaml": "^1.0.1", + "html-loader": "^0.4.5", + "html-loader-jest": "^0.2.1", + "html-webpack-plugin": "^4.0.0-beta.11", + "identity-obj-proxy": "^3.0.0", + "jasmine": "^4.1.0", + "jasmine-reporters": "^2.4.0", + "jasmine-spec-reporter": "^7.0.0", + "jest": "^26.0.1", + "jest-junit": "^8.0.0", + "json-loader": "^0.5.7", + "merge-stream": "^1.0.1", + "minimist": "^1.2.5", + "mysql2": "^1.7.0", + "node-sass": "^4.14.1", + "nodemon": "^2.0.16", + "plugin-error": "^1.0.1", + "raw-loader": "^1.0.0", + "regenerator-runtime": "^0.13.7", + "sass-loader": "^7.3.1", + "style-loader": "^0.23.1", + "webpack": "^4.41.5", + "webpack-cli": "^3.3.10", + "webpack-dev-server": "^3.11.0", + "webpack-merge": "^4.2.2", + "yaml-loader": "^0.5.0" + }, + "engines": { + "node": ">=14" + } + }, + "loopback": { + "name": "vn-loopback", + "version": "1.0.0", + "license": "GPL-3.0" + }, + "node_modules/@babel/code-frame": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.7", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.8", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-explode-assignable-expression": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-member-expression-to-functions": "^7.16.7", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/helper-replace-supers": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "regexpu-core": "^4.7.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0-0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-explode-assignable-expression": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-get-function-arity": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-wrap-function": "^7.16.8", + "@babel/types": "^7.16.8" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-member-expression-to-functions": "^7.16.7", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.16.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-wrap-function": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-function-name": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.8", + "@babel/types": "^7.16.8" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-proposal-optional-chaining": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" + } + }, + "node_modules/@babel/plugin-proposal-async-generator-functions": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-remap-async-to-generator": "^7.16.8", + "@babel/plugin-syntax-async-generators": "^7.8.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-class-properties": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-class-static-block": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" + } + }, + "node_modules/@babel/plugin-proposal-dynamic-import": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-export-namespace-from": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-json-strings": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-json-strings": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-numeric-separator": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-object-rest-spread": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-optional-catch-binding": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-optional-chaining": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-private-methods": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-unicode-property-regex": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-remap-async-to-generator": "^7.16.8" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-classes": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-replace-supers": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-literals": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-replace-supers": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerator-transform": "^0.14.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-spread": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.16.8", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-validator-option": "^7.16.7", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.7", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.7", + "@babel/plugin-proposal-async-generator-functions": "^7.16.8", + "@babel/plugin-proposal-class-properties": "^7.16.7", + "@babel/plugin-proposal-class-static-block": "^7.16.7", + "@babel/plugin-proposal-dynamic-import": "^7.16.7", + "@babel/plugin-proposal-export-namespace-from": "^7.16.7", + "@babel/plugin-proposal-json-strings": "^7.16.7", + "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", + "@babel/plugin-proposal-numeric-separator": "^7.16.7", + "@babel/plugin-proposal-object-rest-spread": "^7.16.7", + "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", + "@babel/plugin-proposal-optional-chaining": "^7.16.7", + "@babel/plugin-proposal-private-methods": "^7.16.7", + "@babel/plugin-proposal-private-property-in-object": "^7.16.7", + "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.16.7", + "@babel/plugin-transform-async-to-generator": "^7.16.8", + "@babel/plugin-transform-block-scoped-functions": "^7.16.7", + "@babel/plugin-transform-block-scoping": "^7.16.7", + "@babel/plugin-transform-classes": "^7.16.7", + "@babel/plugin-transform-computed-properties": "^7.16.7", + "@babel/plugin-transform-destructuring": "^7.16.7", + "@babel/plugin-transform-dotall-regex": "^7.16.7", + "@babel/plugin-transform-duplicate-keys": "^7.16.7", + "@babel/plugin-transform-exponentiation-operator": "^7.16.7", + "@babel/plugin-transform-for-of": "^7.16.7", + "@babel/plugin-transform-function-name": "^7.16.7", + "@babel/plugin-transform-literals": "^7.16.7", + "@babel/plugin-transform-member-expression-literals": "^7.16.7", + "@babel/plugin-transform-modules-amd": "^7.16.7", + "@babel/plugin-transform-modules-commonjs": "^7.16.8", + "@babel/plugin-transform-modules-systemjs": "^7.16.7", + "@babel/plugin-transform-modules-umd": "^7.16.7", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.8", + "@babel/plugin-transform-new-target": "^7.16.7", + "@babel/plugin-transform-object-super": "^7.16.7", + "@babel/plugin-transform-parameters": "^7.16.7", + "@babel/plugin-transform-property-literals": "^7.16.7", + "@babel/plugin-transform-regenerator": "^7.16.7", + "@babel/plugin-transform-reserved-words": "^7.16.7", + "@babel/plugin-transform-shorthand-properties": "^7.16.7", + "@babel/plugin-transform-spread": "^7.16.7", + "@babel/plugin-transform-sticky-regex": "^7.16.7", + "@babel/plugin-transform-template-literals": "^7.16.7", + "@babel/plugin-transform-typeof-symbol": "^7.16.7", + "@babel/plugin-transform-unicode-escapes": "^7.16.7", + "@babel/plugin-transform-unicode-regex": "^7.16.7", + "@babel/preset-modules": "^0.1.5", + "@babel/types": "^7.16.8", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.5.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "core-js-compat": "^3.20.2", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/register": { + "version": "7.16.9", + "dev": true, + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.0", + "source-map-support": "^0.5.16" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime-corejs3": { + "version": "7.16.8", + "license": "MIT", + "dependencies": { + "core-js-pure": "^3.20.2", + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.16.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.16.8", + "@babel/types": "^7.16.8", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.16.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@cnakazawa/watch": { + "version": "1.0.4", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "exec-sh": "^0.3.2", + "minimist": "^1.2.0" + }, + "bin": { + "watch": "cli.js" + }, + "engines": { + "node": ">=0.1.95" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "0.4.3", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.12.0", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@google-cloud/common": { + "version": "0.32.1", + "license": "Apache-2.0", + "dependencies": { + "@google-cloud/projectify": "^0.3.3", + "@google-cloud/promisify": "^0.4.0", + "@types/request": "^2.48.1", + "arrify": "^2.0.0", + "duplexify": "^3.6.0", + "ent": "^2.2.0", + "extend": "^3.0.2", + "google-auth-library": "^3.1.1", + "pify": "^4.0.1", + "retry-request": "^4.0.0", + "teeny-request": "^3.11.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@google-cloud/common/node_modules/arrify": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@google-cloud/common/node_modules/pify": { + "version": "4.0.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/@google-cloud/paginator": { + "version": "0.2.0", + "license": "Apache-2.0", + "dependencies": { + "arrify": "^1.0.1", + "extend": "^3.0.1", + "split-array-stream": "^2.0.0", + "stream-events": "^1.0.4" + } + }, + "node_modules/@google-cloud/projectify": { + "version": "0.3.3", + "license": "Apache-2.0" + }, + "node_modules/@google-cloud/promisify": { + "version": "0.4.0", + "license": "Apache-2.0" + }, + "node_modules/@google-cloud/storage": { + "version": "2.5.0", + "license": "Apache-2.0", + "dependencies": { + "@google-cloud/common": "^0.32.0", + "@google-cloud/paginator": "^0.2.0", + "@google-cloud/promisify": "^0.4.0", + "arrify": "^1.0.0", + "async": "^2.0.1", + "compressible": "^2.0.12", + "concat-stream": "^2.0.0", + "date-and-time": "^0.6.3", + "duplexify": "^3.5.0", + "extend": "^3.0.0", + "gcs-resumable-upload": "^1.0.0", + "hash-stream-validation": "^0.2.1", + "mime": "^2.2.0", + "mime-types": "^2.0.8", + "onetime": "^5.1.0", + "pumpify": "^1.5.1", + "snakeize": "^0.1.0", + "stream-events": "^1.0.1", + "teeny-request": "^3.11.3", + "through2": "^3.0.0", + "xdg-basedir": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@google-cloud/storage/node_modules/concat-stream": { + "version": "2.0.0", + "engines": [ + "node >= 6.0" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/@google-cloud/storage/node_modules/readable-stream": { + "version": "3.6.0", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@google-cloud/storage/node_modules/through2": { + "version": "3.0.2", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.5.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^26.6.2", + "jest-util": "^26.6.2", + "slash": "^3.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/console/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/console/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@jest/console/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/console/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@jest/console/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/core": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^26.6.2", + "@jest/reporters": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/transform": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.4", + "jest-changed-files": "^26.6.2", + "jest-config": "^26.6.3", + "jest-haste-map": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0", + "jest-resolve": "^26.6.2", + "jest-resolve-dependencies": "^26.6.3", + "jest-runner": "^26.6.3", + "jest-runtime": "^26.6.3", + "jest-snapshot": "^26.6.2", + "jest-util": "^26.6.2", + "jest-validate": "^26.6.2", + "jest-watcher": "^26.6.2", + "micromatch": "^4.0.2", + "p-each-series": "^2.1.0", + "rimraf": "^3.0.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/core/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/core/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@jest/core/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/core/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@jest/core/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/core/node_modules/rimraf": { + "version": "3.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@jest/core/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/environment": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "jest-mock": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/fake-timers": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "@sinonjs/fake-timers": "^6.0.1", + "@types/node": "*", + "jest-message-util": "^26.6.2", + "jest-mock": "^26.6.2", + "jest-util": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/globals": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^26.6.2", + "@jest/types": "^26.6.2", + "expect": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/reporters": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/transform": "^26.6.2", + "@jest/types": "^26.6.2", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.2", + "graceful-fs": "^4.2.4", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^4.0.3", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "jest-haste-map": "^26.6.2", + "jest-resolve": "^26.6.2", + "jest-util": "^26.6.2", + "jest-worker": "^26.6.2", + "slash": "^3.0.0", + "source-map": "^0.6.0", + "string-length": "^4.0.1", + "terminal-link": "^2.0.0", + "v8-to-istanbul": "^7.0.0" + }, + "engines": { + "node": ">= 10.14.2" + }, + "optionalDependencies": { + "node-notifier": "^8.0.0" + } + }, + "node_modules/@jest/reporters/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/reporters/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@jest/reporters/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/reporters/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@jest/reporters/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": { + "version": "4.0.3", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/reporters/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@jest/reporters/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/source-map": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0", + "graceful-fs": "^4.2.4", + "source-map": "^0.6.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/source-map/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@jest/test-result": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^26.6.2", + "graceful-fs": "^4.2.4", + "jest-haste-map": "^26.6.2", + "jest-runner": "^26.6.3", + "jest-runtime": "^26.6.3" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/transform": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.1.0", + "@jest/types": "^26.6.2", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^4.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.4", + "jest-haste-map": "^26.6.2", + "jest-regex-util": "^26.0.0", + "jest-util": "^26.6.2", + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/transform/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/transform/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@jest/transform/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/transform/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@jest/transform/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/transform/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@jest/transform/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/types": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/@jest/types/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@jest/types/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@jest/types/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@jest/types/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@jest/types/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/types/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@sindresorhus/is": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@sinonjs/commons": { + "version": "1.8.3", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "6.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, + "node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "license": "MIT", + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@tootallnate/once": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/@types/babel__core": { + "version": "7.1.18", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.14.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.3.0" + } + }, + "node_modules/@types/body-parser": { + "version": "1.19.2", + "license": "MIT", + "dependencies": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "node_modules/@types/cacheable-request": { + "version": "6.0.2", + "license": "MIT", + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "*", + "@types/node": "*", + "@types/responselike": "*" + } + }, + "node_modules/@types/caseless": { + "version": "0.12.2", + "license": "MIT" + }, + "node_modules/@types/connect": { + "version": "3.4.35", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/express": { + "version": "4.17.13", + "license": "MIT", + "dependencies": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "node_modules/@types/express-serve-static-core": { + "version": "4.17.28", + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "node_modules/@types/glob": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/html-minifier-terser": { + "version": "5.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/http-cache-semantics": { + "version": "4.0.1", + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.9", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/keyv": { + "version": "3.1.3", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/mime": { + "version": "1.3.2", + "license": "MIT" + }, + "node_modules/@types/minimatch": { + "version": "3.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "17.0.8", + "license": "MIT" + }, + "node_modules/@types/normalize-package-data": { + "version": "2.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/prettier": { + "version": "2.4.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/qs": { + "version": "6.9.7", + "license": "MIT" + }, + "node_modules/@types/range-parser": { + "version": "1.2.4", + "license": "MIT" + }, + "node_modules/@types/request": { + "version": "2.48.8", + "license": "MIT", + "dependencies": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + } + }, + "node_modules/@types/request/node_modules/form-data": { + "version": "2.5.1", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/@types/responselike": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/serve-static": { + "version": "1.13.10", + "license": "MIT", + "dependencies": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "node_modules/@types/source-list-map": { + "version": "0.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/stack-utils": { + "version": "2.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/tapable": { + "version": "1.0.8", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.1", + "license": "MIT" + }, + "node_modules/@types/uglify-js": { + "version": "3.13.1", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "^0.6.1" + } + }, + "node_modules/@types/uglify-js/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@types/webpack": { + "version": "4.41.32", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tapable": "^1", + "@types/uglify-js": "*", + "@types/webpack-sources": "*", + "anymatch": "^3.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/@types/webpack-sources": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.7.3" + } + }, + "node_modules/@types/webpack-sources/node_modules/source-map": { + "version": "0.7.3", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/webpack/node_modules/anymatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/webpack/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@types/yargs": { + "version": "15.0.14", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "20.2.1", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/yauzl": { + "version": "2.9.2", + "license": "MIT", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/helper-module-context": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/wast-parser": "1.9.0" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.9.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.9.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.9.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-code-frame": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/wast-printer": "1.9.0" + } + }, + "node_modules/@webassemblyjs/helper-fsm": { + "version": "1.9.0", + "dev": true, + "license": "ISC" + }, + "node_modules/@webassemblyjs/helper-module-context": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.9.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.9.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/helper-wasm-section": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0", + "@webassemblyjs/wasm-opt": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0", + "@webassemblyjs/wast-printer": "1.9.0" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/ieee754": "1.9.0", + "@webassemblyjs/leb128": "1.9.0", + "@webassemblyjs/utf8": "1.9.0" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-api-error": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/ieee754": "1.9.0", + "@webassemblyjs/leb128": "1.9.0", + "@webassemblyjs/utf8": "1.9.0" + } + }, + "node_modules/@webassemblyjs/wast-parser": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/floating-point-hex-parser": "1.9.0", + "@webassemblyjs/helper-api-error": "1.9.0", + "@webassemblyjs/helper-code-frame": "1.9.0", + "@webassemblyjs/helper-fsm": "1.9.0", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/wast-parser": "1.9.0", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@xmldom/xmldom": { + "version": "0.7.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/abab": { + "version": "2.0.5", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/abbrev": { + "version": "1.1.1", + "dev": true, + "license": "ISC" + }, + "node_modules/abort-controller": { + "version": "2.0.3", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/abstract-logging": { + "version": "2.0.1", + "license": "MIT" + }, + "node_modules/accept-language": { + "version": "3.0.18", + "license": "MIT", + "dependencies": { + "bcp47": "^1.1.2", + "stable": "^0.1.6" + } + }, + "node_modules/accepts": { + "version": "1.3.7", + "license": "MIT", + "dependencies": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "7.4.1", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-globals": { + "version": "6.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^7.1.1", + "acorn-walk": "^7.1.1" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/adm-zip": { + "version": "0.5.9", + "license": "MIT", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-errors": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "peerDependencies": { + "ajv": ">=5.0.0" + } + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "dev": true, + "license": "MIT", + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/amdefine": { + "version": "1.0.1", + "dev": true, + "license": "BSD-3-Clause OR MIT", + "engines": { + "node": ">=0.4.2" + } + }, + "node_modules/angular-mocks": { + "version": "1.8.2", + "dev": true, + "license": "MIT" + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-align/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-gray": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-wrap": "0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ansi-html-community": { + "version": "0.0.8", + "dev": true, + "engines": [ + "node >= 0.8.0" + ], + "license": "Apache-2.0", + "bin": { + "ansi-html": "bin/ansi-html" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-wrap": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch": { + "version": "2.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + } + }, + "node_modules/anymatch/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch/node_modules/micromatch": { + "version": "3.1.10", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/anymatch/node_modules/normalize-path": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "remove-trailing-separator": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/append-buffer": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-equal": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/aproba": { + "version": "1.2.0", + "license": "ISC" + }, + "node_modules/archy": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/are-we-there-yet": { + "version": "1.1.7", + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/argparse/node_modules/sprintf-js": { + "version": "1.0.3", + "license": "BSD-3-Clause" + }, + "node_modules/arr-diff": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arr-filter": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "make-iterator": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arr-flatten": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arr-map": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "make-iterator": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arr-union": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-differ": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-each": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-find-index": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-flatten": { + "version": "1.1.1", + "license": "MIT" + }, + "node_modules/array-initial": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "array-slice": "^1.0.0", + "is-number": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-initial/node_modules/is-number": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-last": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-last/node_modules/is-number": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-slice": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-sort": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "default-compare": "^1.0.0", + "get-value": "^2.0.6", + "kind-of": "^5.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-sort/node_modules/kind-of": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-union": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-uniq": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/array-unique": { + "version": "0.3.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/arrify": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/asn1": { + "version": "0.2.6", + "license": "MIT", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "node_modules/asn1.js": { + "version": "5.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/assert": { + "version": "1.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "object-assign": "^4.1.1", + "util": "0.10.3" + } + }, + "node_modules/assert-plus": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/assert/node_modules/inherits": { + "version": "2.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/assert/node_modules/util": { + "version": "0.10.3", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "2.0.1" + } + }, + "node_modules/assign-symbols": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ast-types": { + "version": "0.9.6", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "2.6.3", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.14" + } + }, + "node_modules/async-done": { + "version": "1.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.2", + "process-nextick-args": "^2.0.0", + "stream-exhaust": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/async-each": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/async-foreach": { + "version": "0.1.3", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/async-hook-jl": { + "version": "1.7.6", + "license": "MIT", + "dependencies": { + "stack-chain": "^1.3.7" + }, + "engines": { + "node": "^4.7 || >=6.9 || >=7.3" + } + }, + "node_modules/async-limiter": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/async-settle": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "async-done": "^1.2.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "license": "MIT" + }, + "node_modules/atob": { + "version": "2.1.2", + "dev": true, + "license": "(MIT OR Apache-2.0)", + "bin": { + "atob": "bin/atob.js" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/aws-sdk": { + "version": "2.1057.0", + "license": "Apache-2.0", + "dependencies": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.15.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.3.2", + "xml2js": "0.4.19" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/aws-sdk/node_modules/uuid": { + "version": "3.3.2", + "license": "MIT", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/aws-sdk/node_modules/xml2js": { + "version": "0.4.19", + "license": "MIT", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "node_modules/aws-sdk/node_modules/xmlbuilder": { + "version": "9.0.7", + "license": "MIT", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/aws-sign2": { + "version": "0.7.0", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, + "node_modules/aws4": { + "version": "1.11.0", + "license": "MIT" + }, + "node_modules/axios": { + "version": "0.25.0", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.14.7" + } + }, + "node_modules/babel-jest": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/transform": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/babel__core": "^7.1.7", + "babel-plugin-istanbul": "^6.0.0", + "babel-preset-jest": "^26.6.2", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "slash": "^3.0.0" + }, + "engines": { + "node": ">= 10.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-jest/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/babel-jest/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/babel-jest/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/babel-jest/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/babel-jest/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-jest/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-loader": { + "version": "8.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^1.4.0", + "make-dir": "^3.1.0", + "schema-utils": "^2.6.5" + }, + "engines": { + "node": ">= 8.9" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "webpack": ">=2" + } + }, + "node_modules/babel-loader/node_modules/find-cache-dir": { + "version": "3.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/babel-loader/node_modules/make-dir": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/babel-loader/node_modules/pkg-dir": { + "version": "4.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "dev": true, + "license": "MIT", + "dependencies": { + "object.assign": "^4.1.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.0.0", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.3.0", + "semver": "^6.1.1" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.3.0", + "core-js-compat": "^3.20.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.3.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-plugin-jest-hoist": "^26.6.2", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": ">= 10.14.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/bach": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-filter": "^1.1.1", + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "array-each": "^1.0.0", + "array-initial": "^1.0.0", + "array-last": "^1.1.1", + "async-done": "^1.2.2", + "async-settle": "^1.0.0", + "now-and-later": "^2.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/backoff": { + "version": "2.5.0", + "license": "MIT", + "dependencies": { + "precond": "0.2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/base": { + "version": "0.11.2", + "dev": true, + "license": "MIT", + "dependencies": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/define-property": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/batch": { + "version": "0.6.1", + "dev": true, + "license": "MIT" + }, + "node_modules/bcp47": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "license": "BSD-3-Clause", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "node_modules/bcryptjs": { + "version": "2.4.3", + "license": "MIT" + }, + "node_modules/beeper": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/big.js": { + "version": "5.2.2", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/bigdecimal": { + "version": "0.6.1", + "engines": [ + "node" + ], + "bin": { + "bigdecimal.js": "repl.js" + } + }, + "node_modules/bignumber.js": { + "version": "9.0.0", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "1.13.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bl": { + "version": "2.2.1", + "license": "MIT", + "dependencies": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/block-stream": { + "version": "0.0.9", + "dev": true, + "license": "ISC", + "dependencies": { + "inherits": "~2.0.0" + }, + "engines": { + "node": "0.4 || >=0.5.8" + } + }, + "node_modules/bluebird": { + "version": "3.7.2", + "license": "MIT" + }, + "node_modules/bmp-js": { + "version": "0.1.0", + "license": "MIT" + }, + "node_modules/bn.js": { + "version": "5.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/body-parser": { + "version": "1.19.1", + "license": "MIT", + "dependencies": { + "bytes": "3.1.1", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.9.6", + "raw-body": "2.4.2", + "type-is": "~1.6.18" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser/node_modules/bytes": { + "version": "3.1.1", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/bonjour": { + "version": "3.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "array-flatten": "^2.1.0", + "deep-equal": "^1.0.1", + "dns-equal": "^1.0.0", + "dns-txt": "^2.0.2", + "multicast-dns": "^6.0.1", + "multicast-dns-service-types": "^1.1.0" + } + }, + "node_modules/bonjour/node_modules/array-flatten": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/boolbase": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/bops": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "base64-js": "1.0.2", + "to-utf8": "0.0.1" + } + }, + "node_modules/bops/node_modules/base64-js": { + "version": "1.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/bowser": { + "version": "2.9.0", + "license": "MIT" + }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/boxen/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/boxen/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/boxen/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/boxen/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "2.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "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.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/browser-process-hrtime": { + "version": "1.0.0", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/browserify-cipher": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "node_modules/browserify-des": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/browserify-rsa": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "node_modules/browserify-sign": { + "version": "4.2.1", + "dev": true, + "license": "ISC", + "dependencies": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + } + }, + "node_modules/browserify-sign/node_modules/readable-stream": { + "version": "3.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/browserify-sign/node_modules/safe-buffer": { + "version": "5.2.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/browserify-zlib": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pako": "~1.0.5" + } + }, + "node_modules/browserslist": { + "version": "4.19.1", + "dev": true, + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", + "escalade": "^3.1.1", + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/btoa": { + "version": "1.2.1", + "license": "(MIT OR Apache-2.0)", + "bin": { + "btoa": "bin/btoa.js" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/buffer": { + "version": "4.9.2", + "license": "MIT", + "dependencies": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "node_modules/buffer-crc32": { + "version": "0.2.13", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/buffer-equal": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "license": "BSD-3-Clause" + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "license": "MIT" + }, + "node_modules/buffer-indexof": { + "version": "1.1.1", + "dev": true, + "license": "MIT" + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/bufferstreams": { + "version": "1.1.0", + "dev": true, + "dependencies": { + "readable-stream": "^2.0.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/builtin-status-codes": { + "version": "3.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/bytes": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/cacache": { + "version": "12.0.4", + "dev": true, + "license": "ISC", + "dependencies": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + } + }, + "node_modules/cacache/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/cache-base": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "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" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cacheable-lookup": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "@types/keyv": "^3.1.1", + "keyv": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cacheable-request": { + "version": "7.0.2", + "license": "MIT", + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camel-case": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "no-case": "^2.2.0", + "upper-case": "^1.1.1" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-keys": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/camelcase-keys/node_modules/camelcase": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/camelize": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001299", + "dev": true, + "license": "CC-BY-4.0", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/canonical-json": { + "version": "0.0.4", + "license": "BSD" + }, + "node_modules/capture-exit": { + "version": "2.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "rsvp": "^4.8.4" + }, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/caseless": { + "version": "0.12.0", + "license": "Apache-2.0" + }, + "node_modules/chalk": { + "version": "2.4.2", + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/charenc": { + "version": "0.0.2", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "2.1.8", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + }, + "optionalDependencies": { + "fsevents": "^1.2.7" + } + }, + "node_modules/chokidar/node_modules/fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "deprecated": "fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "dependencies": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + }, + "engines": { + "node": ">= 4.0" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "3.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + } + }, + "node_modules/chokidar/node_modules/glob-parent/node_modules/is-glob": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "license": "ISC" + }, + "node_modules/chrome-trace-event": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/ci-info": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/cjs-module-lexer": { + "version": "0.6.0", + "dev": true, + "license": "MIT" + }, + "node_modules/class-utils": { + "version": "0.3.6", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cldrjs": { + "version": "0.5.5" + }, + "node_modules/clean-css": { + "version": "4.2.4", + "dev": true, + "license": "MIT", + "dependencies": { + "source-map": "~0.6.0" + }, + "engines": { + "node": ">= 4.0" + } + }, + "node_modules/clean-css/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "3.2.0", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/clone": { + "version": "2.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/clone-buffer": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/clone-response": { + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/clone-response/node_modules/mimic-response": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/clone-stats": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/cloneable-readable": { + "version": "1.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" + } + }, + "node_modules/cls-hooked": { + "version": "4.2.2", + "license": "BSD-2-Clause", + "dependencies": { + "async-hook-jl": "^1.7.6", + "emitter-listener": "^1.0.1", + "semver": "^5.4.1" + }, + "engines": { + "node": "^4.7 || >=6.9 || >=7.3 || >=8.2.1" + } + }, + "node_modules/cls-hooked/node_modules/semver": { + "version": "5.7.1", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/co": { + "version": "4.6.0", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/code-point-at": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/collection-map": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-map": "^2.0.2", + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/collection-visit": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/color": { + "version": "3.2.1", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "license": "MIT" + }, + "node_modules/color-string": { + "version": "1.9.0", + "license": "MIT", + "dependencies": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "node_modules/color-support": { + "version": "1.1.3", + "dev": true, + "license": "ISC", + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/colors": { + "version": "1.4.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "2.17.1", + "license": "MIT" + }, + "node_modules/commondir": { + "version": "1.0.1", + "license": "MIT" + }, + "node_modules/component-emitter": { + "version": "1.3.0", + "dev": true, + "license": "MIT" + }, + "node_modules/compressible": { + "version": "2.0.18", + "license": "MIT", + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.7.4", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/compression/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "license": "MIT" + }, + "node_modules/concat-stream": { + "version": "1.6.2", + "dev": true, + "engines": [ + "node >= 0.8" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "node_modules/concat-with-sourcemaps": { + "version": "1.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "source-map": "^0.6.1" + } + }, + "node_modules/concat-with-sourcemaps/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/configstore": { + "version": "4.0.0", + "license": "BSD-2-Clause", + "dependencies": { + "dot-prop": "^4.1.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "unique-string": "^1.0.0", + "write-file-atomic": "^2.0.0", + "xdg-basedir": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/configstore/node_modules/make-dir": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/configstore/node_modules/pify": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/configstore/node_modules/write-file-atomic": { + "version": "2.4.3", + "license": "ISC", + "dependencies": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "node_modules/connect-history-api-fallback": { + "version": "1.6.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/console-browserify": { + "version": "1.2.0", + "dev": true + }, + "node_modules/console-control-strings": { + "version": "1.1.0", + "license": "ISC" + }, + "node_modules/consolidate": { + "version": "0.15.1", + "dev": true, + "license": "MIT", + "dependencies": { + "bluebird": "^3.1.1" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/constants-browserify": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/content-disposition": { + "version": "0.5.4", + "license": "MIT", + "dependencies": { + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/content-disposition/node_modules/safe-buffer": { + "version": "5.2.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/content-security-policy-builder": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/content-type": { + "version": "1.0.4", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "1.8.0", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, + "node_modules/cookie": { + "version": "0.4.1", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "license": "MIT" + }, + "node_modules/copy-concurrently": { + "version": "1.0.5", + "dev": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + } + }, + "node_modules/copy-concurrently/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/copy-descriptor": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/copy-props": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "each-props": "^1.3.2", + "is-plain-object": "^5.0.0" + } + }, + "node_modules/copy-props/node_modules/is-plain-object": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/core-js": { + "version": "3.20.2", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-js-compat": { + "version": "3.20.2", + "dev": true, + "license": "MIT", + "dependencies": { + "browserslist": "^4.19.1", + "semver": "7.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-js-compat/node_modules/semver": { + "version": "7.0.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/core-js-pure": { + "version": "3.20.2", + "hasInstallScript": true, + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "license": "MIT" + }, + "node_modules/create-ecdh": { + "version": "4.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "node_modules/create-ecdh/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/create-hash": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "dev": true, + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/cross-fetch": { + "version": "3.1.4", + "license": "MIT", + "dependencies": { + "node-fetch": "2.6.1" + } + }, + "node_modules/cross-fetch/node_modules/node-fetch": { + "version": "2.6.1", + "license": "MIT", + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypt": { + "version": "0.0.2", + "license": "BSD-3-Clause", + "engines": { + "node": "*" + } + }, + "node_modules/crypto-browserify": { + "version": "3.12.0", + "dev": true, + "license": "MIT", + "dependencies": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/crypto-random-string": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/css-loader": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase": "^5.2.0", + "icss-utils": "^4.1.0", + "loader-utils": "^1.2.3", + "normalize-path": "^3.0.0", + "postcss": "^7.0.14", + "postcss-modules-extract-imports": "^2.0.0", + "postcss-modules-local-by-default": "^2.0.6", + "postcss-modules-scope": "^2.1.0", + "postcss-modules-values": "^2.0.0", + "postcss-value-parser": "^3.3.0", + "schema-utils": "^1.0.0" + }, + "engines": { + "node": ">= 6.9.0" + }, + "peerDependencies": { + "webpack": "^4.0.0" + } + }, + "node_modules/css-loader/node_modules/schema-utils": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/css-select": { + "version": "4.2.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^5.1.0", + "domhandler": "^4.3.0", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-select/node_modules/dom-serializer": { + "version": "1.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/css-select/node_modules/domelementtype": { + "version": "2.2.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/css-select/node_modules/domhandler": { + "version": "4.3.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/css-select/node_modules/domutils": { + "version": "2.8.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/css-select/node_modules/entities": { + "version": "2.2.0", + "dev": true, + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/css-what": { + "version": "5.1.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/cssom": { + "version": "0.4.4", + "dev": true, + "license": "MIT" + }, + "node_modules/cssstyle": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cssom": "~0.3.6" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cssstyle/node_modules/cssom": { + "version": "0.3.8", + "dev": true, + "license": "MIT" + }, + "node_modules/currently-unhandled": { + "version": "0.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "array-find-index": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/cyclist": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/d": { + "version": "1.0.1", + "dev": true, + "license": "ISC", + "dependencies": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "node_modules/dargs": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/dashdash": { + "version": "1.14.1", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/dasherize": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/data-urls": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.3", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/date-and-time": { + "version": "0.6.3", + "license": "MIT" + }, + "node_modules/dateformat": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/debug": { + "version": "4.3.3", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decimal.js": { + "version": "10.3.1", + "dev": true, + "license": "MIT" + }, + "node_modules/decode-uri-component": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/decompress-response": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "mimic-response": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/deep-equal": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arguments": "^1.0.4", + "is-date-object": "^1.0.1", + "is-regex": "^1.0.4", + "object-is": "^1.0.1", + "object-keys": "^1.1.1", + "regexp.prototype.flags": "^1.2.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/deepmerge": { + "version": "4.2.2", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-compare": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^5.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-compare/node_modules/kind-of": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-gateway": { + "version": "4.2.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "execa": "^1.0.0", + "ip-regex": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/default-gateway/node_modules/cross-spawn": { + "version": "6.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/default-gateway/node_modules/execa": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/default-gateway/node_modules/get-stream": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/default-gateway/node_modules/is-stream": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-gateway/node_modules/npm-run-path": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/default-gateway/node_modules/path-key": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/default-gateway/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/default-gateway/node_modules/shebang-command": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-gateway/node_modules/shebang-regex": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/default-gateway/node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/default-resolution": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/defer-to-connect": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/define-properties": { + "version": "1.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/define-property": { + "version": "0.2.5", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/del": { + "version": "2.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "globby": "^5.0.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "rimraf": "^2.2.8" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/delegates": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/denque": { + "version": "1.5.1", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/deprecate": { + "version": "1.1.1", + "dev": true, + "license": "MIT" + }, + "node_modules/des.js": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/destroy": { + "version": "1.0.4", + "license": "MIT" + }, + "node_modules/detect-file": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-libc": { + "version": "1.0.3", + "license": "Apache-2.0", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-node": { + "version": "2.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/devtools-protocol": { + "version": "0.0.847576", + "license": "BSD-3-Clause" + }, + "node_modules/diff": { + "version": "1.4.0", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/diffie-hellman": { + "version": "5.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "node_modules/diffie-hellman/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/dns-equal": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/dns-packet": { + "version": "1.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ip": "^1.1.0", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/dns-txt": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-indexof": "^1.0.0" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dom-converter": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "utila": "~0.4" + } + }, + "node_modules/dom-serializer": { + "version": "0.2.2", + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "entities": "^2.0.0" + } + }, + "node_modules/dom-serializer/node_modules/domelementtype": { + "version": "2.2.0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/dom-serializer/node_modules/entities": { + "version": "2.2.0", + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/domain-browser": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4", + "npm": ">=1.2" + } + }, + "node_modules/domelementtype": { + "version": "1.3.1", + "license": "BSD-2-Clause" + }, + "node_modules/domexception": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "webidl-conversions": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/domexception/node_modules/webidl-conversions": { + "version": "5.0.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/domhandler": { + "version": "2.4.2", + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "1" + } + }, + "node_modules/domutils": { + "version": "1.7.0", + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "node_modules/dont-sniff-mimetype": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/dot-case": { + "version": "3.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/dot-case/node_modules/lower-case": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/dot-case/node_modules/no-case": { + "version": "3.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node_modules/dot-prop": { + "version": "4.2.1", + "license": "MIT", + "dependencies": { + "is-obj": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/duplex": { + "version": "1.0.0" + }, + "node_modules/duplex-child-process": { + "version": "0.0.5", + "license": "MIT" + }, + "node_modules/duplexer": { + "version": "0.0.4" + }, + "node_modules/duplexer2": { + "version": "0.0.2", + "dev": true, + "license": "BSD", + "dependencies": { + "readable-stream": "~1.1.9" + } + }, + "node_modules/duplexer2/node_modules/isarray": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/duplexer2/node_modules/readable-stream": { + "version": "1.1.14", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/duplexer2/node_modules/string_decoder": { + "version": "0.10.31", + "dev": true, + "license": "MIT" + }, + "node_modules/duplexer3": { + "version": "0.1.4", + "license": "BSD-3-Clause" + }, + "node_modules/duplexify": { + "version": "3.7.1", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + } + }, + "node_modules/each-props": { + "version": "1.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.1", + "object.defaults": "^1.1.0" + } + }, + "node_modules/ecc-jsbn": { + "version": "0.1.2", + "license": "MIT", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "license": "MIT" + }, + "node_modules/ejs": { + "version": "2.7.4", + "hasInstallScript": true, + "license": "Apache-2.0", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.45", + "dev": true, + "license": "ISC" + }, + "node_modules/elliptic": { + "version": "6.5.4", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/emitter-listener": { + "version": "1.1.2", + "license": "BSD-2-Clause", + "dependencies": { + "shimmer": "^1.2.0" + } + }, + "node_modules/emittery": { + "version": "0.7.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/emojis-list": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/encodeurl": { + "version": "1.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/encoding-japanese": { + "version": "1.0.30", + "license": "MIT" + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/enhanced-resolve": { + "version": "4.5.0", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.5.0", + "tapable": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/enhanced-resolve/node_modules/memory-fs": { + "version": "0.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + }, + "engines": { + "node": ">=4.3.0 <5.0.0 || >=5.10" + } + }, + "node_modules/enquirer": { + "version": "2.3.6", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/ent": { + "version": "2.2.0", + "license": "MIT" + }, + "node_modules/entities": { + "version": "1.1.2", + "license": "BSD-2-Clause" + }, + "node_modules/errno": { + "version": "0.1.8", + "dev": true, + "license": "MIT", + "dependencies": { + "prr": "~1.0.1" + }, + "bin": { + "errno": "cli.js" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/errs": { + "version": "0.3.2", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/es-abstract": { + "version": "1.19.1", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es5-ext": { + "version": "0.10.53", + "dev": true, + "license": "ISC", + "dependencies": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.3", + "next-tick": "~1.0.0" + } + }, + "node_modules/es6-iterator": { + "version": "2.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/es6-promise": { + "version": "4.2.8", + "license": "MIT" + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "es6-promise": "^4.0.3" + } + }, + "node_modules/es6-symbol": { + "version": "3.1.3", + "dev": true, + "license": "ISC", + "dependencies": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "node_modules/es6-templates": { + "version": "0.2.3", + "dev": true, + "license": "Apache 2", + "dependencies": { + "recast": "~0.11.12", + "through": "~2.3.6" + } + }, + "node_modules/es6-weak-map": { + "version": "2.0.3", + "dev": true, + "license": "ISC", + "dependencies": { + "d": "1", + "es5-ext": "^0.10.46", + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/escodegen": { + "version": "2.0.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1" + }, + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=6.0" + }, + "optionalDependencies": { + "source-map": "~0.6.1" + } + }, + "node_modules/escodegen/node_modules/estraverse": { + "version": "5.3.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/escodegen/node_modules/levn": { + "version": "0.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/escodegen/node_modules/optionator": { + "version": "0.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.6", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/escodegen/node_modules/prelude-ls": { + "version": "1.1.2", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/escodegen/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/escodegen/node_modules/type-check": { + "version": "0.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/eslint": { + "version": "7.32.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-config-google": { + "version": "0.11.0", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=0.10.0" + }, + "peerDependencies": { + "eslint": ">=5.4.0" + } + }, + "node_modules/eslint-plugin-jasmine": { + "version": "2.10.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4", + "npm": ">=2" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/@babel/code-frame": { + "version": "7.12.11", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.10.4" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.12.0", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/semver": { + "version": "7.3.5", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/espree": { + "version": "7.3.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=4" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventemitter2": { + "version": "5.0.1", + "license": "MIT" + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "dev": true, + "license": "MIT" + }, + "node_modules/events": { + "version": "1.1.1", + "license": "MIT", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/eventsource": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "original": "^1.0.0" + }, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/exec-sh": { + "version": "0.3.6", + "dev": true, + "license": "MIT" + }, + "node_modules/execa": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/execa/node_modules/merge-stream": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/exit": { + "version": "0.1.2", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expand-brackets": { + "version": "2.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expand-brackets/node_modules/debug": { + "version": "2.6.9", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/expand-brackets/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/expand-template": { + "version": "2.0.3", + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, + "node_modules/expand-tilde": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/expect": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-styles": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/expect/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/expect/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/expect/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/express": { + "version": "4.17.2", + "license": "MIT", + "dependencies": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.4.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.9.6", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.17.2", + "serve-static": "1.14.2", + "setprototypeof": "1.2.0", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/express/node_modules/safe-buffer": { + "version": "5.2.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/ext": { + "version": "1.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "type": "^2.5.0" + } + }, + "node_modules/ext/node_modules/type": { + "version": "2.5.0", + "dev": true, + "license": "ISC" + }, + "node_modules/extend": { + "version": "3.0.2", + "license": "MIT" + }, + "node_modules/extend-shallow": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob": { + "version": "2.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "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" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/define-property": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extglob/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/extract-zip": { + "version": "2.0.1", + "license": "BSD-2-Clause", + "dependencies": { + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extsprintf": { + "version": "1.3.0", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" + }, + "node_modules/eyes": { + "version": "0.1.8", + "engines": { + "node": "> 0.1.90" + } + }, + "node_modules/fancy-log": { + "version": "1.3.3", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-gray": "^0.1.1", + "color-support": "^1.1.3", + "parse-node-version": "^1.0.0", + "time-stamp": "^1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "license": "MIT" + }, + "node_modules/fast-json-patch": { + "version": "2.2.1", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^2.0.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/fast-json-patch/node_modules/fast-deep-equal": { + "version": "2.0.1", + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "license": "MIT" + }, + "node_modules/fast-text-encoding": { + "version": "1.0.3", + "license": "Apache-2.0" + }, + "node_modules/fastparse": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/faye-websocket": { + "version": "0.11.4", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "websocket-driver": ">=0.5.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fb-watchman": { + "version": "2.0.1", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/fd-slicer": { + "version": "1.1.0", + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "node_modules/feature-policy": { + "version": "0.3.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/figgy-pudding": { + "version": "3.5.2", + "dev": true, + "license": "ISC" + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/file-loader": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "loader-utils": "^1.0.2", + "schema-utils": "^0.4.5" + }, + "engines": { + "node": ">= 4.3 < 5.0.0 || >= 5.10" + }, + "peerDependencies": { + "webpack": "^2.0.0 || ^3.0.0 || ^4.0.0" + } + }, + "node_modules/file-loader/node_modules/schema-utils": { + "version": "0.4.7", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/file-type": { + "version": "10.11.0", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, + "node_modules/filed-mimefix": { + "version": "0.1.3", + "license": "ASL 2.0", + "dependencies": { + "mime": "^1.4.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/filed-mimefix/node_modules/mime": { + "version": "1.6.0", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/filelist": { + "version": "1.0.2", + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^3.0.4" + } + }, + "node_modules/fill-range": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/finalhandler": { + "version": "1.1.2", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/finalhandler/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/finalhandler/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/find-cache-dir": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/findup-sync": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/findup-sync/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/findup-sync/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/findup-sync/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/findup-sync/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/findup-sync/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/findup-sync/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/findup-sync/node_modules/micromatch": { + "version": "3.1.10", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fined": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "expand-tilde": "^2.0.2", + "is-plain-object": "^2.0.3", + "object.defaults": "^1.1.0", + "object.pick": "^1.2.0", + "parse-filepath": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/flagged-respawn": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "3.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/flatted": { + "version": "3.2.4", + "dev": true, + "license": "ISC" + }, + "node_modules/flush-write-stream": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "readable-stream": "^2.3.6" + } + }, + "node_modules/follow-redirects": { + "version": "1.14.7", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/for-in": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-own": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "for-in": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/forever-agent": { + "version": "0.6.1", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, + "node_modules/form-data": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data-encoder": { + "version": "1.7.1", + "license": "MIT" + }, + "node_modules/formdata-node": { + "version": "4.3.2", + "license": "MIT", + "dependencies": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.1" + }, + "engines": { + "node": ">= 12.20" + } + }, + "node_modules/formidable": { + "version": "1.2.6", + "license": "MIT", + "funding": { + "url": "https://ko-fi.com/tunnckoCore/commissions" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fragment-cache": { + "version": "0.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "map-cache": "^0.2.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fresh": { + "version": "0.5.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/from2": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/fs-extra": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "node_modules/fs-mkdirp-stream": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.11", + "through2": "^2.0.3" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/fs-readfile-promise": { + "version": "3.0.1", + "dev": true, + "license": "ISC", + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, + "node_modules/fs-write-stream-atomic": { + "version": "1.0.10", + "dev": true, + "license": "ISC", + "dependencies": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/fstream": { + "version": "1.0.12", + "dev": true, + "license": "ISC", + "dependencies": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/fstream/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ftps": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "duplex-child-process": "0.0.5", + "lodash": "^4.4.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "license": "MIT" + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/g11n-pipeline": { + "version": "2.0.6", + "license": "Apache-2.0", + "dependencies": { + "swagger-client": "^3.8.3" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/gauge": { + "version": "2.7.4", + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "node_modules/gauge/node_modules/ansi-regex": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gauge/node_modules/strip-ansi": { + "version": "3.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gaxios": { + "version": "1.8.4", + "license": "Apache-2.0", + "dependencies": { + "abort-controller": "^3.0.0", + "extend": "^3.0.2", + "https-proxy-agent": "^2.2.1", + "node-fetch": "^2.3.0" + } + }, + "node_modules/gaxios/node_modules/abort-controller": { + "version": "3.0.0", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/gaxios/node_modules/agent-base": { + "version": "4.3.0", + "license": "MIT", + "dependencies": { + "es6-promisify": "^5.0.0" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/gaxios/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/gaxios/node_modules/https-proxy-agent": { + "version": "2.2.4", + "license": "MIT", + "dependencies": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/gaze": { + "version": "1.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "globule": "^1.0.0" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/gcp-metadata": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "gaxios": "^1.0.2", + "json-bigint": "^0.3.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/gcs-resumable-upload": { + "version": "1.1.0", + "license": "MIT", + "dependencies": { + "abort-controller": "^2.0.2", + "configstore": "^4.0.0", + "gaxios": "^1.5.0", + "google-auth-library": "^3.0.0", + "pumpify": "^1.5.1", + "stream-events": "^1.0.4" + }, + "bin": { + "gcs-upload": "build/src/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/generate-function": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-property": "^1.0.2" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "1.0.3", + "dev": true, + "license": "ISC" + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stdin": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/get-stream": { + "version": "5.2.0", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-value": { + "version": "2.0.6", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/getpass": { + "version": "0.1.7", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "license": "MIT" + }, + "node_modules/glob": { + "version": "7.2.0", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob-stream": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "extend": "^3.0.0", + "glob": "^7.1.1", + "glob-parent": "^3.1.0", + "is-negated-glob": "^1.0.0", + "ordered-read-streams": "^1.0.0", + "pumpify": "^1.3.5", + "readable-stream": "^2.1.5", + "remove-trailing-separator": "^1.0.1", + "to-absolute-glob": "^2.0.0", + "unique-stream": "^2.0.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/glob-stream/node_modules/glob-parent": { + "version": "3.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + } + }, + "node_modules/glob-stream/node_modules/is-glob": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/glob-watcher": { + "version": "5.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "^2.0.0", + "async-done": "^1.2.0", + "chokidar": "^2.0.0", + "is-negated-glob": "^1.0.0", + "just-debounce": "^1.0.0", + "normalize-path": "^3.0.0", + "object.defaults": "^1.1.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "dependencies": { + "ini": "2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/global-dirs/node_modules/ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/global-modules": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/global-prefix/node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/globalize": { + "version": "1.7.0", + "license": "MIT", + "dependencies": { + "cldrjs": "^0.5.4" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/globby": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/globule": { + "version": "1.3.3", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/globule/node_modules/glob": { + "version": "7.1.7", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glogg": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "sparkles": "^1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/google-auth-library": { + "version": "3.1.2", + "license": "Apache-2.0", + "dependencies": { + "base64-js": "^1.3.0", + "fast-text-encoding": "^1.0.0", + "gaxios": "^1.2.1", + "gcp-metadata": "^1.0.0", + "gtoken": "^2.3.2", + "https-proxy-agent": "^2.2.1", + "jws": "^3.1.5", + "lru-cache": "^5.0.0", + "semver": "^5.5.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/google-auth-library/node_modules/agent-base": { + "version": "4.3.0", + "license": "MIT", + "dependencies": { + "es6-promisify": "^5.0.0" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/google-auth-library/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/google-auth-library/node_modules/https-proxy-agent": { + "version": "2.2.4", + "license": "MIT", + "dependencies": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/google-auth-library/node_modules/semver": { + "version": "5.7.1", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/google-p12-pem": { + "version": "1.0.5", + "license": "MIT", + "dependencies": { + "node-forge": "^0.10.0", + "pify": "^4.0.0" + }, + "bin": { + "gp12-pem": "build/src/bin/gp12-pem.js" + } + }, + "node_modules/google-p12-pem/node_modules/pify": { + "version": "4.0.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/got": { + "version": "10.7.0", + "license": "MIT", + "dependencies": { + "@sindresorhus/is": "^2.0.0", + "@szmarczak/http-timer": "^4.0.0", + "@types/cacheable-request": "^6.0.1", + "cacheable-lookup": "^2.0.0", + "cacheable-request": "^7.0.1", + "decompress-response": "^5.0.0", + "duplexer3": "^0.1.4", + "get-stream": "^5.0.0", + "lowercase-keys": "^2.0.0", + "mimic-response": "^2.1.0", + "p-cancelable": "^2.0.0", + "p-event": "^4.0.0", + "responselike": "^2.0.0", + "to-readable-stream": "^2.0.0", + "type-fest": "^0.10.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.9", + "license": "ISC" + }, + "node_modules/growl": { + "version": "1.9.2", + "license": "MIT" + }, + "node_modules/growly": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/gtoken": { + "version": "2.3.3", + "license": "MIT", + "dependencies": { + "gaxios": "^1.0.4", + "google-p12-pem": "^1.0.0", + "jws": "^3.1.5", + "mime": "^2.2.0", + "pify": "^4.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/gtoken/node_modules/pify": { + "version": "4.0.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/gulp": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "glob-watcher": "^5.0.3", + "gulp-cli": "^2.2.0", + "undertaker": "^1.2.1", + "vinyl-fs": "^3.0.0" + }, + "bin": { + "gulp": "bin/gulp.js" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/gulp-cli": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^1.0.1", + "archy": "^1.0.0", + "array-sort": "^1.0.0", + "color-support": "^1.1.3", + "concat-stream": "^1.6.0", + "copy-props": "^2.0.1", + "fancy-log": "^1.3.2", + "gulplog": "^1.0.0", + "interpret": "^1.4.0", + "isobject": "^3.0.1", + "liftoff": "^3.1.0", + "matchdep": "^2.0.0", + "mute-stdout": "^1.0.0", + "pretty-hrtime": "^1.0.0", + "replace-homedir": "^1.0.0", + "semver-greatest-satisfied-range": "^1.1.0", + "v8flags": "^3.2.0", + "yargs": "^7.1.0" + }, + "bin": { + "gulp": "bin/gulp.js" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/gulp-cli/node_modules/ansi-colors": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-wrap": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp-concat": { + "version": "2.6.1", + "dev": true, + "license": "MIT", + "dependencies": { + "concat-with-sourcemaps": "^1.0.0", + "through2": "^2.0.0", + "vinyl": "^2.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/gulp-env": { + "version": "0.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ini": "^1.3.4", + "through2": "^2.0.0" + } + }, + "node_modules/gulp-file": { + "version": "0.4.0", + "dev": true, + "license": "BSD", + "dependencies": { + "through2": "^0.4.1", + "vinyl": "^2.1.0" + } + }, + "node_modules/gulp-file/node_modules/isarray": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-file/node_modules/object-keys": { + "version": "0.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-file/node_modules/readable-stream": { + "version": "1.0.34", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/gulp-file/node_modules/string_decoder": { + "version": "0.10.31", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-file/node_modules/through2": { + "version": "0.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~1.0.17", + "xtend": "~2.1.1" + } + }, + "node_modules/gulp-file/node_modules/xtend": { + "version": "2.1.2", + "dev": true, + "dependencies": { + "object-keys": "~0.4.0" + }, + "engines": { + "node": ">=0.4" + } + }, + "node_modules/gulp-install": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "dargs": "^5.1.0", + "gulp-util": "^3.0.7", + "lodash.groupby": "^4.6.0", + "p-queue": "^1.0.0", + "through2": "^2.0.3", + "which": "^1.2.14" + } + }, + "node_modules/gulp-install/node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/gulp-merge-json": { + "version": "1.3.1", + "dev": true, + "license": "MIT", + "dependencies": { + "deprecate": "^1.0.0", + "json5": "^1.0.1", + "lodash.mergewith": "^4.6.1", + "plugin-error": "^1.0.1", + "through": "^2.3.8", + "vinyl": "^2.1.0" + } + }, + "node_modules/gulp-merge-json/node_modules/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/gulp-nodemon": { + "version": "2.5.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "colors": "^1.2.1", + "gulp": "^4.0.0", + "nodemon": "^2.0.2" + } + }, + "node_modules/gulp-print": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "gulp-util": "^3.0.6", + "map-stream": "~0.0.6" + }, + "engines": { + "node": ">=0.10.0", + "npm": ">=1.2.10" + } + }, + "node_modules/gulp-util": { + "version": "3.0.8", + "dev": true, + "license": "MIT", + "dependencies": { + "array-differ": "^1.0.0", + "array-uniq": "^1.0.2", + "beeper": "^1.0.0", + "chalk": "^1.0.0", + "dateformat": "^2.0.0", + "fancy-log": "^1.1.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.0.0", + "minimist": "^1.1.0", + "multipipe": "^0.1.2", + "object-assign": "^3.0.0", + "replace-ext": "0.0.1", + "through2": "^2.0.0", + "vinyl": "^0.5.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/gulp-util/node_modules/ansi-regex": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp-util/node_modules/ansi-styles": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp-util/node_modules/chalk": { + "version": "1.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp-util/node_modules/clone": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/gulp-util/node_modules/clone-stats": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/gulp-util/node_modules/object-assign": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp-util/node_modules/strip-ansi": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulp-util/node_modules/supports-color": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/gulp-util/node_modules/vinyl": { + "version": "0.5.3", + "dev": true, + "license": "MIT", + "dependencies": { + "clone": "^1.0.0", + "clone-stats": "^0.0.1", + "replace-ext": "0.0.1" + }, + "engines": { + "node": ">= 0.9" + } + }, + "node_modules/gulp-wrap": { + "version": "0.15.0", + "dev": true, + "dependencies": { + "consolidate": "^0.15.1", + "es6-promise": "^4.2.6", + "fs-readfile-promise": "^3.0.1", + "js-yaml": "^3.13.0", + "lodash": "^4.17.11", + "node.extend": "2.0.2", + "plugin-error": "^1.0.1", + "through2": "^3.0.1", + "tryit": "^1.0.1", + "vinyl-bufferstream": "^1.0.1" + }, + "engines": { + "node": ">=6.14", + "npm": ">=1.4.3" + } + }, + "node_modules/gulp-wrap/node_modules/through2": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + }, + "node_modules/gulp-yaml": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "bufferstreams": "1.1.0", + "gulp-util": "^3.0.6", + "js-yaml": "^3.4.3", + "through2": "^2.0.0", + "xtend": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gulplog": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "glogg": "^1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/handle-thing": { + "version": "2.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/har-schema": { + "version": "2.0.0", + "license": "ISC", + "engines": { + "node": ">=4" + } + }, + "node_modules/har-validator": { + "version": "5.1.5", + "license": "MIT", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/harmony-reflect": { + "version": "1.6.2", + "dev": true, + "license": "(Apache-2.0 OR MPL-1.1)" + }, + "node_modules/has": { + "version": "1.0.3", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-ansi": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-ansi/node_modules/ansi-regex": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/has-gulplog": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "sparkles": "^1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-unicode": { + "version": "2.0.1", + "license": "ISC" + }, + "node_modules/has-value": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-values": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-values/node_modules/kind-of": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash-base/node_modules/readable-stream": { + "version": "3.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/hash-base/node_modules/safe-buffer": { + "version": "5.2.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/hash-stream-validation": { + "version": "0.2.4", + "license": "MIT" + }, + "node_modules/hash.js": { + "version": "1.1.7", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/he": { + "version": "1.2.0", + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "node_modules/helmet": { + "version": "3.23.3", + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "dont-sniff-mimetype": "1.1.0", + "feature-policy": "0.3.0", + "helmet-crossdomain": "0.4.0", + "helmet-csp": "2.10.0", + "hide-powered-by": "1.1.0", + "hpkp": "2.0.0", + "hsts": "2.2.0", + "nocache": "2.1.0", + "referrer-policy": "1.2.0", + "x-xss-protection": "1.3.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/helmet-crossdomain": { + "version": "0.4.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/helmet-csp": { + "version": "2.10.0", + "license": "MIT", + "dependencies": { + "bowser": "2.9.0", + "camelize": "1.0.0", + "content-security-policy-builder": "2.1.0", + "dasherize": "2.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/hide-powered-by": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/homedir-polyfill": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "parse-passwd": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "dev": true, + "license": "ISC" + }, + "node_modules/hpack.js": { + "version": "2.1.6", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "node_modules/hpkp": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/hsts": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "depd": "2.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/html-encoding-sniffer": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-encoding": "^1.0.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/html-entities": { + "version": "1.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/html-loader": { + "version": "0.4.5", + "dev": true, + "license": "MIT", + "dependencies": { + "es6-templates": "^0.2.2", + "fastparse": "^1.1.1", + "html-minifier": "^3.0.1", + "loader-utils": "^1.0.2", + "object-assign": "^4.1.0" + } + }, + "node_modules/html-loader-jest": { + "version": "0.2.1", + "dev": true, + "license": "ISC", + "dependencies": { + "html-loader": "^0.5.1" + } + }, + "node_modules/html-loader-jest/node_modules/html-loader": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "es6-templates": "^0.2.3", + "fastparse": "^1.1.1", + "html-minifier": "^3.5.8", + "loader-utils": "^1.1.0", + "object-assign": "^4.1.1" + } + }, + "node_modules/html-minifier": { + "version": "3.5.21", + "dev": true, + "license": "MIT", + "dependencies": { + "camel-case": "3.0.x", + "clean-css": "4.2.x", + "commander": "2.17.x", + "he": "1.2.x", + "param-case": "2.1.x", + "relateurl": "0.2.x", + "uglify-js": "3.4.x" + }, + "bin": { + "html-minifier": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/html-minifier-terser": { + "version": "5.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "camel-case": "^4.1.1", + "clean-css": "^4.2.3", + "commander": "^4.1.1", + "he": "^1.2.0", + "param-case": "^3.0.3", + "relateurl": "^0.2.7", + "terser": "^4.6.3" + }, + "bin": { + "html-minifier-terser": "cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/html-minifier-terser/node_modules/camel-case": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, + "node_modules/html-minifier-terser/node_modules/commander": { + "version": "4.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/html-minifier-terser/node_modules/param-case": { + "version": "3.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/html-to-text": { + "version": "5.1.1", + "license": "MIT", + "dependencies": { + "he": "^1.2.0", + "htmlparser2": "^3.10.1", + "lodash": "^4.17.11", + "minimist": "^1.2.0" + }, + "bin": { + "html-to-text": "bin/cli.js" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/html-webpack-plugin": { + "version": "4.5.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/html-minifier-terser": "^5.0.0", + "@types/tapable": "^1.0.5", + "@types/webpack": "^4.41.8", + "html-minifier-terser": "^5.0.1", + "loader-utils": "^1.2.3", + "lodash": "^4.17.20", + "pretty-error": "^2.1.1", + "tapable": "^1.1.3", + "util.promisify": "1.0.0" + }, + "engines": { + "node": ">=6.9" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/htmlparser2": { + "version": "3.10.1", + "license": "MIT", + "dependencies": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "node_modules/htmlparser2/node_modules/readable-stream": { + "version": "3.6.0", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-cache-semantics": { + "version": "4.1.0", + "license": "BSD-2-Clause" + }, + "node_modules/http-deceiver": { + "version": "1.2.7", + "dev": true, + "license": "MIT" + }, + "node_modules/http-errors": { + "version": "1.8.1", + "license": "MIT", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-errors/node_modules/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/http-parser-js": { + "version": "0.5.5", + "dev": true, + "license": "MIT" + }, + "node_modules/http-proxy": { + "version": "1.18.1", + "dev": true, + "license": "MIT", + "dependencies": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-proxy-agent": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-middleware": { + "version": "0.19.1", + "dev": true, + "license": "MIT", + "dependencies": { + "http-proxy": "^1.17.0", + "is-glob": "^4.0.0", + "lodash": "^4.17.11", + "micromatch": "^3.1.10" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/http-proxy-middleware/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/http-proxy-middleware/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/http-proxy-middleware/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/http-proxy-middleware/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/http-proxy-middleware/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/http-proxy-middleware/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/http-proxy-middleware/node_modules/micromatch": { + "version": "3.1.10", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/http-signature": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, + "node_modules/http-status": { + "version": "1.5.0", + "license": "BSD-3-Clause", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/httpntlm": { + "version": "1.6.1", + "dependencies": { + "httpreq": ">=0.4.22", + "underscore": "~1.7.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/httpreq": { + "version": "0.5.2", + "license": "MIT", + "engines": { + "node": ">= 6.15.1" + } + }, + "node_modules/https-browserify": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/https-proxy-agent": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/human-signals": { + "version": "1.1.1", + "license": "Apache-2.0", + "engines": { + "node": ">=8.12.0" + } + }, + "node_modules/i18n": { + "version": "0.8.6", + "license": "MIT", + "dependencies": { + "debug": "*", + "make-plural": "^6.0.1", + "math-interval-parser": "^2.0.1", + "messageformat": "^2.3.0", + "mustache": "*", + "sprintf-js": "^1.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/icss-replace-symbols": { + "version": "1.1.0", + "dev": true, + "license": "ISC" + }, + "node_modules/icss-utils": { + "version": "4.1.1", + "dev": true, + "license": "ISC", + "dependencies": { + "postcss": "^7.0.14" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/identity-obj-proxy": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "harmony-reflect": "^1.4.6" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ieee754": { + "version": "1.1.13", + "license": "BSD-3-Clause" + }, + "node_modules/iferr": { + "version": "0.1.5", + "dev": true, + "license": "MIT" + }, + "node_modules/ignore": { + "version": "4.0.6", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/image-type": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "file-type": "^10.10.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/imap": { + "version": "0.8.19", + "dependencies": { + "readable-stream": "1.1.x", + "utf7": ">=1.0.2" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/imap/node_modules/isarray": { + "version": "0.0.1", + "license": "MIT" + }, + "node_modules/imap/node_modules/readable-stream": { + "version": "1.1.14", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/imap/node_modules/string_decoder": { + "version": "0.10.31", + "license": "MIT" + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/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, + "engines": { + "node": ">=4" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-local/node_modules/pkg-dir": { + "version": "4.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/in-publish": { + "version": "2.0.1", + "dev": true, + "license": "ISC", + "bin": { + "in-install": "in-install.js", + "in-publish": "in-publish.js", + "not-in-install": "not-in-install.js", + "not-in-publish": "not-in-publish.js" + } + }, + "node_modules/indent-string": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "repeating": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/infer-owner": { + "version": "1.0.4", + "dev": true, + "license": "ISC" + }, + "node_modules/inflection": { + "version": "1.13.1", + "engines": [ + "node >= 0.4.0" + ], + "license": "MIT" + }, + "node_modules/inflight": { + "version": "1.0.6", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "license": "ISC" + }, + "node_modules/internal-ip": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "default-gateway": "^4.2.0", + "ipaddr.js": "^1.9.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/internal-slot": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/interpret": { + "version": "1.4.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/invert-kv": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ip": { + "version": "1.1.5", + "license": "MIT" + }, + "node_modules/ip-regex": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is": { + "version": "3.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/is-absolute": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-absolute-url": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-accessor-descriptor": { + "version": "0.1.6", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-accessor-descriptor/node_modules/kind-of": { + "version": "3.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "dev": true, + "license": "MIT" + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "license": "MIT" + }, + "node_modules/is-callable": { + "version": "1.2.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-ci": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ci-info": "^2.0.0" + }, + "bin": { + "is-ci": "bin.js" + } + }, + "node_modules/is-core-module": { + "version": "2.8.1", + "dev": true, + "license": "MIT", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-descriptor": { + "version": "0.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-data-descriptor/node_modules/kind-of": { + "version": "3.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-descriptor": { + "version": "0.1.6", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-descriptor/node_modules/kind-of": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-docker": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "optional": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finite": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "number-is-nan": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "dependencies": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-installed-globally/node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-negated-glob": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.6", + "dev": true, + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number/node_modules/kind-of": { + "version": "3.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-obj": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-path-cwd": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-path-in-cwd": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-path-inside": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-path-inside": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "path-is-inside": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/is-property": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/is-regex": { + "version": "1.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-relative": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-unc-path": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-stream-ended": { + "version": "0.1.4", + "license": "MIT" + }, + "node_modules/is-string": { + "version": "1.0.7", + "dev": true, + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/is-unc-path": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "unc-path-regex": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-utf8": { + "version": "0.2.1", + "dev": true, + "license": "MIT" + }, + "node_modules/is-valid-glob": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-windows": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/isemail": { + "version": "3.2.0", + "license": "BSD-3-Clause", + "dependencies": { + "punycode": "2.x.x" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "license": "ISC" + }, + "node_modules/isobject": { + "version": "3.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isstream": { + "version": "0.1.2", + "license": "MIT" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "5.1.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.3", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jade": { + "version": "0.26.3", + "dependencies": { + "commander": "0.6.1", + "mkdirp": "0.3.0" + }, + "bin": { + "jade": "bin/jade" + } + }, + "node_modules/jade/node_modules/commander": { + "version": "0.6.1", + "engines": { + "node": ">= 0.4.x" + } + }, + "node_modules/jade/node_modules/mkdirp": { + "version": "0.3.0", + "license": "MIT/X11", + "engines": { + "node": "*" + } + }, + "node_modules/jake": { + "version": "10.8.2", + "license": "Apache-2.0", + "dependencies": { + "async": "0.9.x", + "chalk": "^2.4.2", + "filelist": "^1.0.1", + "minimatch": "^3.0.4" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/jake/node_modules/async": { + "version": "0.9.2", + "license": "MIT" + }, + "node_modules/jasmine": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.1.0.tgz", + "integrity": "sha512-4VhjbUgwfNS9CBnUMoSWr9tdNgOoOhNIjAD8YRxTn+PmOf4qTSC0Uqhk66dWGnz2vJxtNIU0uBjiwnsp4Ud9VA==", + "dev": true, + "dependencies": { + "glob": "^7.1.6", + "jasmine-core": "^4.1.0" + }, + "bin": { + "jasmine": "bin/jasmine.js" + } + }, + "node_modules/jasmine-core": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.1.1.tgz", + "integrity": "sha512-lmUfT5XcK9KKvt3lLYzn93hc4MGzlUBowExFVgzbSW0ZCrdeyS574dfsyfRhxbg81Wj4gk+RxUiTnj7KBfDA1g==", + "dev": true + }, + "node_modules/jasmine-reporters": { + "version": "2.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@xmldom/xmldom": "^0.7.3", + "mkdirp": "^1.0.4" + } + }, + "node_modules/jasmine-spec-reporter": { + "version": "7.0.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "colors": "1.4.0" + } + }, + "node_modules/jayson": { + "version": "2.1.2", + "license": "MIT", + "dependencies": { + "@types/node": "^10.3.5", + "commander": "^2.12.2", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.1", + "lodash": "^4.17.11", + "uuid": "^3.2.1" + }, + "bin": { + "jayson": "bin/jayson.js" + } + }, + "node_modules/jayson/node_modules/@types/node": { + "version": "10.17.60", + "license": "MIT" + }, + "node_modules/jest": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^26.6.3", + "import-local": "^3.0.2", + "jest-cli": "^26.6.3" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-changed-files": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "execa": "^4.0.0", + "throat": "^5.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-cli": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^26.6.3", + "@jest/test-result": "^26.6.2", + "@jest/types": "^26.6.2", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.4", + "import-local": "^3.0.2", + "is-ci": "^2.0.0", + "jest-config": "^26.6.3", + "jest-util": "^26.6.2", + "jest-validate": "^26.6.2", + "prompts": "^2.0.1", + "yargs": "^15.4.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-cli/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-cli/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-cli/node_modules/cliui": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/jest-cli/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-cli/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-cli/node_modules/get-caller-file": { + "version": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/jest-cli/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/node_modules/require-main-filename": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/jest-cli/node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/node_modules/which-module": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/jest-cli/node_modules/wrap-ansi": { + "version": "6.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/node_modules/yargs": { + "version": "15.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-cli/node_modules/yargs-parser": { + "version": "18.1.3", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jest-config": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^26.6.3", + "@jest/types": "^26.6.2", + "babel-jest": "^26.6.3", + "chalk": "^4.0.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.1", + "graceful-fs": "^4.2.4", + "jest-environment-jsdom": "^26.6.2", + "jest-environment-node": "^26.6.2", + "jest-get-type": "^26.3.0", + "jest-jasmine2": "^26.6.3", + "jest-regex-util": "^26.0.0", + "jest-resolve": "^26.6.2", + "jest-util": "^26.6.2", + "jest-validate": "^26.6.2", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + }, + "peerDependencies": { + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-config/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-config/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-config/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-config/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-config/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-config/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-diff": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-diff/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-diff/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-diff/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-diff/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-diff/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-diff/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-docblock": { + "version": "26.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-each": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "chalk": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-util": "^26.6.2", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-each/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-each/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-each/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-each/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-each/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-each/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-environment-jsdom": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^26.6.2", + "@jest/fake-timers": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "jest-mock": "^26.6.2", + "jest-util": "^26.6.2", + "jsdom": "^16.4.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-environment-node": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^26.6.2", + "@jest/fake-timers": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "jest-mock": "^26.6.2", + "jest-util": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-get-type": { + "version": "26.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-haste-map": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "@types/graceful-fs": "^4.1.2", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.4", + "jest-regex-util": "^26.0.0", + "jest-serializer": "^26.6.2", + "jest-util": "^26.6.2", + "jest-worker": "^26.6.2", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7" + }, + "engines": { + "node": ">= 10.14.2" + }, + "optionalDependencies": { + "fsevents": "^2.1.2" + } + }, + "node_modules/jest-haste-map/node_modules/anymatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/jest-jasmine2": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.1.0", + "@jest/environment": "^26.6.2", + "@jest/source-map": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "expect": "^26.6.2", + "is-generator-fn": "^2.0.0", + "jest-each": "^26.6.2", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-runtime": "^26.6.3", + "jest-snapshot": "^26.6.2", + "jest-util": "^26.6.2", + "pretty-format": "^26.6.2", + "throat": "^5.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-jasmine2/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-jasmine2/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-jasmine2/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-jasmine2/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-jasmine2/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-jasmine2/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-junit": { + "version": "8.0.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "jest-validate": "^24.0.0", + "mkdirp": "^0.5.1", + "strip-ansi": "^4.0.0", + "xml": "^1.0.1" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/jest-junit/node_modules/@jest/types": { + "version": "24.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^13.0.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-junit/node_modules/@types/istanbul-reports": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*", + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/jest-junit/node_modules/@types/yargs": { + "version": "13.0.12", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/jest-junit/node_modules/ansi-regex": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/jest-junit/node_modules/jest-get-type": { + "version": "24.9.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-junit/node_modules/jest-validate": { + "version": "24.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^24.9.0", + "camelcase": "^5.3.1", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "leven": "^3.1.0", + "pretty-format": "^24.9.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-junit/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/jest-junit/node_modules/pretty-format": { + "version": "24.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^24.9.0", + "ansi-regex": "^4.0.0", + "ansi-styles": "^3.2.0", + "react-is": "^16.8.4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/jest-junit/node_modules/react-is": { + "version": "16.13.1", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-junit/node_modules/strip-ansi": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/jest-junit/node_modules/strip-ansi/node_modules/ansi-regex": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/jest-leak-detector": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-matcher-utils": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-matcher-utils/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-matcher-utils/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-matcher-utils/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-matcher-utils/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-matcher-utils/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-matcher-utils/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-message-util": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2", + "slash": "^3.0.0", + "stack-utils": "^2.0.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-message-util/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-message-util/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-message-util/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-message-util/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-message-util/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-message-util/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-mock": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "@types/node": "*" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "26.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-resolve": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^26.6.2", + "read-pkg-up": "^7.0.1", + "resolve": "^1.18.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "jest-regex-util": "^26.0.0", + "jest-snapshot": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-resolve/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-resolve/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-resolve/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-resolve/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-resolve/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-resolve/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runner": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^26.6.2", + "@jest/environment": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.7.1", + "exit": "^0.1.2", + "graceful-fs": "^4.2.4", + "jest-config": "^26.6.3", + "jest-docblock": "^26.0.0", + "jest-haste-map": "^26.6.2", + "jest-leak-detector": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-resolve": "^26.6.2", + "jest-runtime": "^26.6.3", + "jest-util": "^26.6.2", + "jest-worker": "^26.6.2", + "source-map-support": "^0.5.6", + "throat": "^5.0.0" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-runner/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-runner/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-runner/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-runner/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-runner/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runner/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime": { + "version": "26.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^26.6.2", + "@jest/environment": "^26.6.2", + "@jest/fake-timers": "^26.6.2", + "@jest/globals": "^26.6.2", + "@jest/source-map": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/transform": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0", + "cjs-module-lexer": "^0.6.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.4", + "jest-config": "^26.6.3", + "jest-haste-map": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-mock": "^26.6.2", + "jest-regex-util": "^26.0.0", + "jest-resolve": "^26.6.2", + "jest-snapshot": "^26.6.2", + "jest-util": "^26.6.2", + "jest-validate": "^26.6.2", + "slash": "^3.0.0", + "strip-bom": "^4.0.0", + "yargs": "^15.4.1" + }, + "bin": { + "jest-runtime": "bin/jest-runtime.js" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-runtime/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-runtime/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-runtime/node_modules/cliui": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/jest-runtime/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-runtime/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-runtime/node_modules/get-caller-file": { + "version": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/jest-runtime/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime/node_modules/require-main-filename": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/jest-runtime/node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime/node_modules/which-module": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/jest-runtime/node_modules/wrap-ansi": { + "version": "6.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime/node_modules/yargs": { + "version": "15.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-runtime/node_modules/yargs-parser": { + "version": "18.1.3", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jest-serializer": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "graceful-fs": "^4.2.4" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-snapshot": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/babel__traverse": "^7.0.4", + "@types/prettier": "^2.0.0", + "chalk": "^4.0.0", + "expect": "^26.6.2", + "graceful-fs": "^4.2.4", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "jest-haste-map": "^26.6.2", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-resolve": "^26.6.2", + "natural-compare": "^1.4.0", + "pretty-format": "^26.6.2", + "semver": "^7.3.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-snapshot/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-snapshot/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-snapshot/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-snapshot/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.3.5", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/jest-util": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "@types/node": "*", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "is-ci": "^2.0.0", + "micromatch": "^4.0.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-util/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-util/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-util/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-util/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-util/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-util/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-validate": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "camelcase": "^6.0.0", + "chalk": "^4.0.0", + "jest-get-type": "^26.3.0", + "leven": "^3.1.0", + "pretty-format": "^26.6.2" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-validate/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-validate/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-validate/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-validate/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-validate/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-validate/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-watcher": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "jest-util": "^26.6.2", + "string-length": "^4.0.1" + }, + "engines": { + "node": ">= 10.14.2" + } + }, + "node_modules/jest-watcher/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/jest-watcher/node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/jest-watcher/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/jest-watcher/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-watcher/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-watcher/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-worker": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/jest-worker/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/jest-worker/node_modules/merge-stream": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jmespath": { + "version": "0.15.0", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/js-base64": { + "version": "2.6.4", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/js2xmlparser": { + "version": "3.0.0", + "license": "Apache-2.0", + "dependencies": { + "xmlcreate": "^1.0.1" + } + }, + "node_modules/jsbn": { + "version": "0.1.1", + "license": "MIT" + }, + "node_modules/jsdom": { + "version": "16.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "abab": "^2.0.5", + "acorn": "^8.2.4", + "acorn-globals": "^6.0.0", + "cssom": "^0.4.4", + "cssstyle": "^2.3.0", + "data-urls": "^2.0.0", + "decimal.js": "^10.2.1", + "domexception": "^2.0.1", + "escodegen": "^2.0.0", + "form-data": "^3.0.0", + "html-encoding-sniffer": "^2.0.1", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.0", + "parse5": "6.0.1", + "saxes": "^5.0.1", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.0.0", + "w3c-hr-time": "^1.0.2", + "w3c-xmlserializer": "^2.0.0", + "webidl-conversions": "^6.1.0", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.5.0", + "ws": "^7.4.6", + "xml-name-validator": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "canvas": "^2.5.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/acorn": { + "version": "8.7.0", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-bigint": { + "version": "0.3.1", + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "license": "MIT" + }, + "node_modules/json-loader": { + "version": "0.5.7", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema": { + "version": "0.4.0", + "license": "(AFL-2.1 OR BSD-3-Clause)" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "license": "ISC" + }, + "node_modules/json3": { + "version": "3.3.3", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/jsonparse": { + "version": "1.3.1", + "engines": [ + "node >= 0.2.0" + ], + "license": "MIT" + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, + "node_modules/jsprim": { + "version": "1.4.2", + "license": "MIT", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/jsprim/node_modules/core-util-is": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/jsprim/node_modules/verror": { + "version": "1.10.0", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/just-debounce": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/jwa": { + "version": "1.4.1", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "license": "MIT", + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/keyv": { + "version": "4.0.5", + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/killable": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/kind-of": { + "version": "6.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/last-run": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "default-resolution": "^2.0.0", + "es6-weak-map": "^2.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "dependencies": { + "package-json": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lazystream": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/lcid": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "invert-kv": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/ldap-filter": { + "version": "0.3.3", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/ldapjs": { + "version": "2.3.1", + "license": "MIT", + "dependencies": { + "abstract-logging": "^2.0.0", + "asn1": "^0.2.4", + "assert-plus": "^1.0.0", + "backoff": "^2.5.0", + "ldap-filter": "^0.3.3", + "once": "^1.4.0", + "vasync": "^2.2.0", + "verror": "^1.8.1" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/lead": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "flush-write-stream": "^1.0.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/libbase64": { + "version": "1.2.1", + "license": "MIT" + }, + "node_modules/libmime": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "encoding-japanese": "1.0.30", + "iconv-lite": "0.6.2", + "libbase64": "1.2.1", + "libqp": "1.1.0" + } + }, + "node_modules/libmime/node_modules/iconv-lite": { + "version": "0.6.2", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/liboneandone": { + "version": "1.2.0", + "license": "BSD", + "dependencies": { + "mocha": "^2.5.3", + "request": "^2.74.0" + } + }, + "node_modules/libqp": { + "version": "1.1.0", + "license": "MIT" + }, + "node_modules/liftoff": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "extend": "^3.0.0", + "findup-sync": "^3.0.0", + "fined": "^1.0.1", + "flagged-respawn": "^1.0.0", + "is-plain-object": "^2.0.4", + "object.map": "^1.0.0", + "rechoir": "^0.6.2", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "dev": true, + "license": "MIT" + }, + "node_modules/linkify-it": { + "version": "3.0.2", + "license": "MIT", + "dependencies": { + "uc.micro": "^1.0.1" + } + }, + "node_modules/load-json-file": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/load-json-file/node_modules/parse-json": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/load-json-file/node_modules/strip-bom": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-utf8": "^0.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/loader-runner": { + "version": "2.4.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.3.0 <5.0.0 || >=5.10" + } + }, + "node_modules/loader-utils": { + "version": "1.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/loader-utils/node_modules/json5": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "license": "MIT" + }, + "node_modules/lodash._basecopy": { + "version": "3.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._basetostring": { + "version": "3.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._basevalues": { + "version": "3.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._getnative": { + "version": "3.9.1", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._isiterateecall": { + "version": "3.0.9", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._reescape": { + "version": "3.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._reevaluate": { + "version": "3.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._reinterpolate": { + "version": "3.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash._root": { + "version": "3.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.escape": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash._root": "^3.0.0" + } + }, + "node_modules/lodash.groupby": { + "version": "4.6.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isarguments": { + "version": "3.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isarray": { + "version": "3.0.4", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.keys": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.mergewith": { + "version": "4.6.2", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.restparam": { + "version": "3.6.1", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.template": { + "version": "3.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash._basecopy": "^3.0.0", + "lodash._basetostring": "^3.0.0", + "lodash._basevalues": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0", + "lodash.keys": "^3.0.0", + "lodash.restparam": "^3.0.0", + "lodash.templatesettings": "^3.0.0" + } + }, + "node_modules/lodash.templatesettings": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0" + } + }, + "node_modules/lodash.truncate": { + "version": "4.4.2", + "dev": true, + "license": "MIT" + }, + "node_modules/loglevel": { + "version": "1.8.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + }, + "funding": { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/loglevel" + } + }, + "node_modules/long": { + "version": "4.0.0", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/loopback": { + "version": "3.28.0", + "license": "MIT", + "dependencies": { + "async": "^2.0.1", + "bcryptjs": "^2.1.0", + "bluebird": "^3.1.1", + "body-parser": "^1.12.0", + "canonical-json": "0.0.4", + "debug": "^2.1.2", + "depd": "^1.0.0", + "ejs": "^2.3.1", + "express": "^4.14.0", + "inflection": "^1.6.0", + "isemail": "^3.2.0", + "loopback-connector-remote": "^3.0.0", + "loopback-datasource-juggler": "^3.28.0", + "loopback-filters": "^1.0.0", + "loopback-phase": "^3.0.0", + "nodemailer": "^6.4.16", + "nodemailer-direct-transport": "^3.3.2", + "nodemailer-stub-transport": "^1.1.0", + "serve-favicon": "^2.2.0", + "stable": "^0.1.5", + "strong-globalize": "^4.1.1", + "strong-remoting": "^3.11.0", + "uid2": "0.0.3", + "underscore.string": "^3.3.5" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-boot": { + "version": "3.3.1", + "license": "MIT", + "dependencies": { + "async": "^2.4.0", + "bluebird": "^3.5.3", + "commondir": "^1.0.1", + "debug": "^4.1.1", + "lodash": "^4.17.11", + "semver": "^5.1.0", + "strong-globalize": "^4.1.1", + "toposort": "^2.0.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/loopback-boot/node_modules/semver": { + "version": "5.7.1", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/loopback-component-explorer": { + "version": "6.5.1", + "license": "MIT", + "dependencies": { + "debug": "^3.1.0", + "lodash": "^4.17.11", + "loopback-swagger": "^5.0.0", + "strong-globalize": "^4.1.1", + "swagger-ui": "^2.2.5" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/loopback-component-explorer/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/loopback-component-storage": { + "version": "3.6.1", + "license": "Artistic-2.0", + "dependencies": { + "async": "^2.6.1", + "debug": "^3.1.0", + "formidable": "^1.2.1", + "pkgcloud": "^2.0.0", + "strong-globalize": "^4.1.1", + "uuid": "^3.2.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-component-storage/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/loopback-connector": { + "version": "4.11.1", + "license": "MIT", + "dependencies": { + "async": "^3.2.0", + "bluebird": "^3.7.2", + "debug": "^4.1.1", + "msgpack5": "^4.2.0", + "strong-globalize": "^5.1.0", + "uuid": "^7.0.3" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/loopback-connector-mysql": { + "version": "5.4.4", + "license": "MIT", + "dependencies": { + "async": "^2.6.1", + "debug": "^3.1.0", + "lodash": "^4.17.11", + "loopback-connector": "^4.0.0", + "mysql": "^2.11.1", + "strong-globalize": "^5.0.5" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-connector-mysql/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/loopback-connector-mysql/node_modules/invert-kv": { + "version": "3.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sindresorhus/invert-kv?sponsor=1" + } + }, + "node_modules/loopback-connector-mysql/node_modules/lcid": { + "version": "3.1.1", + "license": "MIT", + "dependencies": { + "invert-kv": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-connector-mysql/node_modules/mem": { + "version": "5.1.1", + "license": "MIT", + "dependencies": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-connector-mysql/node_modules/mkdirp": { + "version": "0.5.5", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/loopback-connector-mysql/node_modules/os-locale": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "execa": "^4.0.0", + "lcid": "^3.0.0", + "mem": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loopback-connector-mysql/node_modules/strong-globalize": { + "version": "5.1.0", + "license": "Artistic-2.0", + "dependencies": { + "accept-language": "^3.0.18", + "debug": "^4.1.1", + "globalize": "^1.5.0", + "lodash": "^4.17.15", + "md5": "^2.2.1", + "mkdirp": "^0.5.5", + "os-locale": "^5.0.0", + "yamljs": "^0.3.0" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/loopback-connector-mysql/node_modules/strong-globalize/node_modules/debug": { + "version": "4.3.3", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/loopback-connector-remote": { + "version": "3.4.1", + "license": "MIT", + "dependencies": { + "loopback-datasource-juggler": "^3.0.0", + "strong-remoting": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/loopback-connector/node_modules/async": { + "version": "3.2.3", + "license": "MIT" + }, + "node_modules/loopback-connector/node_modules/invert-kv": { + "version": "3.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sindresorhus/invert-kv?sponsor=1" + } + }, + "node_modules/loopback-connector/node_modules/lcid": { + "version": "3.1.1", + "license": "MIT", + "dependencies": { + "invert-kv": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-connector/node_modules/mem": { + "version": "5.1.1", + "license": "MIT", + "dependencies": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-connector/node_modules/mkdirp": { + "version": "0.5.5", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/loopback-connector/node_modules/os-locale": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "execa": "^4.0.0", + "lcid": "^3.0.0", + "mem": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loopback-connector/node_modules/strong-globalize": { + "version": "5.1.0", + "license": "Artistic-2.0", + "dependencies": { + "accept-language": "^3.0.18", + "debug": "^4.1.1", + "globalize": "^1.5.0", + "lodash": "^4.17.15", + "md5": "^2.2.1", + "mkdirp": "^0.5.5", + "os-locale": "^5.0.0", + "yamljs": "^0.3.0" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/loopback-connector/node_modules/uuid": { + "version": "7.0.3", + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/loopback-context": { + "version": "3.5.2", + "license": "MIT", + "dependencies": { + "cls-hooked": "^4.2.0" + }, + "engines": { + "node": "^8.2.1 || ^10.14 || ^12.15" + } + }, + "node_modules/loopback-datasource-juggler": { + "version": "3.36.1", + "license": "MIT", + "dependencies": { + "async": "^2.6.0", + "bluebird": "^3.1.1", + "debug": "^3.1.0", + "depd": "^1.0.0", + "inflection": "^1.6.0", + "lodash": "^4.17.4", + "loopback-connector": "^4.4.0", + "minimatch": "^3.0.3", + "qs": "^6.5.0", + "shortid": "^2.2.6", + "strong-globalize": "^4.1.1", + "traverse": "^0.6.6", + "uuid": "^3.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-datasource-juggler/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/loopback-datasource-juggler/node_modules/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/loopback-datatype-geopoint": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/loopback-filters": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "debug": "^3.1.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/loopback-filters/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/loopback-phase": { + "version": "3.4.0", + "license": "MIT", + "dependencies": { + "async": "^2.6.1", + "debug": "^3.1.0", + "strong-globalize": "^4.1.1" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/loopback-phase/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/loopback-swagger": { + "version": "5.9.0", + "license": "MIT", + "dependencies": { + "async": "^2.1.4", + "debug": "^3.1.0", + "ejs": "^2.5.5", + "lodash": "^4.17.11", + "strong-globalize": "^4.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/loopback-swagger/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/loopback/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/loopback/node_modules/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/loopback/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/loud-rejection": { + "version": "1.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lower-case": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/lowercase-keys": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/mailparser": { + "version": "2.8.1", + "license": "(MIT OR EUPL-1.1+)", + "dependencies": { + "encoding-japanese": "1.0.30", + "he": "1.2.0", + "html-to-text": "5.1.1", + "iconv-lite": "0.6.2", + "libmime": "5.0.0", + "linkify-it": "3.0.2", + "mailsplit": "5.0.0", + "nodemailer": "6.4.11", + "tlds": "1.208.0" + } + }, + "node_modules/mailparser/node_modules/iconv-lite": { + "version": "0.6.2", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mailparser/node_modules/nodemailer": { + "version": "6.4.11", + "hasInstallScript": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/mailsplit": { + "version": "5.0.0", + "license": "(MIT OR EUPL-1.1+)", + "dependencies": { + "libbase64": "1.2.1", + "libmime": "4.2.1", + "libqp": "1.1.0" + } + }, + "node_modules/mailsplit/node_modules/iconv-lite": { + "version": "0.5.0", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mailsplit/node_modules/libmime": { + "version": "4.2.1", + "license": "MIT", + "dependencies": { + "encoding-japanese": "1.0.30", + "iconv-lite": "0.5.0", + "libbase64": "1.2.1", + "libqp": "1.1.0" + } + }, + "node_modules/make-dir": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/make-dir/node_modules/pify": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/make-iterator": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/make-plural": { + "version": "6.2.2", + "license": "ISC" + }, + "node_modules/makeerror": { + "version": "1.0.12", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/map-age-cleaner": { + "version": "0.1.3", + "license": "MIT", + "dependencies": { + "p-defer": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/map-cache": { + "version": "0.2.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/map-obj": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/map-stream": { + "version": "0.0.7", + "dev": true, + "license": "MIT" + }, + "node_modules/map-visit": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "object-visit": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "findup-sync": "^2.0.0", + "micromatch": "^3.0.4", + "resolve": "^1.4.0", + "stack-trace": "0.0.10" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/matchdep/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep/node_modules/findup-sync": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-file": "^1.0.0", + "is-glob": "^3.1.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/matchdep/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep/node_modules/is-glob": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/matchdep/node_modules/micromatch": { + "version": "3.1.10", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/math-interval-parser": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/md5": { + "version": "2.3.0", + "license": "BSD-3-Clause", + "dependencies": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "node_modules/md5.js": { + "version": "1.3.5", + "dev": true, + "license": "MIT", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/media-typer": { + "version": "0.3.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mem": { + "version": "4.3.0", + "license": "MIT", + "dependencies": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/memory-fs": { + "version": "0.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "node_modules/meow": { + "version": "3.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/meow/node_modules/find-up": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/meow/node_modules/path-exists": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/meow/node_modules/read-pkg": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/meow/node_modules/read-pkg-up": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.1", + "license": "MIT" + }, + "node_modules/merge-stream": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.1" + } + }, + "node_modules/messageformat": { + "version": "2.3.0", + "license": "MIT", + "dependencies": { + "make-plural": "^4.3.0", + "messageformat-formatters": "^2.0.1", + "messageformat-parser": "^4.1.2" + } + }, + "node_modules/messageformat-formatters": { + "version": "2.0.1", + "license": "MIT" + }, + "node_modules/messageformat-parser": { + "version": "4.1.3", + "license": "MIT" + }, + "node_modules/messageformat/node_modules/make-plural": { + "version": "4.3.0", + "license": "ISC", + "bin": { + "make-plural": "bin/make-plural" + }, + "optionalDependencies": { + "minimist": "^1.2.0" + } + }, + "node_modules/methods": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/micromatch": { + "version": "4.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/braces": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/micromatch/node_modules/fill-range": { + "version": "7.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/micromatch/node_modules/is-number": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/micromatch/node_modules/to-regex-range": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/miller-rabin": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" + } + }, + "node_modules/miller-rabin/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/mime": { + "version": "2.6.0", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mime-db": { + "version": "1.51.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.34", + "license": "MIT", + "dependencies": { + "mime-db": "1.51.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/mimic-response": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.0.4", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "license": "MIT" + }, + "node_modules/mississippi": { + "version": "3.0.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^3.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/mixin-deep": { + "version": "1.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mixin-deep/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "license": "MIT" + }, + "node_modules/mktmpdir": { + "version": "0.1.1", + "license": "MIT", + "dependencies": { + "rimraf": "~2.2.8" + } + }, + "node_modules/mktmpdir/node_modules/rimraf": { + "version": "2.2.8", + "license": "MIT", + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/mocha": { + "version": "2.5.3", + "license": "MIT", + "dependencies": { + "commander": "2.3.0", + "debug": "2.2.0", + "diff": "1.4.0", + "escape-string-regexp": "1.0.2", + "glob": "3.2.11", + "growl": "1.9.2", + "jade": "0.26.3", + "mkdirp": "0.5.1", + "supports-color": "1.2.0", + "to-iso-string": "0.0.2" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 0.8.x" + } + }, + "node_modules/mocha/node_modules/commander": { + "version": "2.3.0", + "engines": { + "node": ">= 0.6.x" + } + }, + "node_modules/mocha/node_modules/debug": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "ms": "0.7.1" + } + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "1.0.2", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "3.2.11", + "license": "BSD", + "dependencies": { + "inherits": "2", + "minimatch": "0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/lru-cache": { + "version": "2.7.3", + "license": "ISC" + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "0.3.0", + "license": "MIT", + "dependencies": { + "lru-cache": "2", + "sigmund": "~1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/minimist": { + "version": "0.0.8", + "license": "MIT" + }, + "node_modules/mocha/node_modules/mkdirp": { + "version": "0.5.1", + "license": "MIT", + "dependencies": { + "minimist": "0.0.8" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "0.7.1" + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "1.2.0", + "license": "MIT", + "bin": { + "supports-color": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/move-concurrently": { + "version": "1.0.1", + "dev": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + } + }, + "node_modules/move-concurrently/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/msgpack-js": { + "version": "0.3.0", + "dependencies": { + "bops": "~0.0.6" + } + }, + "node_modules/msgpack-js/node_modules/base64-js": { + "version": "0.0.2", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/msgpack-js/node_modules/bops": { + "version": "0.0.7", + "license": "MIT", + "dependencies": { + "base64-js": "0.0.2", + "to-utf8": "0.0.1" + } + }, + "node_modules/msgpack-stream": { + "version": "0.0.13", + "license": "MIT", + "dependencies": { + "bops": "1.0.0", + "msgpack-js": "0.3.0", + "through": "2.3.4" + } + }, + "node_modules/msgpack-stream/node_modules/through": { + "version": "2.3.4", + "license": "MIT" + }, + "node_modules/msgpack5": { + "version": "4.5.1", + "license": "MIT", + "dependencies": { + "bl": "^2.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.3.6", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/multicast-dns": { + "version": "6.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "dns-packet": "^1.3.1", + "thunky": "^1.0.2" + }, + "bin": { + "multicast-dns": "cli.js" + } + }, + "node_modules/multicast-dns-service-types": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/multipipe": { + "version": "0.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "duplexer2": "0.0.2" + } + }, + "node_modules/mustache": { + "version": "4.2.0", + "license": "MIT", + "bin": { + "mustache": "bin/mustache" + } + }, + "node_modules/mute-stdout": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/mux-demux": { + "version": "3.7.9", + "dependencies": { + "duplex": "~1.0.0", + "json-buffer": "~2.0.4", + "msgpack-stream": "~0.0.10", + "stream-combiner": "0.0.2", + "stream-serializer": "~1.1.1", + "through": "~2.3.1", + "xtend": "~1.0.3" + } + }, + "node_modules/mux-demux/node_modules/json-buffer": { + "version": "2.0.11", + "license": "MIT" + }, + "node_modules/mux-demux/node_modules/xtend": { + "version": "1.0.3", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/mysql": { + "version": "2.18.1", + "license": "MIT", + "dependencies": { + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mysql2": { + "version": "1.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "denque": "^1.4.1", + "generate-function": "^2.3.1", + "iconv-lite": "^0.5.0", + "long": "^4.0.0", + "lru-cache": "^5.1.1", + "named-placeholders": "^1.1.2", + "seq-queue": "^0.0.5", + "sqlstring": "^2.3.1" + }, + "engines": { + "node": ">= 8.0" + } + }, + "node_modules/mysql2/node_modules/iconv-lite": { + "version": "0.5.2", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/named-placeholders": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "lru-cache": "^4.1.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/named-placeholders/node_modules/lru-cache": { + "version": "4.1.5", + "dev": true, + "license": "ISC", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "node_modules/named-placeholders/node_modules/yallist": { + "version": "2.1.2", + "dev": true, + "license": "ISC" + }, + "node_modules/nan": { + "version": "2.15.0", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "2.1.11", + "license": "MIT" + }, + "node_modules/nanomatch": { + "version": "1.2.13", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nanomatch/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/napi-build-utils": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "0.6.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/neo-async": { + "version": "2.6.2", + "dev": true, + "license": "MIT" + }, + "node_modules/next-tick": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/nice-try": { + "version": "1.0.5", + "license": "MIT" + }, + "node_modules/no-case": { + "version": "2.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "lower-case": "^1.1.1" + } + }, + "node_modules/nocache": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/node-abi": { + "version": "2.30.1", + "license": "MIT", + "dependencies": { + "semver": "^5.4.1" + } + }, + "node_modules/node-abi/node_modules/semver": { + "version": "5.7.1", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/node-addon-api": { + "version": "3.2.1", + "license": "MIT" + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "2.6.6", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + } + }, + "node_modules/node-fetch/node_modules/tr46": { + "version": "0.0.3", + "license": "MIT" + }, + "node_modules/node-fetch/node_modules/webidl-conversions": { + "version": "3.0.1", + "license": "BSD-2-Clause" + }, + "node_modules/node-fetch/node_modules/whatwg-url": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/node-forge": { + "version": "0.10.0", + "license": "(BSD-3-Clause OR GPL-2.0)", + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/node-gyp": { + "version": "3.8.0", + "dev": true, + "license": "MIT", + "dependencies": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/node-gyp/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/node-gyp/node_modules/semver": { + "version": "5.3.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/node-gyp/node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/node-libs-browser": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^3.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.1", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.11.0", + "vm-browserify": "^1.0.1" + } + }, + "node_modules/node-libs-browser/node_modules/events": { + "version": "3.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/node-libs-browser/node_modules/punycode": { + "version": "1.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/node-libs-browser/node_modules/url": { + "version": "0.11.0", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/node-libs-browser/node_modules/url/node_modules/punycode": { + "version": "1.3.2", + "dev": true, + "license": "MIT" + }, + "node_modules/node-notifier": { + "version": "8.0.2", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "growly": "^1.3.0", + "is-wsl": "^2.2.0", + "semver": "^7.3.2", + "shellwords": "^0.1.1", + "uuid": "^8.3.0", + "which": "^2.0.2" + } + }, + "node_modules/node-notifier/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-notifier/node_modules/semver": { + "version": "7.3.5", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-notifier/node_modules/uuid": { + "version": "8.3.2", + "dev": true, + "license": "MIT", + "optional": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/node-notifier/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC", + "optional": true + }, + "node_modules/node-releases": { + "version": "2.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/node-sass": { + "version": "4.14.1", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "async-foreach": "^0.1.3", + "chalk": "^1.1.1", + "cross-spawn": "^3.0.0", + "gaze": "^1.0.0", + "get-stdin": "^4.0.1", + "glob": "^7.0.3", + "in-publish": "^2.0.0", + "lodash": "^4.17.15", + "meow": "^3.7.0", + "mkdirp": "^0.5.1", + "nan": "^2.13.2", + "node-gyp": "^3.8.0", + "npmlog": "^4.0.0", + "request": "^2.88.0", + "sass-graph": "2.2.5", + "stdout-stream": "^1.4.0", + "true-case-path": "^1.0.2" + }, + "bin": { + "node-sass": "bin/node-sass" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/ansi-regex": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/ansi-styles": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/chalk": { + "version": "1.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/cross-spawn": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "node_modules/node-sass/node_modules/lru-cache": { + "version": "4.1.5", + "dev": true, + "license": "ISC", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "node_modules/node-sass/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/node-sass/node_modules/strip-ansi": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/node-sass/node_modules/supports-color": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/node-sass/node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/node-sass/node_modules/yallist": { + "version": "2.1.2", + "dev": true, + "license": "ISC" + }, + "node_modules/node-ssh": { + "version": "11.1.1", + "license": "MIT", + "dependencies": { + "make-dir": "^3.1.0", + "sb-promise-queue": "^2.1.0", + "sb-scandir": "^3.1.0", + "shell-escape": "^0.2.0", + "ssh2": "^0.8.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/node-ssh/node_modules/make-dir": { + "version": "3.1.0", + "license": "MIT", + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/node.extend": { + "version": "2.0.2", + "dev": true, + "license": "(MIT OR GPL-2.0)", + "dependencies": { + "has": "^1.0.3", + "is": "^3.2.1" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/nodemailer": { + "version": "6.7.2", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/nodemailer-direct-transport": { + "version": "3.3.2", + "license": "MIT", + "dependencies": { + "nodemailer-shared": "1.1.0", + "smtp-connection": "2.12.0" + } + }, + "node_modules/nodemailer-fetch": { + "version": "1.6.0", + "license": "MIT" + }, + "node_modules/nodemailer-shared": { + "version": "1.1.0", + "license": "MIT", + "dependencies": { + "nodemailer-fetch": "1.6.0" + } + }, + "node_modules/nodemailer-stub-transport": { + "version": "1.1.0", + "license": "MIT" + }, + "node_modules/nodemon": { + "version": "2.0.16", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.16.tgz", + "integrity": "sha512-zsrcaOfTWRuUzBn3P44RDliLlp263Z/76FPoHFr3cFFkOz0lTPAcIw8dCzfdVIx/t3AtDYCZRCDkoCojJqaG3w==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/nodemon/node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/nodemon/node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nodemon/node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "3.2.7", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/nodemon/node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nodemon/node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nodemon/node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/nodemon/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/nodemon/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/nodemon/node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/nopt": { + "version": "3.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-url": { + "version": "6.1.0", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/now-and-later": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.3.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npmlog": { + "version": "4.1.2", + "license": "ISC", + "dependencies": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "node_modules/nth-check": { + "version": "2.0.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, + "node_modules/number-is-nan": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nwsapi": { + "version": "2.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/oauth-sign": { + "version": "0.9.0", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-copy": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-copy/node_modules/kind-of": { + "version": "3.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-diff": { + "version": "0.0.4", + "license": "MIT" + }, + "node_modules/object-inspect": { + "version": "1.12.0", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.5", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object-visit": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.assign": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.defaults": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.getownpropertydescriptors": { + "version": "2.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.map": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.pick": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object.reduce": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/obuf": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/on-finished": { + "version": "2.3.0", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/opn": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-wsl": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/opn/node_modules/is-wsl": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/optional": { + "version": "0.1.4", + "license": "MIT" + }, + "node_modules/optionator": { + "version": "0.9.1", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/options": { + "version": "0.0.6", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ordered-read-streams": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.1" + } + }, + "node_modules/original": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "url-parse": "^1.4.3" + } + }, + "node_modules/os-browserify": { + "version": "0.3.0", + "dev": true, + "license": "MIT" + }, + "node_modules/os-homedir": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-locale": { + "version": "3.1.0", + "license": "MIT", + "dependencies": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/os-locale/node_modules/cross-spawn": { + "version": "6.0.5", + "license": "MIT", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/os-locale/node_modules/execa": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/os-locale/node_modules/get-stream": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/os-locale/node_modules/is-stream": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-locale/node_modules/npm-run-path": { + "version": "2.0.2", + "license": "MIT", + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/os-locale/node_modules/path-key": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/os-locale/node_modules/semver": { + "version": "5.7.1", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/os-locale/node_modules/shebang-command": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-locale/node_modules/shebang-regex": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/os-locale/node_modules/which": { + "version": "1.3.1", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/osenv": { + "version": "0.1.5", + "dev": true, + "license": "ISC", + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "node_modules/p-cancelable": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/p-defer": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-each-series": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-event": { + "version": "4.2.0", + "license": "MIT", + "dependencies": { + "p-timeout": "^3.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-finally": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-is-promise": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-map": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/p-queue": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/p-retry": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "retry": "^0.12.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/p-timeout": { + "version": "3.2.0", + "license": "MIT", + "dependencies": { + "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "dependencies": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json/node_modules/@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "dependencies": { + "defer-to-connect": "^1.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json/node_modules/cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/package-json/node_modules/defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, + "node_modules/package-json/node_modules/got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/package-json/node_modules/got/node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json/node_modules/got/node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/package-json/node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "node_modules/package-json/node_modules/keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/package-json/node_modules/mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/package-json/node_modules/normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/package-json/node_modules/p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-json/node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/package-json/node_modules/responselike/node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/package-json/node_modules/to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pako": { + "version": "1.0.11", + "dev": true, + "license": "(MIT AND Zlib)" + }, + "node_modules/parallel-transform": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cyclist": "^1.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + } + }, + "node_modules/param-case": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "no-case": "^2.2.0" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-asn1": { + "version": "5.1.6", + "dev": true, + "license": "ISC", + "dependencies": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/parse-filepath": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-node-version": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/parse-passwd": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/parse5": { + "version": "6.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/pascal-case": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + } + }, + "node_modules/pascal-case/node_modules/lower-case": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.3" + } + }, + "node_modules/pascal-case/node_modules/no-case": { + "version": "3.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + }, + "node_modules/pascalcase": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-browserify": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/path-dirname": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/path-exists": { + "version": "4.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-is-inside": { + "version": "1.0.2", + "dev": true, + "license": "(WTFPL OR MIT)" + }, + "node_modules/path-key": { + "version": "3.1.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "dev": true, + "license": "MIT" + }, + "node_modules/path-root": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "path-root-regex": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-root-regex": { + "version": "0.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-to-regexp": { + "version": "0.1.7", + "license": "MIT" + }, + "node_modules/path-type": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "license": "MIT" + }, + "node_modules/performance-now": { + "version": "2.1.0", + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pirates": { + "version": "4.0.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/path-exists": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/pkgcloud": { + "version": "2.2.0", + "dependencies": { + "@google-cloud/storage": "^2.4.3", + "async": "^2.6.1", + "aws-sdk": "^2.382.0", + "errs": "^0.3.2", + "eventemitter2": "^5.0.1", + "fast-json-patch": "^2.1.0", + "filed-mimefix": "^0.1.3", + "ip": "^1.1.5", + "liboneandone": "^1.2.0", + "lodash": "^4.17.10", + "mime": "^2.4.1", + "qs": "^6.5.2", + "request": "^2.88.0", + "through2": "^3.0.1", + "url-join": "^4.0.0", + "xml2js": "^0.4.19" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/pkgcloud/node_modules/through2": { + "version": "3.0.2", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + }, + "node_modules/plugin-error": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^1.0.1", + "arr-diff": "^4.0.0", + "arr-union": "^3.1.0", + "extend-shallow": "^3.0.2" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/plugin-error/node_modules/ansi-colors": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-wrap": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/plugin-error/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/plugin-error/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/portfinder": { + "version": "1.0.28", + "dev": true, + "license": "MIT", + "dependencies": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.5" + }, + "engines": { + "node": ">= 0.12.0" + } + }, + "node_modules/portfinder/node_modules/debug": { + "version": "3.2.7", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/portfinder/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/posix-character-classes": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/posix-getopt": { + "version": "1.2.1", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/postcss": { + "version": "7.0.39", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^0.2.1", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + } + }, + "node_modules/postcss-modules-extract-imports": { + "version": "2.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "postcss": "^7.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss-modules-local-by-default": { + "version": "2.0.6", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss": "^7.0.6", + "postcss-selector-parser": "^6.0.0", + "postcss-value-parser": "^3.3.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss-modules-scope": { + "version": "2.2.0", + "dev": true, + "license": "ISC", + "dependencies": { + "postcss": "^7.0.6", + "postcss-selector-parser": "^6.0.0" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss-modules-values": { + "version": "2.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "icss-replace-symbols": "^1.1.0", + "postcss": "^7.0.6" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.0.8", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "3.3.1", + "dev": true, + "license": "MIT" + }, + "node_modules/postcss/node_modules/picocolors": { + "version": "0.2.1", + "dev": true, + "license": "ISC" + }, + "node_modules/postcss/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/prebuild-install": { + "version": "6.1.4", + "license": "MIT", + "dependencies": { + "detect-libc": "^1.0.3", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^2.21.0", + "npmlog": "^4.0.1", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^3.0.3", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/prebuild-install/node_modules/decompress-response": { + "version": "4.2.1", + "license": "MIT", + "dependencies": { + "mimic-response": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/prebuild-install/node_modules/simple-get": { + "version": "3.1.0", + "license": "MIT", + "dependencies": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/precond": { + "version": "0.2.3", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pretty-error": { + "version": "2.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.20", + "renderkid": "^2.0.4" + } + }, + "node_modules/pretty-format": { + "version": "26.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/pretty-format/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/pretty-format/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/pretty-hrtime": { + "version": "1.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/private": { + "version": "0.1.8", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/process": { + "version": "0.11.10", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "license": "MIT" + }, + "node_modules/progress": { + "version": "2.0.3", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/promise-inflight": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/prompts": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "license": "MIT" + }, + "node_modules/prr": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/pseudomap": { + "version": "1.0.2", + "license": "ISC" + }, + "node_modules/psl": { + "version": "1.8.0", + "license": "MIT" + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "dev": true, + "license": "MIT" + }, + "node_modules/public-encrypt": { + "version": "4.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/public-encrypt/node_modules/bn.js": { + "version": "4.12.0", + "dev": true, + "license": "MIT" + }, + "node_modules/pump": { + "version": "3.0.0", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pumpify": { + "version": "1.5.1", + "license": "MIT", + "dependencies": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + } + }, + "node_modules/pumpify/node_modules/pump": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "dependencies": { + "escape-goat": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/puppeteer": { + "version": "7.1.0", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "debug": "^4.1.0", + "devtools-protocol": "0.0.847576", + "extract-zip": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.1", + "pkg-dir": "^4.2.0", + "progress": "^2.0.1", + "proxy-from-env": "^1.1.0", + "rimraf": "^3.0.2", + "tar-fs": "^2.0.0", + "unbzip2-stream": "^1.3.3", + "ws": "^7.2.3" + }, + "engines": { + "node": ">=10.18.1" + } + }, + "node_modules/puppeteer/node_modules/pkg-dir": { + "version": "4.2.0", + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/puppeteer/node_modules/rimraf": { + "version": "3.0.2", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/qs": { + "version": "6.9.6", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/querystring": { + "version": "0.2.0", + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/querystring-es3": { + "version": "0.2.1", + "dev": true, + "engines": { + "node": ">=0.4.x" + } + }, + "node_modules/querystringify": { + "version": "2.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/randomfill": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "2.4.2", + "license": "MIT", + "dependencies": { + "bytes": "3.1.1", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/raw-body/node_modules/bytes": { + "version": "3.1.1", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/raw-loader": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "loader-utils": "^1.1.0", + "schema-utils": "^1.0.0" + }, + "engines": { + "node": ">= 6.9.0" + }, + "peerDependencies": { + "webpack": "^4.3.0" + } + }, + "node_modules/raw-loader/node_modules/schema-utils": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-is": { + "version": "17.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/read-chunk": { + "version": "3.2.0", + "license": "MIT", + "dependencies": { + "pify": "^4.0.1", + "with-open-file": "^0.1.6" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/read-chunk/node_modules/pify": { + "version": "4.0.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/read-pkg": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg-up": { + "version": "7.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/type-fest": { + "version": "0.8.1", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/read-pkg/node_modules/type-fest": { + "version": "0.6.0", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/readable-stream": { + "version": "2.3.7", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readdirp": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/readdirp/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readdirp/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readdirp/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readdirp/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readdirp/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readdirp/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/readdirp/node_modules/micromatch": { + "version": "3.1.10", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/recast": { + "version": "0.11.23", + "dev": true, + "license": "MIT", + "dependencies": { + "ast-types": "0.9.6", + "esprima": "~3.1.0", + "private": "~0.1.5", + "source-map": "~0.5.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/recast/node_modules/esprima": { + "version": "3.1.3", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/rechoir": { + "version": "0.6.2", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/redent": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/referrer-policy": { + "version": "1.2.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "dev": true, + "license": "MIT" + }, + "node_modules/regenerate-unicode-properties": { + "version": "9.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.9", + "license": "MIT" + }, + "node_modules/regenerator-transform": { + "version": "0.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.8.4" + } + }, + "node_modules/regex-not": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regex-not/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regex-not/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/regexpu-core": { + "version": "4.8.0", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^9.0.0", + "regjsgen": "^0.5.2", + "regjsparser": "^0.7.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "dependencies": { + "rc": "^1.2.8" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/regjsgen": { + "version": "0.5.2", + "dev": true, + "license": "MIT" + }, + "node_modules/regjsparser": { + "version": "0.7.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/relateurl": { + "version": "0.2.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/remove-bom-buffer": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5", + "is-utf8": "^0.2.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/remove-bom-stream": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "remove-bom-buffer": "^3.0.0", + "safe-buffer": "^5.1.0", + "through2": "^2.0.3" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/remove-trailing-separator": { + "version": "1.1.0", + "dev": true, + "license": "ISC" + }, + "node_modules/renderkid": { + "version": "2.0.7", + "dev": true, + "license": "MIT", + "dependencies": { + "css-select": "^4.1.3", + "dom-converter": "^0.2.0", + "htmlparser2": "^6.1.0", + "lodash": "^4.17.21", + "strip-ansi": "^3.0.1" + } + }, + "node_modules/renderkid/node_modules/ansi-regex": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/renderkid/node_modules/dom-serializer": { + "version": "1.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "node_modules/renderkid/node_modules/domelementtype": { + "version": "2.2.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "node_modules/renderkid/node_modules/domhandler": { + "version": "4.3.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "node_modules/renderkid/node_modules/domutils": { + "version": "2.8.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "node_modules/renderkid/node_modules/entities": { + "version": "2.2.0", + "dev": true, + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/renderkid/node_modules/htmlparser2": { + "version": "6.1.0", + "dev": true, + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "node_modules/renderkid/node_modules/strip-ansi": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/repeat-element": { + "version": "1.1.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/repeating": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-finite": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/replace-ext": { + "version": "0.0.1", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/replace-homedir": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "homedir-polyfill": "^1.0.1", + "is-absolute": "^1.0.0", + "remove-trailing-separator": "^1.1.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/request": { + "version": "2.88.2", + "license": "Apache-2.0", + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/request/node_modules/form-data": { + "version": "2.3.3", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/request/node_modules/qs": { + "version": "6.5.3", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/request/node_modules/tough-cookie": { + "version": "2.5.0", + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "1.0.1", + "dev": true, + "license": "ISC" + }, + "node_modules/require-yaml": { + "version": "0.0.1", + "license": "BSD", + "dependencies": { + "js-yaml": "" + } + }, + "node_modules/requires-port": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/resolve": { + "version": "1.21.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-dir": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-options": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "value-or-function": "^3.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/resolve-url": { + "version": "0.2.1", + "dev": true, + "license": "MIT" + }, + "node_modules/responselike": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "lowercase-keys": "^2.0.0" + } + }, + "node_modules/ret": { + "version": "0.1.15", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12" + } + }, + "node_modules/retry": { + "version": "0.12.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/retry-request": { + "version": "4.2.2", + "license": "MIT", + "dependencies": { + "debug": "^4.1.1", + "extend": "^3.0.2" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rsvp": { + "version": "4.8.5", + "dev": true, + "license": "MIT", + "engines": { + "node": "6.* || >= 7.*" + } + }, + "node_modules/run-queue": { + "version": "1.0.3", + "dev": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.1.1" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "license": "MIT" + }, + "node_modules/safe-regex": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ret": "~0.1.10" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/sane": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@cnakazawa/watch": "^1.0.3", + "anymatch": "^2.0.0", + "capture-exit": "^2.0.0", + "exec-sh": "^0.3.2", + "execa": "^1.0.0", + "fb-watchman": "^2.0.0", + "micromatch": "^3.1.4", + "minimist": "^1.1.1", + "walker": "~1.0.5" + }, + "bin": { + "sane": "src/cli.js" + }, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/sane/node_modules/cross-spawn": { + "version": "6.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/sane/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/execa": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sane/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/get-stream": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sane/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/is-stream": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/micromatch": { + "version": "3.1.10", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/npm-run-path": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/sane/node_modules/path-key": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/sane/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/sane/node_modules/shebang-command": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/shebang-regex": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sane/node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/sass-graph": { + "version": "2.2.5", + "dev": true, + "license": "MIT", + "dependencies": { + "glob": "^7.0.0", + "lodash": "^4.0.0", + "scss-tokenizer": "^0.2.3", + "yargs": "^13.3.2" + }, + "bin": { + "sassgraph": "bin/sassgraph" + } + }, + "node_modules/sass-graph/node_modules/ansi-regex": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/sass-graph/node_modules/cliui": { + "version": "5.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "node_modules/sass-graph/node_modules/emoji-regex": { + "version": "7.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/sass-graph/node_modules/find-up": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sass-graph/node_modules/get-caller-file": { + "version": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/sass-graph/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/sass-graph/node_modules/locate-path": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sass-graph/node_modules/p-locate": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sass-graph/node_modules/path-exists": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/sass-graph/node_modules/require-main-filename": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/sass-graph/node_modules/string-width": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sass-graph/node_modules/strip-ansi": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sass-graph/node_modules/which-module": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/sass-graph/node_modules/wrap-ansi": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/sass-graph/node_modules/yargs": { + "version": "13.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "node_modules/sass-graph/node_modules/yargs-parser": { + "version": "13.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "node_modules/sass-loader": { + "version": "7.3.1", + "dev": true, + "license": "MIT", + "dependencies": { + "clone-deep": "^4.0.1", + "loader-utils": "^1.0.1", + "neo-async": "^2.5.0", + "pify": "^4.0.1", + "semver": "^6.3.0" + }, + "engines": { + "node": ">= 6.9.0" + }, + "peerDependencies": { + "webpack": "^3.0.0 || ^4.0.0" + } + }, + "node_modules/sass-loader/node_modules/pify": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/sax": { + "version": "1.2.1", + "license": "ISC" + }, + "node_modules/saxes": { + "version": "5.0.1", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sb-promise-queue": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/sb-scandir": { + "version": "3.1.0", + "license": "MIT", + "dependencies": { + "sb-promise-queue": "^2.1.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/schema-utils": { + "version": "2.7.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 8.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/scss-tokenizer": { + "version": "0.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "js-base64": "^2.1.8", + "source-map": "^0.4.2" + } + }, + "node_modules/scss-tokenizer/node_modules/source-map": { + "version": "0.4.4", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "amdefine": ">=0.0.4" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/select-hose": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/selfsigned": { + "version": "1.10.14", + "dev": true, + "license": "MIT", + "dependencies": { + "node-forge": "^0.10.0" + } + }, + "node_modules/semver": { + "version": "6.3.0", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "dependencies": { + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/semver-greatest-satisfied-range": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "sver-compat": "^1.5.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/send": { + "version": "0.17.2", + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "1.8.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/send/node_modules/depd": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/send/node_modules/mime": { + "version": "1.6.0", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "node_modules/seq-queue": { + "version": "0.0.5", + "dev": true + }, + "node_modules/serialize-javascript": { + "version": "4.0.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/serve-favicon": { + "version": "2.5.0", + "license": "MIT", + "dependencies": { + "etag": "~1.8.1", + "fresh": "0.5.2", + "ms": "2.1.1", + "parseurl": "~1.3.2", + "safe-buffer": "5.1.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-favicon/node_modules/ms": { + "version": "2.1.1", + "license": "MIT" + }, + "node_modules/serve-favicon/node_modules/safe-buffer": { + "version": "5.1.1", + "license": "MIT" + }, + "node_modules/serve-index": { + "version": "1.9.1", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-index/node_modules/debug": { + "version": "2.6.9", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/serve-index/node_modules/depd": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/http-errors": { + "version": "1.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-index/node_modules/inherits": { + "version": "2.0.3", + "dev": true, + "license": "ISC" + }, + "node_modules/serve-index/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/serve-index/node_modules/setprototypeof": { + "version": "1.1.0", + "dev": true, + "license": "ISC" + }, + "node_modules/serve-static": { + "version": "1.14.2", + "license": "MIT", + "dependencies": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "license": "ISC" + }, + "node_modules/set-value": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "license": "ISC" + }, + "node_modules/sha.js": { + "version": "2.4.11", + "dev": true, + "license": "(MIT AND BSD-3-Clause)", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sharp": { + "version": "0.27.2", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "array-flatten": "^3.0.0", + "color": "^3.1.3", + "detect-libc": "^1.0.3", + "node-addon-api": "^3.1.0", + "npmlog": "^4.1.2", + "prebuild-install": "^6.0.1", + "semver": "^7.3.4", + "simple-get": "^4.0.0", + "tar-fs": "^2.1.1", + "tunnel-agent": "^0.6.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/sharp/node_modules/array-flatten": { + "version": "3.0.0", + "license": "MIT" + }, + "node_modules/sharp/node_modules/lru-cache": { + "version": "6.0.0", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp/node_modules/semver": { + "version": "7.3.5", + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp/node_modules/yallist": { + "version": "4.0.0", + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/shell-escape": { + "version": "0.2.0", + "license": "MIT" + }, + "node_modules/shellwords": { + "version": "0.1.1", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/shimmer": { + "version": "1.2.1", + "license": "BSD-2-Clause" + }, + "node_modules/shortid": { + "version": "2.2.16", + "license": "MIT", + "dependencies": { + "nanoid": "^2.1.0" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sigmund": { + "version": "1.0.1", + "license": "ISC" + }, + "node_modules/signal-exit": { + "version": "3.0.6", + "license": "ISC" + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/simple-get/node_modules/decompress-response": { + "version": "6.0.0", + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/simple-get/node_modules/mimic-response": { + "version": "3.1.0", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/simple-swizzle": { + "version": "0.2.2", + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.3.1" + } + }, + "node_modules/simple-swizzle/node_modules/is-arrayish": { + "version": "0.3.2", + "license": "MIT" + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/slash": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/slice-ansi/node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/smbhash": { + "version": "0.0.1", + "engines": [ + "node" + ], + "dependencies": { + "bigdecimal": ">= 0.6.0" + } + }, + "node_modules/smtp-connection": { + "version": "2.12.0", + "license": "MIT", + "dependencies": { + "httpntlm": "1.6.1", + "nodemailer-shared": "1.1.0" + } + }, + "node_modules/snakeize": { + "version": "0.1.0", + "license": "MIT" + }, + "node_modules/snapdragon": { + "version": "0.8.2", + "dev": true, + "license": "MIT", + "dependencies": { + "base": "^0.11.1", + "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.0", + "use": "^3.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/define-property": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-node/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-util": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.2.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon-util/node_modules/kind-of": { + "version": "3.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/snapdragon/node_modules/debug": { + "version": "2.6.9", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/snapdragon/node_modules/ms": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/sockjs": { + "version": "0.3.24", + "dev": true, + "license": "MIT", + "dependencies": { + "faye-websocket": "^0.11.3", + "uuid": "^8.3.2", + "websocket-driver": "^0.7.4" + } + }, + "node_modules/sockjs-client": { + "version": "1.5.2", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.6", + "eventsource": "^1.0.7", + "faye-websocket": "^0.11.3", + "inherits": "^2.0.4", + "json3": "^3.3.3", + "url-parse": "^1.5.3" + } + }, + "node_modules/sockjs-client/node_modules/debug": { + "version": "3.2.7", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/sockjs/node_modules/uuid": { + "version": "8.3.2", + "dev": true, + "license": "MIT", + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/source-list-map": { + "version": "2.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/source-map": { + "version": "0.5.7", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-resolve": { + "version": "0.5.3", + "dev": true, + "license": "MIT", + "dependencies": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-url": { + "version": "0.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/sparkles": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/spdx-correct": { + "version": "3.1.1", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.3.0", + "dev": true, + "license": "CC-BY-3.0" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.11", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/spdy": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/spdy-transport": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + } + }, + "node_modules/spdy-transport/node_modules/readable-stream": { + "version": "3.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/split-array-stream": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "is-stream-ended": "^0.1.4" + } + }, + "node_modules/split-string": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "extend-shallow": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/split-string/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/split-string/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.1.2", + "license": "BSD-3-Clause" + }, + "node_modules/sqlstring": { + "version": "2.3.1", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/sse": { + "version": "0.0.8", + "dependencies": { + "options": "0.0.6" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ssh2": { + "version": "0.8.9", + "dependencies": { + "ssh2-streams": "~0.4.10" + }, + "engines": { + "node": ">=5.2.0" + } + }, + "node_modules/ssh2-streams": { + "version": "0.4.10", + "dependencies": { + "asn1": "~0.2.0", + "bcrypt-pbkdf": "^1.0.2", + "streamsearch": "~0.1.2" + }, + "engines": { + "node": ">=5.2.0" + } + }, + "node_modules/sshpk": { + "version": "1.17.0", + "license": "MIT", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ssri": { + "version": "6.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "figgy-pudding": "^3.5.1" + } + }, + "node_modules/stable": { + "version": "0.1.8", + "license": "MIT" + }, + "node_modules/stack-chain": { + "version": "1.3.7", + "license": "MIT" + }, + "node_modules/stack-trace": { + "version": "0.0.10", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/stack-utils": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stack-utils/node_modules/escape-string-regexp": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/static-extend": { + "version": "0.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/statuses": { + "version": "1.5.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/stdout-stream": { + "version": "1.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.1" + } + }, + "node_modules/stream-browserify": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "node_modules/stream-combiner": { + "version": "0.0.2", + "license": "MIT", + "dependencies": { + "duplexer": "~0.0.3" + } + }, + "node_modules/stream-each": { + "version": "1.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } + }, + "node_modules/stream-events": { + "version": "1.0.5", + "license": "MIT", + "dependencies": { + "stubs": "^3.0.0" + } + }, + "node_modules/stream-exhaust": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/stream-http": { + "version": "2.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "node_modules/stream-serializer": { + "version": "1.1.2", + "license": "MIT" + }, + "node_modules/stream-shift": { + "version": "1.0.1", + "license": "MIT" + }, + "node_modules/streamsearch": { + "version": "0.1.2", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/ansi-regex": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { + "version": "3.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-eof": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-indent": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "get-stdin": "^4.0.1" + }, + "bin": { + "strip-indent": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strong-error-handler": { + "version": "2.3.2", + "license": "MIT", + "dependencies": { + "accepts": "^1.3.3", + "debug": "^2.2.0", + "ejs": "^2.5.7", + "http-status": "^1.0.0", + "js2xmlparser": "^3.0.0", + "strong-globalize": "^3.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-error-handler/node_modules/cross-spawn": { + "version": "5.1.0", + "license": "MIT", + "dependencies": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "node_modules/strong-error-handler/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/strong-error-handler/node_modules/execa": { + "version": "0.7.0", + "license": "MIT", + "dependencies": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-error-handler/node_modules/get-stream": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-error-handler/node_modules/invert-kv": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-error-handler/node_modules/is-stream": { + "version": "1.1.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-error-handler/node_modules/lcid": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "invert-kv": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-error-handler/node_modules/lru-cache": { + "version": "4.1.5", + "license": "ISC", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "node_modules/strong-error-handler/node_modules/mem": { + "version": "1.1.0", + "license": "MIT", + "dependencies": { + "mimic-fn": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-error-handler/node_modules/mimic-fn": { + "version": "1.2.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-error-handler/node_modules/mkdirp": { + "version": "0.5.5", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/strong-error-handler/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/strong-error-handler/node_modules/npm-run-path": { + "version": "2.0.2", + "license": "MIT", + "dependencies": { + "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-error-handler/node_modules/os-locale": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-error-handler/node_modules/path-key": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strong-error-handler/node_modules/shebang-command": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-error-handler/node_modules/shebang-regex": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-error-handler/node_modules/strong-globalize": { + "version": "3.3.0", + "license": "Artistic-2.0", + "dependencies": { + "accept-language": "^3.0.18", + "async": "^2.4.1", + "debug": "^3.1.0", + "esprima": "^4.0.0", + "estraverse": "^4.2.0", + "g11n-pipeline": "^2.0.1", + "globalize": "^1.3.0", + "htmlparser2": "^3.9.2", + "lodash": "^4.17.4", + "md5": "^2.2.1", + "mkdirp": "^0.5.1", + "mktmpdir": "^0.1.1", + "optional": "^0.1.3", + "os-locale": "^2.0.0", + "posix-getopt": "^1.2.0", + "word-count": "^0.2.2", + "xtend": "^4.0.1", + "yamljs": "^0.3.0" + }, + "bin": { + "slt-globalize": "bin/slt-globalize.js" + } + }, + "node_modules/strong-error-handler/node_modules/strong-globalize/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/strong-error-handler/node_modules/strong-globalize/node_modules/ms": { + "version": "2.1.3", + "license": "MIT" + }, + "node_modules/strong-error-handler/node_modules/which": { + "version": "1.3.1", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/strong-error-handler/node_modules/yallist": { + "version": "2.1.2", + "license": "ISC" + }, + "node_modules/strong-globalize": { + "version": "4.1.3", + "license": "Artistic-2.0", + "dependencies": { + "accept-language": "^3.0.18", + "debug": "^4.1.1", + "globalize": "^1.4.2", + "lodash": "^4.17.4", + "md5": "^2.2.1", + "mkdirp": "^0.5.1", + "os-locale": "^3.1.0", + "yamljs": "^0.3.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/strong-globalize/node_modules/mkdirp": { + "version": "0.5.5", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/strong-remoting": { + "version": "3.17.0", + "license": "Artistic-2.0", + "dependencies": { + "async": "^3.1.0", + "body-parser": "^1.12.4", + "debug": "^4.1.1", + "depd": "^2.0.0", + "escape-string-regexp": "^2.0.0", + "eventemitter2": "^5.0.1", + "express": "4.x", + "inflection": "^1.7.1", + "jayson": "^2.0.5", + "js2xmlparser": "^3.0.0", + "loopback-datatype-geopoint": "^1.0.0", + "loopback-phase": "^3.1.0", + "mux-demux": "^3.7.9", + "qs": "^6.2.1", + "request": "^2.83.0", + "sse": "0.0.8", + "strong-error-handler": "^3.0.0", + "strong-globalize": "^5.0.2", + "traverse": "^0.6.6", + "xml2js": "^0.4.8" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strong-remoting/node_modules/async": { + "version": "3.2.3", + "license": "MIT" + }, + "node_modules/strong-remoting/node_modules/ejs": { + "version": "3.1.6", + "license": "Apache-2.0", + "dependencies": { + "jake": "^10.6.1" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strong-remoting/node_modules/escape-string-regexp": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strong-remoting/node_modules/invert-kv": { + "version": "3.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sindresorhus/invert-kv?sponsor=1" + } + }, + "node_modules/strong-remoting/node_modules/lcid": { + "version": "3.1.1", + "license": "MIT", + "dependencies": { + "invert-kv": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strong-remoting/node_modules/mem": { + "version": "5.1.1", + "license": "MIT", + "dependencies": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strong-remoting/node_modules/os-locale": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "execa": "^4.0.0", + "lcid": "^3.0.0", + "mem": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strong-remoting/node_modules/strong-error-handler": { + "version": "3.5.0", + "license": "MIT", + "dependencies": { + "@types/express": "^4.16.0", + "accepts": "^1.3.3", + "debug": "^4.1.1", + "ejs": "^3.1.3", + "fast-safe-stringify": "^2.0.6", + "http-status": "^1.1.2", + "js2xmlparser": "^4.0.0", + "strong-globalize": "^6.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/strong-remoting/node_modules/strong-error-handler/node_modules/js2xmlparser": { + "version": "4.0.2", + "license": "Apache-2.0", + "dependencies": { + "xmlcreate": "^2.0.4" + } + }, + "node_modules/strong-remoting/node_modules/strong-error-handler/node_modules/strong-globalize": { + "version": "6.0.5", + "license": "Artistic-2.0", + "dependencies": { + "accept-language": "^3.0.18", + "debug": "^4.2.0", + "globalize": "^1.6.0", + "lodash": "^4.17.20", + "md5": "^2.3.0", + "mkdirp": "^1.0.4", + "os-locale": "^5.0.0", + "yamljs": "^0.3.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/strong-remoting/node_modules/strong-globalize": { + "version": "5.1.0", + "license": "Artistic-2.0", + "dependencies": { + "accept-language": "^3.0.18", + "debug": "^4.1.1", + "globalize": "^1.5.0", + "lodash": "^4.17.15", + "md5": "^2.2.1", + "mkdirp": "^0.5.5", + "os-locale": "^5.0.0", + "yamljs": "^0.3.0" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/strong-remoting/node_modules/strong-globalize/node_modules/mkdirp": { + "version": "0.5.5", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/strong-remoting/node_modules/xmlcreate": { + "version": "2.0.4", + "license": "Apache-2.0" + }, + "node_modules/stubs": { + "version": "3.0.0", + "license": "MIT" + }, + "node_modules/style-loader": { + "version": "0.23.1", + "dev": true, + "license": "MIT", + "dependencies": { + "loader-utils": "^1.1.0", + "schema-utils": "^1.0.0" + }, + "engines": { + "node": ">= 0.12.0" + } + }, + "node_modules/style-loader/node_modules/schema-utils": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-hyperlinks": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks/node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-hyperlinks/node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/sver-compat": { + "version": "1.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/swagger-client": { + "version": "3.18.1", + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime-corejs3": "^7.11.2", + "btoa": "^1.2.1", + "cookie": "~0.4.1", + "cross-fetch": "^3.1.4", + "deepmerge": "~4.2.2", + "fast-json-patch": "^3.0.0-1", + "form-data-encoder": "^1.4.3", + "formdata-node": "^4.0.0", + "is-plain-object": "^5.0.0", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "qs": "^6.10.2", + "traverse": "~0.6.6", + "url": "~0.11.0" + } + }, + "node_modules/swagger-client/node_modules/argparse": { + "version": "2.0.1", + "license": "Python-2.0" + }, + "node_modules/swagger-client/node_modules/fast-json-patch": { + "version": "3.1.0", + "license": "MIT" + }, + "node_modules/swagger-client/node_modules/is-plain-object": { + "version": "5.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/swagger-client/node_modules/js-yaml": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/swagger-client/node_modules/punycode": { + "version": "1.3.2", + "license": "MIT" + }, + "node_modules/swagger-client/node_modules/qs": { + "version": "6.10.3", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/swagger-client/node_modules/url": { + "version": "0.11.0", + "license": "MIT", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/swagger-ui": { + "version": "2.2.10", + "license": "Apache-2.0" + }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "dev": true, + "license": "MIT" + }, + "node_modules/table": { + "version": "6.8.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/table/node_modules/ajv": { + "version": "8.8.2", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/table/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/table/node_modules/json-schema-traverse": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/table/node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tapable": { + "version": "1.1.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/tar": { + "version": "2.2.2", + "dev": true, + "license": "ISC", + "dependencies": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + }, + "node_modules/tar-fs": { + "version": "2.1.1", + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/bl": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/tar-stream/node_modules/buffer": { + "version": "5.7.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.0", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/teeny-request": { + "version": "3.11.3", + "license": "Apache-2.0", + "dependencies": { + "https-proxy-agent": "^2.2.1", + "node-fetch": "^2.2.0", + "uuid": "^3.3.2" + } + }, + "node_modules/teeny-request/node_modules/agent-base": { + "version": "4.3.0", + "license": "MIT", + "dependencies": { + "es6-promisify": "^5.0.0" + }, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/teeny-request/node_modules/debug": { + "version": "3.2.7", + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/teeny-request/node_modules/https-proxy-agent": { + "version": "2.2.4", + "license": "MIT", + "dependencies": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + }, + "engines": { + "node": ">= 4.5.0" + } + }, + "node_modules/terminal-link": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-escapes": "^4.2.1", + "supports-hyperlinks": "^2.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/terser": { + "version": "4.8.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "1.4.5", + "dev": true, + "license": "MIT", + "dependencies": { + "cacache": "^12.0.2", + "find-cache-dir": "^2.1.0", + "is-wsl": "^1.1.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^4.0.0", + "source-map": "^0.6.1", + "terser": "^4.1.2", + "webpack-sources": "^1.4.0", + "worker-farm": "^1.7.0" + }, + "engines": { + "node": ">= 6.9.0" + }, + "peerDependencies": { + "webpack": "^4.0.0" + } + }, + "node_modules/terser-webpack-plugin/node_modules/is-wsl": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/terser-webpack-plugin/node_modules/schema-utils": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/terser-webpack-plugin/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "dev": true, + "license": "MIT" + }, + "node_modules/terser/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/throat": { + "version": "5.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/through": { + "version": "2.3.8", + "license": "MIT" + }, + "node_modules/through2": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "node_modules/through2-filter": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "through2": "~2.0.0", + "xtend": "~4.0.0" + } + }, + "node_modules/thunky": { + "version": "1.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/time-stamp": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/timers-browserify": { + "version": "2.0.12", + "dev": true, + "license": "MIT", + "dependencies": { + "setimmediate": "^1.0.4" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/tlds": { + "version": "1.208.0", + "license": "MIT", + "bin": { + "tlds": "bin.js" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-absolute-glob": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-arraybuffer": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/to-iso-string": { + "version": "0.0.2", + "license": "MIT" + }, + "node_modules/to-object-path": { + "version": "0.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-object-path/node_modules/kind-of": { + "version": "3.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-readable-stream": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/to-regex": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex-range": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-regex/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/to-through": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "through2": "^2.0.3" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/to-utf8": { + "version": "0.0.1", + "license": "MIT" + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/toposort": { + "version": "2.0.2", + "license": "MIT" + }, + "node_modules/touch": { + "version": "3.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "nopt": "~1.0.10" + }, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/touch/node_modules/nopt": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "dependencies": { + "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" + } + }, + "node_modules/tough-cookie": { + "version": "4.0.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tr46": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/traverse": { + "version": "0.6.6", + "license": "MIT" + }, + "node_modules/trim-newlines": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/true-case-path": { + "version": "1.0.3", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "glob": "^7.1.2" + } + }, + "node_modules/tryit": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/tslib": { + "version": "2.3.1", + "dev": true, + "license": "0BSD" + }, + "node_modules/tty-browserify": { + "version": "0.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/tweetnacl": { + "version": "0.14.5", + "license": "Unlicense" + }, + "node_modules/type": { + "version": "1.2.0", + "dev": true, + "license": "ISC" + }, + "node_modules/type-check": { + "version": "0.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.10.0", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/type-is": { + "version": "1.6.18", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typedarray": { + "version": "0.0.6", + "license": "MIT" + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "dev": true, + "license": "MIT", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/uc.micro": { + "version": "1.0.6", + "license": "MIT" + }, + "node_modules/uglify-js": { + "version": "3.4.10", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "commander": "~2.19.0", + "source-map": "~0.6.1" + }, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/uglify-js/node_modules/commander": { + "version": "2.19.0", + "dev": true, + "license": "MIT" + }, + "node_modules/uglify-js/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/uid2": { + "version": "0.0.3" + }, + "node_modules/unbox-primitive": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unbzip2-stream": { + "version": "1.4.3", + "license": "MIT", + "dependencies": { + "buffer": "^5.2.1", + "through": "^2.3.8" + } + }, + "node_modules/unbzip2-stream/node_modules/buffer": { + "version": "5.7.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/unc-path-regex": { + "version": "0.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/undefsafe": { + "version": "2.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/underscore": { + "version": "1.7.0" + }, + "node_modules/underscore.string": { + "version": "3.3.5", + "license": "MIT", + "dependencies": { + "sprintf-js": "^1.0.3", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/undertaker": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "bach": "^1.0.0", + "collection-map": "^1.0.0", + "es6-weak-map": "^2.0.1", + "fast-levenshtein": "^1.0.0", + "last-run": "^1.1.0", + "object.defaults": "^1.0.0", + "object.reduce": "^1.0.0", + "undertaker-registry": "^1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/undertaker-registry": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/undertaker/node_modules/fast-levenshtein": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/union-value": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unique-filename": { + "version": "1.1.1", + "dev": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^2.0.0" + } + }, + "node_modules/unique-slug": { + "version": "2.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + } + }, + "node_modules/unique-stream": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "dependencies": { + "json-stable-stringify-without-jsonify": "^1.0.1", + "through2-filter": "^3.0.0" + } + }, + "node_modules/unique-string": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "crypto-random-string": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/universalify": { + "version": "0.1.2", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/unset-value": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unset-value/node_modules/has-value": { + "version": "0.3.1", + "dev": true, + "license": "MIT", + "dependencies": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unset-value/node_modules/has-value/node_modules/isobject": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "isarray": "1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/unset-value/node_modules/has-values": { + "version": "0.1.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/upath": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4", + "yarn": "*" + } + }, + "node_modules/update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "dependencies": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/yeoman/update-notifier?sponsor=1" + } + }, + "node_modules/update-notifier/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/update-notifier/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/update-notifier/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/update-notifier/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/update-notifier/node_modules/configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "dependencies": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/update-notifier/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/update-notifier/node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/update-notifier/node_modules/semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/update-notifier/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/update-notifier/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/upper-case": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/urix": { + "version": "0.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/url": { + "version": "0.10.3", + "license": "MIT", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/url-join": { + "version": "4.0.1", + "license": "MIT" + }, + "node_modules/url-parse": { + "version": "1.5.4", + "dev": true, + "license": "MIT", + "dependencies": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "node_modules/url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "dependencies": { + "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/url/node_modules/punycode": { + "version": "1.3.2", + "license": "MIT" + }, + "node_modules/use": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/utf7": { + "version": "1.0.2", + "dependencies": { + "semver": "~5.3.0" + } + }, + "node_modules/utf7/node_modules/semver": { + "version": "5.3.0", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/util": { + "version": "0.11.1", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/util.promisify": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, + "node_modules/util/node_modules/inherits": { + "version": "2.0.3", + "dev": true, + "license": "ISC" + }, + "node_modules/utila": { + "version": "0.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/utils-merge": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/uuid": { + "version": "3.4.0", + "license": "MIT", + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-to-istanbul": { + "version": "7.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/source-map": { + "version": "0.7.3", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 8" + } + }, + "node_modules/v8flags": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/value-or-function": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vasync": { + "version": "2.2.1", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT", + "dependencies": { + "verror": "1.10.0" + } + }, + "node_modules/vasync/node_modules/core-util-is": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/vasync/node_modules/verror": { + "version": "1.10.0", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "node_modules/verror": { + "version": "1.10.1", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/verror/node_modules/core-util-is": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/vinyl": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vinyl-bufferstream": { + "version": "1.0.1", + "dev": true, + "dependencies": { + "bufferstreams": "1.0.1" + } + }, + "node_modules/vinyl-bufferstream/node_modules/bufferstreams": { + "version": "1.0.1", + "dev": true, + "dependencies": { + "readable-stream": "^1.0.33" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/vinyl-bufferstream/node_modules/isarray": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/vinyl-bufferstream/node_modules/readable-stream": { + "version": "1.1.14", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "node_modules/vinyl-bufferstream/node_modules/string_decoder": { + "version": "0.10.31", + "dev": true, + "license": "MIT" + }, + "node_modules/vinyl-fs": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "fs-mkdirp-stream": "^1.0.0", + "glob-stream": "^6.1.0", + "graceful-fs": "^4.0.0", + "is-valid-glob": "^1.0.0", + "lazystream": "^1.0.0", + "lead": "^1.0.0", + "object.assign": "^4.0.4", + "pumpify": "^1.3.5", + "readable-stream": "^2.3.3", + "remove-bom-buffer": "^3.0.0", + "remove-bom-stream": "^1.2.0", + "resolve-options": "^1.1.0", + "through2": "^2.0.0", + "to-through": "^2.0.0", + "value-or-function": "^3.0.0", + "vinyl": "^2.0.0", + "vinyl-sourcemap": "^1.1.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vinyl-sourcemap": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "append-buffer": "^1.0.2", + "convert-source-map": "^1.5.0", + "graceful-fs": "^4.1.6", + "normalize-path": "^2.1.1", + "now-and-later": "^2.0.0", + "remove-bom-buffer": "^3.0.0", + "vinyl": "^2.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vinyl-sourcemap/node_modules/normalize-path": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "remove-trailing-separator": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/vinyl/node_modules/replace-ext": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/vm-browserify": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/vn-loopback": { + "resolved": "loopback", + "link": true + }, + "node_modules/vn-print": { + "resolved": "print", + "link": true + }, + "node_modules/w3c-hr-time": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "browser-process-hrtime": "^1.0.0" + } + }, + "node_modules/w3c-xmlserializer": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^3.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/watchpack": { + "version": "1.7.5", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0" + }, + "optionalDependencies": { + "chokidar": "^3.4.1", + "watchpack-chokidar2": "^2.0.1" + } + }, + "node_modules/watchpack-chokidar2": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "chokidar": "^2.1.8" + } + }, + "node_modules/watchpack/node_modules/anymatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "optional": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/watchpack/node_modules/binary-extensions": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/watchpack/node_modules/braces": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/watchpack/node_modules/chokidar": { + "version": "3.5.2", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/watchpack/node_modules/fill-range": { + "version": "7.0.1", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/watchpack/node_modules/is-binary-path": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/watchpack/node_modules/is-number": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/watchpack/node_modules/readdirp": { + "version": "3.6.0", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/watchpack/node_modules/to-regex-range": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/wbuf": { + "version": "1.7.3", + "dev": true, + "license": "MIT", + "dependencies": { + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/web-streams-polyfill": { + "version": "4.0.0-beta.1", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/webidl-conversions": { + "version": "6.1.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=10.4" + } + }, + "node_modules/webpack": { + "version": "4.46.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-module-context": "1.9.0", + "@webassemblyjs/wasm-edit": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0", + "acorn": "^6.4.1", + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^4.5.0", + "eslint-scope": "^4.0.3", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^2.4.0", + "loader-utils": "^1.2.3", + "memory-fs": "^0.4.1", + "micromatch": "^3.1.10", + "mkdirp": "^0.5.3", + "neo-async": "^2.6.1", + "node-libs-browser": "^2.2.1", + "schema-utils": "^1.0.0", + "tapable": "^1.1.3", + "terser-webpack-plugin": "^1.4.3", + "watchpack": "^1.7.4", + "webpack-sources": "^1.4.1" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=6.11.5" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + }, + "webpack-command": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "3.3.12", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^2.4.2", + "cross-spawn": "^6.0.5", + "enhanced-resolve": "^4.1.1", + "findup-sync": "^3.0.0", + "global-modules": "^2.0.0", + "import-local": "^2.0.0", + "interpret": "^1.4.0", + "loader-utils": "^1.4.0", + "supports-color": "^6.1.0", + "v8-compile-cache": "^2.1.1", + "yargs": "^13.3.2" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=6.11.5" + }, + "peerDependencies": { + "webpack": "4.x.x" + } + }, + "node_modules/webpack-cli/node_modules/ansi-regex": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/cliui": { + "version": "5.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "node_modules/webpack-cli/node_modules/cross-spawn": { + "version": "6.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/webpack-cli/node_modules/emoji-regex": { + "version": "7.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/webpack-cli/node_modules/find-up": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/get-caller-file": { + "version": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/webpack-cli/node_modules/global-modules": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "global-prefix": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/global-prefix": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/import-local": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-cli/node_modules/locate-path": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/p-locate": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/path-exists": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-cli/node_modules/path-key": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-cli/node_modules/require-main-filename": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/webpack-cli/node_modules/resolve-cwd": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-cli/node_modules/resolve-from": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-cli/node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/webpack-cli/node_modules/shebang-command": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-cli/node_modules/shebang-regex": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-cli/node_modules/string-width": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/strip-ansi": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/supports-color": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/webpack-cli/node_modules/which-module": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/webpack-cli/node_modules/wrap-ansi": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-cli/node_modules/yargs": { + "version": "13.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "node_modules/webpack-cli/node_modules/yargs-parser": { + "version": "13.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "node_modules/webpack-dev-middleware": { + "version": "3.7.3", + "dev": true, + "license": "MIT", + "dependencies": { + "memory-fs": "^0.4.1", + "mime": "^2.4.4", + "mkdirp": "^0.5.1", + "range-parser": "^1.2.1", + "webpack-log": "^2.0.0" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, + "node_modules/webpack-dev-middleware/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/webpack-dev-server": { + "version": "3.11.3", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-html-community": "0.0.8", + "bonjour": "^3.5.0", + "chokidar": "^2.1.8", + "compression": "^1.7.4", + "connect-history-api-fallback": "^1.6.0", + "debug": "^4.1.1", + "del": "^4.1.1", + "express": "^4.17.1", + "html-entities": "^1.3.1", + "http-proxy-middleware": "0.19.1", + "import-local": "^2.0.0", + "internal-ip": "^4.3.0", + "ip": "^1.1.5", + "is-absolute-url": "^3.0.3", + "killable": "^1.0.1", + "loglevel": "^1.6.8", + "opn": "^5.5.0", + "p-retry": "^3.0.1", + "portfinder": "^1.0.26", + "schema-utils": "^1.0.0", + "selfsigned": "^1.10.8", + "semver": "^6.3.0", + "serve-index": "^1.9.1", + "sockjs": "^0.3.21", + "sockjs-client": "^1.5.0", + "spdy": "^4.0.2", + "strip-ansi": "^3.0.1", + "supports-color": "^6.1.0", + "url": "^0.11.0", + "webpack-dev-middleware": "^3.7.2", + "webpack-log": "^2.0.0", + "ws": "^6.2.1", + "yargs": "^13.3.2" + }, + "bin": { + "webpack-dev-server": "bin/webpack-dev-server.js" + }, + "engines": { + "node": ">= 6.11.5" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-dev-server/node_modules/ansi-regex": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-dev-server/node_modules/cliui": { + "version": "5.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "node_modules/webpack-dev-server/node_modules/cliui/node_modules/ansi-regex": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/cliui/node_modules/strip-ansi": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/del": { + "version": "4.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/glob": "^7.1.1", + "globby": "^6.1.0", + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "pify": "^4.0.1", + "rimraf": "^2.6.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/del/node_modules/pify": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/emoji-regex": { + "version": "7.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/webpack-dev-server/node_modules/find-up": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/get-caller-file": { + "version": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/webpack-dev-server/node_modules/globby": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-dev-server/node_modules/import-local": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-dev-server/node_modules/is-path-cwd": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/is-path-in-cwd": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-path-inside": "^2.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/is-path-inside": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "path-is-inside": "^1.0.2" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/locate-path": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/p-locate": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/path-exists": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-dev-server/node_modules/punycode": { + "version": "1.3.2", + "dev": true, + "license": "MIT" + }, + "node_modules/webpack-dev-server/node_modules/require-main-filename": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/webpack-dev-server/node_modules/resolve-cwd": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-dev-server/node_modules/resolve-from": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/webpack-dev-server/node_modules/schema-utils": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/webpack-dev-server/node_modules/string-width": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/string-width/node_modules/ansi-regex": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/string-width/node_modules/strip-ansi": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/strip-ansi": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack-dev-server/node_modules/supports-color": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/url": { + "version": "0.11.0", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "node_modules/webpack-dev-server/node_modules/which-module": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/webpack-dev-server/node_modules/wrap-ansi": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-dev-server/node_modules/ws": { + "version": "6.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "async-limiter": "~1.0.0" + } + }, + "node_modules/webpack-dev-server/node_modules/yargs": { + "version": "13.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "node_modules/webpack-dev-server/node_modules/yargs-parser": { + "version": "13.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "node_modules/webpack-log": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^3.0.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/webpack-log/node_modules/ansi-colors": { + "version": "3.2.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/webpack-merge": { + "version": "4.2.2", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.15" + } + }, + "node_modules/webpack-sources": { + "version": "1.4.3", + "dev": true, + "license": "MIT", + "dependencies": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + } + }, + "node_modules/webpack-sources/node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack/node_modules/acorn": { + "version": "6.4.2", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/webpack/node_modules/define-property": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack/node_modules/eslint-scope": { + "version": "4.0.3", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/webpack/node_modules/extend-shallow": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack/node_modules/is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack/node_modules/is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack/node_modules/is-descriptor": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack/node_modules/is-extendable": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-plain-object": "^2.0.4" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack/node_modules/micromatch": { + "version": "3.1.10", + "dev": true, + "license": "MIT", + "dependencies": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/webpack/node_modules/mkdirp": { + "version": "0.5.5", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/webpack/node_modules/schema-utils": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + }, + "engines": { + "node": ">= 4" + } + }, + "node_modules/websocket-driver": { + "version": "0.7.4", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/websocket-extensions": { + "version": "0.1.4", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/whatwg-encoding": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "iconv-lite": "0.4.24" + } + }, + "node_modules/whatwg-mimetype": { + "version": "2.3.0", + "dev": true, + "license": "MIT" + }, + "node_modules/whatwg-url": { + "version": "8.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.7.0", + "tr46": "^2.1.0", + "webidl-conversions": "^6.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/which": { + "version": "2.0.2", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-module": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/wide-align": { + "version": "1.1.5", + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/with-open-file": { + "version": "0.1.7", + "license": "MIT", + "dependencies": { + "p-finally": "^1.0.0", + "p-try": "^2.1.0", + "pify": "^4.0.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/with-open-file/node_modules/pify": { + "version": "4.0.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/word-count": { + "version": "0.2.2", + "license": "MIT" + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/worker-farm": { + "version": "1.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "errno": "~0.1.7" + } + }, + "node_modules/wrap-ansi": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/ws": { + "version": "7.5.6", + "license": "MIT", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/x-xss-protection": { + "version": "1.3.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xdg-basedir": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/xml": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/xml-name-validator": { + "version": "3.0.0", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/xml2js": { + "version": "0.4.23", + "license": "MIT", + "dependencies": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/xmlbuilder": { + "version": "11.0.1", + "license": "MIT", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/xmlcreate": { + "version": "1.0.2", + "license": "Apache-2.0" + }, + "node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "dev": true, + "license": "ISC" + }, + "node_modules/yallist": { + "version": "3.1.1", + "license": "ISC" + }, + "node_modules/yaml-loader": { + "version": "0.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "js-yaml": "^3.5.2" + } + }, + "node_modules/yamljs": { + "version": "0.3.0", + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "glob": "^7.0.5" + }, + "bin": { + "json2yaml": "bin/json2yaml", + "yaml2json": "bin/yaml2json" + } + }, + "node_modules/yargs": { + "version": "7.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "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.1" + } + }, + "node_modules/yargs-parser": { + "version": "5.0.1", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^3.0.0", + "object.assign": "^4.1.0" + } + }, + "node_modules/yargs-parser/node_modules/camelcase": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/camelcase": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/find-up": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/invert-kv": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/lcid": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "invert-kv": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/os-locale": { + "version": "1.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "lcid": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/path-exists": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/read-pkg": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/read-pkg-up": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yargs/node_modules/y18n": { + "version": "3.2.2", + "dev": true, + "license": "ISC" + }, + "node_modules/yauzl": { + "version": "2.10.0", + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "print": { + "name": "vn-print", + "version": "2.0.0", + "license": "GPL-3.0", + "dependencies": { + "fs-extra": "^7.0.1", + "intl": "^1.2.5", + "js-yaml": "^3.13.1", + "jsonexport": "^3.2.0", + "juice": "^5.2.0", + "mysql2": "^1.7.0", + "nodemailer": "^4.7.0", + "puppeteer": "^2.0.0", + "qrcode": "^1.4.2", + "strftime": "^0.10.0", + "vue": "^2.6.10", + "vue-i18n": "^8.15.0", + "vue-server-renderer": "^2.6.10" + } + }, + "print/node_modules/@types/mime-types": { + "version": "2.1.1", + "license": "MIT" + }, + "print/node_modules/agent-base": { + "version": "5.1.1", + "license": "MIT", + "engines": { + "node": ">= 6.0.0" + } + }, + "print/node_modules/ajv": { + "version": "6.12.6", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "print/node_modules/ansi-regex": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/ansi-styles": { + "version": "2.2.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/argparse": { + "version": "1.0.10", + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "print/node_modules/asn1": { + "version": "0.2.6", + "license": "MIT", + "dependencies": { + "safer-buffer": "~2.1.0" + } + }, + "print/node_modules/assert-plus": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "print/node_modules/async": { + "version": "3.2.3", + "license": "MIT" + }, + "print/node_modules/async-limiter": { + "version": "1.0.1", + "license": "MIT" + }, + "print/node_modules/asynckit": { + "version": "0.4.0", + "license": "MIT" + }, + "print/node_modules/aws-sign2": { + "version": "0.7.0", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, + "print/node_modules/aws4": { + "version": "1.11.0", + "license": "MIT" + }, + "print/node_modules/balanced-match": { + "version": "1.0.2", + "license": "MIT" + }, + "print/node_modules/bcrypt-pbkdf": { + "version": "1.0.2", + "license": "BSD-3-Clause", + "dependencies": { + "tweetnacl": "^0.14.3" + } + }, + "print/node_modules/boolbase": { + "version": "1.0.0", + "license": "ISC" + }, + "print/node_modules/brace-expansion": { + "version": "1.1.11", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "print/node_modules/buffer-crc32": { + "version": "0.2.13", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "print/node_modules/buffer-from": { + "version": "1.1.2", + "license": "MIT" + }, + "print/node_modules/camelcase": { + "version": "5.3.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "print/node_modules/caseless": { + "version": "0.12.0", + "license": "Apache-2.0" + }, + "print/node_modules/chalk": { + "version": "1.1.3", + "license": "MIT", + "dependencies": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/cheerio": { + "version": "0.22.0", + "license": "MIT", + "dependencies": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "print/node_modules/cliui": { + "version": "6.0.0", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "print/node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "print/node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/color-convert": { + "version": "1.9.3", + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "print/node_modules/color-name": { + "version": "1.1.3", + "license": "MIT" + }, + "print/node_modules/combined-stream": { + "version": "1.0.8", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "print/node_modules/commander": { + "version": "2.20.3", + "license": "MIT" + }, + "print/node_modules/concat-map": { + "version": "0.0.1", + "license": "MIT" + }, + "print/node_modules/concat-stream": { + "version": "1.6.2", + "engines": [ + "node >= 0.8" + ], + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "print/node_modules/concat-stream/node_modules/readable-stream": { + "version": "2.3.7", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "print/node_modules/concat-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "license": "MIT" + }, + "print/node_modules/concat-stream/node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "print/node_modules/core-util-is": { + "version": "1.0.2", + "license": "MIT" + }, + "print/node_modules/cross-spawn": { + "version": "6.0.5", + "license": "MIT", + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "print/node_modules/css-select": { + "version": "1.2.0", + "license": "BSD-like", + "dependencies": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "print/node_modules/css-what": { + "version": "2.1.3", + "license": "BSD-2-Clause", + "engines": { + "node": "*" + } + }, + "print/node_modules/dashdash": { + "version": "1.14.1", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "print/node_modules/datauri": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "image-size": "^0.7.3", + "mimer": "^1.0.0" + }, + "engines": { + "node": ">= 4" + } + }, + "print/node_modules/debug": { + "version": "4.3.3", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "print/node_modules/decamelize": { + "version": "1.2.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/deep-extend": { + "version": "0.6.0", + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "print/node_modules/delayed-stream": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "print/node_modules/denque": { + "version": "1.5.1", + "license": "Apache-2.0", + "engines": { + "node": ">=0.10" + } + }, + "print/node_modules/dijkstrajs": { + "version": "1.0.2", + "license": "MIT" + }, + "print/node_modules/dom-serializer": { + "version": "0.1.1", + "license": "MIT", + "dependencies": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, + "print/node_modules/domelementtype": { + "version": "1.3.1", + "license": "BSD-2-Clause" + }, + "print/node_modules/domhandler": { + "version": "2.4.2", + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "1" + } + }, + "print/node_modules/domutils": { + "version": "1.5.1", + "dependencies": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "print/node_modules/ecc-jsbn": { + "version": "0.1.2", + "license": "MIT", + "dependencies": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "print/node_modules/emoji-regex": { + "version": "8.0.0", + "license": "MIT" + }, + "print/node_modules/encode-utf8": { + "version": "1.0.3", + "license": "MIT" + }, + "print/node_modules/entities": { + "version": "1.1.2", + "license": "BSD-2-Clause" + }, + "print/node_modules/escape-string-regexp": { + "version": "1.0.5", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "print/node_modules/esprima": { + "version": "4.0.1", + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "print/node_modules/extend": { + "version": "3.0.2", + "license": "MIT" + }, + "print/node_modules/extract-zip": { + "version": "1.7.0", + "license": "BSD-2-Clause", + "dependencies": { + "concat-stream": "^1.6.2", + "debug": "^2.6.9", + "mkdirp": "^0.5.4", + "yauzl": "^2.10.0" + }, + "bin": { + "extract-zip": "cli.js" + } + }, + "print/node_modules/extract-zip/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "print/node_modules/extract-zip/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "print/node_modules/extsprintf": { + "version": "1.3.0", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT" + }, + "print/node_modules/fast-deep-equal": { + "version": "3.1.3", + "license": "MIT" + }, + "print/node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "license": "MIT" + }, + "print/node_modules/fd-slicer": { + "version": "1.1.0", + "license": "MIT", + "dependencies": { + "pend": "~1.2.0" + } + }, + "print/node_modules/find-up": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/forever-agent": { + "version": "0.6.1", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, + "print/node_modules/form-data": { + "version": "2.3.3", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 0.12" + } + }, + "print/node_modules/fs-extra": { + "version": "7.0.1", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "print/node_modules/fs.realpath": { + "version": "1.0.0", + "license": "ISC" + }, + "print/node_modules/function-bind": { + "version": "1.1.1", + "license": "MIT" + }, + "print/node_modules/generate-function": { + "version": "2.3.1", + "license": "MIT", + "dependencies": { + "is-property": "^1.0.2" + } + }, + "print/node_modules/get-caller-file": { + "version": "2.0.5", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "print/node_modules/getpass": { + "version": "0.1.7", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0" + } + }, + "print/node_modules/glob": { + "version": "7.2.0", + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "print/node_modules/graceful-fs": { + "version": "4.2.9", + "license": "ISC" + }, + "print/node_modules/har-schema": { + "version": "2.0.0", + "license": "ISC", + "engines": { + "node": ">=4" + } + }, + "print/node_modules/har-validator": { + "version": "5.1.5", + "license": "MIT", + "dependencies": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "print/node_modules/has": { + "version": "1.0.3", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "print/node_modules/has-ansi": { + "version": "2.0.0", + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/has-flag": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "print/node_modules/hash-sum": { + "version": "1.0.2", + "license": "MIT" + }, + "print/node_modules/he": { + "version": "1.2.0", + "license": "MIT", + "bin": { + "he": "bin/he" + } + }, + "print/node_modules/htmlparser2": { + "version": "3.10.1", + "license": "MIT", + "dependencies": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "print/node_modules/http-signature": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + }, + "engines": { + "node": ">=0.8", + "npm": ">=1.3.7" + } + }, + "print/node_modules/https-proxy-agent": { + "version": "4.0.0", + "license": "MIT", + "dependencies": { + "agent-base": "5", + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "print/node_modules/iconv-lite": { + "version": "0.5.2", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/image-size": { + "version": "0.7.5", + "license": "MIT", + "bin": { + "image-size": "bin/image-size.js" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "print/node_modules/inflight": { + "version": "1.0.6", + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "print/node_modules/inherits": { + "version": "2.0.4", + "license": "ISC" + }, + "print/node_modules/intl": { + "version": "1.2.5", + "license": "MIT" + }, + "print/node_modules/is-core-module": { + "version": "2.8.1", + "license": "MIT", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "print/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "print/node_modules/is-property": { + "version": "1.0.2", + "license": "MIT" + }, + "print/node_modules/is-typedarray": { + "version": "1.0.0", + "license": "MIT" + }, + "print/node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "print/node_modules/isexe": { + "version": "2.0.0", + "license": "ISC" + }, + "print/node_modules/isstream": { + "version": "0.1.2", + "license": "MIT" + }, + "print/node_modules/js-yaml": { + "version": "3.14.1", + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "print/node_modules/jsbn": { + "version": "0.1.1", + "license": "MIT" + }, + "print/node_modules/json-schema": { + "version": "0.4.0", + "license": "(AFL-2.1 OR BSD-3-Clause)" + }, + "print/node_modules/json-schema-traverse": { + "version": "0.4.1", + "license": "MIT" + }, + "print/node_modules/json-stringify-safe": { + "version": "5.0.1", + "license": "ISC" + }, + "print/node_modules/jsonexport": { + "version": "3.2.0", + "license": "Apache-2.0", + "bin": { + "jsonexport": "bin/jsonexport.js" + } + }, + "print/node_modules/jsonfile": { + "version": "4.0.0", + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "print/node_modules/jsprim": { + "version": "1.4.2", + "license": "MIT", + "dependencies": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "print/node_modules/juice": { + "version": "5.2.0", + "license": "MIT", + "dependencies": { + "cheerio": "^0.22.0", + "commander": "^2.15.1", + "cross-spawn": "^6.0.5", + "deep-extend": "^0.6.0", + "mensch": "^0.3.3", + "slick": "^1.12.2", + "web-resource-inliner": "^4.3.1" + }, + "bin": { + "juice": "bin/juice" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "print/node_modules/locate-path": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/lodash._reinterpolate": { + "version": "3.0.0", + "license": "MIT" + }, + "print/node_modules/lodash.assignin": { + "version": "4.2.0", + "license": "MIT" + }, + "print/node_modules/lodash.bind": { + "version": "4.2.1", + "license": "MIT" + }, + "print/node_modules/lodash.defaults": { + "version": "4.2.0", + "license": "MIT" + }, + "print/node_modules/lodash.filter": { + "version": "4.6.0", + "license": "MIT" + }, + "print/node_modules/lodash.flatten": { + "version": "4.4.0", + "license": "MIT" + }, + "print/node_modules/lodash.foreach": { + "version": "4.5.0", + "license": "MIT" + }, + "print/node_modules/lodash.map": { + "version": "4.6.0", + "license": "MIT" + }, + "print/node_modules/lodash.merge": { + "version": "4.6.2", + "license": "MIT" + }, + "print/node_modules/lodash.pick": { + "version": "4.4.0", + "license": "MIT" + }, + "print/node_modules/lodash.reduce": { + "version": "4.6.0", + "license": "MIT" + }, + "print/node_modules/lodash.reject": { + "version": "4.6.0", + "license": "MIT" + }, + "print/node_modules/lodash.some": { + "version": "4.6.0", + "license": "MIT" + }, + "print/node_modules/lodash.template": { + "version": "4.5.0", + "license": "MIT", + "dependencies": { + "lodash._reinterpolate": "^3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "print/node_modules/lodash.templatesettings": { + "version": "4.2.0", + "license": "MIT", + "dependencies": { + "lodash._reinterpolate": "^3.0.0" + } + }, + "print/node_modules/lodash.unescape": { + "version": "4.0.1", + "license": "MIT" + }, + "print/node_modules/lodash.uniq": { + "version": "4.5.0", + "license": "MIT" + }, + "print/node_modules/long": { + "version": "4.0.0", + "license": "Apache-2.0" + }, + "print/node_modules/lru-cache": { + "version": "5.1.1", + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "print/node_modules/mensch": { + "version": "0.3.4", + "license": "MIT" + }, + "print/node_modules/mime": { + "version": "2.6.0", + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "print/node_modules/mime-db": { + "version": "1.51.0", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "print/node_modules/mime-types": { + "version": "2.1.34", + "license": "MIT", + "dependencies": { + "mime-db": "1.51.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "print/node_modules/mimer": { + "version": "1.1.1", + "license": "MIT", + "bin": { + "mimer": "bin/mimer" + }, + "engines": { + "node": ">= 6.0" + } + }, + "print/node_modules/minimatch": { + "version": "3.0.4", + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "print/node_modules/minimist": { + "version": "1.2.5", + "license": "MIT" + }, + "print/node_modules/mkdirp": { + "version": "0.5.5", + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "print/node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "print/node_modules/mysql2": { + "version": "1.7.0", + "license": "MIT", + "dependencies": { + "denque": "^1.4.1", + "generate-function": "^2.3.1", + "iconv-lite": "^0.5.0", + "long": "^4.0.0", + "lru-cache": "^5.1.1", + "named-placeholders": "^1.1.2", + "seq-queue": "^0.0.5", + "sqlstring": "^2.3.1" + }, + "engines": { + "node": ">= 8.0" + } + }, + "print/node_modules/named-placeholders": { + "version": "1.1.2", + "license": "MIT", + "dependencies": { + "lru-cache": "^4.1.3" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "print/node_modules/named-placeholders/node_modules/lru-cache": { + "version": "4.1.5", + "license": "ISC", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "print/node_modules/named-placeholders/node_modules/yallist": { + "version": "2.1.2", + "license": "ISC" + }, + "print/node_modules/nice-try": { + "version": "1.0.5", + "license": "MIT" + }, + "print/node_modules/nodemailer": { + "version": "4.7.0", + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "print/node_modules/nth-check": { + "version": "1.0.2", + "license": "BSD-2-Clause", + "dependencies": { + "boolbase": "~1.0.0" + } + }, + "print/node_modules/oauth-sign": { + "version": "0.9.0", + "license": "Apache-2.0", + "engines": { + "node": "*" + } + }, + "print/node_modules/once": { + "version": "1.4.0", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "print/node_modules/p-limit": { + "version": "2.3.0", + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "print/node_modules/p-locate": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/p-try": { + "version": "2.2.0", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "print/node_modules/path-exists": { + "version": "4.0.0", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "print/node_modules/path-is-absolute": { + "version": "1.0.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/path-key": { + "version": "2.0.1", + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "print/node_modules/path-parse": { + "version": "1.0.7", + "license": "MIT" + }, + "print/node_modules/pend": { + "version": "1.2.0", + "license": "MIT" + }, + "print/node_modules/performance-now": { + "version": "2.1.0", + "license": "MIT" + }, + "print/node_modules/pngjs": { + "version": "5.0.0", + "license": "MIT", + "engines": { + "node": ">=10.13.0" + } + }, + "print/node_modules/process-nextick-args": { + "version": "2.0.1", + "license": "MIT" + }, + "print/node_modules/progress": { + "version": "2.0.3", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "print/node_modules/proxy-from-env": { + "version": "1.1.0", + "license": "MIT" + }, + "print/node_modules/pseudomap": { + "version": "1.0.2", + "license": "ISC" + }, + "print/node_modules/psl": { + "version": "1.8.0", + "license": "MIT" + }, + "print/node_modules/punycode": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "print/node_modules/puppeteer": { + "version": "2.1.1", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@types/mime-types": "^2.1.0", + "debug": "^4.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^4.0.0", + "mime": "^2.0.3", + "mime-types": "^2.1.25", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^6.1.0" + }, + "engines": { + "node": ">=8.16.0" + } + }, + "print/node_modules/qrcode": { + "version": "1.5.0", + "license": "MIT", + "dependencies": { + "dijkstrajs": "^1.0.1", + "encode-utf8": "^1.0.3", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" + }, + "bin": { + "qrcode": "bin/qrcode" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "print/node_modules/qs": { + "version": "6.5.3", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.6" + } + }, + "print/node_modules/randombytes": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "print/node_modules/readable-stream": { + "version": "3.6.0", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "print/node_modules/request": { + "version": "2.88.2", + "license": "Apache-2.0", + "dependencies": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "engines": { + "node": ">= 6" + } + }, + "print/node_modules/require-directory": { + "version": "2.1.1", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/require-main-filename": { + "version": "2.0.0", + "license": "ISC" + }, + "print/node_modules/resolve": { + "version": "1.21.0", + "license": "MIT", + "dependencies": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "print/node_modules/rimraf": { + "version": "2.7.1", + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "print/node_modules/safe-buffer": { + "version": "5.2.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "print/node_modules/safer-buffer": { + "version": "2.1.2", + "license": "MIT" + }, + "print/node_modules/semver": { + "version": "5.7.1", + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "print/node_modules/seq-queue": { + "version": "0.0.5" + }, + "print/node_modules/serialize-javascript": { + "version": "3.1.0", + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "print/node_modules/set-blocking": { + "version": "2.0.0", + "license": "ISC" + }, + "print/node_modules/shebang-command": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/shebang-regex": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/slick": { + "version": "1.12.2", + "license": "MIT (http://mootools.net/license.txt)", + "engines": { + "node": "*" + } + }, + "print/node_modules/source-map": { + "version": "0.5.6", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/sprintf-js": { + "version": "1.0.3", + "license": "BSD-3-Clause" + }, + "print/node_modules/sqlstring": { + "version": "2.3.2", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "print/node_modules/sshpk": { + "version": "1.17.0", + "license": "MIT", + "dependencies": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "bin": { + "sshpk-conv": "bin/sshpk-conv", + "sshpk-sign": "bin/sshpk-sign", + "sshpk-verify": "bin/sshpk-verify" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/strftime": { + "version": "0.10.1", + "license": "MIT", + "engines": { + "node": ">=0.2.0" + } + }, + "print/node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "print/node_modules/string-width": { + "version": "4.2.3", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/string-width/node_modules/ansi-regex": { + "version": "5.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "print/node_modules/string-width/node_modules/strip-ansi": { + "version": "6.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/strip-ansi": { + "version": "3.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "print/node_modules/supports-color": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "print/node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "print/node_modules/tough-cookie": { + "version": "2.5.0", + "license": "BSD-3-Clause", + "dependencies": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + }, + "engines": { + "node": ">=0.8" + } + }, + "print/node_modules/tunnel-agent": { + "version": "0.6.0", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "print/node_modules/tweetnacl": { + "version": "0.14.5", + "license": "Unlicense" + }, + "print/node_modules/typedarray": { + "version": "0.0.6", + "license": "MIT" + }, + "print/node_modules/universalify": { + "version": "0.1.2", + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "print/node_modules/uri-js": { + "version": "4.4.1", + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "print/node_modules/util-deprecate": { + "version": "1.0.2", + "license": "MIT" + }, + "print/node_modules/uuid": { + "version": "3.4.0", + "license": "MIT", + "bin": { + "uuid": "bin/uuid" + } + }, + "print/node_modules/valid-data-url": { + "version": "2.0.0", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "print/node_modules/verror": { + "version": "1.10.0", + "engines": [ + "node >=0.6.0" + ], + "license": "MIT", + "dependencies": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "print/node_modules/vue": { + "version": "2.6.14", + "license": "MIT" + }, + "print/node_modules/vue-i18n": { + "version": "8.26.8", + "license": "MIT" + }, + "print/node_modules/vue-server-renderer": { + "version": "2.6.14", + "license": "MIT", + "dependencies": { + "chalk": "^1.1.3", + "hash-sum": "^1.0.2", + "he": "^1.1.0", + "lodash.template": "^4.5.0", + "lodash.uniq": "^4.5.0", + "resolve": "^1.2.0", + "serialize-javascript": "^3.1.0", + "source-map": "0.5.6" + } + }, + "print/node_modules/web-resource-inliner": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "async": "^3.1.0", + "chalk": "^2.4.2", + "datauri": "^2.0.0", + "htmlparser2": "^4.0.0", + "lodash.unescape": "^4.0.1", + "request": "^2.88.0", + "safer-buffer": "^2.1.2", + "valid-data-url": "^2.0.0", + "xtend": "^4.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "print/node_modules/web-resource-inliner/node_modules/ansi-styles": { + "version": "3.2.1", + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "print/node_modules/web-resource-inliner/node_modules/chalk": { + "version": "2.4.2", + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "print/node_modules/web-resource-inliner/node_modules/dom-serializer": { + "version": "1.3.2", + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + } + }, + "print/node_modules/web-resource-inliner/node_modules/dom-serializer/node_modules/domhandler": { + "version": "4.3.0", + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "print/node_modules/web-resource-inliner/node_modules/domelementtype": { + "version": "2.2.0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], + "license": "BSD-2-Clause" + }, + "print/node_modules/web-resource-inliner/node_modules/domhandler": { + "version": "3.3.0", + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.0.1" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "print/node_modules/web-resource-inliner/node_modules/domutils": { + "version": "2.8.0", + "license": "BSD-2-Clause", + "dependencies": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" + } + }, + "print/node_modules/web-resource-inliner/node_modules/domutils/node_modules/domhandler": { + "version": "4.3.0", + "license": "BSD-2-Clause", + "dependencies": { + "domelementtype": "^2.2.0" + }, + "engines": { + "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" + } + }, + "print/node_modules/web-resource-inliner/node_modules/entities": { + "version": "2.2.0", + "license": "BSD-2-Clause", + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "print/node_modules/web-resource-inliner/node_modules/htmlparser2": { + "version": "4.1.0", + "license": "MIT", + "dependencies": { + "domelementtype": "^2.0.1", + "domhandler": "^3.0.0", + "domutils": "^2.0.0", + "entities": "^2.0.0" + } + }, + "print/node_modules/web-resource-inliner/node_modules/supports-color": { + "version": "5.5.0", + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "print/node_modules/which": { + "version": "1.3.1", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "print/node_modules/which-module": { + "version": "2.0.0", + "license": "ISC" + }, + "print/node_modules/wrap-ansi": { + "version": "6.2.0", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "print/node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "print/node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "print/node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "license": "MIT" + }, + "print/node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/wrappy": { + "version": "1.0.2", + "license": "ISC" + }, + "print/node_modules/ws": { + "version": "6.2.2", + "license": "MIT", + "dependencies": { + "async-limiter": "~1.0.0" + } + }, + "print/node_modules/xtend": { + "version": "4.0.2", + "license": "MIT", + "engines": { + "node": ">=0.4" + } + }, + "print/node_modules/y18n": { + "version": "4.0.3", + "license": "ISC" + }, + "print/node_modules/yallist": { + "version": "3.1.1", + "license": "ISC" + }, + "print/node_modules/yargs": { + "version": "15.4.1", + "license": "MIT", + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "print/node_modules/yargs-parser": { + "version": "18.1.3", + "license": "ISC", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "print/node_modules/yauzl": { + "version": "2.10.0", + "license": "MIT", + "dependencies": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.7" + } + }, + "@babel/compat-data": { + "version": "7.16.8", + "dev": true + }, + "@babel/core": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.7", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helpers": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + } + }, + "@babel/generator": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/types": "^7.16.8", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-explode-assignable-expression": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-validator-option": "^7.16.7", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-member-expression-to-functions": "^7.16.7", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/helper-replace-supers": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7" + } + }, + "@babel/helper-create-regexp-features-plugin": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "regexpu-core": "^4.7.1" + } + }, + "@babel/helper-define-polyfill-provider": { + "version": "0.3.0", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-function-name": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-imports": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-module-transforms": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.16.7", + "dev": true + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-wrap-function": "^7.16.8", + "@babel/types": "^7.16.8" + } + }, + "@babel/helper-replace-supers": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-member-expression-to-functions": "^7.16.7", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-simple-access": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.16.0", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/types": "^7.16.7" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.16.7", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.16.7", + "dev": true + }, + "@babel/helper-wrap-function": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.16.7", + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.8", + "@babel/types": "^7.16.8" + } + }, + "@babel/helpers": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/template": "^7.16.7", + "@babel/traverse": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/highlight": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.16.8", + "dev": true + }, + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-proposal-optional-chaining": "^7.16.7" + } + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-remap-async-to-generator": "^7.16.8", + "@babel/plugin-syntax-async-generators": "^7.8.4" + } + }, + "@babel/plugin-proposal-class-properties": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-proposal-class-static-block": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + } + }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + } + }, + "@babel/plugin-proposal-export-namespace-from": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-json-strings": "^7.8.3" + } + }, + "@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + } + }, + "@babel/plugin-proposal-numeric-separator": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.16.7" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + } + }, + "@babel/plugin-proposal-private-methods": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-proposal-private-property-in-object": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-create-class-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-remap-async-to-generator": "^7.16.8" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.7", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-optimise-call-expression": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-replace-supers": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-simple-access": "^7.16.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-validator-identifier": "^7.16.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-replace-supers": "^7.16.7" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.16.7", + "dev": true, + "requires": { + "regenerator-transform": "^0.14.2" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-unicode-escapes": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7" + } + }, + "@babel/preset-env": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.8", + "@babel/helper-compilation-targets": "^7.16.7", + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-validator-option": "^7.16.7", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.7", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.7", + "@babel/plugin-proposal-async-generator-functions": "^7.16.8", + "@babel/plugin-proposal-class-properties": "^7.16.7", + "@babel/plugin-proposal-class-static-block": "^7.16.7", + "@babel/plugin-proposal-dynamic-import": "^7.16.7", + "@babel/plugin-proposal-export-namespace-from": "^7.16.7", + "@babel/plugin-proposal-json-strings": "^7.16.7", + "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", + "@babel/plugin-proposal-numeric-separator": "^7.16.7", + "@babel/plugin-proposal-object-rest-spread": "^7.16.7", + "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", + "@babel/plugin-proposal-optional-chaining": "^7.16.7", + "@babel/plugin-proposal-private-methods": "^7.16.7", + "@babel/plugin-proposal-private-property-in-object": "^7.16.7", + "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.16.7", + "@babel/plugin-transform-async-to-generator": "^7.16.8", + "@babel/plugin-transform-block-scoped-functions": "^7.16.7", + "@babel/plugin-transform-block-scoping": "^7.16.7", + "@babel/plugin-transform-classes": "^7.16.7", + "@babel/plugin-transform-computed-properties": "^7.16.7", + "@babel/plugin-transform-destructuring": "^7.16.7", + "@babel/plugin-transform-dotall-regex": "^7.16.7", + "@babel/plugin-transform-duplicate-keys": "^7.16.7", + "@babel/plugin-transform-exponentiation-operator": "^7.16.7", + "@babel/plugin-transform-for-of": "^7.16.7", + "@babel/plugin-transform-function-name": "^7.16.7", + "@babel/plugin-transform-literals": "^7.16.7", + "@babel/plugin-transform-member-expression-literals": "^7.16.7", + "@babel/plugin-transform-modules-amd": "^7.16.7", + "@babel/plugin-transform-modules-commonjs": "^7.16.8", + "@babel/plugin-transform-modules-systemjs": "^7.16.7", + "@babel/plugin-transform-modules-umd": "^7.16.7", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.8", + "@babel/plugin-transform-new-target": "^7.16.7", + "@babel/plugin-transform-object-super": "^7.16.7", + "@babel/plugin-transform-parameters": "^7.16.7", + "@babel/plugin-transform-property-literals": "^7.16.7", + "@babel/plugin-transform-regenerator": "^7.16.7", + "@babel/plugin-transform-reserved-words": "^7.16.7", + "@babel/plugin-transform-shorthand-properties": "^7.16.7", + "@babel/plugin-transform-spread": "^7.16.7", + "@babel/plugin-transform-sticky-regex": "^7.16.7", + "@babel/plugin-transform-template-literals": "^7.16.7", + "@babel/plugin-transform-typeof-symbol": "^7.16.7", + "@babel/plugin-transform-unicode-escapes": "^7.16.7", + "@babel/plugin-transform-unicode-regex": "^7.16.7", + "@babel/preset-modules": "^0.1.5", + "@babel/types": "^7.16.8", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.5.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "core-js-compat": "^3.20.2", + "semver": "^6.3.0" + } + }, + "@babel/preset-modules": { + "version": "0.1.5", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + } + }, + "@babel/register": { + "version": "7.16.9", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.0", + "source-map-support": "^0.5.16" + } + }, + "@babel/runtime": { + "version": "7.16.7", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/runtime-corejs3": { + "version": "7.16.8", + "requires": { + "core-js-pure": "^3.20.2", + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/template": { + "version": "7.16.7", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/parser": "^7.16.7", + "@babel/types": "^7.16.7" + } + }, + "@babel/traverse": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.7", + "@babel/generator": "^7.16.8", + "@babel/helper-environment-visitor": "^7.16.7", + "@babel/helper-function-name": "^7.16.7", + "@babel/helper-hoist-variables": "^7.16.7", + "@babel/helper-split-export-declaration": "^7.16.7", + "@babel/parser": "^7.16.8", + "@babel/types": "^7.16.8", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.16.8", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.16.7", + "to-fast-properties": "^2.0.0" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "dev": true + }, + "@cnakazawa/watch": { + "version": "1.0.4", + "dev": true, + "requires": { + "exec-sh": "^0.3.2", + "minimist": "^1.2.0" + } + }, + "@eslint/eslintrc": { + "version": "0.4.3", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "globals": { + "version": "13.12.0", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "type-fest": { + "version": "0.20.2", + "dev": true + } + } + }, + "@google-cloud/common": { + "version": "0.32.1", + "requires": { + "@google-cloud/projectify": "^0.3.3", + "@google-cloud/promisify": "^0.4.0", + "@types/request": "^2.48.1", + "arrify": "^2.0.0", + "duplexify": "^3.6.0", + "ent": "^2.2.0", + "extend": "^3.0.2", + "google-auth-library": "^3.1.1", + "pify": "^4.0.1", + "retry-request": "^4.0.0", + "teeny-request": "^3.11.3" + }, + "dependencies": { + "arrify": { + "version": "2.0.1" + }, + "pify": { + "version": "4.0.1" + } + } + }, + "@google-cloud/paginator": { + "version": "0.2.0", + "requires": { + "arrify": "^1.0.1", + "extend": "^3.0.1", + "split-array-stream": "^2.0.0", + "stream-events": "^1.0.4" + } + }, + "@google-cloud/projectify": { + "version": "0.3.3" + }, + "@google-cloud/promisify": { + "version": "0.4.0" + }, + "@google-cloud/storage": { + "version": "2.5.0", + "requires": { + "@google-cloud/common": "^0.32.0", + "@google-cloud/paginator": "^0.2.0", + "@google-cloud/promisify": "^0.4.0", + "arrify": "^1.0.0", + "async": "^2.0.1", + "compressible": "^2.0.12", + "concat-stream": "^2.0.0", + "date-and-time": "^0.6.3", + "duplexify": "^3.5.0", + "extend": "^3.0.0", + "gcs-resumable-upload": "^1.0.0", + "hash-stream-validation": "^0.2.1", + "mime": "^2.2.0", + "mime-types": "^2.0.8", + "onetime": "^5.1.0", + "pumpify": "^1.5.1", + "snakeize": "^0.1.0", + "stream-events": "^1.0.1", + "teeny-request": "^3.11.3", + "through2": "^3.0.0", + "xdg-basedir": "^3.0.0" + }, + "dependencies": { + "concat-stream": { + "version": "2.0.0", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.0.2", + "typedarray": "^0.0.6" + } + }, + "readable-stream": { + "version": "3.6.0", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "through2": { + "version": "3.0.2", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.5.0", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "dev": true + }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "dev": true + }, + "@jest/console": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^26.6.2", + "jest-util": "^26.6.2", + "slash": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jest/core": { + "version": "26.6.3", + "dev": true, + "requires": { + "@jest/console": "^26.6.2", + "@jest/reporters": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/transform": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.4", + "jest-changed-files": "^26.6.2", + "jest-config": "^26.6.3", + "jest-haste-map": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0", + "jest-resolve": "^26.6.2", + "jest-resolve-dependencies": "^26.6.3", + "jest-runner": "^26.6.3", + "jest-runtime": "^26.6.3", + "jest-snapshot": "^26.6.2", + "jest-util": "^26.6.2", + "jest-validate": "^26.6.2", + "jest-watcher": "^26.6.2", + "micromatch": "^4.0.2", + "p-each-series": "^2.1.0", + "rimraf": "^3.0.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jest/environment": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/fake-timers": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "jest-mock": "^26.6.2" + } + }, + "@jest/fake-timers": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "@sinonjs/fake-timers": "^6.0.1", + "@types/node": "*", + "jest-message-util": "^26.6.2", + "jest-mock": "^26.6.2", + "jest-util": "^26.6.2" + } + }, + "@jest/globals": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/environment": "^26.6.2", + "@jest/types": "^26.6.2", + "expect": "^26.6.2" + } + }, + "@jest/reporters": { + "version": "26.6.2", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/transform": "^26.6.2", + "@jest/types": "^26.6.2", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.2", + "graceful-fs": "^4.2.4", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^4.0.3", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "jest-haste-map": "^26.6.2", + "jest-resolve": "^26.6.2", + "jest-util": "^26.6.2", + "jest-worker": "^26.6.2", + "node-notifier": "^8.0.0", + "slash": "^3.0.0", + "source-map": "^0.6.0", + "string-length": "^4.0.1", + "terminal-link": "^2.0.0", + "v8-to-istanbul": "^7.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "4.0.3", + "dev": true, + "requires": { + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + } + }, + "source-map": { + "version": "0.6.1", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jest/source-map": { + "version": "26.6.2", + "dev": true, + "requires": { + "callsites": "^3.0.0", + "graceful-fs": "^4.2.4", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "@jest/test-result": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/console": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + } + }, + "@jest/test-sequencer": { + "version": "26.6.3", + "dev": true, + "requires": { + "@jest/test-result": "^26.6.2", + "graceful-fs": "^4.2.4", + "jest-haste-map": "^26.6.2", + "jest-runner": "^26.6.3", + "jest-runtime": "^26.6.3" + } + }, + "@jest/transform": { + "version": "26.6.2", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/types": "^26.6.2", + "babel-plugin-istanbul": "^6.0.0", + "chalk": "^4.0.0", + "convert-source-map": "^1.4.0", + "fast-json-stable-stringify": "^2.0.0", + "graceful-fs": "^4.2.4", + "jest-haste-map": "^26.6.2", + "jest-regex-util": "^26.0.0", + "jest-util": "^26.6.2", + "micromatch": "^4.0.2", + "pirates": "^4.0.1", + "slash": "^3.0.0", + "source-map": "^0.6.1", + "write-file-atomic": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@jest/types": { + "version": "26.6.2", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@sindresorhus/is": { + "version": "2.1.1" + }, + "@sinonjs/commons": { + "version": "1.8.3", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "6.0.1", + "dev": true, + "requires": { + "@sinonjs/commons": "^1.7.0" + } + }, + "@szmarczak/http-timer": { + "version": "4.0.6", + "requires": { + "defer-to-connect": "^2.0.0" + } + }, + "@tootallnate/once": { + "version": "1.1.2", + "dev": true + }, + "@types/babel__core": { + "version": "7.1.18", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.4", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.1", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.14.2", + "dev": true, + "requires": { + "@babel/types": "^7.3.0" + } + }, + "@types/body-parser": { + "version": "1.19.2", + "requires": { + "@types/connect": "*", + "@types/node": "*" + } + }, + "@types/cacheable-request": { + "version": "6.0.2", + "requires": { + "@types/http-cache-semantics": "*", + "@types/keyv": "*", + "@types/node": "*", + "@types/responselike": "*" + } + }, + "@types/caseless": { + "version": "0.12.2" + }, + "@types/connect": { + "version": "3.4.35", + "requires": { + "@types/node": "*" + } + }, + "@types/express": { + "version": "4.17.13", + "requires": { + "@types/body-parser": "*", + "@types/express-serve-static-core": "^4.17.18", + "@types/qs": "*", + "@types/serve-static": "*" + } + }, + "@types/express-serve-static-core": { + "version": "4.17.28", + "requires": { + "@types/node": "*", + "@types/qs": "*", + "@types/range-parser": "*" + } + }, + "@types/glob": { + "version": "7.2.0", + "dev": true, + "requires": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "@types/graceful-fs": { + "version": "4.1.5", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/html-minifier-terser": { + "version": "5.1.2", + "dev": true + }, + "@types/http-cache-semantics": { + "version": "4.0.1" + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.0", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.1", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/json-schema": { + "version": "7.0.9", + "dev": true + }, + "@types/keyv": { + "version": "3.1.3", + "requires": { + "@types/node": "*" + } + }, + "@types/mime": { + "version": "1.3.2" + }, + "@types/minimatch": { + "version": "3.0.5", + "dev": true + }, + "@types/node": { + "version": "17.0.8" + }, + "@types/normalize-package-data": { + "version": "2.4.1", + "dev": true + }, + "@types/prettier": { + "version": "2.4.3", + "dev": true + }, + "@types/qs": { + "version": "6.9.7" + }, + "@types/range-parser": { + "version": "1.2.4" + }, + "@types/request": { + "version": "2.48.8", + "requires": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + }, + "dependencies": { + "form-data": { + "version": "2.5.1", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } + } + }, + "@types/responselike": { + "version": "1.0.0", + "requires": { + "@types/node": "*" + } + }, + "@types/serve-static": { + "version": "1.13.10", + "requires": { + "@types/mime": "^1", + "@types/node": "*" + } + }, + "@types/source-list-map": { + "version": "0.1.2", + "dev": true + }, + "@types/stack-utils": { + "version": "2.0.1", + "dev": true + }, + "@types/tapable": { + "version": "1.0.8", + "dev": true + }, + "@types/tough-cookie": { + "version": "4.0.1" + }, + "@types/uglify-js": { + "version": "3.13.1", + "dev": true, + "requires": { + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "@types/webpack": { + "version": "4.41.32", + "dev": true, + "requires": { + "@types/node": "*", + "@types/tapable": "^1", + "@types/uglify-js": "*", + "@types/webpack-sources": "*", + "anymatch": "^3.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "anymatch": { + "version": "3.1.2", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "@types/webpack-sources": { + "version": "3.2.0", + "dev": true, + "requires": { + "@types/node": "*", + "@types/source-list-map": "*", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "dev": true + } + } + }, + "@types/yargs": { + "version": "15.0.14", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "20.2.1", + "dev": true + }, + "@types/yauzl": { + "version": "2.9.2", + "optional": true, + "requires": { + "@types/node": "*" + } + }, + "@webassemblyjs/ast": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/helper-module-context": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/wast-parser": "1.9.0" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.9.0", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.9.0", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.9.0", + "dev": true + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.9.0" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.9.0", + "dev": true + }, + "@webassemblyjs/helper-module-context": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0" + } + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.9.0", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.9.0", + "dev": true, + "requires": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.9.0", + "dev": true, + "requires": { + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/utf8": { + "version": "1.9.0", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/helper-wasm-section": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0", + "@webassemblyjs/wasm-opt": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0", + "@webassemblyjs/wast-printer": "1.9.0" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/ieee754": "1.9.0", + "@webassemblyjs/leb128": "1.9.0", + "@webassemblyjs/utf8": "1.9.0" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-api-error": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/ieee754": "1.9.0", + "@webassemblyjs/leb128": "1.9.0", + "@webassemblyjs/utf8": "1.9.0" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/floating-point-hex-parser": "1.9.0", + "@webassemblyjs/helper-api-error": "1.9.0", + "@webassemblyjs/helper-code-frame": "1.9.0", + "@webassemblyjs/helper-fsm": "1.9.0", + "@xtuc/long": "4.2.2" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.9.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/wast-parser": "1.9.0", + "@xtuc/long": "4.2.2" + } + }, + "@xmldom/xmldom": { + "version": "0.7.5", + "dev": true + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.2", + "dev": true + }, + "abab": { + "version": "2.0.5", + "dev": true + }, + "abbrev": { + "version": "1.1.1", + "dev": true + }, + "abort-controller": { + "version": "2.0.3", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "abstract-logging": { + "version": "2.0.1" + }, + "accept-language": { + "version": "3.0.18", + "requires": { + "bcp47": "^1.1.2", + "stable": "^0.1.6" + } + }, + "accepts": { + "version": "1.3.7", + "requires": { + "mime-types": "~2.1.24", + "negotiator": "0.6.2" + } + }, + "acorn": { + "version": "7.4.1", + "dev": true + }, + "acorn-globals": { + "version": "6.0.0", + "dev": true, + "requires": { + "acorn": "^7.1.1", + "acorn-walk": "^7.1.1" + } + }, + "acorn-jsx": { + "version": "5.3.2", + "dev": true, + "requires": {} + }, + "acorn-walk": { + "version": "7.2.0", + "dev": true + }, + "adm-zip": { + "version": "0.5.9" + }, + "agent-base": { + "version": "6.0.2", + "requires": { + "debug": "4" + } + }, + "ajv": { + "version": "6.12.6", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-errors": { + "version": "1.0.1", + "dev": true, + "requires": {} + }, + "ajv-keywords": { + "version": "3.5.2", + "dev": true, + "requires": {} + }, + "amdefine": { + "version": "1.0.1", + "dev": true + }, + "angular-mocks": { + "version": "1.8.2", + "dev": true + }, + "ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "requires": { + "string-width": "^4.1.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, + "ansi-colors": { + "version": "4.1.1", + "dev": true + }, + "ansi-escapes": { + "version": "4.3.2", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + }, + "dependencies": { + "type-fest": { + "version": "0.21.3", + "dev": true + } + } + }, + "ansi-gray": { + "version": "0.1.1", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-html-community": { + "version": "0.0.8", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "requires": { + "color-convert": "^1.9.0" + } + }, + "ansi-wrap": { + "version": "0.1.0", + "dev": true + }, + "anymatch": { + "version": "2.0.0", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "micromatch": { + "version": "3.1.10", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "normalize-path": { + "version": "2.1.1", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "append-buffer": { + "version": "1.0.2", + "dev": true, + "requires": { + "buffer-equal": "^1.0.0" + } + }, + "aproba": { + "version": "1.2.0" + }, + "archy": { + "version": "1.0.0", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.7", + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "argparse": { + "version": "1.0.10", + "requires": { + "sprintf-js": "~1.0.2" + }, + "dependencies": { + "sprintf-js": { + "version": "1.0.3" + } + } + }, + "arr-diff": { + "version": "4.0.0", + "dev": true + }, + "arr-filter": { + "version": "1.1.2", + "dev": true, + "requires": { + "make-iterator": "^1.0.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "dev": true + }, + "arr-map": { + "version": "2.0.2", + "dev": true, + "requires": { + "make-iterator": "^1.0.0" + } + }, + "arr-union": { + "version": "3.1.0", + "dev": true + }, + "array-differ": { + "version": "1.0.0", + "dev": true + }, + "array-each": { + "version": "1.0.1", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "dev": true + }, + "array-flatten": { + "version": "1.1.1" + }, + "array-initial": { + "version": "1.1.0", + "dev": true, + "requires": { + "array-slice": "^1.0.0", + "is-number": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "dev": true + } + } + }, + "array-last": { + "version": "1.3.0", + "dev": true, + "requires": { + "is-number": "^4.0.0" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "dev": true + } + } + }, + "array-slice": { + "version": "1.1.0", + "dev": true + }, + "array-sort": { + "version": "1.0.0", + "dev": true, + "requires": { + "default-compare": "^1.0.0", + "get-value": "^2.0.6", + "kind-of": "^5.0.2" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "dev": true + } + } + }, + "array-union": { + "version": "1.0.2", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "dev": true + }, + "arrify": { + "version": "1.0.1" + }, + "asn1": { + "version": "0.2.6", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "asn1.js": { + "version": "5.4.1", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "dev": true + } + } + }, + "assert": { + "version": "1.5.0", + "dev": true, + "requires": { + "object-assign": "^4.1.1", + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "dev": true + }, + "util": { + "version": "0.10.3", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assert-plus": { + "version": "1.0.0" + }, + "assign-symbols": { + "version": "1.0.0", + "dev": true + }, + "ast-types": { + "version": "0.9.6", + "dev": true + }, + "astral-regex": { + "version": "2.0.0", + "dev": true + }, + "async": { + "version": "2.6.3", + "requires": { + "lodash": "^4.17.14" + } + }, + "async-done": { + "version": "1.3.2", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.2", + "process-nextick-args": "^2.0.0", + "stream-exhaust": "^1.0.1" + } + }, + "async-each": { + "version": "1.0.3", + "dev": true + }, + "async-foreach": { + "version": "0.1.3", + "dev": true + }, + "async-hook-jl": { + "version": "1.7.6", + "requires": { + "stack-chain": "^1.3.7" + } + }, + "async-limiter": { + "version": "1.0.1", + "dev": true + }, + "async-settle": { + "version": "1.0.0", + "dev": true, + "requires": { + "async-done": "^1.2.2" + } + }, + "asynckit": { + "version": "0.4.0" + }, + "atob": { + "version": "2.1.2", + "dev": true + }, + "aws-sdk": { + "version": "2.1057.0", + "requires": { + "buffer": "4.9.2", + "events": "1.1.1", + "ieee754": "1.1.13", + "jmespath": "0.15.0", + "querystring": "0.2.0", + "sax": "1.2.1", + "url": "0.10.3", + "uuid": "3.3.2", + "xml2js": "0.4.19" + }, + "dependencies": { + "uuid": { + "version": "3.3.2" + }, + "xml2js": { + "version": "0.4.19", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~9.0.1" + } + }, + "xmlbuilder": { + "version": "9.0.7" + } + } + }, + "aws-sign2": { + "version": "0.7.0" + }, + "aws4": { + "version": "1.11.0" + }, + "axios": { + "version": "0.25.0", + "requires": { + "follow-redirects": "^1.14.7" + } + }, + "babel-jest": { + "version": "26.6.3", + "dev": true, + "requires": { + "@jest/transform": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/babel__core": "^7.1.7", + "babel-plugin-istanbul": "^6.0.0", + "babel-preset-jest": "^26.6.2", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "slash": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "babel-loader": { + "version": "8.2.3", + "dev": true, + "requires": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^1.4.0", + "make-dir": "^3.1.0", + "schema-utils": "^2.6.5" + }, + "dependencies": { + "find-cache-dir": { + "version": "3.3.2", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "make-dir": { + "version": "3.1.0", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "pkg-dir": { + "version": "4.2.0", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + } + } + }, + "babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "dev": true, + "requires": { + "object.assign": "^4.1.0" + } + }, + "babel-plugin-istanbul": { + "version": "6.1.1", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + } + }, + "babel-plugin-jest-hoist": { + "version": "26.6.2", + "dev": true, + "requires": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.0.0", + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-plugin-polyfill-corejs2": { + "version": "0.3.0", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.3.0", + "semver": "^6.1.1" + } + }, + "babel-plugin-polyfill-corejs3": { + "version": "0.5.0", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.0", + "core-js-compat": "^3.20.0" + } + }, + "babel-plugin-polyfill-regenerator": { + "version": "0.3.0", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.0" + } + }, + "babel-preset-current-node-syntax": { + "version": "1.0.1", + "dev": true, + "requires": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + } + }, + "babel-preset-jest": { + "version": "26.6.2", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^26.6.2", + "babel-preset-current-node-syntax": "^1.0.0" + } + }, + "bach": { + "version": "1.2.0", + "dev": true, + "requires": { + "arr-filter": "^1.1.1", + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "array-each": "^1.0.0", + "array-initial": "^1.0.0", + "array-last": "^1.1.1", + "async-done": "^1.2.2", + "async-settle": "^1.0.0", + "now-and-later": "^2.0.0" + } + }, + "backoff": { + "version": "2.5.0", + "requires": { + "precond": "0.2" + } + }, + "balanced-match": { + "version": "1.0.2" + }, + "base": { + "version": "0.11.2", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-js": { + "version": "1.5.1" + }, + "batch": { + "version": "0.6.1", + "dev": true + }, + "bcp47": { + "version": "1.1.2" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bcryptjs": { + "version": "2.4.3" + }, + "beeper": { + "version": "1.1.1", + "dev": true + }, + "big.js": { + "version": "5.2.2", + "dev": true + }, + "bigdecimal": { + "version": "0.6.1" + }, + "bignumber.js": { + "version": "9.0.0" + }, + "binary-extensions": { + "version": "1.13.1", + "dev": true + }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, + "bl": { + "version": "2.2.1", + "requires": { + "readable-stream": "^2.3.5", + "safe-buffer": "^5.1.1" + } + }, + "block-stream": { + "version": "0.0.9", + "dev": true, + "requires": { + "inherits": "~2.0.0" + } + }, + "bluebird": { + "version": "3.7.2" + }, + "bmp-js": { + "version": "0.1.0" + }, + "bn.js": { + "version": "5.2.0", + "dev": true + }, + "body-parser": { + "version": "1.19.1", + "requires": { + "bytes": "3.1.1", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.2", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "on-finished": "~2.3.0", + "qs": "6.9.6", + "raw-body": "2.4.2", + "type-is": "~1.6.18" + }, + "dependencies": { + "bytes": { + "version": "3.1.1" + }, + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2" + }, + "ms": { + "version": "2.0.0" + } + } + }, + "bonjour": { + "version": "3.5.0", + "dev": true, + "requires": { + "array-flatten": "^2.1.0", + "deep-equal": "^1.0.1", + "dns-equal": "^1.0.0", + "dns-txt": "^2.0.2", + "multicast-dns": "^6.0.1", + "multicast-dns-service-types": "^1.1.0" + }, + "dependencies": { + "array-flatten": { + "version": "2.1.2", + "dev": true + } + } + }, + "boolbase": { + "version": "1.0.0", + "dev": true + }, + "bops": { + "version": "1.0.0", + "requires": { + "base64-js": "1.0.2", + "to-utf8": "0.0.1" + }, + "dependencies": { + "base64-js": { + "version": "1.0.2" + } + } + }, + "bowser": { + "version": "2.9.0" + }, + "boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "requires": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } + } + }, + "brace-expansion": { + "version": "1.1.11", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "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.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "dev": true + }, + "browser-process-hrtime": { + "version": "1.0.0", + "dev": true + }, + "browserify-aes": { + "version": "1.2.0", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.1.0", + "dev": true, + "requires": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.2.1", + "dev": true, + "requires": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "dev": true + } + } + }, + "browserify-zlib": { + "version": "0.2.0", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "browserslist": { + "version": "4.19.1", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", + "escalade": "^3.1.1", + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" + } + }, + "bser": { + "version": "2.1.1", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "btoa": { + "version": "1.2.1" + }, + "buffer": { + "version": "4.9.2", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "buffer-crc32": { + "version": "0.2.13" + }, + "buffer-equal": { + "version": "1.0.0", + "dev": true + }, + "buffer-equal-constant-time": { + "version": "1.0.1" + }, + "buffer-from": { + "version": "1.1.2" + }, + "buffer-indexof": { + "version": "1.1.1", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "dev": true + }, + "bufferstreams": { + "version": "1.1.0", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "builtin-status-codes": { + "version": "3.0.0", + "dev": true + }, + "bytes": { + "version": "3.0.0" + }, + "cacache": { + "version": "12.0.4", + "dev": true, + "requires": { + "bluebird": "^3.5.5", + "chownr": "^1.1.1", + "figgy-pudding": "^3.5.1", + "glob": "^7.1.4", + "graceful-fs": "^4.1.15", + "infer-owner": "^1.0.3", + "lru-cache": "^5.1.1", + "mississippi": "^3.0.0", + "mkdirp": "^0.5.1", + "move-concurrently": "^1.0.1", + "promise-inflight": "^1.0.1", + "rimraf": "^2.6.3", + "ssri": "^6.0.1", + "unique-filename": "^1.1.1", + "y18n": "^4.0.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "cache-base": { + "version": "1.0.1", + "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" + } + }, + "cacheable-lookup": { + "version": "2.0.1", + "requires": { + "@types/keyv": "^3.1.1", + "keyv": "^4.0.0" + } + }, + "cacheable-request": { + "version": "7.0.2", + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + } + }, + "call-bind": { + "version": "1.0.2", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "dev": true + }, + "camel-case": { + "version": "3.0.0", + "dev": true, + "requires": { + "no-case": "^2.2.0", + "upper-case": "^1.1.1" + } + }, + "camelcase": { + "version": "5.3.1", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "dev": true + } + } + }, + "camelize": { + "version": "1.0.0" + }, + "caniuse-lite": { + "version": "1.0.30001299", + "dev": true + }, + "canonical-json": { + "version": "0.0.4" + }, + "capture-exit": { + "version": "2.0.0", + "dev": true, + "requires": { + "rsvp": "^4.8.4" + } + }, + "caseless": { + "version": "0.12.0" + }, + "chalk": { + "version": "2.4.2", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "char-regex": { + "version": "1.0.2", + "dev": true + }, + "charenc": { + "version": "0.0.2" + }, + "chokidar": { + "version": "2.1.8", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + }, + "dependencies": { + "fsevents": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", + "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "dev": true, + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } + }, + "glob-parent": { + "version": "3.1.0", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + } + } + }, + "chownr": { + "version": "1.1.4" + }, + "chrome-trace-event": { + "version": "1.0.3", + "dev": true + }, + "ci-info": { + "version": "2.0.0", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "cjs-module-lexer": { + "version": "0.6.0", + "dev": true + }, + "class-utils": { + "version": "0.3.6", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + } + }, + "cldrjs": { + "version": "0.5.5" + }, + "clean-css": { + "version": "4.2.4", + "dev": true, + "requires": { + "source-map": "~0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "clone": { + "version": "2.1.2", + "dev": true + }, + "clone-buffer": { + "version": "1.0.0", + "dev": true + }, + "clone-deep": { + "version": "4.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "clone-response": { + "version": "1.0.2", + "requires": { + "mimic-response": "^1.0.0" + }, + "dependencies": { + "mimic-response": { + "version": "1.0.1" + } + } + }, + "clone-stats": { + "version": "1.0.0", + "dev": true + }, + "cloneable-readable": { + "version": "1.1.3", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "process-nextick-args": "^2.0.0", + "readable-stream": "^2.3.5" + } + }, + "cls-hooked": { + "version": "4.2.2", + "requires": { + "async-hook-jl": "^1.7.6", + "emitter-listener": "^1.0.1", + "semver": "^5.4.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1" + } + } + }, + "co": { + "version": "4.6.0", + "dev": true + }, + "code-point-at": { + "version": "1.1.0" + }, + "collect-v8-coverage": { + "version": "1.0.1", + "dev": true + }, + "collection-map": { + "version": "1.0.0", + "dev": true, + "requires": { + "arr-map": "^2.0.2", + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "collection-visit": { + "version": "1.0.0", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color": { + "version": "3.2.1", + "requires": { + "color-convert": "^1.9.3", + "color-string": "^1.6.0" + } + }, + "color-convert": { + "version": "1.9.3", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3" + }, + "color-string": { + "version": "1.9.0", + "requires": { + "color-name": "^1.0.0", + "simple-swizzle": "^0.2.2" + } + }, + "color-support": { + "version": "1.1.3", + "dev": true + }, + "colors": { + "version": "1.4.0", + "dev": true + }, + "combined-stream": { + "version": "1.0.8", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.17.1" + }, + "commondir": { + "version": "1.0.1" + }, + "component-emitter": { + "version": "1.3.0", + "dev": true + }, + "compressible": { + "version": "2.0.18", + "requires": { + "mime-db": ">= 1.43.0 < 2" + } + }, + "compression": { + "version": "1.7.4", + "requires": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0" + } + } + }, + "concat-map": { + "version": "0.0.1" + }, + "concat-stream": { + "version": "1.6.2", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + }, + "concat-with-sourcemaps": { + "version": "1.1.0", + "dev": true, + "requires": { + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "configstore": { + "version": "4.0.0", + "requires": { + "dot-prop": "^4.1.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "unique-string": "^1.0.0", + "write-file-atomic": "^2.0.0", + "xdg-basedir": "^3.0.0" + }, + "dependencies": { + "make-dir": { + "version": "1.3.0", + "requires": { + "pify": "^3.0.0" + } + }, + "pify": { + "version": "3.0.0" + }, + "write-file-atomic": { + "version": "2.4.3", + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + } + } + }, + "connect-history-api-fallback": { + "version": "1.6.0", + "dev": true + }, + "console-browserify": { + "version": "1.2.0", + "dev": true + }, + "console-control-strings": { + "version": "1.1.0" + }, + "consolidate": { + "version": "0.15.1", + "dev": true, + "requires": { + "bluebird": "^3.1.1" + } + }, + "constants-browserify": { + "version": "1.0.0", + "dev": true + }, + "content-disposition": { + "version": "0.5.4", + "requires": { + "safe-buffer": "5.2.1" + }, + "dependencies": { + "safe-buffer": { + "version": "5.2.1" + } + } + }, + "content-security-policy-builder": { + "version": "2.1.0" + }, + "content-type": { + "version": "1.0.4" + }, + "convert-source-map": { + "version": "1.8.0", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "cookie": { + "version": "0.4.1" + }, + "cookie-signature": { + "version": "1.0.6" + }, + "copy-concurrently": { + "version": "1.0.5", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "fs-write-stream-atomic": "^1.0.8", + "iferr": "^0.1.5", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "copy-descriptor": { + "version": "0.1.1", + "dev": true + }, + "copy-props": { + "version": "2.0.5", + "dev": true, + "requires": { + "each-props": "^1.3.2", + "is-plain-object": "^5.0.0" + }, + "dependencies": { + "is-plain-object": { + "version": "5.0.0", + "dev": true + } + } + }, + "core-js": { + "version": "3.20.2", + "dev": true + }, + "core-js-compat": { + "version": "3.20.2", + "dev": true, + "requires": { + "browserslist": "^4.19.1", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "dev": true + } + } + }, + "core-js-pure": { + "version": "3.20.2" + }, + "core-util-is": { + "version": "1.0.3" + }, + "create-ecdh": { + "version": "4.0.4", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "dev": true + } + } + }, + "create-hash": { + "version": "1.2.0", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-fetch": { + "version": "3.1.4", + "requires": { + "node-fetch": "2.6.1" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.1" + } + } + }, + "cross-spawn": { + "version": "7.0.3", + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "crypt": { + "version": "0.0.2" + }, + "crypto-browserify": { + "version": "3.12.0", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "crypto-random-string": { + "version": "1.0.0" + }, + "css-loader": { + "version": "2.1.1", + "dev": true, + "requires": { + "camelcase": "^5.2.0", + "icss-utils": "^4.1.0", + "loader-utils": "^1.2.3", + "normalize-path": "^3.0.0", + "postcss": "^7.0.14", + "postcss-modules-extract-imports": "^2.0.0", + "postcss-modules-local-by-default": "^2.0.6", + "postcss-modules-scope": "^2.1.0", + "postcss-modules-values": "^2.0.0", + "postcss-value-parser": "^3.3.0", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "css-select": { + "version": "4.2.1", + "dev": true, + "requires": { + "boolbase": "^1.0.0", + "css-what": "^5.1.0", + "domhandler": "^4.3.0", + "domutils": "^2.8.0", + "nth-check": "^2.0.1" + }, + "dependencies": { + "dom-serializer": { + "version": "1.3.2", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + } + }, + "domelementtype": { + "version": "2.2.0", + "dev": true + }, + "domhandler": { + "version": "4.3.0", + "dev": true, + "requires": { + "domelementtype": "^2.2.0" + } + }, + "domutils": { + "version": "2.8.0", + "dev": true, + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + } + }, + "entities": { + "version": "2.2.0", + "dev": true + } + } + }, + "css-what": { + "version": "5.1.0", + "dev": true + }, + "cssesc": { + "version": "3.0.0", + "dev": true + }, + "cssom": { + "version": "0.4.4", + "dev": true + }, + "cssstyle": { + "version": "2.3.0", + "dev": true, + "requires": { + "cssom": "~0.3.6" + }, + "dependencies": { + "cssom": { + "version": "0.3.8", + "dev": true + } + } + }, + "currently-unhandled": { + "version": "0.4.1", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "cyclist": { + "version": "1.0.1", + "dev": true + }, + "d": { + "version": "1.0.1", + "dev": true, + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "dargs": { + "version": "5.1.0", + "dev": true + }, + "dashdash": { + "version": "1.14.1", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "dasherize": { + "version": "2.0.0" + }, + "data-urls": { + "version": "2.0.0", + "dev": true, + "requires": { + "abab": "^2.0.3", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.0.0" + } + }, + "date-and-time": { + "version": "0.6.3" + }, + "dateformat": { + "version": "2.2.0", + "dev": true + }, + "debug": { + "version": "4.3.3", + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "1.2.0", + "dev": true + }, + "decimal.js": { + "version": "10.3.1", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "dev": true + }, + "decompress-response": { + "version": "5.0.0", + "requires": { + "mimic-response": "^2.0.0" + } + }, + "deep-equal": { + "version": "1.1.1", + "dev": true, + "requires": { + "is-arguments": "^1.0.4", + "is-date-object": "^1.0.1", + "is-regex": "^1.0.4", + "object-is": "^1.0.1", + "object-keys": "^1.1.1", + "regexp.prototype.flags": "^1.2.0" + } + }, + "deep-extend": { + "version": "0.6.0" + }, + "deep-is": { + "version": "0.1.4", + "dev": true + }, + "deepmerge": { + "version": "4.2.2" + }, + "default-compare": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^5.0.2" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "dev": true + } + } + }, + "default-gateway": { + "version": "4.2.0", + "dev": true, + "requires": { + "execa": "^1.0.0", + "ip-regex": "^2.1.0" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "1.0.0", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "is-stream": { + "version": "1.1.0", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "path-key": { + "version": "2.0.1", + "dev": true + }, + "semver": { + "version": "5.7.1", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "dev": true + }, + "which": { + "version": "1.3.1", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "default-resolution": { + "version": "2.0.0", + "dev": true + }, + "defer-to-connect": { + "version": "2.0.1" + }, + "define-properties": { + "version": "1.1.3", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "define-property": { + "version": "0.2.5", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "del": { + "version": "2.2.2", + "dev": true, + "requires": { + "globby": "^5.0.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "rimraf": "^2.2.8" + } + }, + "delayed-stream": { + "version": "1.0.0" + }, + "delegates": { + "version": "1.0.0" + }, + "denque": { + "version": "1.5.1", + "dev": true + }, + "depd": { + "version": "2.0.0" + }, + "deprecate": { + "version": "1.1.1", + "dev": true + }, + "des.js": { + "version": "1.0.1", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "destroy": { + "version": "1.0.4" + }, + "detect-file": { + "version": "1.0.0", + "dev": true + }, + "detect-libc": { + "version": "1.0.3" + }, + "detect-newline": { + "version": "3.1.0", + "dev": true + }, + "detect-node": { + "version": "2.1.0", + "dev": true + }, + "devtools-protocol": { + "version": "0.0.847576" + }, + "diff": { + "version": "1.4.0" + }, + "diff-sequences": { + "version": "26.6.2", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "dev": true + } + } + }, + "dns-equal": { + "version": "1.0.0", + "dev": true + }, + "dns-packet": { + "version": "1.3.4", + "dev": true, + "requires": { + "ip": "^1.1.0", + "safe-buffer": "^5.0.1" + } + }, + "dns-txt": { + "version": "2.0.2", + "dev": true, + "requires": { + "buffer-indexof": "^1.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "dom-converter": { + "version": "0.2.0", + "dev": true, + "requires": { + "utila": "~0.4" + } + }, + "dom-serializer": { + "version": "0.2.2", + "requires": { + "domelementtype": "^2.0.1", + "entities": "^2.0.0" + }, + "dependencies": { + "domelementtype": { + "version": "2.2.0" + }, + "entities": { + "version": "2.2.0" + } + } + }, + "domain-browser": { + "version": "1.2.0", + "dev": true + }, + "domelementtype": { + "version": "1.3.1" + }, + "domexception": { + "version": "2.0.1", + "dev": true, + "requires": { + "webidl-conversions": "^5.0.0" + }, + "dependencies": { + "webidl-conversions": { + "version": "5.0.0", + "dev": true + } + } + }, + "domhandler": { + "version": "2.4.2", + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.7.0", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "dont-sniff-mimetype": { + "version": "1.1.0" + }, + "dot-case": { + "version": "3.0.4", + "dev": true, + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + }, + "dependencies": { + "lower-case": { + "version": "2.0.2", + "dev": true, + "requires": { + "tslib": "^2.0.3" + } + }, + "no-case": { + "version": "3.0.4", + "dev": true, + "requires": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + } + } + }, + "dot-prop": { + "version": "4.2.1", + "requires": { + "is-obj": "^1.0.0" + } + }, + "duplex": { + "version": "1.0.0" + }, + "duplex-child-process": { + "version": "0.0.5" + }, + "duplexer": { + "version": "0.0.4" + }, + "duplexer2": { + "version": "0.0.2", + "dev": true, + "requires": { + "readable-stream": "~1.1.9" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "dev": true + }, + "readable-stream": { + "version": "1.1.14", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "dev": true + } + } + }, + "duplexer3": { + "version": "0.1.4" + }, + "duplexify": { + "version": "3.7.1", + "requires": { + "end-of-stream": "^1.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.0.0", + "stream-shift": "^1.0.0" + } + }, + "each-props": { + "version": "1.3.2", + "dev": true, + "requires": { + "is-plain-object": "^2.0.1", + "object.defaults": "^1.1.0" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "ee-first": { + "version": "1.1.1" + }, + "ejs": { + "version": "2.7.4" + }, + "electron-to-chromium": { + "version": "1.4.45", + "dev": true + }, + "elliptic": { + "version": "6.5.4", + "dev": true, + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "dev": true + } + } + }, + "emitter-listener": { + "version": "1.1.2", + "requires": { + "shimmer": "^1.2.0" + } + }, + "emittery": { + "version": "0.7.2", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "dev": true + }, + "emojis-list": { + "version": "3.0.0", + "dev": true + }, + "encodeurl": { + "version": "1.0.2" + }, + "encoding-japanese": { + "version": "1.0.30" + }, + "end-of-stream": { + "version": "1.4.4", + "requires": { + "once": "^1.4.0" + } + }, + "enhanced-resolve": { + "version": "4.5.0", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.5.0", + "tapable": "^1.0.0" + }, + "dependencies": { + "memory-fs": { + "version": "0.5.0", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + } + } + }, + "enquirer": { + "version": "2.3.6", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "ent": { + "version": "2.2.0" + }, + "entities": { + "version": "1.1.2" + }, + "errno": { + "version": "0.1.8", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, + "error-ex": { + "version": "1.3.2", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "errs": { + "version": "0.3.2" + }, + "es-abstract": { + "version": "1.19.1", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "es5-ext": { + "version": "0.10.53", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.3", + "next-tick": "~1.0.0" + } + }, + "es6-iterator": { + "version": "2.0.3", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "es6-promise": { + "version": "4.2.8" + }, + "es6-promisify": { + "version": "5.0.0", + "requires": { + "es6-promise": "^4.0.3" + } + }, + "es6-symbol": { + "version": "3.1.3", + "dev": true, + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "es6-templates": { + "version": "0.2.3", + "dev": true, + "requires": { + "recast": "~0.11.12", + "through": "~2.3.6" + } + }, + "es6-weak-map": { + "version": "2.0.3", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.46", + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.1" + } + }, + "escalade": { + "version": "3.1.1", + "dev": true + }, + "escape-goat": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", + "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", + "dev": true + }, + "escape-html": { + "version": "1.0.3" + }, + "escape-string-regexp": { + "version": "1.0.5" + }, + "escodegen": { + "version": "2.0.0", + "dev": true, + "requires": { + "esprima": "^4.0.1", + "estraverse": "^5.2.0", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.6.1" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "dev": true + }, + "levn": { + "version": "0.3.0", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "optionator": { + "version": "0.8.3", + "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", + "word-wrap": "~1.2.3" + } + }, + "prelude-ls": { + "version": "1.1.2", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "dev": true, + "optional": true + }, + "type-check": { + "version": "0.3.2", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + } + } + }, + "eslint": { + "version": "7.32.0", + "dev": true, + "requires": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.12.11", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "dev": true + }, + "globals": { + "version": "13.12.0", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.5", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "type-fest": { + "version": "0.20.2", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "eslint-config-google": { + "version": "0.11.0", + "dev": true, + "requires": {} + }, + "eslint-plugin-jasmine": { + "version": "2.10.1", + "dev": true + }, + "eslint-scope": { + "version": "5.1.1", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "2.1.0", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "dev": true + }, + "espree": { + "version": "7.3.1", + "dev": true, + "requires": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "1.3.0", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.1" + }, + "esquery": { + "version": "1.4.0", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0" + }, + "esutils": { + "version": "2.0.3", + "dev": true + }, + "etag": { + "version": "1.8.1" + }, + "event-target-shim": { + "version": "5.0.1" + }, + "eventemitter2": { + "version": "5.0.1" + }, + "eventemitter3": { + "version": "4.0.7", + "dev": true + }, + "events": { + "version": "1.1.1" + }, + "eventsource": { + "version": "1.1.0", + "dev": true, + "requires": { + "original": "^1.0.0" + } + }, + "evp_bytestokey": { + "version": "1.0.3", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "exec-sh": { + "version": "0.3.6", + "dev": true + }, + "execa": { + "version": "4.1.0", + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + }, + "dependencies": { + "merge-stream": { + "version": "2.0.0" + } + } + }, + "exit": { + "version": "0.1.2", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "dev": true + } + } + }, + "expand-template": { + "version": "2.0.3" + }, + "expand-tilde": { + "version": "2.0.2", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "expect": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "ansi-styles": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-regex-util": "^26.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + } + } + }, + "express": { + "version": "4.17.2", + "requires": { + "accepts": "~1.3.7", + "array-flatten": "1.1.1", + "body-parser": "1.19.1", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.4.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.2", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "~1.1.2", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.7", + "qs": "6.9.6", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.17.2", + "serve-static": "1.14.2", + "setprototypeof": "1.2.0", + "statuses": "~1.5.0", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2" + }, + "ms": { + "version": "2.0.0" + }, + "safe-buffer": { + "version": "5.2.1" + } + } + }, + "ext": { + "version": "1.6.0", + "dev": true, + "requires": { + "type": "^2.5.0" + }, + "dependencies": { + "type": { + "version": "2.5.0", + "dev": true + } + } + }, + "extend": { + "version": "3.0.2" + }, + "extend-shallow": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "extglob": { + "version": "2.0.4", + "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" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extract-zip": { + "version": "2.0.1", + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + } + }, + "extsprintf": { + "version": "1.3.0" + }, + "eyes": { + "version": "0.1.8" + }, + "fancy-log": { + "version": "1.3.3", + "dev": true, + "requires": { + "ansi-gray": "^0.1.1", + "color-support": "^1.1.3", + "parse-node-version": "^1.0.0", + "time-stamp": "^1.0.0" + } + }, + "fast-deep-equal": { + "version": "3.1.3" + }, + "fast-json-patch": { + "version": "2.2.1", + "requires": { + "fast-deep-equal": "^2.0.1" + }, + "dependencies": { + "fast-deep-equal": { + "version": "2.0.1" + } + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0" + }, + "fast-levenshtein": { + "version": "2.0.6", + "dev": true + }, + "fast-safe-stringify": { + "version": "2.1.1" + }, + "fast-text-encoding": { + "version": "1.0.3" + }, + "fastparse": { + "version": "1.1.2", + "dev": true + }, + "faye-websocket": { + "version": "0.11.4", + "dev": true, + "requires": { + "websocket-driver": ">=0.5.1" + } + }, + "fb-watchman": { + "version": "2.0.1", + "dev": true, + "requires": { + "bser": "2.1.1" + } + }, + "fd-slicer": { + "version": "1.1.0", + "requires": { + "pend": "~1.2.0" + } + }, + "feature-policy": { + "version": "0.3.0" + }, + "figgy-pudding": { + "version": "3.5.2", + "dev": true + }, + "file-entry-cache": { + "version": "6.0.1", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "file-loader": { + "version": "1.1.11", + "dev": true, + "requires": { + "loader-utils": "^1.0.2", + "schema-utils": "^0.4.5" + }, + "dependencies": { + "schema-utils": { + "version": "0.4.7", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "file-type": { + "version": "10.11.0" + }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, + "filed-mimefix": { + "version": "0.1.3", + "requires": { + "mime": "^1.4.0" + }, + "dependencies": { + "mime": { + "version": "1.6.0" + } + } + }, + "filelist": { + "version": "1.0.2", + "requires": { + "minimatch": "^3.0.4" + } + }, + "fill-range": { + "version": "4.0.0", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + } + }, + "finalhandler": { + "version": "1.1.2", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.3", + "statuses": "~1.5.0", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0" + } + } + }, + "find-cache-dir": { + "version": "2.1.0", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "4.1.0", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "findup-sync": { + "version": "3.0.0", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^4.0.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + }, + "dependencies": { + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "micromatch": { + "version": "3.1.10", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "fined": { + "version": "1.2.0", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "is-plain-object": "^2.0.3", + "object.defaults": "^1.1.0", + "object.pick": "^1.2.0", + "parse-filepath": "^1.0.1" + } + }, + "flagged-respawn": { + "version": "1.0.1", + "dev": true + }, + "flat-cache": { + "version": "3.0.4", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "dependencies": { + "rimraf": { + "version": "3.0.2", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "flatted": { + "version": "3.2.4", + "dev": true + }, + "flush-write-stream": { + "version": "1.1.1", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "readable-stream": "^2.3.6" + } + }, + "follow-redirects": { + "version": "1.14.7" + }, + "for-in": { + "version": "1.0.2", + "dev": true + }, + "for-own": { + "version": "1.0.0", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, + "forever-agent": { + "version": "0.6.1" + }, + "form-data": { + "version": "3.0.1", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "form-data-encoder": { + "version": "1.7.1" + }, + "formdata-node": { + "version": "4.3.2", + "requires": { + "node-domexception": "1.0.0", + "web-streams-polyfill": "4.0.0-beta.1" + } + }, + "formidable": { + "version": "1.2.6" + }, + "forwarded": { + "version": "0.2.0" + }, + "fragment-cache": { + "version": "0.2.1", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fresh": { + "version": "0.5.2" + }, + "from2": { + "version": "2.3.0", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "fs-constants": { + "version": "1.0.0" + }, + "fs-extra": { + "version": "5.0.0", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs-mkdirp-stream": { + "version": "1.0.0", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "through2": "^2.0.3" + } + }, + "fs-readfile-promise": { + "version": "3.0.1", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "iferr": "^0.1.5", + "imurmurhash": "^0.1.4", + "readable-stream": "1 || 2" + } + }, + "fs.realpath": { + "version": "1.0.0" + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "fstream": { + "version": "1.0.12", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "ftps": { + "version": "1.2.0", + "requires": { + "duplex-child-process": "0.0.5", + "lodash": "^4.4.0" + } + }, + "function-bind": { + "version": "1.1.1" + }, + "functional-red-black-tree": { + "version": "1.0.1", + "dev": true + }, + "g11n-pipeline": { + "version": "2.0.6", + "requires": { + "swagger-client": "^3.8.3" + } + }, + "gauge": { + "version": "2.7.4", + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1" + }, + "strip-ansi": { + "version": "3.0.1", + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "gaxios": { + "version": "1.8.4", + "requires": { + "abort-controller": "^3.0.0", + "extend": "^3.0.2", + "https-proxy-agent": "^2.2.1", + "node-fetch": "^2.3.0" + }, + "dependencies": { + "abort-controller": { + "version": "3.0.0", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "agent-base": { + "version": "4.3.0", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + }, + "https-proxy-agent": { + "version": "2.2.4", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + } + } + }, + "gaze": { + "version": "1.1.3", + "dev": true, + "requires": { + "globule": "^1.0.0" + } + }, + "gcp-metadata": { + "version": "1.0.0", + "requires": { + "gaxios": "^1.0.2", + "json-bigint": "^0.3.0" + } + }, + "gcs-resumable-upload": { + "version": "1.1.0", + "requires": { + "abort-controller": "^2.0.2", + "configstore": "^4.0.0", + "gaxios": "^1.5.0", + "google-auth-library": "^3.0.0", + "pumpify": "^1.5.1", + "stream-events": "^1.0.4" + } + }, + "generate-function": { + "version": "2.3.1", + "dev": true, + "requires": { + "is-property": "^1.0.2" + } + }, + "gensync": { + "version": "1.0.0-beta.2", + "dev": true + }, + "get-caller-file": { + "version": "1.0.3", + "dev": true + }, + "get-intrinsic": { + "version": "1.1.1", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-package-type": { + "version": "0.1.0", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "dev": true + }, + "get-stream": { + "version": "5.2.0", + "requires": { + "pump": "^3.0.0" + } + }, + "get-symbol-description": { + "version": "1.0.0", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "get-value": { + "version": "2.0.6", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "github-from-package": { + "version": "0.0.0" + }, + "glob": { + "version": "7.2.0", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "glob-stream": { + "version": "6.1.0", + "dev": true, + "requires": { + "extend": "^3.0.0", + "glob": "^7.1.1", + "glob-parent": "^3.1.0", + "is-negated-glob": "^1.0.0", + "ordered-read-streams": "^1.0.0", + "pumpify": "^1.3.5", + "readable-stream": "^2.1.5", + "remove-trailing-separator": "^1.0.1", + "to-absolute-glob": "^2.0.0", + "unique-stream": "^2.0.2" + }, + "dependencies": { + "glob-parent": { + "version": "3.1.0", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + } + }, + "is-glob": { + "version": "3.1.0", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "glob-watcher": { + "version": "5.0.5", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-done": "^1.2.0", + "chokidar": "^2.0.0", + "is-negated-glob": "^1.0.0", + "just-debounce": "^1.0.0", + "normalize-path": "^3.0.0", + "object.defaults": "^1.1.0" + } + }, + "global-dirs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", + "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", + "dev": true, + "requires": { + "ini": "2.0.0" + }, + "dependencies": { + "ini": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", + "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", + "dev": true + } + } + }, + "global-modules": { + "version": "1.0.0", + "dev": true, + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + }, + "global-prefix": { + "version": "1.0.2", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "globalize": { + "version": "1.7.0", + "requires": { + "cldrjs": "^0.5.4" + } + }, + "globals": { + "version": "11.12.0", + "dev": true + }, + "globby": { + "version": "5.0.0", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "arrify": "^1.0.0", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "globule": { + "version": "1.3.3", + "dev": true, + "requires": { + "glob": "~7.1.1", + "lodash": "~4.17.10", + "minimatch": "~3.0.2" + }, + "dependencies": { + "glob": { + "version": "7.1.7", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + } + } + }, + "glogg": { + "version": "1.0.2", + "dev": true, + "requires": { + "sparkles": "^1.0.0" + } + }, + "google-auth-library": { + "version": "3.1.2", + "requires": { + "base64-js": "^1.3.0", + "fast-text-encoding": "^1.0.0", + "gaxios": "^1.2.1", + "gcp-metadata": "^1.0.0", + "gtoken": "^2.3.2", + "https-proxy-agent": "^2.2.1", + "jws": "^3.1.5", + "lru-cache": "^5.0.0", + "semver": "^5.5.0" + }, + "dependencies": { + "agent-base": { + "version": "4.3.0", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + }, + "https-proxy-agent": { + "version": "2.2.4", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + }, + "semver": { + "version": "5.7.1" + } + } + }, + "google-p12-pem": { + "version": "1.0.5", + "requires": { + "node-forge": "^0.10.0", + "pify": "^4.0.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1" + } + } + }, + "got": { + "version": "10.7.0", + "requires": { + "@sindresorhus/is": "^2.0.0", + "@szmarczak/http-timer": "^4.0.0", + "@types/cacheable-request": "^6.0.1", + "cacheable-lookup": "^2.0.0", + "cacheable-request": "^7.0.1", + "decompress-response": "^5.0.0", + "duplexer3": "^0.1.4", + "get-stream": "^5.0.0", + "lowercase-keys": "^2.0.0", + "mimic-response": "^2.1.0", + "p-cancelable": "^2.0.0", + "p-event": "^4.0.0", + "responselike": "^2.0.0", + "to-readable-stream": "^2.0.0", + "type-fest": "^0.10.0" + } + }, + "graceful-fs": { + "version": "4.2.9" + }, + "growl": { + "version": "1.9.2" + }, + "growly": { + "version": "1.3.0", + "dev": true, + "optional": true + }, + "gtoken": { + "version": "2.3.3", + "requires": { + "gaxios": "^1.0.4", + "google-p12-pem": "^1.0.0", + "jws": "^3.1.5", + "mime": "^2.2.0", + "pify": "^4.0.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1" + } + } + }, + "gulp": { + "version": "4.0.2", + "dev": true, + "requires": { + "glob-watcher": "^5.0.3", + "gulp-cli": "^2.2.0", + "undertaker": "^1.2.1", + "vinyl-fs": "^3.0.0" + } + }, + "gulp-cli": { + "version": "2.3.0", + "dev": true, + "requires": { + "ansi-colors": "^1.0.1", + "archy": "^1.0.0", + "array-sort": "^1.0.0", + "color-support": "^1.1.3", + "concat-stream": "^1.6.0", + "copy-props": "^2.0.1", + "fancy-log": "^1.3.2", + "gulplog": "^1.0.0", + "interpret": "^1.4.0", + "isobject": "^3.0.1", + "liftoff": "^3.1.0", + "matchdep": "^2.0.0", + "mute-stdout": "^1.0.0", + "pretty-hrtime": "^1.0.0", + "replace-homedir": "^1.0.0", + "semver-greatest-satisfied-range": "^1.1.0", + "v8flags": "^3.2.0", + "yargs": "^7.1.0" + }, + "dependencies": { + "ansi-colors": { + "version": "1.1.0", + "dev": true, + "requires": { + "ansi-wrap": "^0.1.0" + } + } + } + }, + "gulp-concat": { + "version": "2.6.1", + "dev": true, + "requires": { + "concat-with-sourcemaps": "^1.0.0", + "through2": "^2.0.0", + "vinyl": "^2.0.0" + } + }, + "gulp-env": { + "version": "0.4.0", + "dev": true, + "requires": { + "ini": "^1.3.4", + "through2": "^2.0.0" + } + }, + "gulp-file": { + "version": "0.4.0", + "dev": true, + "requires": { + "through2": "^0.4.1", + "vinyl": "^2.1.0" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "dev": true + }, + "object-keys": { + "version": "0.4.0", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "dev": true + }, + "through2": { + "version": "0.4.2", + "dev": true, + "requires": { + "readable-stream": "~1.0.17", + "xtend": "~2.1.1" + } + }, + "xtend": { + "version": "2.1.2", + "dev": true, + "requires": { + "object-keys": "~0.4.0" + } + } + } + }, + "gulp-install": { + "version": "1.1.0", + "dev": true, + "requires": { + "dargs": "^5.1.0", + "gulp-util": "^3.0.7", + "lodash.groupby": "^4.6.0", + "p-queue": "^1.0.0", + "through2": "^2.0.3", + "which": "^1.2.14" + }, + "dependencies": { + "which": { + "version": "1.3.1", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "gulp-merge-json": { + "version": "1.3.1", + "dev": true, + "requires": { + "deprecate": "^1.0.0", + "json5": "^1.0.1", + "lodash.mergewith": "^4.6.1", + "plugin-error": "^1.0.1", + "through": "^2.3.8", + "vinyl": "^2.1.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "gulp-nodemon": { + "version": "2.5.0", + "dev": true, + "requires": { + "colors": "^1.2.1", + "gulp": "^4.0.0", + "nodemon": "^2.0.2" + } + }, + "gulp-print": { + "version": "2.0.1", + "dev": true, + "requires": { + "gulp-util": "^3.0.6", + "map-stream": "~0.0.6" + } + }, + "gulp-util": { + "version": "3.0.8", + "dev": true, + "requires": { + "array-differ": "^1.0.0", + "array-uniq": "^1.0.2", + "beeper": "^1.0.0", + "chalk": "^1.0.0", + "dateformat": "^2.0.0", + "fancy-log": "^1.1.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.0.0", + "minimist": "^1.1.0", + "multipipe": "^0.1.2", + "object-assign": "^3.0.0", + "replace-ext": "0.0.1", + "through2": "^2.0.0", + "vinyl": "^0.5.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "clone": { + "version": "1.0.4", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "dev": true + }, + "object-assign": { + "version": "3.0.0", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "dev": true + }, + "vinyl": { + "version": "0.5.3", + "dev": true, + "requires": { + "clone": "^1.0.0", + "clone-stats": "^0.0.1", + "replace-ext": "0.0.1" + } + } + } + }, + "gulp-wrap": { + "version": "0.15.0", + "dev": true, + "requires": { + "consolidate": "^0.15.1", + "es6-promise": "^4.2.6", + "fs-readfile-promise": "^3.0.1", + "js-yaml": "^3.13.0", + "lodash": "^4.17.11", + "node.extend": "2.0.2", + "plugin-error": "^1.0.1", + "through2": "^3.0.1", + "tryit": "^1.0.1", + "vinyl-bufferstream": "^1.0.1" + }, + "dependencies": { + "through2": { + "version": "3.0.2", + "dev": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + } + } + }, + "gulp-yaml": { + "version": "1.0.1", + "dev": true, + "requires": { + "bufferstreams": "1.1.0", + "gulp-util": "^3.0.6", + "js-yaml": "^3.4.3", + "through2": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "gulplog": { + "version": "1.0.0", + "dev": true, + "requires": { + "glogg": "^1.0.0" + } + }, + "handle-thing": { + "version": "2.0.1", + "dev": true + }, + "har-schema": { + "version": "2.0.0" + }, + "har-validator": { + "version": "5.1.5", + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + } + }, + "harmony-reflect": { + "version": "1.6.2", + "dev": true + }, + "has": { + "version": "1.0.3", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "dev": true + } + } + }, + "has-bigints": { + "version": "1.0.1", + "dev": true + }, + "has-flag": { + "version": "3.0.0" + }, + "has-gulplog": { + "version": "0.1.0", + "dev": true, + "requires": { + "sparkles": "^1.0.0" + } + }, + "has-symbols": { + "version": "1.0.2" + }, + "has-tostringtag": { + "version": "1.0.0", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "has-unicode": { + "version": "2.0.1" + }, + "has-value": { + "version": "1.0.0", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "has-yarn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", + "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", + "dev": true + }, + "hash-base": { + "version": "3.1.0", + "dev": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "dev": true + } + } + }, + "hash-stream-validation": { + "version": "0.2.4" + }, + "hash.js": { + "version": "1.1.7", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "he": { + "version": "1.2.0" + }, + "helmet": { + "version": "3.23.3", + "requires": { + "depd": "2.0.0", + "dont-sniff-mimetype": "1.1.0", + "feature-policy": "0.3.0", + "helmet-crossdomain": "0.4.0", + "helmet-csp": "2.10.0", + "hide-powered-by": "1.1.0", + "hpkp": "2.0.0", + "hsts": "2.2.0", + "nocache": "2.1.0", + "referrer-policy": "1.2.0", + "x-xss-protection": "1.3.0" + } + }, + "helmet-crossdomain": { + "version": "0.4.0" + }, + "helmet-csp": { + "version": "2.10.0", + "requires": { + "bowser": "2.9.0", + "camelize": "1.0.0", + "content-security-policy-builder": "2.1.0", + "dasherize": "2.0.0" + } + }, + "hide-powered-by": { + "version": "1.1.0" + }, + "hmac-drbg": { + "version": "1.0.1", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "homedir-polyfill": { + "version": "1.0.3", + "dev": true, + "requires": { + "parse-passwd": "^1.0.0" + } + }, + "hosted-git-info": { + "version": "2.8.9", + "dev": true + }, + "hpack.js": { + "version": "2.1.6", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "obuf": "^1.0.0", + "readable-stream": "^2.0.1", + "wbuf": "^1.1.0" + } + }, + "hpkp": { + "version": "2.0.0" + }, + "hsts": { + "version": "2.2.0", + "requires": { + "depd": "2.0.0" + } + }, + "html-encoding-sniffer": { + "version": "2.0.1", + "dev": true, + "requires": { + "whatwg-encoding": "^1.0.5" + } + }, + "html-entities": { + "version": "1.4.0", + "dev": true + }, + "html-escaper": { + "version": "2.0.2", + "dev": true + }, + "html-loader": { + "version": "0.4.5", + "dev": true, + "requires": { + "es6-templates": "^0.2.2", + "fastparse": "^1.1.1", + "html-minifier": "^3.0.1", + "loader-utils": "^1.0.2", + "object-assign": "^4.1.0" + } + }, + "html-loader-jest": { + "version": "0.2.1", + "dev": true, + "requires": { + "html-loader": "^0.5.1" + }, + "dependencies": { + "html-loader": { + "version": "0.5.5", + "dev": true, + "requires": { + "es6-templates": "^0.2.3", + "fastparse": "^1.1.1", + "html-minifier": "^3.5.8", + "loader-utils": "^1.1.0", + "object-assign": "^4.1.1" + } + } + } + }, + "html-minifier": { + "version": "3.5.21", + "dev": true, + "requires": { + "camel-case": "3.0.x", + "clean-css": "4.2.x", + "commander": "2.17.x", + "he": "1.2.x", + "param-case": "2.1.x", + "relateurl": "0.2.x", + "uglify-js": "3.4.x" + } + }, + "html-minifier-terser": { + "version": "5.1.1", + "dev": true, + "requires": { + "camel-case": "^4.1.1", + "clean-css": "^4.2.3", + "commander": "^4.1.1", + "he": "^1.2.0", + "param-case": "^3.0.3", + "relateurl": "^0.2.7", + "terser": "^4.6.3" + }, + "dependencies": { + "camel-case": { + "version": "4.1.2", + "dev": true, + "requires": { + "pascal-case": "^3.1.2", + "tslib": "^2.0.3" + } + }, + "commander": { + "version": "4.1.1", + "dev": true + }, + "param-case": { + "version": "3.0.4", + "dev": true, + "requires": { + "dot-case": "^3.0.4", + "tslib": "^2.0.3" + } + } + } + }, + "html-to-text": { + "version": "5.1.1", + "requires": { + "he": "^1.2.0", + "htmlparser2": "^3.10.1", + "lodash": "^4.17.11", + "minimist": "^1.2.0" + } + }, + "html-webpack-plugin": { + "version": "4.5.2", + "dev": true, + "requires": { + "@types/html-minifier-terser": "^5.0.0", + "@types/tapable": "^1.0.5", + "@types/webpack": "^4.41.8", + "html-minifier-terser": "^5.0.1", + "loader-utils": "^1.2.3", + "lodash": "^4.17.20", + "pretty-error": "^2.1.1", + "tapable": "^1.1.3", + "util.promisify": "1.0.0" + } + }, + "htmlparser2": { + "version": "3.10.1", + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "http-cache-semantics": { + "version": "4.1.0" + }, + "http-deceiver": { + "version": "1.2.7", + "dev": true + }, + "http-errors": { + "version": "1.8.1", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": ">= 1.5.0 < 2", + "toidentifier": "1.0.1" + }, + "dependencies": { + "depd": { + "version": "1.1.2" + } + } + }, + "http-parser-js": { + "version": "0.5.5", + "dev": true + }, + "http-proxy": { + "version": "1.18.1", + "dev": true, + "requires": { + "eventemitter3": "^4.0.0", + "follow-redirects": "^1.0.0", + "requires-port": "^1.0.0" + } + }, + "http-proxy-agent": { + "version": "4.0.1", + "dev": true, + "requires": { + "@tootallnate/once": "1", + "agent-base": "6", + "debug": "4" + } + }, + "http-proxy-middleware": { + "version": "0.19.1", + "dev": true, + "requires": { + "http-proxy": "^1.17.0", + "is-glob": "^4.0.0", + "lodash": "^4.17.11", + "micromatch": "^3.1.10" + }, + "dependencies": { + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "micromatch": { + "version": "3.1.10", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "http-signature": { + "version": "1.2.0", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "http-status": { + "version": "1.5.0" + }, + "httpntlm": { + "version": "1.6.1", + "requires": { + "httpreq": ">=0.4.22", + "underscore": "~1.7.0" + } + }, + "httpreq": { + "version": "0.5.2" + }, + "https-browserify": { + "version": "1.0.0", + "dev": true + }, + "https-proxy-agent": { + "version": "5.0.0", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "human-signals": { + "version": "1.1.1" + }, + "i18n": { + "version": "0.8.6", + "requires": { + "debug": "*", + "make-plural": "^6.0.1", + "math-interval-parser": "^2.0.1", + "messageformat": "^2.3.0", + "mustache": "*", + "sprintf-js": "^1.1.2" + } + }, + "iconv-lite": { + "version": "0.4.24", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "icss-replace-symbols": { + "version": "1.1.0", + "dev": true + }, + "icss-utils": { + "version": "4.1.1", + "dev": true, + "requires": { + "postcss": "^7.0.14" + } + }, + "identity-obj-proxy": { + "version": "3.0.0", + "dev": true, + "requires": { + "harmony-reflect": "^1.4.6" + } + }, + "ieee754": { + "version": "1.1.13" + }, + "iferr": { + "version": "0.1.5", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "dev": true + }, + "ignore-by-default": { + "version": "1.0.1", + "dev": true + }, + "image-type": { + "version": "4.1.0", + "requires": { + "file-type": "^10.10.0" + } + }, + "imap": { + "version": "0.8.19", + "requires": { + "readable-stream": "1.1.x", + "utf7": ">=1.0.2" + }, + "dependencies": { + "isarray": { + "version": "0.0.1" + }, + "readable-stream": { + "version": "1.1.14", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31" + } + } + }, + "import-fresh": { + "version": "3.3.0", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "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 + }, + "import-local": { + "version": "3.1.0", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "dependencies": { + "pkg-dir": { + "version": "4.2.0", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + } + } + }, + "imurmurhash": { + "version": "0.1.4" + }, + "in-publish": { + "version": "2.0.1", + "dev": true + }, + "indent-string": { + "version": "2.1.0", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "infer-owner": { + "version": "1.0.4", + "dev": true + }, + "inflection": { + "version": "1.13.1" + }, + "inflight": { + "version": "1.0.6", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4" + }, + "ini": { + "version": "1.3.8" + }, + "internal-ip": { + "version": "4.3.0", + "dev": true, + "requires": { + "default-gateway": "^4.2.0", + "ipaddr.js": "^1.9.0" + } + }, + "internal-slot": { + "version": "1.0.3", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, + "interpret": { + "version": "1.4.0", + "dev": true + }, + "invert-kv": { + "version": "2.0.0" + }, + "ip": { + "version": "1.1.5" + }, + "ip-regex": { + "version": "2.1.0", + "dev": true + }, + "ipaddr.js": { + "version": "1.9.1" + }, + "is": { + "version": "3.3.0", + "dev": true + }, + "is-absolute": { + "version": "1.0.0", + "dev": true, + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, + "is-absolute-url": { + "version": "3.0.3", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arguments": { + "version": "1.1.1", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-arrayish": { + "version": "0.2.1", + "dev": true + }, + "is-bigint": { + "version": "1.0.4", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-binary-path": { + "version": "1.0.1", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6" + }, + "is-callable": { + "version": "1.2.4", + "dev": true + }, + "is-ci": { + "version": "2.0.0", + "dev": true, + "requires": { + "ci-info": "^2.0.0" + } + }, + "is-core-module": { + "version": "2.8.1", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-date-object": { + "version": "1.0.5", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-descriptor": { + "version": "0.1.6", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "dev": true + } + } + }, + "is-docker": { + "version": "2.2.1", + "dev": true, + "optional": true + }, + "is-extendable": { + "version": "0.1.1", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "dev": true + }, + "is-finite": { + "version": "1.1.0", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-generator-fn": { + "version": "2.1.0", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-installed-globally": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", + "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", + "dev": true, + "requires": { + "global-dirs": "^3.0.0", + "is-path-inside": "^3.0.2" + }, + "dependencies": { + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + } + } + }, + "is-negated-glob": { + "version": "1.0.0", + "dev": true + }, + "is-negative-zero": { + "version": "2.0.2", + "dev": true + }, + "is-npm": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", + "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", + "dev": true + }, + "is-number": { + "version": "3.0.0", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-number-object": { + "version": "1.0.6", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-obj": { + "version": "1.0.1" + }, + "is-path-cwd": { + "version": "1.0.0", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-path-inside": "^1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.1", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "is-plain-object": { + "version": "2.0.4", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-potential-custom-element-name": { + "version": "1.0.1", + "dev": true + }, + "is-property": { + "version": "1.0.2", + "dev": true + }, + "is-regex": { + "version": "1.1.4", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-relative": { + "version": "1.0.0", + "dev": true, + "requires": { + "is-unc-path": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.1", + "dev": true + }, + "is-stream": { + "version": "2.0.1" + }, + "is-stream-ended": { + "version": "0.1.4" + }, + "is-string": { + "version": "1.0.7", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-typedarray": { + "version": "1.0.0" + }, + "is-unc-path": { + "version": "1.0.0", + "dev": true, + "requires": { + "unc-path-regex": "^0.1.2" + } + }, + "is-utf8": { + "version": "0.2.1", + "dev": true + }, + "is-valid-glob": { + "version": "1.0.0", + "dev": true + }, + "is-weakref": { + "version": "1.0.2", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "is-windows": { + "version": "1.0.2", + "dev": true + }, + "is-wsl": { + "version": "2.2.0", + "dev": true, + "optional": true, + "requires": { + "is-docker": "^2.0.0" + } + }, + "is-yarn-global": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", + "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", + "dev": true + }, + "isarray": { + "version": "1.0.0" + }, + "isemail": { + "version": "3.2.0", + "requires": { + "punycode": "2.x.x" + } + }, + "isexe": { + "version": "2.0.0" + }, + "isobject": { + "version": "3.0.1" + }, + "isstream": { + "version": "0.1.2" + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "5.1.0", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + }, + "istanbul-lib-report": { + "version": "3.0.0", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "make-dir": { + "version": "3.1.0", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "istanbul-reports": { + "version": "3.1.3", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jade": { + "version": "0.26.3", + "requires": { + "commander": "0.6.1", + "mkdirp": "0.3.0" + }, + "dependencies": { + "commander": { + "version": "0.6.1" + }, + "mkdirp": { + "version": "0.3.0" + } + } + }, + "jake": { + "version": "10.8.2", + "requires": { + "async": "0.9.x", + "chalk": "^2.4.2", + "filelist": "^1.0.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "async": { + "version": "0.9.2" + } + } + }, + "jasmine": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.1.0.tgz", + "integrity": "sha512-4VhjbUgwfNS9CBnUMoSWr9tdNgOoOhNIjAD8YRxTn+PmOf4qTSC0Uqhk66dWGnz2vJxtNIU0uBjiwnsp4Ud9VA==", + "dev": true, + "requires": { + "glob": "^7.1.6", + "jasmine-core": "^4.1.0" + } + }, + "jasmine-core": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.1.1.tgz", + "integrity": "sha512-lmUfT5XcK9KKvt3lLYzn93hc4MGzlUBowExFVgzbSW0ZCrdeyS574dfsyfRhxbg81Wj4gk+RxUiTnj7KBfDA1g==", + "dev": true + }, + "jasmine-reporters": { + "version": "2.5.0", + "dev": true, + "requires": { + "@xmldom/xmldom": "^0.7.3", + "mkdirp": "^1.0.4" + } + }, + "jasmine-spec-reporter": { + "version": "7.0.0", + "dev": true, + "requires": { + "colors": "1.4.0" + } + }, + "jayson": { + "version": "2.1.2", + "requires": { + "@types/node": "^10.3.5", + "commander": "^2.12.2", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.1", + "lodash": "^4.17.11", + "uuid": "^3.2.1" + }, + "dependencies": { + "@types/node": { + "version": "10.17.60" + } + } + }, + "jest": { + "version": "26.6.3", + "dev": true, + "requires": { + "@jest/core": "^26.6.3", + "import-local": "^3.0.2", + "jest-cli": "^26.6.3" + } + }, + "jest-changed-files": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "execa": "^4.0.0", + "throat": "^5.0.0" + } + }, + "jest-cli": { + "version": "26.6.3", + "dev": true, + "requires": { + "@jest/core": "^26.6.3", + "@jest/test-result": "^26.6.2", + "@jest/types": "^26.6.2", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.4", + "import-local": "^3.0.2", + "is-ci": "^2.0.0", + "jest-config": "^26.6.3", + "jest-util": "^26.6.2", + "jest-validate": "^26.6.2", + "prompts": "^2.0.1", + "yargs": "^15.4.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "cliui": { + "version": "6.0.0", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "dev": true + }, + "wrap-ansi": { + "version": "6.2.0", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "yargs": { + "version": "15.4.1", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "jest-config": { + "version": "26.6.3", + "dev": true, + "requires": { + "@babel/core": "^7.1.0", + "@jest/test-sequencer": "^26.6.3", + "@jest/types": "^26.6.2", + "babel-jest": "^26.6.3", + "chalk": "^4.0.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.1", + "graceful-fs": "^4.2.4", + "jest-environment-jsdom": "^26.6.2", + "jest-environment-node": "^26.6.2", + "jest-get-type": "^26.3.0", + "jest-jasmine2": "^26.6.3", + "jest-regex-util": "^26.0.0", + "jest-resolve": "^26.6.2", + "jest-util": "^26.6.2", + "jest-validate": "^26.6.2", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-diff": { + "version": "26.6.2", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-docblock": { + "version": "26.0.0", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "chalk": "^4.0.0", + "jest-get-type": "^26.3.0", + "jest-util": "^26.6.2", + "pretty-format": "^26.6.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-environment-jsdom": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/environment": "^26.6.2", + "@jest/fake-timers": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "jest-mock": "^26.6.2", + "jest-util": "^26.6.2", + "jsdom": "^16.4.0" + } + }, + "jest-environment-node": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/environment": "^26.6.2", + "@jest/fake-timers": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "jest-mock": "^26.6.2", + "jest-util": "^26.6.2" + } + }, + "jest-get-type": { + "version": "26.3.0", + "dev": true + }, + "jest-haste-map": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "@types/graceful-fs": "^4.1.2", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.1.2", + "graceful-fs": "^4.2.4", + "jest-regex-util": "^26.0.0", + "jest-serializer": "^26.6.2", + "jest-util": "^26.6.2", + "jest-worker": "^26.6.2", + "micromatch": "^4.0.2", + "sane": "^4.0.3", + "walker": "^1.0.7" + }, + "dependencies": { + "anymatch": { + "version": "3.1.2", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + } + } + }, + "jest-jasmine2": { + "version": "26.6.3", + "dev": true, + "requires": { + "@babel/traverse": "^7.1.0", + "@jest/environment": "^26.6.2", + "@jest/source-map": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "expect": "^26.6.2", + "is-generator-fn": "^2.0.0", + "jest-each": "^26.6.2", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-runtime": "^26.6.3", + "jest-snapshot": "^26.6.2", + "jest-util": "^26.6.2", + "pretty-format": "^26.6.2", + "throat": "^5.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-junit": { + "version": "8.0.0", + "dev": true, + "requires": { + "jest-validate": "^24.0.0", + "mkdirp": "^0.5.1", + "strip-ansi": "^4.0.0", + "xml": "^1.0.1" + }, + "dependencies": { + "@jest/types": { + "version": "24.9.0", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^1.1.1", + "@types/yargs": "^13.0.0" + } + }, + "@types/istanbul-reports": { + "version": "1.1.2", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*", + "@types/istanbul-lib-report": "*" + } + }, + "@types/yargs": { + "version": "13.0.12", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "ansi-regex": { + "version": "4.1.0", + "dev": true + }, + "jest-get-type": { + "version": "24.9.0", + "dev": true + }, + "jest-validate": { + "version": "24.9.0", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "camelcase": "^5.3.1", + "chalk": "^2.0.1", + "jest-get-type": "^24.9.0", + "leven": "^3.1.0", + "pretty-format": "^24.9.0" + } + }, + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "pretty-format": { + "version": "24.9.0", + "dev": true, + "requires": { + "@jest/types": "^24.9.0", + "ansi-regex": "^4.0.0", + "ansi-styles": "^3.2.0", + "react-is": "^16.8.4" + } + }, + "react-is": { + "version": "16.13.1", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "dev": true + } + } + } + } + }, + "jest-leak-detector": { + "version": "26.6.2", + "dev": true, + "requires": { + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + } + }, + "jest-matcher-utils": { + "version": "26.6.2", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "pretty-format": "^26.6.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-message-util": { + "version": "26.6.2", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "micromatch": "^4.0.2", + "pretty-format": "^26.6.2", + "slash": "^3.0.0", + "stack-utils": "^2.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-mock": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "@types/node": "*" + } + }, + "jest-pnp-resolver": { + "version": "1.2.2", + "dev": true, + "requires": {} + }, + "jest-regex-util": { + "version": "26.0.0", + "dev": true + }, + "jest-resolve": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^26.6.2", + "read-pkg-up": "^7.0.1", + "resolve": "^1.18.1", + "slash": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-resolve-dependencies": { + "version": "26.6.3", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "jest-regex-util": "^26.0.0", + "jest-snapshot": "^26.6.2" + } + }, + "jest-runner": { + "version": "26.6.3", + "dev": true, + "requires": { + "@jest/console": "^26.6.2", + "@jest/environment": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.7.1", + "exit": "^0.1.2", + "graceful-fs": "^4.2.4", + "jest-config": "^26.6.3", + "jest-docblock": "^26.0.0", + "jest-haste-map": "^26.6.2", + "jest-leak-detector": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-resolve": "^26.6.2", + "jest-runtime": "^26.6.3", + "jest-util": "^26.6.2", + "jest-worker": "^26.6.2", + "source-map-support": "^0.5.6", + "throat": "^5.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-runtime": { + "version": "26.6.3", + "dev": true, + "requires": { + "@jest/console": "^26.6.2", + "@jest/environment": "^26.6.2", + "@jest/fake-timers": "^26.6.2", + "@jest/globals": "^26.6.2", + "@jest/source-map": "^26.6.2", + "@jest/test-result": "^26.6.2", + "@jest/transform": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/yargs": "^15.0.0", + "chalk": "^4.0.0", + "cjs-module-lexer": "^0.6.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.4", + "jest-config": "^26.6.3", + "jest-haste-map": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-mock": "^26.6.2", + "jest-regex-util": "^26.0.0", + "jest-resolve": "^26.6.2", + "jest-snapshot": "^26.6.2", + "jest-util": "^26.6.2", + "jest-validate": "^26.6.2", + "slash": "^3.0.0", + "strip-bom": "^4.0.0", + "yargs": "^15.4.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "cliui": { + "version": "6.0.0", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "dev": true + }, + "wrap-ansi": { + "version": "6.2.0", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "yargs": { + "version": "15.4.1", + "dev": true, + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "jest-serializer": { + "version": "26.6.2", + "dev": true, + "requires": { + "@types/node": "*", + "graceful-fs": "^4.2.4" + } + }, + "jest-snapshot": { + "version": "26.6.2", + "dev": true, + "requires": { + "@babel/types": "^7.0.0", + "@jest/types": "^26.6.2", + "@types/babel__traverse": "^7.0.4", + "@types/prettier": "^2.0.0", + "chalk": "^4.0.0", + "expect": "^26.6.2", + "graceful-fs": "^4.2.4", + "jest-diff": "^26.6.2", + "jest-get-type": "^26.3.0", + "jest-haste-map": "^26.6.2", + "jest-matcher-utils": "^26.6.2", + "jest-message-util": "^26.6.2", + "jest-resolve": "^26.6.2", + "natural-compare": "^1.4.0", + "pretty-format": "^26.6.2", + "semver": "^7.3.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.5", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "jest-util": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "@types/node": "*", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.4", + "is-ci": "^2.0.0", + "micromatch": "^4.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-validate": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "camelcase": "^6.0.0", + "chalk": "^4.0.0", + "jest-get-type": "^26.3.0", + "leven": "^3.1.0", + "pretty-format": "^26.6.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "camelcase": { + "version": "6.3.0", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-watcher": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/test-result": "^26.6.2", + "@jest/types": "^26.6.2", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "jest-util": "^26.6.2", + "string-length": "^4.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jest-worker": { + "version": "26.6.2", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "merge-stream": { + "version": "2.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jmespath": { + "version": "0.15.0" + }, + "js-base64": { + "version": "2.6.4", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "js2xmlparser": { + "version": "3.0.0", + "requires": { + "xmlcreate": "^1.0.1" + } + }, + "jsbn": { + "version": "0.1.1" + }, + "jsdom": { + "version": "16.7.0", + "dev": true, + "requires": { + "abab": "^2.0.5", + "acorn": "^8.2.4", + "acorn-globals": "^6.0.0", + "cssom": "^0.4.4", + "cssstyle": "^2.3.0", + "data-urls": "^2.0.0", + "decimal.js": "^10.2.1", + "domexception": "^2.0.1", + "escodegen": "^2.0.0", + "form-data": "^3.0.0", + "html-encoding-sniffer": "^2.0.1", + "http-proxy-agent": "^4.0.1", + "https-proxy-agent": "^5.0.0", + "is-potential-custom-element-name": "^1.0.1", + "nwsapi": "^2.2.0", + "parse5": "6.0.1", + "saxes": "^5.0.1", + "symbol-tree": "^3.2.4", + "tough-cookie": "^4.0.0", + "w3c-hr-time": "^1.0.2", + "w3c-xmlserializer": "^2.0.0", + "webidl-conversions": "^6.1.0", + "whatwg-encoding": "^1.0.5", + "whatwg-mimetype": "^2.3.0", + "whatwg-url": "^8.5.0", + "ws": "^7.4.6", + "xml-name-validator": "^3.0.0" + }, + "dependencies": { + "acorn": { + "version": "8.7.0", + "dev": true + } + } + }, + "jsesc": { + "version": "2.5.2", + "dev": true + }, + "json-bigint": { + "version": "0.3.1", + "requires": { + "bignumber.js": "^9.0.0" + } + }, + "json-buffer": { + "version": "3.0.1" + }, + "json-loader": { + "version": "0.5.7", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "dev": true + }, + "json-schema": { + "version": "0.4.0" + }, + "json-schema-traverse": { + "version": "0.4.1" + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1" + }, + "json3": { + "version": "3.3.3", + "dev": true + }, + "json5": { + "version": "2.2.0", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonfile": { + "version": "4.0.0", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsonparse": { + "version": "1.3.1" + }, + "JSONStream": { + "version": "1.3.5", + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "jsprim": { + "version": "1.4.2", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2" + }, + "verror": { + "version": "1.10.0", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + } + } + }, + "just-debounce": { + "version": "1.1.0", + "dev": true + }, + "jwa": { + "version": "1.4.1", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, + "keyv": { + "version": "4.0.5", + "requires": { + "json-buffer": "3.0.1" + } + }, + "killable": { + "version": "1.0.1", + "dev": true + }, + "kind-of": { + "version": "6.0.3", + "dev": true + }, + "kleur": { + "version": "3.0.3", + "dev": true + }, + "last-run": { + "version": "1.1.1", + "dev": true, + "requires": { + "default-resolution": "^2.0.0", + "es6-weak-map": "^2.0.1" + } + }, + "latest-version": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", + "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", + "dev": true, + "requires": { + "package-json": "^6.3.0" + } + }, + "lazystream": { + "version": "1.0.1", + "dev": true, + "requires": { + "readable-stream": "^2.0.5" + } + }, + "lcid": { + "version": "2.0.0", + "requires": { + "invert-kv": "^2.0.0" + } + }, + "ldap-filter": { + "version": "0.3.3", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "ldapjs": { + "version": "2.3.1", + "requires": { + "abstract-logging": "^2.0.0", + "asn1": "^0.2.4", + "assert-plus": "^1.0.0", + "backoff": "^2.5.0", + "ldap-filter": "^0.3.3", + "once": "^1.4.0", + "vasync": "^2.2.0", + "verror": "^1.8.1" + } + }, + "lead": { + "version": "1.0.0", + "dev": true, + "requires": { + "flush-write-stream": "^1.0.2" + } + }, + "leven": { + "version": "3.1.0", + "dev": true + }, + "levn": { + "version": "0.4.1", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "libbase64": { + "version": "1.2.1" + }, + "libmime": { + "version": "5.0.0", + "requires": { + "encoding-japanese": "1.0.30", + "iconv-lite": "0.6.2", + "libbase64": "1.2.1", + "libqp": "1.1.0" + }, + "dependencies": { + "iconv-lite": { + "version": "0.6.2", + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + } + } + }, + "liboneandone": { + "version": "1.2.0", + "requires": { + "mocha": "^2.5.3", + "request": "^2.74.0" + } + }, + "libqp": { + "version": "1.1.0" + }, + "liftoff": { + "version": "3.1.0", + "dev": true, + "requires": { + "extend": "^3.0.0", + "findup-sync": "^3.0.0", + "fined": "^1.0.1", + "flagged-respawn": "^1.0.0", + "is-plain-object": "^2.0.4", + "object.map": "^1.0.0", + "rechoir": "^0.6.2", + "resolve": "^1.1.7" + } + }, + "lines-and-columns": { + "version": "1.2.4", + "dev": true + }, + "linkify-it": { + "version": "3.0.2", + "requires": { + "uc.micro": "^1.0.1" + } + }, + "load-json-file": { + "version": "1.1.0", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + }, + "dependencies": { + "parse-json": { + "version": "2.2.0", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, + "loader-runner": { + "version": "2.4.0", + "dev": true + }, + "loader-utils": { + "version": "1.4.0", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "locate-path": { + "version": "5.0.0", + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21" + }, + "lodash._basecopy": { + "version": "3.0.1", + "dev": true + }, + "lodash._basetostring": { + "version": "3.0.1", + "dev": true + }, + "lodash._basevalues": { + "version": "3.0.0", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "dev": true + }, + "lodash._reescape": { + "version": "3.0.0", + "dev": true + }, + "lodash._reevaluate": { + "version": "3.0.0", + "dev": true + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "dev": true + }, + "lodash._root": { + "version": "3.0.1", + "dev": true + }, + "lodash.debounce": { + "version": "4.0.8", + "dev": true + }, + "lodash.escape": { + "version": "3.2.0", + "dev": true, + "requires": { + "lodash._root": "^3.0.0" + } + }, + "lodash.groupby": { + "version": "4.6.0", + "dev": true + }, + "lodash.isarguments": { + "version": "3.1.0", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "lodash.merge": { + "version": "4.6.2", + "dev": true + }, + "lodash.mergewith": { + "version": "4.6.2", + "dev": true + }, + "lodash.restparam": { + "version": "3.6.1", + "dev": true + }, + "lodash.template": { + "version": "3.6.2", + "dev": true, + "requires": { + "lodash._basecopy": "^3.0.0", + "lodash._basetostring": "^3.0.0", + "lodash._basevalues": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0", + "lodash.keys": "^3.0.0", + "lodash.restparam": "^3.0.0", + "lodash.templatesettings": "^3.0.0" + } + }, + "lodash.templatesettings": { + "version": "3.1.1", + "dev": true, + "requires": { + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0" + } + }, + "lodash.truncate": { + "version": "4.4.2", + "dev": true + }, + "loglevel": { + "version": "1.8.0", + "dev": true + }, + "long": { + "version": "4.0.0", + "dev": true + }, + "loopback": { + "version": "3.28.0", + "requires": { + "async": "^2.0.1", + "bcryptjs": "^2.1.0", + "bluebird": "^3.1.1", + "body-parser": "^1.12.0", + "canonical-json": "0.0.4", + "debug": "^2.1.2", + "depd": "^1.0.0", + "ejs": "^2.3.1", + "express": "^4.14.0", + "inflection": "^1.6.0", + "isemail": "^3.2.0", + "loopback-connector-remote": "^3.0.0", + "loopback-datasource-juggler": "^3.28.0", + "loopback-filters": "^1.0.0", + "loopback-phase": "^3.0.0", + "nodemailer": "^6.4.16", + "nodemailer-direct-transport": "^3.3.2", + "nodemailer-stub-transport": "^1.1.0", + "serve-favicon": "^2.2.0", + "stable": "^0.1.5", + "strong-globalize": "^4.1.1", + "strong-remoting": "^3.11.0", + "uid2": "0.0.3", + "underscore.string": "^3.3.5" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2" + }, + "ms": { + "version": "2.0.0" + } + } + }, + "loopback-boot": { + "version": "3.3.1", + "requires": { + "async": "^2.4.0", + "bluebird": "^3.5.3", + "commondir": "^1.0.1", + "debug": "^4.1.1", + "lodash": "^4.17.11", + "semver": "^5.1.0", + "strong-globalize": "^4.1.1", + "toposort": "^2.0.2" + }, + "dependencies": { + "semver": { + "version": "5.7.1" + } + } + }, + "loopback-component-explorer": { + "version": "6.5.1", + "requires": { + "debug": "^3.1.0", + "lodash": "^4.17.11", + "loopback-swagger": "^5.0.0", + "strong-globalize": "^4.1.1", + "swagger-ui": "^2.2.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "loopback-component-storage": { + "version": "3.6.1", + "requires": { + "async": "^2.6.1", + "debug": "^3.1.0", + "formidable": "^1.2.1", + "pkgcloud": "^2.0.0", + "strong-globalize": "^4.1.1", + "uuid": "^3.2.1" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "loopback-connector": { + "version": "4.11.1", + "requires": { + "async": "^3.2.0", + "bluebird": "^3.7.2", + "debug": "^4.1.1", + "msgpack5": "^4.2.0", + "strong-globalize": "^5.1.0", + "uuid": "^7.0.3" + }, + "dependencies": { + "async": { + "version": "3.2.3" + }, + "invert-kv": { + "version": "3.0.1" + }, + "lcid": { + "version": "3.1.1", + "requires": { + "invert-kv": "^3.0.0" + } + }, + "mem": { + "version": "5.1.1", + "requires": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" + } + }, + "mkdirp": { + "version": "0.5.5", + "requires": { + "minimist": "^1.2.5" + } + }, + "os-locale": { + "version": "5.0.0", + "requires": { + "execa": "^4.0.0", + "lcid": "^3.0.0", + "mem": "^5.0.0" + } + }, + "strong-globalize": { + "version": "5.1.0", + "requires": { + "accept-language": "^3.0.18", + "debug": "^4.1.1", + "globalize": "^1.5.0", + "lodash": "^4.17.15", + "md5": "^2.2.1", + "mkdirp": "^0.5.5", + "os-locale": "^5.0.0", + "yamljs": "^0.3.0" + } + }, + "uuid": { + "version": "7.0.3" + } + } + }, + "loopback-connector-mysql": { + "version": "5.4.4", + "requires": { + "async": "^2.6.1", + "debug": "^3.1.0", + "lodash": "^4.17.11", + "loopback-connector": "^4.0.0", + "mysql": "^2.11.1", + "strong-globalize": "^5.0.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + }, + "invert-kv": { + "version": "3.0.1" + }, + "lcid": { + "version": "3.1.1", + "requires": { + "invert-kv": "^3.0.0" + } + }, + "mem": { + "version": "5.1.1", + "requires": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" + } + }, + "mkdirp": { + "version": "0.5.5", + "requires": { + "minimist": "^1.2.5" + } + }, + "os-locale": { + "version": "5.0.0", + "requires": { + "execa": "^4.0.0", + "lcid": "^3.0.0", + "mem": "^5.0.0" + } + }, + "strong-globalize": { + "version": "5.1.0", + "requires": { + "accept-language": "^3.0.18", + "debug": "^4.1.1", + "globalize": "^1.5.0", + "lodash": "^4.17.15", + "md5": "^2.2.1", + "mkdirp": "^0.5.5", + "os-locale": "^5.0.0", + "yamljs": "^0.3.0" + }, + "dependencies": { + "debug": { + "version": "4.3.3", + "requires": { + "ms": "2.1.2" + } + } + } + } + } + }, + "loopback-connector-remote": { + "version": "3.4.1", + "requires": { + "loopback-datasource-juggler": "^3.0.0", + "strong-remoting": "^3.0.0" + } + }, + "loopback-context": { + "version": "3.5.2", + "requires": { + "cls-hooked": "^4.2.0" + } + }, + "loopback-datasource-juggler": { + "version": "3.36.1", + "requires": { + "async": "^2.6.0", + "bluebird": "^3.1.1", + "debug": "^3.1.0", + "depd": "^1.0.0", + "inflection": "^1.6.0", + "lodash": "^4.17.4", + "loopback-connector": "^4.4.0", + "minimatch": "^3.0.3", + "qs": "^6.5.0", + "shortid": "^2.2.6", + "strong-globalize": "^4.1.1", + "traverse": "^0.6.6", + "uuid": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + }, + "depd": { + "version": "1.1.2" + } + } + }, + "loopback-datatype-geopoint": { + "version": "1.0.0" + }, + "loopback-filters": { + "version": "1.1.1", + "requires": { + "debug": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "loopback-phase": { + "version": "3.4.0", + "requires": { + "async": "^2.6.1", + "debug": "^3.1.0", + "strong-globalize": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "loopback-swagger": { + "version": "5.9.0", + "requires": { + "async": "^2.1.4", + "debug": "^3.1.0", + "ejs": "^2.5.5", + "lodash": "^4.17.11", + "strong-globalize": "^4.1.1" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "loud-rejection": { + "version": "1.6.0", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lower-case": { + "version": "1.1.4", + "dev": true + }, + "lowercase-keys": { + "version": "2.0.0" + }, + "lru-cache": { + "version": "5.1.1", + "requires": { + "yallist": "^3.0.2" + } + }, + "mailparser": { + "version": "2.8.1", + "requires": { + "encoding-japanese": "1.0.30", + "he": "1.2.0", + "html-to-text": "5.1.1", + "iconv-lite": "0.6.2", + "libmime": "5.0.0", + "linkify-it": "3.0.2", + "mailsplit": "5.0.0", + "nodemailer": "6.4.11", + "tlds": "1.208.0" + }, + "dependencies": { + "iconv-lite": { + "version": "0.6.2", + "requires": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + } + }, + "nodemailer": { + "version": "6.4.11" + } + } + }, + "mailsplit": { + "version": "5.0.0", + "requires": { + "libbase64": "1.2.1", + "libmime": "4.2.1", + "libqp": "1.1.0" + }, + "dependencies": { + "iconv-lite": { + "version": "0.5.0", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "libmime": { + "version": "4.2.1", + "requires": { + "encoding-japanese": "1.0.30", + "iconv-lite": "0.5.0", + "libbase64": "1.2.1", + "libqp": "1.1.0" + } + } + } + }, + "make-dir": { + "version": "2.1.0", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "dev": true + }, + "semver": { + "version": "5.7.1", + "dev": true + } + } + }, + "make-iterator": { + "version": "1.0.1", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "make-plural": { + "version": "6.2.2" + }, + "makeerror": { + "version": "1.0.12", + "dev": true, + "requires": { + "tmpl": "1.0.5" + } + }, + "map-age-cleaner": { + "version": "0.1.3", + "requires": { + "p-defer": "^1.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "dev": true + }, + "map-obj": { + "version": "1.0.1", + "dev": true + }, + "map-stream": { + "version": "0.0.7", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "matchdep": { + "version": "2.0.0", + "dev": true, + "requires": { + "findup-sync": "^2.0.0", + "micromatch": "^3.0.4", + "resolve": "^1.4.0", + "stack-trace": "0.0.10" + }, + "dependencies": { + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "findup-sync": { + "version": "2.0.0", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^3.1.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "is-glob": { + "version": "3.1.0", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + }, + "micromatch": { + "version": "3.1.10", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "math-interval-parser": { + "version": "2.0.1" + }, + "md5": { + "version": "2.3.0", + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, + "md5.js": { + "version": "1.3.5", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "media-typer": { + "version": "0.3.0" + }, + "mem": { + "version": "4.3.0", + "requires": { + "map-age-cleaner": "^0.1.1", + "mimic-fn": "^2.0.0", + "p-is-promise": "^2.0.0" + } + }, + "memory-fs": { + "version": "0.4.1", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "meow": { + "version": "3.7.0", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "read-pkg": { + "version": "1.1.0", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + } + } + }, + "merge-descriptors": { + "version": "1.0.1" + }, + "merge-stream": { + "version": "1.0.1", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + } + }, + "messageformat": { + "version": "2.3.0", + "requires": { + "make-plural": "^4.3.0", + "messageformat-formatters": "^2.0.1", + "messageformat-parser": "^4.1.2" + }, + "dependencies": { + "make-plural": { + "version": "4.3.0", + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "messageformat-formatters": { + "version": "2.0.1" + }, + "messageformat-parser": { + "version": "4.1.3" + }, + "methods": { + "version": "1.1.2" + }, + "micromatch": { + "version": "4.0.4", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fill-range": { + "version": "7.0.1", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "miller-rabin": { + "version": "4.0.1", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "dev": true + } + } + }, + "mime": { + "version": "2.6.0" + }, + "mime-db": { + "version": "1.51.0" + }, + "mime-types": { + "version": "2.1.34", + "requires": { + "mime-db": "1.51.0" + } + }, + "mimic-fn": { + "version": "2.1.0" + }, + "mimic-response": { + "version": "2.1.0" + }, + "minimalistic-assert": { + "version": "1.0.1", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5" + }, + "mississippi": { + "version": "3.0.0", + "dev": true, + "requires": { + "concat-stream": "^1.5.0", + "duplexify": "^3.4.2", + "end-of-stream": "^1.1.0", + "flush-write-stream": "^1.0.0", + "from2": "^2.1.0", + "parallel-transform": "^1.1.0", + "pump": "^3.0.0", + "pumpify": "^1.3.3", + "stream-each": "^1.1.0", + "through2": "^2.0.0" + } + }, + "mixin-deep": { + "version": "1.3.2", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "1.0.4" + }, + "mkdirp-classic": { + "version": "0.5.3" + }, + "mktmpdir": { + "version": "0.1.1", + "requires": { + "rimraf": "~2.2.8" + }, + "dependencies": { + "rimraf": { + "version": "2.2.8" + } + } + }, + "mocha": { + "version": "2.5.3", + "requires": { + "commander": "2.3.0", + "debug": "2.2.0", + "diff": "1.4.0", + "escape-string-regexp": "1.0.2", + "glob": "3.2.11", + "growl": "1.9.2", + "jade": "0.26.3", + "mkdirp": "0.5.1", + "supports-color": "1.2.0", + "to-iso-string": "0.0.2" + }, + "dependencies": { + "commander": { + "version": "2.3.0" + }, + "debug": { + "version": "2.2.0", + "requires": { + "ms": "0.7.1" + } + }, + "escape-string-regexp": { + "version": "1.0.2" + }, + "glob": { + "version": "3.2.11", + "requires": { + "inherits": "2", + "minimatch": "0.3" + } + }, + "lru-cache": { + "version": "2.7.3" + }, + "minimatch": { + "version": "0.3.0", + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + }, + "minimist": { + "version": "0.0.8" + }, + "mkdirp": { + "version": "0.5.1", + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "0.7.1" + }, + "supports-color": { + "version": "1.2.0" + } + } + }, + "move-concurrently": { + "version": "1.0.1", + "dev": true, + "requires": { + "aproba": "^1.1.1", + "copy-concurrently": "^1.0.0", + "fs-write-stream-atomic": "^1.0.8", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.4", + "run-queue": "^1.0.3" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "ms": { + "version": "2.1.2" + }, + "msgpack-js": { + "version": "0.3.0", + "requires": { + "bops": "~0.0.6" + }, + "dependencies": { + "base64-js": { + "version": "0.0.2" + }, + "bops": { + "version": "0.0.7", + "requires": { + "base64-js": "0.0.2", + "to-utf8": "0.0.1" + } + } + } + }, + "msgpack-stream": { + "version": "0.0.13", + "requires": { + "bops": "1.0.0", + "msgpack-js": "0.3.0", + "through": "2.3.4" + }, + "dependencies": { + "through": { + "version": "2.3.4" + } + } + }, + "msgpack5": { + "version": "4.5.1", + "requires": { + "bl": "^2.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.3.6", + "safe-buffer": "^5.1.2" + } + }, + "multicast-dns": { + "version": "6.2.3", + "dev": true, + "requires": { + "dns-packet": "^1.3.1", + "thunky": "^1.0.2" + } + }, + "multicast-dns-service-types": { + "version": "1.1.0", + "dev": true + }, + "multipipe": { + "version": "0.1.2", + "dev": true, + "requires": { + "duplexer2": "0.0.2" + } + }, + "mustache": { + "version": "4.2.0" + }, + "mute-stdout": { + "version": "1.0.1", + "dev": true + }, + "mux-demux": { + "version": "3.7.9", + "requires": { + "duplex": "~1.0.0", + "json-buffer": "~2.0.4", + "msgpack-stream": "~0.0.10", + "stream-combiner": "0.0.2", + "stream-serializer": "~1.1.1", + "through": "~2.3.1", + "xtend": "~1.0.3" + }, + "dependencies": { + "json-buffer": { + "version": "2.0.11" + }, + "xtend": { + "version": "1.0.3" + } + } + }, + "mysql": { + "version": "2.18.1", + "requires": { + "bignumber.js": "9.0.0", + "readable-stream": "2.3.7", + "safe-buffer": "5.1.2", + "sqlstring": "2.3.1" + } + }, + "mysql2": { + "version": "1.7.0", + "dev": true, + "requires": { + "denque": "^1.4.1", + "generate-function": "^2.3.1", + "iconv-lite": "^0.5.0", + "long": "^4.0.0", + "lru-cache": "^5.1.1", + "named-placeholders": "^1.1.2", + "seq-queue": "^0.0.5", + "sqlstring": "^2.3.1" + }, + "dependencies": { + "iconv-lite": { + "version": "0.5.2", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + } + } + }, + "named-placeholders": { + "version": "1.1.2", + "dev": true, + "requires": { + "lru-cache": "^4.1.3" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.5", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "yallist": { + "version": "2.1.2", + "dev": true + } + } + }, + "nan": { + "version": "2.15.0", + "dev": true + }, + "nanoid": { + "version": "2.1.11" + }, + "nanomatch": { + "version": "1.2.13", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "napi-build-utils": { + "version": "1.0.2" + }, + "natural-compare": { + "version": "1.4.0", + "dev": true + }, + "negotiator": { + "version": "0.6.2" + }, + "neo-async": { + "version": "2.6.2", + "dev": true + }, + "next-tick": { + "version": "1.0.0", + "dev": true + }, + "nice-try": { + "version": "1.0.5" + }, + "no-case": { + "version": "2.3.2", + "dev": true, + "requires": { + "lower-case": "^1.1.1" + } + }, + "nocache": { + "version": "2.1.0" + }, + "node-abi": { + "version": "2.30.1", + "requires": { + "semver": "^5.4.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1" + } + } + }, + "node-addon-api": { + "version": "3.2.1" + }, + "node-domexception": { + "version": "1.0.0" + }, + "node-fetch": { + "version": "2.6.6", + "requires": { + "whatwg-url": "^5.0.0" + }, + "dependencies": { + "tr46": { + "version": "0.0.3" + }, + "webidl-conversions": { + "version": "3.0.1" + }, + "whatwg-url": { + "version": "5.0.0", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + } + } + }, + "node-forge": { + "version": "0.10.0" + }, + "node-gyp": { + "version": "3.8.0", + "dev": true, + "requires": { + "fstream": "^1.0.0", + "glob": "^7.0.3", + "graceful-fs": "^4.1.2", + "mkdirp": "^0.5.0", + "nopt": "2 || 3", + "npmlog": "0 || 1 || 2 || 3 || 4", + "osenv": "0", + "request": "^2.87.0", + "rimraf": "2", + "semver": "~5.3.0", + "tar": "^2.0.0", + "which": "1" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "semver": { + "version": "5.3.0", + "dev": true + }, + "which": { + "version": "1.3.1", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "node-int64": { + "version": "0.4.0", + "dev": true + }, + "node-libs-browser": { + "version": "2.2.1", + "dev": true, + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.2.0", + "buffer": "^4.3.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "^3.11.0", + "domain-browser": "^1.1.1", + "events": "^3.0.0", + "https-browserify": "^1.0.0", + "os-browserify": "^0.3.0", + "path-browserify": "0.0.1", + "process": "^0.11.10", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.3.3", + "stream-browserify": "^2.0.1", + "stream-http": "^2.7.2", + "string_decoder": "^1.0.0", + "timers-browserify": "^2.0.4", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.11.0", + "vm-browserify": "^1.0.1" + }, + "dependencies": { + "events": { + "version": "3.3.0", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "dev": true + }, + "url": { + "version": "0.11.0", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "dev": true + } + } + } + } + }, + "node-notifier": { + "version": "8.0.2", + "dev": true, + "optional": true, + "requires": { + "growly": "^1.3.0", + "is-wsl": "^2.2.0", + "semver": "^7.3.2", + "shellwords": "^0.1.1", + "uuid": "^8.3.0", + "which": "^2.0.2" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "dev": true, + "optional": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.5", + "dev": true, + "optional": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "uuid": { + "version": "8.3.2", + "dev": true, + "optional": true + }, + "yallist": { + "version": "4.0.0", + "dev": true, + "optional": true + } + } + }, + "node-releases": { + "version": "2.0.1", + "dev": true + }, + "node-sass": { + "version": "4.14.1", + "dev": true, + "requires": { + "async-foreach": "^0.1.3", + "chalk": "^1.1.1", + "cross-spawn": "^3.0.0", + "gaze": "^1.0.0", + "get-stdin": "^4.0.1", + "glob": "^7.0.3", + "in-publish": "^2.0.0", + "lodash": "^4.17.15", + "meow": "^3.7.0", + "mkdirp": "^0.5.1", + "nan": "^2.13.2", + "node-gyp": "^3.8.0", + "npmlog": "^4.0.0", + "request": "^2.88.0", + "sass-graph": "2.2.5", + "stdout-stream": "^1.4.0", + "true-case-path": "^1.0.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cross-spawn": { + "version": "3.0.1", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "lru-cache": { + "version": "4.1.5", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "strip-ansi": { + "version": "3.0.1", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "dev": true + }, + "which": { + "version": "1.3.1", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "yallist": { + "version": "2.1.2", + "dev": true + } + } + }, + "node-ssh": { + "version": "11.1.1", + "requires": { + "make-dir": "^3.1.0", + "sb-promise-queue": "^2.1.0", + "sb-scandir": "^3.1.0", + "shell-escape": "^0.2.0", + "ssh2": "^0.8.9" + }, + "dependencies": { + "make-dir": { + "version": "3.1.0", + "requires": { + "semver": "^6.0.0" + } + } + } + }, + "node.extend": { + "version": "2.0.2", + "dev": true, + "requires": { + "has": "^1.0.3", + "is": "^3.2.1" + } + }, + "nodemailer": { + "version": "6.7.2" + }, + "nodemailer-direct-transport": { + "version": "3.3.2", + "requires": { + "nodemailer-shared": "1.1.0", + "smtp-connection": "2.12.0" + } + }, + "nodemailer-fetch": { + "version": "1.6.0" + }, + "nodemailer-shared": { + "version": "1.1.0", + "requires": { + "nodemailer-fetch": "1.6.0" + } + }, + "nodemailer-stub-transport": { + "version": "1.1.0" + }, + "nodemon": { + "version": "2.0.16", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.16.tgz", + "integrity": "sha512-zsrcaOfTWRuUzBn3P44RDliLlp263Z/76FPoHFr3cFFkOz0lTPAcIw8dCzfdVIx/t3AtDYCZRCDkoCojJqaG3w==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^3.2.7", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.0.4", + "pstree.remy": "^1.1.8", + "semver": "^5.7.1", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5", + "update-notifier": "^5.1.0" + }, + "dependencies": { + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "debug": { + "version": "3.2.7", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "semver": { + "version": "5.7.1", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "nopt": { + "version": "3.0.6", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-package-data": { + "version": "2.5.0", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "dev": true + } + } + }, + "normalize-path": { + "version": "3.0.0", + "dev": true + }, + "normalize-url": { + "version": "6.1.0" + }, + "now-and-later": { + "version": "2.0.1", + "dev": true, + "requires": { + "once": "^1.3.2" + } + }, + "npm-run-path": { + "version": "4.0.1", + "requires": { + "path-key": "^3.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "nth-check": { + "version": "2.0.1", + "dev": true, + "requires": { + "boolbase": "^1.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1" + }, + "nwsapi": { + "version": "2.2.0", + "dev": true + }, + "oauth-sign": { + "version": "0.9.0" + }, + "object-assign": { + "version": "4.1.1" + }, + "object-copy": { + "version": "0.1.0", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-diff": { + "version": "0.0.4" + }, + "object-inspect": { + "version": "1.12.0" + }, + "object-is": { + "version": "1.1.5", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "object-keys": { + "version": "1.1.1", + "dev": true + }, + "object-visit": { + "version": "1.0.1", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.assign": { + "version": "4.1.2", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.defaults": { + "version": "1.1.0", + "dev": true, + "requires": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "object.getownpropertydescriptors": { + "version": "2.1.3", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + } + }, + "object.map": { + "version": "1.0.1", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "requires": { + "isobject": "^3.0.1" + } + }, + "object.reduce": { + "version": "1.0.1", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "obuf": { + "version": "1.1.2", + "dev": true + }, + "on-finished": { + "version": "2.3.0", + "requires": { + "ee-first": "1.1.1" + } + }, + "on-headers": { + "version": "1.0.2" + }, + "once": { + "version": "1.4.0", + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "opn": { + "version": "5.5.0", + "dev": true, + "requires": { + "is-wsl": "^1.1.0" + }, + "dependencies": { + "is-wsl": { + "version": "1.1.0", + "dev": true + } + } + }, + "optional": { + "version": "0.1.4" + }, + "optionator": { + "version": "0.9.1", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "options": { + "version": "0.0.6" + }, + "ordered-read-streams": { + "version": "1.0.1", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + } + }, + "original": { + "version": "1.0.2", + "dev": true, + "requires": { + "url-parse": "^1.4.3" + } + }, + "os-browserify": { + "version": "0.3.0", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "dev": true + }, + "os-locale": { + "version": "3.1.0", + "requires": { + "execa": "^1.0.0", + "lcid": "^2.0.0", + "mem": "^4.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "execa": { + "version": "1.0.0", + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "4.1.0", + "requires": { + "pump": "^3.0.0" + } + }, + "is-stream": { + "version": "1.1.0" + }, + "npm-run-path": { + "version": "2.0.2", + "requires": { + "path-key": "^2.0.0" + } + }, + "path-key": { + "version": "2.0.1" + }, + "semver": { + "version": "5.7.1" + }, + "shebang-command": { + "version": "1.2.0", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0" + }, + "which": { + "version": "1.3.1", + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "os-tmpdir": { + "version": "1.0.2", + "dev": true + }, + "osenv": { + "version": "0.1.5", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-cancelable": { + "version": "2.1.1" + }, + "p-defer": { + "version": "1.0.0" + }, + "p-each-series": { + "version": "2.2.0", + "dev": true + }, + "p-event": { + "version": "4.2.0", + "requires": { + "p-timeout": "^3.1.0" + } + }, + "p-finally": { + "version": "1.0.0" + }, + "p-is-promise": { + "version": "2.1.0" + }, + "p-limit": { + "version": "2.3.0", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-map": { + "version": "2.1.0", + "dev": true + }, + "p-queue": { + "version": "1.2.0", + "dev": true + }, + "p-retry": { + "version": "3.0.1", + "dev": true, + "requires": { + "retry": "^0.12.0" + } + }, + "p-timeout": { + "version": "3.2.0", + "requires": { + "p-finally": "^1.0.0" + } + }, + "p-try": { + "version": "2.2.0" + }, + "package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "requires": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "dependencies": { + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "dev": true, + "requires": { + "defer-to-connect": "^1.0.1" + } + }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + }, + "dependencies": { + "get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + } + } + }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, + "normalize-url": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", + "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", + "dev": true + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + }, + "dependencies": { + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + } + } + }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true + } + } + }, + "pako": { + "version": "1.0.11", + "dev": true + }, + "parallel-transform": { + "version": "1.2.0", + "dev": true, + "requires": { + "cyclist": "^1.0.1", + "inherits": "^2.0.3", + "readable-stream": "^2.1.5" + } + }, + "param-case": { + "version": "2.1.1", + "dev": true, + "requires": { + "no-case": "^2.2.0" + } + }, + "parent-module": { + "version": "1.0.1", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-asn1": { + "version": "5.1.6", + "dev": true, + "requires": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "parse-filepath": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + } + }, + "parse-json": { + "version": "5.2.0", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "parse-node-version": { + "version": "1.0.1", + "dev": true + }, + "parse-passwd": { + "version": "1.0.0", + "dev": true + }, + "parse5": { + "version": "6.0.1", + "dev": true + }, + "parseurl": { + "version": "1.3.3" + }, + "pascal-case": { + "version": "3.1.2", + "dev": true, + "requires": { + "no-case": "^3.0.4", + "tslib": "^2.0.3" + }, + "dependencies": { + "lower-case": { + "version": "2.0.2", + "dev": true, + "requires": { + "tslib": "^2.0.3" + } + }, + "no-case": { + "version": "3.0.4", + "dev": true, + "requires": { + "lower-case": "^2.0.2", + "tslib": "^2.0.3" + } + } + } + }, + "pascalcase": { + "version": "0.1.1", + "dev": true + }, + "path-browserify": { + "version": "0.0.1", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "dev": true + }, + "path-exists": { + "version": "4.0.0" + }, + "path-is-absolute": { + "version": "1.0.1" + }, + "path-is-inside": { + "version": "1.0.2", + "dev": true + }, + "path-key": { + "version": "3.1.1" + }, + "path-parse": { + "version": "1.0.7", + "dev": true + }, + "path-root": { + "version": "0.1.1", + "dev": true, + "requires": { + "path-root-regex": "^0.1.0" + } + }, + "path-root-regex": { + "version": "0.1.2", + "dev": true + }, + "path-to-regexp": { + "version": "0.1.7" + }, + "path-type": { + "version": "1.1.0", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pbkdf2": { + "version": "3.1.2", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "pend": { + "version": "1.2.0" + }, + "performance-now": { + "version": "2.1.0" + }, + "picocolors": { + "version": "1.0.0", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "dev": true + }, + "pify": { + "version": "2.3.0", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "pirates": { + "version": "4.0.4", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "dev": true, + "requires": { + "find-up": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "dev": true + } + } + }, + "pkgcloud": { + "version": "2.2.0", + "requires": { + "@google-cloud/storage": "^2.4.3", + "async": "^2.6.1", + "aws-sdk": "^2.382.0", + "errs": "^0.3.2", + "eventemitter2": "^5.0.1", + "fast-json-patch": "^2.1.0", + "filed-mimefix": "^0.1.3", + "ip": "^1.1.5", + "liboneandone": "^1.2.0", + "lodash": "^4.17.10", + "mime": "^2.4.1", + "qs": "^6.5.2", + "request": "^2.88.0", + "through2": "^3.0.1", + "url-join": "^4.0.0", + "xml2js": "^0.4.19" + }, + "dependencies": { + "through2": { + "version": "3.0.2", + "requires": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + } + } + }, + "plugin-error": { + "version": "1.0.1", + "dev": true, + "requires": { + "ansi-colors": "^1.0.1", + "arr-diff": "^4.0.0", + "arr-union": "^3.1.0", + "extend-shallow": "^3.0.2" + }, + "dependencies": { + "ansi-colors": { + "version": "1.1.0", + "dev": true, + "requires": { + "ansi-wrap": "^0.1.0" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "portfinder": { + "version": "1.0.28", + "dev": true, + "requires": { + "async": "^2.6.2", + "debug": "^3.1.1", + "mkdirp": "^0.5.5" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "posix-character-classes": { + "version": "0.1.1", + "dev": true + }, + "posix-getopt": { + "version": "1.2.1" + }, + "postcss": { + "version": "7.0.39", + "dev": true, + "requires": { + "picocolors": "^0.2.1", + "source-map": "^0.6.1" + }, + "dependencies": { + "picocolors": { + "version": "0.2.1", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "postcss-modules-extract-imports": { + "version": "2.0.0", + "dev": true, + "requires": { + "postcss": "^7.0.5" + } + }, + "postcss-modules-local-by-default": { + "version": "2.0.6", + "dev": true, + "requires": { + "postcss": "^7.0.6", + "postcss-selector-parser": "^6.0.0", + "postcss-value-parser": "^3.3.1" + } + }, + "postcss-modules-scope": { + "version": "2.2.0", + "dev": true, + "requires": { + "postcss": "^7.0.6", + "postcss-selector-parser": "^6.0.0" + } + }, + "postcss-modules-values": { + "version": "2.0.0", + "dev": true, + "requires": { + "icss-replace-symbols": "^1.1.0", + "postcss": "^7.0.6" + } + }, + "postcss-selector-parser": { + "version": "6.0.8", + "dev": true, + "requires": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + } + }, + "postcss-value-parser": { + "version": "3.3.1", + "dev": true + }, + "prebuild-install": { + "version": "6.1.4", + "requires": { + "detect-libc": "^1.0.3", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^2.21.0", + "npmlog": "^4.0.1", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^3.0.3", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "dependencies": { + "decompress-response": { + "version": "4.2.1", + "requires": { + "mimic-response": "^2.0.0" + } + }, + "simple-get": { + "version": "3.1.0", + "requires": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + } + } + }, + "precond": { + "version": "0.2.3" + }, + "prelude-ls": { + "version": "1.2.1", + "dev": true + }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, + "pretty-error": { + "version": "2.1.2", + "dev": true, + "requires": { + "lodash": "^4.17.20", + "renderkid": "^2.0.4" + } + }, + "pretty-format": { + "version": "26.6.2", + "dev": true, + "requires": { + "@jest/types": "^26.6.2", + "ansi-regex": "^5.0.0", + "ansi-styles": "^4.0.0", + "react-is": "^17.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + } + } + }, + "pretty-hrtime": { + "version": "1.0.3", + "dev": true + }, + "private": { + "version": "0.1.8", + "dev": true + }, + "process": { + "version": "0.11.10", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.1" + }, + "progress": { + "version": "2.0.3" + }, + "promise-inflight": { + "version": "1.0.1", + "dev": true + }, + "prompts": { + "version": "2.4.2", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + } + }, + "proxy-addr": { + "version": "2.0.7", + "requires": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + } + }, + "proxy-from-env": { + "version": "1.1.0" + }, + "prr": { + "version": "1.0.1", + "dev": true + }, + "pseudomap": { + "version": "1.0.2" + }, + "psl": { + "version": "1.8.0" + }, + "pstree.remy": { + "version": "1.1.8", + "dev": true + }, + "public-encrypt": { + "version": "4.0.3", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.12.0", + "dev": true + } + } + }, + "pump": { + "version": "3.0.0", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "pumpify": { + "version": "1.5.1", + "requires": { + "duplexify": "^3.6.0", + "inherits": "^2.0.3", + "pump": "^2.0.0" + }, + "dependencies": { + "pump": { + "version": "2.0.1", + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + } + } + }, + "punycode": { + "version": "2.1.1" + }, + "pupa": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", + "dev": true, + "requires": { + "escape-goat": "^2.0.0" + } + }, + "puppeteer": { + "version": "7.1.0", + "requires": { + "debug": "^4.1.0", + "devtools-protocol": "0.0.847576", + "extract-zip": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.1", + "pkg-dir": "^4.2.0", + "progress": "^2.0.1", + "proxy-from-env": "^1.1.0", + "rimraf": "^3.0.2", + "tar-fs": "^2.0.0", + "unbzip2-stream": "^1.3.3", + "ws": "^7.2.3" + }, + "dependencies": { + "pkg-dir": { + "version": "4.2.0", + "requires": { + "find-up": "^4.0.0" + } + }, + "rimraf": { + "version": "3.0.2", + "requires": { + "glob": "^7.1.3" + } + } + } + }, + "qs": { + "version": "6.9.6" + }, + "querystring": { + "version": "0.2.0" + }, + "querystring-es3": { + "version": "0.2.1", + "dev": true + }, + "querystringify": { + "version": "2.2.0", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "range-parser": { + "version": "1.2.1" + }, + "raw-body": { + "version": "2.4.2", + "requires": { + "bytes": "3.1.1", + "http-errors": "1.8.1", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "dependencies": { + "bytes": { + "version": "3.1.1" + } + } + }, + "raw-loader": { + "version": "1.0.0", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "rc": { + "version": "1.2.8", + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "2.0.1" + } + } + }, + "react-is": { + "version": "17.0.2", + "dev": true + }, + "read-chunk": { + "version": "3.2.0", + "requires": { + "pify": "^4.0.1", + "with-open-file": "^0.1.6" + }, + "dependencies": { + "pify": { + "version": "4.0.1" + } + } + }, + "read-pkg": { + "version": "5.2.0", + "dev": true, + "requires": { + "@types/normalize-package-data": "^2.4.0", + "normalize-package-data": "^2.5.0", + "parse-json": "^5.0.0", + "type-fest": "^0.6.0" + }, + "dependencies": { + "type-fest": { + "version": "0.6.0", + "dev": true + } + } + }, + "read-pkg-up": { + "version": "7.0.1", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "read-pkg": "^5.2.0", + "type-fest": "^0.8.1" + }, + "dependencies": { + "type-fest": { + "version": "0.8.1", + "dev": true + } + } + }, + "readable-stream": { + "version": "2.3.7", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "readdirp": { + "version": "2.2.1", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "micromatch": "^3.1.10", + "readable-stream": "^2.0.2" + }, + "dependencies": { + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "micromatch": { + "version": "3.1.10", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + } + } + }, + "recast": { + "version": "0.11.23", + "dev": true, + "requires": { + "ast-types": "0.9.6", + "esprima": "~3.1.0", + "private": "~0.1.5", + "source-map": "~0.5.0" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "dev": true + } + } + }, + "rechoir": { + "version": "0.6.2", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "redent": { + "version": "1.0.0", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "referrer-policy": { + "version": "1.2.0" + }, + "regenerate": { + "version": "1.4.2", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "9.0.0", + "dev": true, + "requires": { + "regenerate": "^1.4.2" + } + }, + "regenerator-runtime": { + "version": "0.13.9" + }, + "regenerator-transform": { + "version": "0.14.5", + "dev": true, + "requires": { + "@babel/runtime": "^7.8.4" + } + }, + "regex-not": { + "version": "1.0.2", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "regexp.prototype.flags": { + "version": "1.4.1", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "regexpp": { + "version": "3.2.0", + "dev": true + }, + "regexpu-core": { + "version": "4.8.0", + "dev": true, + "requires": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^9.0.0", + "regjsgen": "^0.5.2", + "regjsparser": "^0.7.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.0.0" + } + }, + "registry-auth-token": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", + "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "regjsgen": { + "version": "0.5.2", + "dev": true + }, + "regjsparser": { + "version": "0.7.0", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "dev": true + } + } + }, + "relateurl": { + "version": "0.2.7", + "dev": true + }, + "remove-bom-buffer": { + "version": "3.0.0", + "dev": true, + "requires": { + "is-buffer": "^1.1.5", + "is-utf8": "^0.2.1" + } + }, + "remove-bom-stream": { + "version": "1.2.0", + "dev": true, + "requires": { + "remove-bom-buffer": "^3.0.0", + "safe-buffer": "^5.1.0", + "through2": "^2.0.3" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "dev": true + }, + "renderkid": { + "version": "2.0.7", + "dev": true, + "requires": { + "css-select": "^4.1.3", + "dom-converter": "^0.2.0", + "htmlparser2": "^6.1.0", + "lodash": "^4.17.21", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "dev": true + }, + "dom-serializer": { + "version": "1.3.2", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + } + }, + "domelementtype": { + "version": "2.2.0", + "dev": true + }, + "domhandler": { + "version": "4.3.0", + "dev": true, + "requires": { + "domelementtype": "^2.2.0" + } + }, + "domutils": { + "version": "2.8.0", + "dev": true, + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + } + }, + "entities": { + "version": "2.2.0", + "dev": true + }, + "htmlparser2": { + "version": "6.1.0", + "dev": true, + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.0.0", + "domutils": "^2.5.2", + "entities": "^2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "repeat-element": { + "version": "1.1.4", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "replace-ext": { + "version": "0.0.1", + "dev": true + }, + "replace-homedir": { + "version": "1.0.0", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1", + "is-absolute": "^1.0.0", + "remove-trailing-separator": "^1.1.0" + } + }, + "request": { + "version": "2.88.2", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "form-data": { + "version": "2.3.3", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "qs": { + "version": "6.5.3" + }, + "tough-cookie": { + "version": "2.5.0", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + } + } + }, + "require-directory": { + "version": "2.1.1", + "dev": true + }, + "require-from-string": { + "version": "2.0.2", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "dev": true + }, + "require-yaml": { + "version": "0.0.1", + "requires": { + "js-yaml": "" + } + }, + "requires-port": { + "version": "1.0.0", + "dev": true + }, + "resolve": { + "version": "1.21.0", + "dev": true, + "requires": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-cwd": { + "version": "3.0.0", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-dir": { + "version": "1.0.1", + "dev": true, + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "dev": true + }, + "resolve-options": { + "version": "1.1.0", + "dev": true, + "requires": { + "value-or-function": "^3.0.0" + } + }, + "resolve-url": { + "version": "0.2.1", + "dev": true + }, + "responselike": { + "version": "2.0.0", + "requires": { + "lowercase-keys": "^2.0.0" + } + }, + "ret": { + "version": "0.1.15", + "dev": true + }, + "retry": { + "version": "0.12.0", + "dev": true + }, + "retry-request": { + "version": "4.2.2", + "requires": { + "debug": "^4.1.1", + "extend": "^3.0.2" + } + }, + "rimraf": { + "version": "2.7.1", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rsvp": { + "version": "4.8.5", + "dev": true + }, + "run-queue": { + "version": "1.0.3", + "dev": true, + "requires": { + "aproba": "^1.1.1" + } + }, + "safe-buffer": { + "version": "5.1.2" + }, + "safe-regex": { + "version": "1.1.0", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2" + }, + "sane": { + "version": "4.1.0", + "dev": true, + "requires": { + "@cnakazawa/watch": "^1.0.3", + "anymatch": "^2.0.0", + "capture-exit": "^2.0.0", + "exec-sh": "^0.3.2", + "execa": "^1.0.0", + "fb-watchman": "^2.0.0", + "micromatch": "^3.1.4", + "minimist": "^1.1.1", + "walker": "~1.0.5" + }, + "dependencies": { + "cross-spawn": { + "version": "6.0.5", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "execa": { + "version": "1.0.0", + "dev": true, + "requires": { + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "get-stream": { + "version": "4.1.0", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "is-stream": { + "version": "1.1.0", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "npm-run-path": { + "version": "2.0.2", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "path-key": { + "version": "2.0.1", + "dev": true + }, + "semver": { + "version": "5.7.1", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "dev": true + }, + "which": { + "version": "1.3.1", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, + "sass-graph": { + "version": "2.2.5", + "dev": true, + "requires": { + "glob": "^7.0.0", + "lodash": "^4.0.0", + "scss-tokenizer": "^0.2.3", + "yargs": "^13.3.2" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "emoji-regex": { + "version": "7.0.3", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "dev": true + }, + "locate-path": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "which-module": { + "version": "2.0.0", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "yargs-parser": { + "version": "13.1.2", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "sass-loader": { + "version": "7.3.1", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "loader-utils": "^1.0.1", + "neo-async": "^2.5.0", + "pify": "^4.0.1", + "semver": "^6.3.0" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "dev": true + } + } + }, + "sax": { + "version": "1.2.1" + }, + "saxes": { + "version": "5.0.1", + "dev": true, + "requires": { + "xmlchars": "^2.2.0" + } + }, + "sb-promise-queue": { + "version": "2.1.0" + }, + "sb-scandir": { + "version": "3.1.0", + "requires": { + "sb-promise-queue": "^2.1.0" + } + }, + "schema-utils": { + "version": "2.7.1", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" + } + }, + "scss-tokenizer": { + "version": "0.2.3", + "dev": true, + "requires": { + "js-base64": "^2.1.8", + "source-map": "^0.4.2" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "select-hose": { + "version": "2.0.0", + "dev": true + }, + "selfsigned": { + "version": "1.10.14", + "dev": true, + "requires": { + "node-forge": "^0.10.0" + } + }, + "semver": { + "version": "6.3.0" + }, + "semver-diff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", + "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", + "dev": true, + "requires": { + "semver": "^6.3.0" + } + }, + "semver-greatest-satisfied-range": { + "version": "1.1.0", + "dev": true, + "requires": { + "sver-compat": "^1.5.0" + } + }, + "send": { + "version": "0.17.2", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.2", + "destroy": "~1.0.4", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "1.8.1", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "~2.3.0", + "range-parser": "~1.2.1", + "statuses": "~1.5.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + }, + "dependencies": { + "ms": { + "version": "2.0.0" + } + } + }, + "depd": { + "version": "1.1.2" + }, + "mime": { + "version": "1.6.0" + }, + "ms": { + "version": "2.1.3" + } + } + }, + "seq-queue": { + "version": "0.0.5", + "dev": true + }, + "serialize-javascript": { + "version": "4.0.0", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "serve-favicon": { + "version": "2.5.0", + "requires": { + "etag": "~1.8.1", + "fresh": "0.5.2", + "ms": "2.1.1", + "parseurl": "~1.3.2", + "safe-buffer": "5.1.1" + }, + "dependencies": { + "ms": { + "version": "2.1.1" + }, + "safe-buffer": { + "version": "5.1.1" + } + } + }, + "serve-index": { + "version": "1.9.1", + "dev": true, + "requires": { + "accepts": "~1.3.4", + "batch": "0.6.1", + "debug": "2.6.9", + "escape-html": "~1.0.3", + "http-errors": "~1.6.2", + "mime-types": "~2.1.17", + "parseurl": "~1.3.2" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "depd": { + "version": "1.1.2", + "dev": true + }, + "http-errors": { + "version": "1.6.3", + "dev": true, + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "inherits": { + "version": "2.0.3", + "dev": true + }, + "ms": { + "version": "2.0.0", + "dev": true + }, + "setprototypeof": { + "version": "1.1.0", + "dev": true + } + } + }, + "serve-static": { + "version": "1.14.2", + "requires": { + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.17.2" + } + }, + "set-blocking": { + "version": "2.0.0" + }, + "set-value": { + "version": "2.0.1", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + } + }, + "setimmediate": { + "version": "1.0.5", + "dev": true + }, + "setprototypeof": { + "version": "1.2.0" + }, + "sha.js": { + "version": "2.4.11", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shallow-clone": { + "version": "3.0.1", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "sharp": { + "version": "0.27.2", + "requires": { + "array-flatten": "^3.0.0", + "color": "^3.1.3", + "detect-libc": "^1.0.3", + "node-addon-api": "^3.1.0", + "npmlog": "^4.1.2", + "prebuild-install": "^6.0.1", + "semver": "^7.3.4", + "simple-get": "^4.0.0", + "tar-fs": "^2.1.1", + "tunnel-agent": "^0.6.0" + }, + "dependencies": { + "array-flatten": { + "version": "3.0.0" + }, + "lru-cache": { + "version": "6.0.0", + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.3.5", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0" + } + } + }, + "shebang-command": { + "version": "2.0.0", + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0" + }, + "shell-escape": { + "version": "0.2.0" + }, + "shellwords": { + "version": "0.1.1", + "dev": true, + "optional": true + }, + "shimmer": { + "version": "1.2.1" + }, + "shortid": { + "version": "2.2.16", + "requires": { + "nanoid": "^2.1.0" + } + }, + "side-channel": { + "version": "1.0.4", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "sigmund": { + "version": "1.0.1" + }, + "signal-exit": { + "version": "3.0.6" + }, + "simple-concat": { + "version": "1.0.1" + }, + "simple-get": { + "version": "4.0.0", + "requires": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + }, + "dependencies": { + "decompress-response": { + "version": "6.0.0", + "requires": { + "mimic-response": "^3.1.0" + } + }, + "mimic-response": { + "version": "3.1.0" + } + } + }, + "simple-swizzle": { + "version": "0.2.2", + "requires": { + "is-arrayish": "^0.3.1" + }, + "dependencies": { + "is-arrayish": { + "version": "0.3.2" + } + } + }, + "sisteransi": { + "version": "1.0.5", + "dev": true + }, + "slash": { + "version": "3.0.0", + "dev": true + }, + "slice-ansi": { + "version": "4.0.0", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true + } + } + }, + "smbhash": { + "version": "0.0.1", + "requires": { + "bigdecimal": ">= 0.6.0" + } + }, + "smtp-connection": { + "version": "2.12.0", + "requires": { + "httpntlm": "1.6.1", + "nodemailer-shared": "1.1.0" + } + }, + "snakeize": { + "version": "0.1.0" + }, + "snapdragon": { + "version": "0.8.2", + "dev": true, + "requires": { + "base": "^0.11.1", + "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.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "sockjs": { + "version": "0.3.24", + "dev": true, + "requires": { + "faye-websocket": "^0.11.3", + "uuid": "^8.3.2", + "websocket-driver": "^0.7.4" + }, + "dependencies": { + "uuid": { + "version": "8.3.2", + "dev": true + } + } + }, + "sockjs-client": { + "version": "1.5.2", + "dev": true, + "requires": { + "debug": "^3.2.6", + "eventsource": "^1.0.7", + "faye-websocket": "^0.11.3", + "inherits": "^2.0.4", + "json3": "^3.3.3", + "url-parse": "^1.5.3" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "source-list-map": { + "version": "2.0.1", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.3", + "dev": true, + "requires": { + "atob": "^2.1.2", + "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.5.21", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "source-map-url": { + "version": "0.4.1", + "dev": true + }, + "sparkles": { + "version": "1.0.1", + "dev": true + }, + "spdx-correct": { + "version": "3.1.1", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.3.0", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.1", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.11", + "dev": true + }, + "spdy": { + "version": "4.0.2", + "dev": true, + "requires": { + "debug": "^4.1.0", + "handle-thing": "^2.0.0", + "http-deceiver": "^1.2.7", + "select-hose": "^2.0.0", + "spdy-transport": "^3.0.0" + } + }, + "spdy-transport": { + "version": "3.0.0", + "dev": true, + "requires": { + "debug": "^4.1.0", + "detect-node": "^2.0.4", + "hpack.js": "^2.1.6", + "obuf": "^1.1.2", + "readable-stream": "^3.0.6", + "wbuf": "^1.7.3" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "split-array-stream": { + "version": "2.0.0", + "requires": { + "is-stream-ended": "^0.1.4" + } + }, + "split-string": { + "version": "3.1.0", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + }, + "dependencies": { + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "sprintf-js": { + "version": "1.1.2" + }, + "sqlstring": { + "version": "2.3.1" + }, + "sse": { + "version": "0.0.8", + "requires": { + "options": "0.0.6" + } + }, + "ssh2": { + "version": "0.8.9", + "requires": { + "ssh2-streams": "~0.4.10" + } + }, + "ssh2-streams": { + "version": "0.4.10", + "requires": { + "asn1": "~0.2.0", + "bcrypt-pbkdf": "^1.0.2", + "streamsearch": "~0.1.2" + } + }, + "sshpk": { + "version": "1.17.0", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "ssri": { + "version": "6.0.2", + "dev": true, + "requires": { + "figgy-pudding": "^3.5.1" + } + }, + "stable": { + "version": "0.1.8" + }, + "stack-chain": { + "version": "1.3.7" + }, + "stack-trace": { + "version": "0.0.10", + "dev": true + }, + "stack-utils": { + "version": "2.0.5", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "dev": true + } + } + }, + "static-extend": { + "version": "0.1.2", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + } + }, + "statuses": { + "version": "1.5.0" + }, + "stdout-stream": { + "version": "1.4.1", + "dev": true, + "requires": { + "readable-stream": "^2.0.1" + } + }, + "stream-browserify": { + "version": "2.0.2", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-combiner": { + "version": "0.0.2", + "requires": { + "duplexer": "~0.0.3" + } + }, + "stream-each": { + "version": "1.2.3", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "stream-shift": "^1.0.0" + } + }, + "stream-events": { + "version": "1.0.5", + "requires": { + "stubs": "^3.0.0" + } + }, + "stream-exhaust": { + "version": "1.0.2", + "dev": true + }, + "stream-http": { + "version": "2.8.3", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-serializer": { + "version": "1.1.2" + }, + "stream-shift": { + "version": "1.0.1" + }, + "streamsearch": { + "version": "0.1.2" + }, + "string_decoder": { + "version": "1.1.1", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "string-length": { + "version": "4.0.2", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1" + }, + "strip-ansi": { + "version": "3.0.1", + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "string.prototype.trimend": { + "version": "1.0.4", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "string.prototype.trimstart": { + "version": "1.0.4", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "4.0.0", + "dev": true + }, + "strip-eof": { + "version": "1.0.0" + }, + "strip-final-newline": { + "version": "2.0.0" + }, + "strip-indent": { + "version": "1.0.1", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "dev": true + }, + "strong-error-handler": { + "version": "2.3.2", + "requires": { + "accepts": "^1.3.3", + "debug": "^2.2.0", + "ejs": "^2.5.7", + "http-status": "^1.0.0", + "js2xmlparser": "^3.0.0", + "strong-globalize": "^3.1.0" + }, + "dependencies": { + "cross-spawn": { + "version": "5.1.0", + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "execa": { + "version": "0.7.0", + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "get-stream": { + "version": "3.0.0" + }, + "invert-kv": { + "version": "1.0.0" + }, + "is-stream": { + "version": "1.1.0" + }, + "lcid": { + "version": "1.0.0", + "requires": { + "invert-kv": "^1.0.0" + } + }, + "lru-cache": { + "version": "4.1.5", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "mem": { + "version": "1.1.0", + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "mimic-fn": { + "version": "1.2.0" + }, + "mkdirp": { + "version": "0.5.5", + "requires": { + "minimist": "^1.2.5" + } + }, + "ms": { + "version": "2.0.0" + }, + "npm-run-path": { + "version": "2.0.2", + "requires": { + "path-key": "^2.0.0" + } + }, + "os-locale": { + "version": "2.1.0", + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + } + }, + "path-key": { + "version": "2.0.1" + }, + "shebang-command": { + "version": "1.2.0", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0" + }, + "strong-globalize": { + "version": "3.3.0", + "requires": { + "accept-language": "^3.0.18", + "async": "^2.4.1", + "debug": "^3.1.0", + "esprima": "^4.0.0", + "estraverse": "^4.2.0", + "g11n-pipeline": "^2.0.1", + "globalize": "^1.3.0", + "htmlparser2": "^3.9.2", + "lodash": "^4.17.4", + "md5": "^2.2.1", + "mkdirp": "^0.5.1", + "mktmpdir": "^0.1.1", + "optional": "^0.1.3", + "os-locale": "^2.0.0", + "posix-getopt": "^1.2.0", + "word-count": "^0.2.2", + "xtend": "^4.0.1", + "yamljs": "^0.3.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.3" + } + } + }, + "which": { + "version": "1.3.1", + "requires": { + "isexe": "^2.0.0" + } + }, + "yallist": { + "version": "2.1.2" + } + } + }, + "strong-globalize": { + "version": "4.1.3", + "requires": { + "accept-language": "^3.0.18", + "debug": "^4.1.1", + "globalize": "^1.4.2", + "lodash": "^4.17.4", + "md5": "^2.2.1", + "mkdirp": "^0.5.1", + "os-locale": "^3.1.0", + "yamljs": "^0.3.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "strong-remoting": { + "version": "3.17.0", + "requires": { + "async": "^3.1.0", + "body-parser": "^1.12.4", + "debug": "^4.1.1", + "depd": "^2.0.0", + "escape-string-regexp": "^2.0.0", + "eventemitter2": "^5.0.1", + "express": "4.x", + "inflection": "^1.7.1", + "jayson": "^2.0.5", + "js2xmlparser": "^3.0.0", + "loopback-datatype-geopoint": "^1.0.0", + "loopback-phase": "^3.1.0", + "mux-demux": "^3.7.9", + "qs": "^6.2.1", + "request": "^2.83.0", + "sse": "0.0.8", + "strong-error-handler": "^3.0.0", + "strong-globalize": "^5.0.2", + "traverse": "^0.6.6", + "xml2js": "^0.4.8" + }, + "dependencies": { + "async": { + "version": "3.2.3" + }, + "ejs": { + "version": "3.1.6", + "requires": { + "jake": "^10.6.1" + } + }, + "escape-string-regexp": { + "version": "2.0.0" + }, + "invert-kv": { + "version": "3.0.1" + }, + "lcid": { + "version": "3.1.1", + "requires": { + "invert-kv": "^3.0.0" + } + }, + "mem": { + "version": "5.1.1", + "requires": { + "map-age-cleaner": "^0.1.3", + "mimic-fn": "^2.1.0", + "p-is-promise": "^2.1.0" + } + }, + "os-locale": { + "version": "5.0.0", + "requires": { + "execa": "^4.0.0", + "lcid": "^3.0.0", + "mem": "^5.0.0" + } + }, + "strong-error-handler": { + "version": "3.5.0", + "requires": { + "@types/express": "^4.16.0", + "accepts": "^1.3.3", + "debug": "^4.1.1", + "ejs": "^3.1.3", + "fast-safe-stringify": "^2.0.6", + "http-status": "^1.1.2", + "js2xmlparser": "^4.0.0", + "strong-globalize": "^6.0.1" + }, + "dependencies": { + "js2xmlparser": { + "version": "4.0.2", + "requires": { + "xmlcreate": "^2.0.4" + } + }, + "strong-globalize": { + "version": "6.0.5", + "requires": { + "accept-language": "^3.0.18", + "debug": "^4.2.0", + "globalize": "^1.6.0", + "lodash": "^4.17.20", + "md5": "^2.3.0", + "mkdirp": "^1.0.4", + "os-locale": "^5.0.0", + "yamljs": "^0.3.0" + } + } + } + }, + "strong-globalize": { + "version": "5.1.0", + "requires": { + "accept-language": "^3.0.18", + "debug": "^4.1.1", + "globalize": "^1.5.0", + "lodash": "^4.17.15", + "md5": "^2.2.1", + "mkdirp": "^0.5.5", + "os-locale": "^5.0.0", + "yamljs": "^0.3.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "xmlcreate": { + "version": "2.0.4" + } + } + }, + "stubs": { + "version": "3.0.0" + }, + "style-loader": { + "version": "0.23.1", + "dev": true, + "requires": { + "loader-utils": "^1.1.0", + "schema-utils": "^1.0.0" + }, + "dependencies": { + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "supports-color": { + "version": "5.5.0", + "requires": { + "has-flag": "^3.0.0" + } + }, + "supports-hyperlinks": { + "version": "2.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0", + "supports-color": "^7.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "dev": true + }, + "sver-compat": { + "version": "1.5.0", + "dev": true, + "requires": { + "es6-iterator": "^2.0.1", + "es6-symbol": "^3.1.1" + } + }, + "swagger-client": { + "version": "3.18.1", + "requires": { + "@babel/runtime-corejs3": "^7.11.2", + "btoa": "^1.2.1", + "cookie": "~0.4.1", + "cross-fetch": "^3.1.4", + "deepmerge": "~4.2.2", + "fast-json-patch": "^3.0.0-1", + "form-data-encoder": "^1.4.3", + "formdata-node": "^4.0.0", + "is-plain-object": "^5.0.0", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "qs": "^6.10.2", + "traverse": "~0.6.6", + "url": "~0.11.0" + }, + "dependencies": { + "argparse": { + "version": "2.0.1" + }, + "fast-json-patch": { + "version": "3.1.0" + }, + "is-plain-object": { + "version": "5.0.0" + }, + "js-yaml": { + "version": "4.1.0", + "requires": { + "argparse": "^2.0.1" + } + }, + "punycode": { + "version": "1.3.2" + }, + "qs": { + "version": "6.10.3", + "requires": { + "side-channel": "^1.0.4" + } + }, + "url": { + "version": "0.11.0", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + } + } + }, + "swagger-ui": { + "version": "2.2.10" + }, + "symbol-tree": { + "version": "3.2.4", + "dev": true + }, + "table": { + "version": "6.8.0", + "dev": true, + "requires": { + "ajv": "^8.0.1", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "ajv": { + "version": "8.8.2", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true + }, + "json-schema-traverse": { + "version": "1.0.0", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, + "tapable": { + "version": "1.1.3", + "dev": true + }, + "tar": { + "version": "2.2.2", + "dev": true, + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + }, + "tar-fs": { + "version": "2.1.1", + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "tar-stream": { + "version": "2.2.0", + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "bl": { + "version": "4.1.0", + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "buffer": { + "version": "5.7.1", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "readable-stream": { + "version": "3.6.0", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "teeny-request": { + "version": "3.11.3", + "requires": { + "https-proxy-agent": "^2.2.1", + "node-fetch": "^2.2.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "agent-base": { + "version": "4.3.0", + "requires": { + "es6-promisify": "^5.0.0" + } + }, + "debug": { + "version": "3.2.7", + "requires": { + "ms": "^2.1.1" + } + }, + "https-proxy-agent": { + "version": "2.2.4", + "requires": { + "agent-base": "^4.3.0", + "debug": "^3.1.0" + } + } + } + }, + "terminal-link": { + "version": "2.1.1", + "dev": true, + "requires": { + "ansi-escapes": "^4.2.1", + "supports-hyperlinks": "^2.0.0" + } + }, + "terser": { + "version": "4.8.0", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + }, + "dependencies": { + "commander": { + "version": "2.20.3", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "terser-webpack-plugin": { + "version": "1.4.5", + "dev": true, + "requires": { + "cacache": "^12.0.2", + "find-cache-dir": "^2.1.0", + "is-wsl": "^1.1.0", + "schema-utils": "^1.0.0", + "serialize-javascript": "^4.0.0", + "source-map": "^0.6.1", + "terser": "^4.1.2", + "webpack-sources": "^1.4.0", + "worker-farm": "^1.7.0" + }, + "dependencies": { + "is-wsl": { + "version": "1.1.0", + "dev": true + }, + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "test-exclude": { + "version": "6.0.0", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, + "text-table": { + "version": "0.2.0", + "dev": true + }, + "throat": { + "version": "5.0.0", + "dev": true + }, + "through": { + "version": "2.3.8" + }, + "through2": { + "version": "2.0.5", + "dev": true, + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "through2-filter": { + "version": "3.0.0", + "dev": true, + "requires": { + "through2": "~2.0.0", + "xtend": "~4.0.0" + } + }, + "thunky": { + "version": "1.1.0", + "dev": true + }, + "time-stamp": { + "version": "1.1.0", + "dev": true + }, + "timers-browserify": { + "version": "2.0.12", + "dev": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "tlds": { + "version": "1.208.0" + }, + "tmpl": { + "version": "1.0.5", + "dev": true + }, + "to-absolute-glob": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-absolute": "^1.0.0", + "is-negated-glob": "^1.0.0" + } + }, + "to-arraybuffer": { + "version": "1.0.1", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "dev": true + }, + "to-iso-string": { + "version": "0.0.2" + }, + "to-object-path": { + "version": "0.3.0", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-readable-stream": { + "version": "2.1.0" + }, + "to-regex": { + "version": "3.0.2", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + }, + "dependencies": { + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "to-through": { + "version": "2.0.0", + "dev": true, + "requires": { + "through2": "^2.0.3" + } + }, + "to-utf8": { + "version": "0.0.1" + }, + "toidentifier": { + "version": "1.0.1" + }, + "toposort": { + "version": "2.0.2" + }, + "touch": { + "version": "3.1.0", + "dev": true, + "requires": { + "nopt": "~1.0.10" + }, + "dependencies": { + "nopt": { + "version": "1.0.10", + "dev": true, + "requires": { + "abbrev": "1" + } + } + } + }, + "tough-cookie": { + "version": "4.0.0", + "dev": true, + "requires": { + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" + } + }, + "tr46": { + "version": "2.1.0", + "dev": true, + "requires": { + "punycode": "^2.1.1" + } + }, + "traverse": { + "version": "0.6.6" + }, + "trim-newlines": { + "version": "1.0.0", + "dev": true + }, + "true-case-path": { + "version": "1.0.3", + "dev": true, + "requires": { + "glob": "^7.1.2" + } + }, + "tryit": { + "version": "1.0.3", + "dev": true + }, + "tslib": { + "version": "2.3.1", + "dev": true + }, + "tty-browserify": { + "version": "0.0.0", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5" + }, + "type": { + "version": "1.2.0", + "dev": true + }, + "type-check": { + "version": "0.4.0", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-detect": { + "version": "4.0.8", + "dev": true + }, + "type-fest": { + "version": "0.10.0" + }, + "type-is": { + "version": "1.6.18", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + } + }, + "typedarray": { + "version": "0.0.6" + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "uc.micro": { + "version": "1.0.6" + }, + "uglify-js": { + "version": "3.4.10", + "dev": true, + "requires": { + "commander": "~2.19.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.19.0", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "uid2": { + "version": "0.0.3" + }, + "unbox-primitive": { + "version": "1.0.1", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + } + }, + "unbzip2-stream": { + "version": "1.4.3", + "requires": { + "buffer": "^5.2.1", + "through": "^2.3.8" + }, + "dependencies": { + "buffer": { + "version": "5.7.1", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + } + } + }, + "unc-path-regex": { + "version": "0.1.2", + "dev": true + }, + "undefsafe": { + "version": "2.0.5", + "dev": true + }, + "underscore": { + "version": "1.7.0" + }, + "underscore.string": { + "version": "3.3.5", + "requires": { + "sprintf-js": "^1.0.3", + "util-deprecate": "^1.0.2" + } + }, + "undertaker": { + "version": "1.3.0", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1", + "arr-map": "^2.0.0", + "bach": "^1.0.0", + "collection-map": "^1.0.0", + "es6-weak-map": "^2.0.1", + "fast-levenshtein": "^1.0.0", + "last-run": "^1.1.0", + "object.defaults": "^1.0.0", + "object.reduce": "^1.0.0", + "undertaker-registry": "^1.0.0" + }, + "dependencies": { + "fast-levenshtein": { + "version": "1.1.4", + "dev": true + } + } + }, + "undertaker-registry": { + "version": "1.0.1", + "dev": true + }, + "unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "2.0.0", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "2.0.0", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "2.0.0", + "dev": true + }, + "union-value": { + "version": "1.0.1", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^2.0.1" + } + }, + "unique-filename": { + "version": "1.1.1", + "dev": true, + "requires": { + "unique-slug": "^2.0.0" + } + }, + "unique-slug": { + "version": "2.0.2", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4" + } + }, + "unique-stream": { + "version": "2.3.1", + "dev": true, + "requires": { + "json-stable-stringify-without-jsonify": "^1.0.1", + "through2-filter": "^3.0.0" + } + }, + "unique-string": { + "version": "1.0.0", + "requires": { + "crypto-random-string": "^1.0.0" + } + }, + "universalify": { + "version": "0.1.2" + }, + "unpipe": { + "version": "1.0.0" + }, + "unset-value": { + "version": "1.0.0", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "dev": true + } + } + }, + "upath": { + "version": "1.2.0", + "dev": true + }, + "update-notifier": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", + "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", + "dev": true, + "requires": { + "boxen": "^5.0.0", + "chalk": "^4.1.0", + "configstore": "^5.0.1", + "has-yarn": "^2.1.0", + "import-lazy": "^2.1.0", + "is-ci": "^2.0.0", + "is-installed-globally": "^0.4.0", + "is-npm": "^5.0.0", + "is-yarn-global": "^0.3.0", + "latest-version": "^5.1.0", + "pupa": "^2.1.1", + "semver": "^7.3.4", + "semver-diff": "^3.1.1", + "xdg-basedir": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + } + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true + }, + "dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "semver": { + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", + "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, + "upper-case": { + "version": "1.1.3", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "requires": { + "punycode": "^2.1.0" + } + }, + "urix": { + "version": "0.1.0", + "dev": true + }, + "url": { + "version": "0.10.3", + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2" + } + } + }, + "url-join": { + "version": "4.0.1" + }, + "url-parse": { + "version": "1.5.4", + "dev": true, + "requires": { + "querystringify": "^2.1.1", + "requires-port": "^1.0.0" + } + }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + } + }, + "use": { + "version": "3.1.1", + "dev": true + }, + "utf7": { + "version": "1.0.2", + "requires": { + "semver": "~5.3.0" + }, + "dependencies": { + "semver": { + "version": "5.3.0" + } + } + }, + "util": { + "version": "0.11.1", + "dev": true, + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "dev": true + } + } + }, + "util-deprecate": { + "version": "1.0.2" + }, + "util.promisify": { + "version": "1.0.0", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, + "utila": { + "version": "0.4.0", + "dev": true + }, + "utils-merge": { + "version": "1.0.1" + }, + "uuid": { + "version": "3.4.0" + }, + "v8-compile-cache": { + "version": "2.3.0", + "dev": true + }, + "v8-to-istanbul": { + "version": "7.1.2", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "dev": true + } + } + }, + "v8flags": { + "version": "3.2.0", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "validate-npm-package-license": { + "version": "3.0.4", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "value-or-function": { + "version": "3.0.0", + "dev": true + }, + "vary": { + "version": "1.1.2" + }, + "vasync": { + "version": "2.2.1", + "requires": { + "verror": "1.10.0" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2" + }, + "verror": { + "version": "1.10.0", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + } + } + }, + "verror": { + "version": "1.10.1", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2" + } + } + }, + "vinyl": { + "version": "2.2.1", + "dev": true, + "requires": { + "clone": "^2.1.1", + "clone-buffer": "^1.0.0", + "clone-stats": "^1.0.0", + "cloneable-readable": "^1.0.0", + "remove-trailing-separator": "^1.0.1", + "replace-ext": "^1.0.0" + }, + "dependencies": { + "replace-ext": { + "version": "1.0.1", + "dev": true + } + } + }, + "vinyl-bufferstream": { + "version": "1.0.1", + "dev": true, + "requires": { + "bufferstreams": "1.0.1" + }, + "dependencies": { + "bufferstreams": { + "version": "1.0.1", + "dev": true, + "requires": { + "readable-stream": "^1.0.33" + } + }, + "isarray": { + "version": "0.0.1", + "dev": true + }, + "readable-stream": { + "version": "1.1.14", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "dev": true + } + } + }, + "vinyl-fs": { + "version": "3.0.3", + "dev": true, + "requires": { + "fs-mkdirp-stream": "^1.0.0", + "glob-stream": "^6.1.0", + "graceful-fs": "^4.0.0", + "is-valid-glob": "^1.0.0", + "lazystream": "^1.0.0", + "lead": "^1.0.0", + "object.assign": "^4.0.4", + "pumpify": "^1.3.5", + "readable-stream": "^2.3.3", + "remove-bom-buffer": "^3.0.0", + "remove-bom-stream": "^1.2.0", + "resolve-options": "^1.1.0", + "through2": "^2.0.0", + "to-through": "^2.0.0", + "value-or-function": "^3.0.0", + "vinyl": "^2.0.0", + "vinyl-sourcemap": "^1.1.0" + } + }, + "vinyl-sourcemap": { + "version": "1.1.0", + "dev": true, + "requires": { + "append-buffer": "^1.0.2", + "convert-source-map": "^1.5.0", + "graceful-fs": "^4.1.6", + "normalize-path": "^2.1.1", + "now-and-later": "^2.0.0", + "remove-bom-buffer": "^3.0.0", + "vinyl": "^2.0.0" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "vm-browserify": { + "version": "1.1.2", + "dev": true + }, + "vn-loopback": { + "version": "file:loopback" + }, + "vn-print": { + "version": "file:print", + "requires": { + "fs-extra": "^7.0.1", + "intl": "^1.2.5", + "js-yaml": "^3.13.1", + "jsonexport": "^3.2.0", + "juice": "^5.2.0", + "mysql2": "^1.7.0", + "nodemailer": "^4.7.0", + "puppeteer": "^2.0.0", + "qrcode": "^1.4.2", + "strftime": "^0.10.0", + "vue": "^2.6.10", + "vue-i18n": "^8.15.0", + "vue-server-renderer": "^2.6.10" + }, + "dependencies": { + "@types/mime-types": { + "version": "2.1.1" + }, + "agent-base": { + "version": "5.1.1" + }, + "ajv": { + "version": "6.12.6", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-regex": { + "version": "2.1.1" + }, + "ansi-styles": { + "version": "2.2.1" + }, + "argparse": { + "version": "1.0.10", + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "asn1": { + "version": "0.2.6", + "requires": { + "safer-buffer": "~2.1.0" + } + }, + "assert-plus": { + "version": "1.0.0" + }, + "async": { + "version": "3.2.3" + }, + "async-limiter": { + "version": "1.0.1" + }, + "asynckit": { + "version": "0.4.0" + }, + "aws-sign2": { + "version": "0.7.0" + }, + "aws4": { + "version": "1.11.0" + }, + "balanced-match": { + "version": "1.0.2" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "boolbase": { + "version": "1.0.0" + }, + "brace-expansion": { + "version": "1.1.11", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "buffer-crc32": { + "version": "0.2.13" + }, + "buffer-from": { + "version": "1.1.2" + }, + "camelcase": { + "version": "5.3.1" + }, + "caseless": { + "version": "0.12.0" + }, + "chalk": { + "version": "1.1.3", + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "cheerio": { + "version": "0.22.0", + "requires": { + "css-select": "~1.2.0", + "dom-serializer": "~0.1.0", + "entities": "~1.1.1", + "htmlparser2": "^3.9.1", + "lodash.assignin": "^4.0.9", + "lodash.bind": "^4.1.4", + "lodash.defaults": "^4.0.1", + "lodash.filter": "^4.4.0", + "lodash.flatten": "^4.2.0", + "lodash.foreach": "^4.3.0", + "lodash.map": "^4.4.0", + "lodash.merge": "^4.4.0", + "lodash.pick": "^4.2.1", + "lodash.reduce": "^4.4.0", + "lodash.reject": "^4.4.0", + "lodash.some": "^4.4.0" + } + }, + "cliui": { + "version": "6.0.0", + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1" + }, + "strip-ansi": { + "version": "6.0.1", + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "color-convert": { + "version": "1.9.3", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3" + }, + "combined-stream": { + "version": "1.0.8", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.20.3" + }, + "concat-map": { + "version": "0.0.1" + }, + "concat-stream": { + "version": "1.6.2", + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + }, + "dependencies": { + "readable-stream": { + "version": "2.3.7", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2" + }, + "string_decoder": { + "version": "1.1.1", + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "core-util-is": { + "version": "1.0.2" + }, + "cross-spawn": { + "version": "6.0.5", + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "css-select": { + "version": "1.2.0", + "requires": { + "boolbase": "~1.0.0", + "css-what": "2.1", + "domutils": "1.5.1", + "nth-check": "~1.0.1" + } + }, + "css-what": { + "version": "2.1.3" + }, + "dashdash": { + "version": "1.14.1", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "datauri": { + "version": "2.0.0", + "requires": { + "image-size": "^0.7.3", + "mimer": "^1.0.0" + } + }, + "debug": { + "version": "4.3.3", + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "1.2.0" + }, + "deep-extend": { + "version": "0.6.0" + }, + "delayed-stream": { + "version": "1.0.0" + }, + "denque": { + "version": "1.5.1" + }, + "dijkstrajs": { + "version": "1.0.2" + }, + "dom-serializer": { + "version": "0.1.1", + "requires": { + "domelementtype": "^1.3.0", + "entities": "^1.1.1" + } + }, + "domelementtype": { + "version": "1.3.1" + }, + "domhandler": { + "version": "2.4.2", + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "ecc-jsbn": { + "version": "0.1.2", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, + "emoji-regex": { + "version": "8.0.0" + }, + "encode-utf8": { + "version": "1.0.3" + }, + "entities": { + "version": "1.1.2" + }, + "escape-string-regexp": { + "version": "1.0.5" + }, + "esprima": { + "version": "4.0.1" + }, + "extend": { + "version": "3.0.2" + }, + "extract-zip": { + "version": "1.7.0", + "requires": { + "concat-stream": "^1.6.2", + "debug": "^2.6.9", + "mkdirp": "^0.5.4", + "yauzl": "^2.10.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0" + } + } + }, + "extsprintf": { + "version": "1.3.0" + }, + "fast-deep-equal": { + "version": "3.1.3" + }, + "fast-json-stable-stringify": { + "version": "2.1.0" + }, + "fd-slicer": { + "version": "1.1.0", + "requires": { + "pend": "~1.2.0" + } + }, + "find-up": { + "version": "4.1.0", + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "forever-agent": { + "version": "0.6.1" + }, + "form-data": { + "version": "2.3.3", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "fs-extra": { + "version": "7.0.1", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "fs.realpath": { + "version": "1.0.0" + }, + "function-bind": { + "version": "1.1.1" + }, + "generate-function": { + "version": "2.3.1", + "requires": { + "is-property": "^1.0.2" + } + }, + "get-caller-file": { + "version": "2.0.5" + }, + "getpass": { + "version": "0.1.7", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "7.2.0", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.2.9" + }, + "har-schema": { + "version": "2.0.0" + }, + "har-validator": { + "version": "5.1.5", + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0" + }, + "hash-sum": { + "version": "1.0.2" + }, + "he": { + "version": "1.2.0" + }, + "htmlparser2": { + "version": "3.10.1", + "requires": { + "domelementtype": "^1.3.1", + "domhandler": "^2.3.0", + "domutils": "^1.5.1", + "entities": "^1.1.1", + "inherits": "^2.0.1", + "readable-stream": "^3.1.1" + } + }, + "http-signature": { + "version": "1.2.0", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-proxy-agent": { + "version": "4.0.0", + "requires": { + "agent-base": "5", + "debug": "4" + } + }, + "iconv-lite": { + "version": "0.5.2", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "image-size": { + "version": "0.7.5" + }, + "inflight": { + "version": "1.0.6", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4" + }, + "intl": { + "version": "1.2.5" + }, + "is-core-module": { + "version": "2.8.1", + "requires": { + "has": "^1.0.3" + } + }, + "is-fullwidth-code-point": { + "version": "3.0.0" + }, + "is-property": { + "version": "1.0.2" + }, + "is-typedarray": { + "version": "1.0.0" + }, + "isarray": { + "version": "1.0.0" + }, + "isexe": { + "version": "2.0.0" + }, + "isstream": { + "version": "0.1.2" + }, + "js-yaml": { + "version": "3.14.1", + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsbn": { + "version": "0.1.1" + }, + "json-schema": { + "version": "0.4.0" + }, + "json-schema-traverse": { + "version": "0.4.1" + }, + "json-stringify-safe": { + "version": "5.0.1" + }, + "jsonexport": { + "version": "3.2.0" + }, + "jsonfile": { + "version": "4.0.0", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.2", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.4.0", + "verror": "1.10.0" + } + }, + "juice": { + "version": "5.2.0", + "requires": { + "cheerio": "^0.22.0", + "commander": "^2.15.1", + "cross-spawn": "^6.0.5", + "deep-extend": "^0.6.0", + "mensch": "^0.3.3", + "slick": "^1.12.2", + "web-resource-inliner": "^4.3.1" + } + }, + "locate-path": { + "version": "5.0.0", + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash._reinterpolate": { + "version": "3.0.0" + }, + "lodash.assignin": { + "version": "4.2.0" + }, + "lodash.bind": { + "version": "4.2.1" + }, + "lodash.defaults": { + "version": "4.2.0" + }, + "lodash.filter": { + "version": "4.6.0" + }, + "lodash.flatten": { + "version": "4.4.0" + }, + "lodash.foreach": { + "version": "4.5.0" + }, + "lodash.map": { + "version": "4.6.0" + }, + "lodash.merge": { + "version": "4.6.2" + }, + "lodash.pick": { + "version": "4.4.0" + }, + "lodash.reduce": { + "version": "4.6.0" + }, + "lodash.reject": { + "version": "4.6.0" + }, + "lodash.some": { + "version": "4.6.0" + }, + "lodash.template": { + "version": "4.5.0", + "requires": { + "lodash._reinterpolate": "^3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.2.0", + "requires": { + "lodash._reinterpolate": "^3.0.0" + } + }, + "lodash.unescape": { + "version": "4.0.1" + }, + "lodash.uniq": { + "version": "4.5.0" + }, + "long": { + "version": "4.0.0" + }, + "lru-cache": { + "version": "5.1.1", + "requires": { + "yallist": "^3.0.2" + } + }, + "mensch": { + "version": "0.3.4" + }, + "mime": { + "version": "2.6.0" + }, + "mime-db": { + "version": "1.51.0" + }, + "mime-types": { + "version": "2.1.34", + "requires": { + "mime-db": "1.51.0" + } + }, + "mimer": { + "version": "1.1.1" + }, + "minimatch": { + "version": "3.0.4", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5" + }, + "mkdirp": { + "version": "0.5.5", + "requires": { + "minimist": "^1.2.5" + } + }, + "ms": { + "version": "2.1.2" + }, + "mysql2": { + "version": "1.7.0", + "requires": { + "denque": "^1.4.1", + "generate-function": "^2.3.1", + "iconv-lite": "^0.5.0", + "long": "^4.0.0", + "lru-cache": "^5.1.1", + "named-placeholders": "^1.1.2", + "seq-queue": "^0.0.5", + "sqlstring": "^2.3.1" + } + }, + "named-placeholders": { + "version": "1.1.2", + "requires": { + "lru-cache": "^4.1.3" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.5", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "yallist": { + "version": "2.1.2" + } + } + }, + "nice-try": { + "version": "1.0.5" + }, + "nodemailer": { + "version": "4.7.0" + }, + "nth-check": { + "version": "1.0.2", + "requires": { + "boolbase": "~1.0.0" + } + }, + "oauth-sign": { + "version": "0.9.0" + }, + "once": { + "version": "1.4.0", + "requires": { + "wrappy": "1" + } + }, + "p-limit": { + "version": "2.3.0", + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0" + }, + "path-exists": { + "version": "4.0.0" + }, + "path-is-absolute": { + "version": "1.0.1" + }, + "path-key": { + "version": "2.0.1" + }, + "path-parse": { + "version": "1.0.7" + }, + "pend": { + "version": "1.2.0" + }, + "performance-now": { + "version": "2.1.0" + }, + "pngjs": { + "version": "5.0.0" + }, + "process-nextick-args": { + "version": "2.0.1" + }, + "progress": { + "version": "2.0.3" + }, + "proxy-from-env": { + "version": "1.1.0" + }, + "pseudomap": { + "version": "1.0.2" + }, + "psl": { + "version": "1.8.0" + }, + "punycode": { + "version": "2.1.1" + }, + "puppeteer": { + "version": "2.1.1", + "requires": { + "@types/mime-types": "^2.1.0", + "debug": "^4.1.0", + "extract-zip": "^1.6.6", + "https-proxy-agent": "^4.0.0", + "mime": "^2.0.3", + "mime-types": "^2.1.25", + "progress": "^2.0.1", + "proxy-from-env": "^1.0.0", + "rimraf": "^2.6.1", + "ws": "^6.1.0" + } + }, + "qrcode": { + "version": "1.5.0", + "requires": { + "dijkstrajs": "^1.0.1", + "encode-utf8": "^1.0.3", + "pngjs": "^5.0.0", + "yargs": "^15.3.1" + } + }, + "qs": { + "version": "6.5.3" + }, + "randombytes": { + "version": "2.1.0", + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readable-stream": { + "version": "3.6.0", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "request": { + "version": "2.88.2", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "require-directory": { + "version": "2.1.1" + }, + "require-main-filename": { + "version": "2.0.0" + }, + "resolve": { + "version": "1.21.0", + "requires": { + "is-core-module": "^2.8.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "rimraf": { + "version": "2.7.1", + "requires": { + "glob": "^7.1.3" + } + }, + "safe-buffer": { + "version": "5.2.1" + }, + "safer-buffer": { + "version": "2.1.2" + }, + "semver": { + "version": "5.7.1" + }, + "seq-queue": { + "version": "0.0.5" + }, + "serialize-javascript": { + "version": "3.1.0", + "requires": { + "randombytes": "^2.1.0" + } + }, + "set-blocking": { + "version": "2.0.0" + }, + "shebang-command": { + "version": "1.2.0", + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0" + }, + "slick": { + "version": "1.12.2" + }, + "source-map": { + "version": "0.5.6" + }, + "sprintf-js": { + "version": "1.0.3" + }, + "sqlstring": { + "version": "2.3.2" + }, + "sshpk": { + "version": "1.17.0", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "strftime": { + "version": "0.10.1" + }, + "string_decoder": { + "version": "1.3.0", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "string-width": { + "version": "4.2.3", + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1" + }, + "strip-ansi": { + "version": "6.0.1", + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0" + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0" + }, + "tough-cookie": { + "version": "2.5.0", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5" + }, + "typedarray": { + "version": "0.0.6" + }, + "universalify": { + "version": "0.1.2" + }, + "uri-js": { + "version": "4.4.1", + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2" + }, + "uuid": { + "version": "3.4.0" + }, + "valid-data-url": { + "version": "2.0.0" + }, + "verror": { + "version": "1.10.0", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "vue": { + "version": "2.6.14" + }, + "vue-i18n": { + "version": "8.26.8" + }, + "vue-server-renderer": { + "version": "2.6.14", + "requires": { + "chalk": "^1.1.3", + "hash-sum": "^1.0.2", + "he": "^1.1.0", + "lodash.template": "^4.5.0", + "lodash.uniq": "^4.5.0", + "resolve": "^1.2.0", + "serialize-javascript": "^3.1.0", + "source-map": "0.5.6" + } + }, + "web-resource-inliner": { + "version": "4.3.4", + "requires": { + "async": "^3.1.0", + "chalk": "^2.4.2", + "datauri": "^2.0.0", + "htmlparser2": "^4.0.0", + "lodash.unescape": "^4.0.1", + "request": "^2.88.0", + "safer-buffer": "^2.1.2", + "valid-data-url": "^2.0.0", + "xtend": "^4.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "dom-serializer": { + "version": "1.3.2", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^4.2.0", + "entities": "^2.0.0" + }, + "dependencies": { + "domhandler": { + "version": "4.3.0", + "requires": { + "domelementtype": "^2.2.0" + } + } + } + }, + "domelementtype": { + "version": "2.2.0" + }, + "domhandler": { + "version": "3.3.0", + "requires": { + "domelementtype": "^2.0.1" + } + }, + "domutils": { + "version": "2.8.0", + "requires": { + "dom-serializer": "^1.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "dependencies": { + "domhandler": { + "version": "4.3.0", + "requires": { + "domelementtype": "^2.2.0" + } + } + } + }, + "entities": { + "version": "2.2.0" + }, + "htmlparser2": { + "version": "4.1.0", + "requires": { + "domelementtype": "^2.0.1", + "domhandler": "^3.0.0", + "domutils": "^2.0.0", + "entities": "^2.0.0" + } + }, + "supports-color": { + "version": "5.5.0", + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "which": { + "version": "1.3.1", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0" + }, + "wrap-ansi": { + "version": "6.2.0", + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "5.0.1" + }, + "ansi-styles": { + "version": "4.3.0", + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4" + }, + "strip-ansi": { + "version": "6.0.1", + "requires": { + "ansi-regex": "^5.0.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2" + }, + "ws": { + "version": "6.2.2", + "requires": { + "async-limiter": "~1.0.0" + } + }, + "xtend": { + "version": "4.0.2" + }, + "y18n": { + "version": "4.0.3" + }, + "yallist": { + "version": "3.1.1" + }, + "yargs": { + "version": "15.4.1", + "requires": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + } + }, + "yargs-parser": { + "version": "18.1.3", + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "yauzl": { + "version": "2.10.0", + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + } + } + }, + "w3c-hr-time": { + "version": "1.0.2", + "dev": true, + "requires": { + "browser-process-hrtime": "^1.0.0" + } + }, + "w3c-xmlserializer": { + "version": "2.0.0", + "dev": true, + "requires": { + "xml-name-validator": "^3.0.0" + } + }, + "walker": { + "version": "1.0.8", + "dev": true, + "requires": { + "makeerror": "1.0.12" + } + }, + "watchpack": { + "version": "1.7.5", + "dev": true, + "requires": { + "chokidar": "^3.4.1", + "graceful-fs": "^4.1.2", + "neo-async": "^2.5.0", + "watchpack-chokidar2": "^2.0.1" + }, + "dependencies": { + "anymatch": { + "version": "3.1.2", + "dev": true, + "optional": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "binary-extensions": { + "version": "2.2.0", + "dev": true, + "optional": true + }, + "braces": { + "version": "3.0.2", + "dev": true, + "optional": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "chokidar": { + "version": "3.5.2", + "dev": true, + "optional": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "fill-range": { + "version": "7.0.1", + "dev": true, + "optional": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-number": { + "version": "7.0.0", + "dev": true, + "optional": true + }, + "readdirp": { + "version": "3.6.0", + "dev": true, + "optional": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "to-regex-range": { + "version": "5.0.1", + "dev": true, + "optional": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "watchpack-chokidar2": { + "version": "2.0.1", + "dev": true, + "optional": true, + "requires": { + "chokidar": "^2.1.8" + } + }, + "wbuf": { + "version": "1.7.3", + "dev": true, + "requires": { + "minimalistic-assert": "^1.0.0" + } + }, + "web-streams-polyfill": { + "version": "4.0.0-beta.1" + }, + "webidl-conversions": { + "version": "6.1.0", + "dev": true + }, + "webpack": { + "version": "4.46.0", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-module-context": "1.9.0", + "@webassemblyjs/wasm-edit": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0", + "acorn": "^6.4.1", + "ajv": "^6.10.2", + "ajv-keywords": "^3.4.1", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^4.5.0", + "eslint-scope": "^4.0.3", + "json-parse-better-errors": "^1.0.2", + "loader-runner": "^2.4.0", + "loader-utils": "^1.2.3", + "memory-fs": "^0.4.1", + "micromatch": "^3.1.10", + "mkdirp": "^0.5.3", + "neo-async": "^2.6.1", + "node-libs-browser": "^2.2.1", + "schema-utils": "^1.0.0", + "tapable": "^1.1.3", + "terser-webpack-plugin": "^1.4.3", + "watchpack": "^1.7.4", + "webpack-sources": "^1.4.1" + }, + "dependencies": { + "acorn": { + "version": "6.4.2", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + } + }, + "eslint-scope": { + "version": "4.0.3", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "extend-shallow": { + "version": "3.0.2", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extendable": { + "version": "1.0.1", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + }, + "micromatch": { + "version": "3.1.10", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + } + } + }, + "webpack-cli": { + "version": "3.3.12", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "cross-spawn": "^6.0.5", + "enhanced-resolve": "^4.1.1", + "findup-sync": "^3.0.0", + "global-modules": "^2.0.0", + "import-local": "^2.0.0", + "interpret": "^1.4.0", + "loader-utils": "^1.4.0", + "supports-color": "^6.1.0", + "v8-compile-cache": "^2.1.1", + "yargs": "^13.3.2" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "cross-spawn": { + "version": "6.0.5", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "emoji-regex": { + "version": "7.0.3", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "dev": true + }, + "global-modules": { + "version": "2.0.0", + "dev": true, + "requires": { + "global-prefix": "^3.0.0" + } + }, + "global-prefix": { + "version": "3.0.0", + "dev": true, + "requires": { + "ini": "^1.3.5", + "kind-of": "^6.0.2", + "which": "^1.3.1" + } + }, + "import-local": { + "version": "2.0.0", + "dev": true, + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "dev": true + }, + "locate-path": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "dev": true + }, + "resolve-cwd": { + "version": "2.0.0", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "dev": true + }, + "semver": { + "version": "5.7.1", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "supports-color": { + "version": "6.1.0", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "which": { + "version": "1.3.1", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "yargs-parser": { + "version": "13.1.2", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "webpack-dev-middleware": { + "version": "3.7.3", + "dev": true, + "requires": { + "memory-fs": "^0.4.1", + "mime": "^2.4.4", + "mkdirp": "^0.5.1", + "range-parser": "^1.2.1", + "webpack-log": "^2.0.0" + }, + "dependencies": { + "mkdirp": { + "version": "0.5.5", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } + } + }, + "webpack-dev-server": { + "version": "3.11.3", + "dev": true, + "requires": { + "ansi-html-community": "0.0.8", + "bonjour": "^3.5.0", + "chokidar": "^2.1.8", + "compression": "^1.7.4", + "connect-history-api-fallback": "^1.6.0", + "debug": "^4.1.1", + "del": "^4.1.1", + "express": "^4.17.1", + "html-entities": "^1.3.1", + "http-proxy-middleware": "0.19.1", + "import-local": "^2.0.0", + "internal-ip": "^4.3.0", + "ip": "^1.1.5", + "is-absolute-url": "^3.0.3", + "killable": "^1.0.1", + "loglevel": "^1.6.8", + "opn": "^5.5.0", + "p-retry": "^3.0.1", + "portfinder": "^1.0.26", + "schema-utils": "^1.0.0", + "selfsigned": "^1.10.8", + "semver": "^6.3.0", + "serve-index": "^1.9.1", + "sockjs": "^0.3.21", + "sockjs-client": "^1.5.0", + "spdy": "^4.0.2", + "strip-ansi": "^3.0.1", + "supports-color": "^6.1.0", + "url": "^0.11.0", + "webpack-dev-middleware": "^3.7.2", + "webpack-log": "^2.0.0", + "ws": "^6.2.1", + "yargs": "^13.3.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "del": { + "version": "4.1.1", + "dev": true, + "requires": { + "@types/glob": "^7.1.1", + "globby": "^6.1.0", + "is-path-cwd": "^2.0.0", + "is-path-in-cwd": "^2.0.0", + "p-map": "^2.0.0", + "pify": "^4.0.1", + "rimraf": "^2.6.3" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "dev": true + } + } + }, + "emoji-regex": { + "version": "7.0.3", + "dev": true + }, + "find-up": { + "version": "3.0.0", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "dev": true + }, + "globby": { + "version": "6.1.0", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "import-local": { + "version": "2.0.0", + "dev": true, + "requires": { + "pkg-dir": "^3.0.0", + "resolve-cwd": "^2.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "dev": true + }, + "is-path-cwd": { + "version": "2.2.0", + "dev": true + }, + "is-path-in-cwd": { + "version": "2.1.0", + "dev": true, + "requires": { + "is-path-inside": "^2.1.0" + } + }, + "is-path-inside": { + "version": "2.1.0", + "dev": true, + "requires": { + "path-is-inside": "^1.0.2" + } + }, + "locate-path": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "dev": true + }, + "punycode": { + "version": "1.3.2", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "dev": true + }, + "resolve-cwd": { + "version": "2.0.0", + "dev": true, + "requires": { + "resolve-from": "^3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "dev": true + }, + "schema-utils": { + "version": "1.0.0", + "dev": true, + "requires": { + "ajv": "^6.1.0", + "ajv-errors": "^1.0.0", + "ajv-keywords": "^3.1.0" + } + }, + "string-width": { + "version": "3.1.0", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "6.1.0", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "url": { + "version": "0.11.0", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + } + }, + "which-module": { + "version": "2.0.0", + "dev": true + }, + "wrap-ansi": { + "version": "5.1.0", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "4.1.0", + "dev": true + }, + "strip-ansi": { + "version": "5.2.0", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + } + } + }, + "ws": { + "version": "6.2.2", + "dev": true, + "requires": { + "async-limiter": "~1.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "dev": true, + "requires": { + "cliui": "^5.0.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "yargs-parser": { + "version": "13.1.2", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + } + } + }, + "webpack-log": { + "version": "2.0.0", + "dev": true, + "requires": { + "ansi-colors": "^3.0.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "ansi-colors": { + "version": "3.2.4", + "dev": true + } + } + }, + "webpack-merge": { + "version": "4.2.2", + "dev": true, + "requires": { + "lodash": "^4.17.15" + } + }, + "webpack-sources": { + "version": "1.4.3", + "dev": true, + "requires": { + "source-list-map": "^2.0.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "dev": true + } + } + }, + "websocket-driver": { + "version": "0.7.4", + "dev": true, + "requires": { + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + } + }, + "websocket-extensions": { + "version": "0.1.4", + "dev": true + }, + "whatwg-encoding": { + "version": "1.0.5", + "dev": true, + "requires": { + "iconv-lite": "0.4.24" + } + }, + "whatwg-mimetype": { + "version": "2.3.0", + "dev": true + }, + "whatwg-url": { + "version": "8.7.0", + "dev": true, + "requires": { + "lodash": "^4.7.0", + "tr46": "^2.1.0", + "webidl-conversions": "^6.1.0" + } + }, + "which": { + "version": "2.0.2", + "requires": { + "isexe": "^2.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.0.2", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "which-module": { + "version": "1.0.0", + "dev": true + }, + "wide-align": { + "version": "1.1.5", + "requires": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "requires": { + "string-width": "^4.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + } + } + }, + "with-open-file": { + "version": "0.1.7", + "requires": { + "p-finally": "^1.0.0", + "p-try": "^2.1.0", + "pify": "^4.0.1" + }, + "dependencies": { + "pify": { + "version": "4.0.1" + } + } + }, + "word-count": { + "version": "0.2.2" + }, + "word-wrap": { + "version": "1.2.3", + "dev": true + }, + "worker-farm": { + "version": "1.7.0", + "dev": true, + "requires": { + "errno": "~0.1.7" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2" + }, + "write-file-atomic": { + "version": "3.0.3", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "ws": { + "version": "7.5.6", + "requires": {} + }, + "x-xss-protection": { + "version": "1.3.0" + }, + "xdg-basedir": { + "version": "3.0.0" + }, + "xml": { + "version": "1.0.1", + "dev": true + }, + "xml-name-validator": { + "version": "3.0.0", + "dev": true + }, + "xml2js": { + "version": "0.4.23", + "requires": { + "sax": ">=0.6.0", + "xmlbuilder": "~11.0.0" + } + }, + "xmlbuilder": { + "version": "11.0.1" + }, + "xmlchars": { + "version": "2.2.0", + "dev": true + }, + "xmlcreate": { + "version": "1.0.2" + }, + "xtend": { + "version": "4.0.2" + }, + "y18n": { + "version": "4.0.3", + "dev": true + }, + "yallist": { + "version": "3.1.1" + }, + "yaml-loader": { + "version": "0.5.0", + "dev": true, + "requires": { + "js-yaml": "^3.5.2" + } + }, + "yamljs": { + "version": "0.3.0", + "requires": { + "argparse": "^1.0.7", + "glob": "^7.0.5" + } + }, + "yargs": { + "version": "7.1.2", + "dev": true, + "requires": { + "camelcase": "^3.0.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "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.1" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "dev": true + }, + "find-up": { + "version": "1.1.2", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "invert-kv": { + "version": "1.0.0", + "dev": true + }, + "lcid": { + "version": "1.0.0", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "os-locale": { + "version": "1.4.0", + "dev": true, + "requires": { + "lcid": "^1.0.0" + } + }, + "path-exists": { + "version": "2.1.0", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "read-pkg": { + "version": "1.1.0", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + } + }, + "y18n": { + "version": "3.2.2", + "dev": true + } + } + }, + "yargs-parser": { + "version": "5.0.1", + "dev": true, + "requires": { + "camelcase": "^3.0.0", + "object.assign": "^4.1.0" + }, + "dependencies": { + "camelcase": { + "version": "3.0.0", + "dev": true + } + } + }, + "yauzl": { + "version": "2.10.0", + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + } + } +} diff --git a/package.json b/package.json index 35c27fc0c..88ac91233 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "gulp-env": "^0.4.0", "gulp-file": "^0.4.0", "gulp-install": "^1.1.0", - "gulp-jasmine": "^4.0.0", "gulp-merge-json": "^1.3.1", "gulp-nodemon": "^2.5.0", "gulp-print": "^2.0.1", @@ -78,7 +77,7 @@ "html-loader-jest": "^0.2.1", "html-webpack-plugin": "^4.0.0-beta.11", "identity-obj-proxy": "^3.0.0", - "jasmine": "^3.10.0", + "jasmine": "^4.1.0", "jasmine-reporters": "^2.4.0", "jasmine-spec-reporter": "^7.0.0", "jest": "^26.0.1", @@ -88,7 +87,7 @@ "minimist": "^1.2.5", "mysql2": "^1.7.0", "node-sass": "^4.14.1", - "nodemon": "^1.19.4", + "nodemon": "^2.0.16", "plugin-error": "^1.0.1", "raw-loader": "^1.0.0", "regenerator-runtime": "^0.13.7", @@ -102,6 +101,7 @@ }, "scripts": { "dbtest": "nodemon -q db/tests.js -w db/tests", + "backtest": "nodemon -q back/tests.js --config back/nodemonConfig.json", "test": "jest --watch", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", "lint": "eslint ./ --cache --ignore-pattern .gitignore", From af1fa8051f7fdcdd5fff4b192dad719f46865e69 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 12 May 2022 08:06:30 +0200 Subject: [PATCH 085/141] refactor(clientCredit): refactor test --- modules/client/back/models/client-config.json | 36 ++++----- .../client/back/models/client-contact.json | 46 +++++------ .../back/models/client-credit-limit.json | 48 ++++++------ modules/client/back/models/client-credit.json | 62 +++++++-------- modules/client/back/models/client-risk.json | 30 ++++---- modules/client/back/models/client-unpaid.json | 26 +++---- .../client/back/models/contact-channel.json | 32 ++++---- .../back/models/credit-classification.json | 76 +++++++++---------- modules/client/back/models/recovery.json | 60 +++++++-------- .../back/models/specs/clientCredit.spec.js | 14 +++- 10 files changed, 218 insertions(+), 212 deletions(-) diff --git a/modules/client/back/models/client-config.json b/modules/client/back/models/client-config.json index 9d4228ede..90d47333d 100644 --- a/modules/client/back/models/client-config.json +++ b/modules/client/back/models/client-config.json @@ -1,22 +1,22 @@ { - "name": "ClientConfig", - "base": "VnModel", - "options": { - "mysql": { - "table": "clientConfig" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" + "name": "ClientConfig", + "base": "VnModel", + "options": { + "mysql": { + "table": "clientConfig" + } }, - "riskTolerance": { - "type": "Number" - }, - "maxCreditRows": { - "type": "Number" + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "riskTolerance": { + "type": "number" + }, + "maxCreditRows": { + "type": "number" + } } - } } \ No newline at end of file diff --git a/modules/client/back/models/client-contact.json b/modules/client/back/models/client-contact.json index ea916c072..5a7a7a967 100644 --- a/modules/client/back/models/client-contact.json +++ b/modules/client/back/models/client-contact.json @@ -3,34 +3,34 @@ "description": "Client phone contacts", "base": "Loggable", "log": { - "model": "ClientLog", - "relation": "client", - "showField": "name" + "model": "ClientLog", + "relation": "client", + "showField": "name" }, "options": { - "mysql": { - "table": "clientContact" - } + "mysql": { + "table": "clientContact" + } }, "validateUpsert": true, "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "name": { - "type": "string" - }, - "phone": { - "type": "string" - } + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string" + }, + "phone": { + "type": "string" + } }, "relations": { - "client": { - "type": "belongsTo", - "model": "Client", - "foreignKey": "clientFk" - } + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/modules/client/back/models/client-credit-limit.json b/modules/client/back/models/client-credit-limit.json index 5263fb94b..31e60b452 100644 --- a/modules/client/back/models/client-credit-limit.json +++ b/modules/client/back/models/client-credit-limit.json @@ -1,26 +1,26 @@ { - "name": "ClientCreditLimit", - "base": "VnModel", - "options": { - "mysql": { - "table": "clientCreditLimit" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "maxAmount": { - "type": "Number" - } - }, - "relations": { - "role": { - "type": "belongsTo", - "model": "Role", - "foreignKey": "roleFk" - } - } + "name": "ClientCreditLimit", + "base": "VnModel", + "options": { + "mysql": { + "table": "clientCreditLimit" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "maxAmount": { + "type": "Number" + } + }, + "relations": { + "role": { + "type": "belongsTo", + "model": "Role", + "foreignKey": "roleFk" + } + } } \ No newline at end of file diff --git a/modules/client/back/models/client-credit.json b/modules/client/back/models/client-credit.json index 2b71fbe2d..161cc7dcf 100644 --- a/modules/client/back/models/client-credit.json +++ b/modules/client/back/models/client-credit.json @@ -1,36 +1,36 @@ { - "name": "ClientCredit", - "description": "Log of credit changes", - "base": "VnModel", - "options": { - "mysql": { - "table": "clientCredit" - } - }, - "validateUpsert": true, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" + "name": "ClientCredit", + "description": "Log of credit changes", + "base": "VnModel", + "options": { + "mysql": { + "table": "clientCredit" + } }, - "amount": { - "type": "Number" + "validateUpsert": true, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "amount": { + "type": "Number" + }, + "created": { + "type": "date" + } }, - "created": { - "type": "date" + "relations": { + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + }, + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + } } - }, - "relations": { - "client": { - "type": "belongsTo", - "model": "Client", - "foreignKey": "clientFk" - }, - "worker": { - "type": "belongsTo", - "model": "Worker", - "foreignKey": "workerFk" - } - } } \ No newline at end of file diff --git a/modules/client/back/models/client-risk.json b/modules/client/back/models/client-risk.json index f76483fca..de7e4a42f 100644 --- a/modules/client/back/models/client-risk.json +++ b/modules/client/back/models/client-risk.json @@ -2,22 +2,22 @@ "name": "ClientRisk", "base": "VnModel", "options": { - "mysql": { - "table": "clientRisk" - } + "mysql": { + "table": "clientRisk" + } }, "properties": { - "clientFk": { - "type": "Number", - "id": true - }, - "companyFk": { - "type": "Number", - "id": true - }, - "amount": { - "type": "Number" - } + "clientFk": { + "type": "Number", + "id": true + }, + "companyFk": { + "type": "Number", + "id": true + }, + "amount": { + "type": "Number" + } }, "relations": { "client": { @@ -31,4 +31,4 @@ "foreignKey": "companyFk" } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/modules/client/back/models/client-unpaid.json b/modules/client/back/models/client-unpaid.json index a3d1a684c..4f78ad48a 100644 --- a/modules/client/back/models/client-unpaid.json +++ b/modules/client/back/models/client-unpaid.json @@ -2,21 +2,21 @@ "name": "ClientUnpaid", "base": "VnModel", "options": { - "mysql": { - "table": "clientUnpaid" - } + "mysql": { + "table": "clientUnpaid" + } }, "properties": { - "clientFk": { - "type": "number", - "id": true - }, - "dated": { - "type": "date" - }, - "amount": { - "type": "Number" - } + "clientFk": { + "type": "number", + "id": true + }, + "dated": { + "type": "date" + }, + "amount": { + "type": "Number" + } }, "relations": { "client": { diff --git a/modules/client/back/models/contact-channel.json b/modules/client/back/models/contact-channel.json index 3a5de2140..e9949b307 100644 --- a/modules/client/back/models/contact-channel.json +++ b/modules/client/back/models/contact-channel.json @@ -1,20 +1,20 @@ { - "name": "ContactChannel", - "base": "VnModel", - "options": { - "mysql": { - "table": "contactChannel" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" + "name": "ContactChannel", + "base": "VnModel", + "options": { + "mysql": { + "table": "contactChannel" + } }, - "name": { - "type": "string", - "required": true + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": true + } } - } } \ No newline at end of file diff --git a/modules/client/back/models/credit-classification.json b/modules/client/back/models/credit-classification.json index 2e636af63..4db480f5c 100644 --- a/modules/client/back/models/credit-classification.json +++ b/modules/client/back/models/credit-classification.json @@ -1,42 +1,42 @@ { - "name": "CreditClassification", - "description": "Clasified clients", - "base": "VnModel", - "options": { - "mysql": { - "table": "creditClassification" - } - }, - "properties": { - "id": { - "id": true, - "type": "Number", - "description": "Identifier" + "name": "CreditClassification", + "description": "Clasified clients", + "base": "VnModel", + "options": { + "mysql": { + "table": "creditClassification" + } }, - "started": { - "type": "date", - "required": true, - "mysql": { - "columnName": "dateStart" - } + "properties": { + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "started": { + "type": "date", + "required": true, + "mysql": { + "columnName": "dateStart" + } + }, + "finished": { + "type": "date", + "mysql": { + "columnName": "dateEnd" + } + } }, - "finished": { - "type": "date", - "mysql": { - "columnName": "dateEnd" - } + "relations": { + "customer": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "client" + }, + "insurances": { + "type": "hasMany", + "model": "CreditInsurance", + "foreignKey": "creditClassification" + } } - }, - "relations": { - "customer": { - "type": "belongsTo", - "model": "Client", - "foreignKey": "client" - }, - "insurances": { - "type": "hasMany", - "model": "CreditInsurance", - "foreignKey": "creditClassification" - } - } -} +} \ No newline at end of file diff --git a/modules/client/back/models/recovery.json b/modules/client/back/models/recovery.json index 5a26cd842..24962bca8 100644 --- a/modules/client/back/models/recovery.json +++ b/modules/client/back/models/recovery.json @@ -2,40 +2,40 @@ "name": "Recovery", "base": "Loggable", "log": { - "model": "ClientLog", - "relation": "client" + "model": "ClientLog", + "relation": "client" }, "options": { - "mysql": { - "table": "recovery" - } + "mysql": { + "table": "recovery" + } }, "properties": { - "id": { - "id": true, - "type": "Number", - "description": "Identifier" - }, - "started": { - "type": "date", - "required": true - }, - "finished": { - "type": "date" - }, - "amount": { - "type": "Number", - "required": true - }, - "period": { - "type": "Number" - } + "id": { + "id": true, + "type": "Number", + "description": "Identifier" + }, + "started": { + "type": "date", + "required": true + }, + "finished": { + "type": "date" + }, + "amount": { + "type": "Number", + "required": true + }, + "period": { + "type": "Number" + } }, "relations": { - "client": { - "type": "belongsTo", - "model": "Client", - "foreignKey": "clientFk" - } + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + } } - } \ No newline at end of file +} \ No newline at end of file diff --git a/modules/client/back/models/specs/clientCredit.spec.js b/modules/client/back/models/specs/clientCredit.spec.js index 7a42b7531..ab3924feb 100644 --- a/modules/client/back/models/specs/clientCredit.spec.js +++ b/modules/client/back/models/specs/clientCredit.spec.js @@ -9,24 +9,29 @@ describe('Client Credit', () => { const clientConfig = await models.ClientConfig.findOne({ where: {id: 1} }); + + let rowsBefore; let rowsAfter; try { const options = {transaction: tx}; - const ctx = {options}; const salesAssistant = await models.Account.findOne({ where: {name: 'salesAssistant'} - }, ctx.options); + }, options); + + rowsBefore = await models.ClientCredit.find({ + where: {clientFk: instance.id}, + }, options); await models.ClientCredit.create({ amount: 355, clientFk: instance.id, workerFk: salesAssistant.id - }, ctx.options); + }, options); rowsAfter = await models.ClientCredit.find({ where: {clientFk: instance.id}, - }, ctx.options); + }, options); await tx.rollback(); } catch (e) { @@ -34,6 +39,7 @@ describe('Client Credit', () => { throw e; } + expect(rowsBefore.length).toBeGreaterThanOrEqual(clientConfig.maxCreditRows); expect(rowsAfter.length).toEqual(clientConfig.maxCreditRows); }); }); From 568579f46170736aeeaffa6fb1eb4d53aa9fd50f Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 12 May 2022 08:27:04 +0200 Subject: [PATCH 086/141] refactor: pull request changes --- modules/invoiceIn/front/tax/index.html | 17 +++++----- modules/invoiceIn/front/tax/index.js | 35 ++++++++++--------- modules/invoiceIn/front/tax/index.spec.js | 41 +++++++++++++++++++---- modules/invoiceIn/front/tax/locale/es.yml | 7 ++-- 4 files changed, 67 insertions(+), 33 deletions(-) diff --git a/modules/invoiceIn/front/tax/index.html b/modules/invoiceIn/front/tax/index.html index 44ceef807..acc9cf492 100644 --- a/modules/invoiceIn/front/tax/index.html +++ b/modules/invoiceIn/front/tax/index.html @@ -35,7 +35,7 @@ {{id}}: {{name}} @@ -105,31 +105,32 @@ - + -
-
{{$ctrl.$t('New expence')}}
+
+
{{$ctrl.$t('New expense')}}
+ ng-model="$ctrl.expense.code" + required="true" + vn-focus> + ng-model="$ctrl.expense.isWithheld"> diff --git a/modules/invoiceIn/front/tax/index.js b/modules/invoiceIn/front/tax/index.js index 48fb98d4e..d05a77f29 100644 --- a/modules/invoiceIn/front/tax/index.js +++ b/modules/invoiceIn/front/tax/index.js @@ -3,6 +3,10 @@ import Section from 'salix/components/section'; import UserError from 'core/lib/user-error'; class Controller extends Section { + constructor($element, $, vnWeekDays) { + super($element, $); + this.expense = {}; + } taxRate(invoiceInTax, taxRateSelection) { const taxTypeSage = taxRateSelection && taxRateSelection.rate; const taxableBase = invoiceInTax && invoiceInTax.taxableBase; @@ -29,23 +33,24 @@ class Controller extends Section { } onResponse() { - if (!this.expence) - throw new UserError(`The fields can't be empty`); - else if (!this.expence.code) - throw new UserError(`The code can't be empty`); - else if (!this.expence.description) - throw new UserError(`The description can't be empty`); + try { + if (!this.expense.code) + throw new Error(`The code can't be empty`); + if (!this.expense.description) + throw new UserError(`The description can't be empty`); - const params = []; - params.push({ - id: this.expence.code, - isWithheld: this.expence.isWithheld, - name: this.expence.description - }); + const data = [{ + id: this.expense.code, + isWithheld: this.expense.isWithheld, + name: this.expense.description + }]; - this.$http.post(`Expenses`, params) .then(() => { - this.vnApp.showSuccess(this.$t('Expence saved!')); - }); + this.$http.post(`Expenses`, data) .then(() => { + this.vnApp.showSuccess(this.$t('Expense saved!')); + }); + } catch (e) { + this.vnApp.showError(this.$t(e.message)); + } } } diff --git a/modules/invoiceIn/front/tax/index.spec.js b/modules/invoiceIn/front/tax/index.spec.js index bc7963899..c62ada9ca 100644 --- a/modules/invoiceIn/front/tax/index.spec.js +++ b/modules/invoiceIn/front/tax/index.spec.js @@ -1,6 +1,7 @@ import './index.js'; import watcher from 'core/mocks/watcher'; import crudModel from 'core/mocks/crud-model'; +const UserError = require('vn-loopback/util/user-error'); describe('InvoiceIn', () => { describe('Component tax', () => { @@ -61,25 +62,51 @@ describe('InvoiceIn', () => { describe('onResponse()', () => { it('should return success message', () => { - controller.expence = { + controller.expense = { code: 7050000005, isWithheld: 0, description: 'Test' }; - const params = [{ - id: controller.expence.code, - isWithheld: controller.expence.isWithheld, - name: controller.expence.description + const data = [{ + id: controller.expense.code, + isWithheld: controller.expense.isWithheld, + name: controller.expense.description }]; jest.spyOn(controller.vnApp, 'showSuccess'); - $httpBackend.expect('POST', `Expenses`, params).respond(); + $httpBackend.expect('POST', `Expenses`, data).respond(); controller.onResponse(); $httpBackend.flush(); - expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Expence saved!'); + expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Expense saved!'); + }); + + it('should return an error if code is empty', () => { + controller.expense = { + code: null, + isWithheld: 0, + description: 'Test' + }; + + jest.spyOn(controller.vnApp, 'showError'); + controller.onResponse(); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The code can't be empty`); + }); + + it('should return an error if description is empty', () => { + controller.expense = { + code: 7050000005, + isWithheld: 0, + description: null + }; + + jest.spyOn(controller.vnApp, 'showError'); + controller.onResponse(); + + expect(controller.vnApp.showError).toHaveBeenCalledWith(`The description can't be empty`); }); }); }); diff --git a/modules/invoiceIn/front/tax/locale/es.yml b/modules/invoiceIn/front/tax/locale/es.yml index 220802d9a..3ff68ea40 100644 --- a/modules/invoiceIn/front/tax/locale/es.yml +++ b/modules/invoiceIn/front/tax/locale/es.yml @@ -1,6 +1,7 @@ -Create expence: Crear gasto -New expence: Nuevo gasto +Create expense: Crear gasto +New expense: Nuevo gasto It's a withholding: Es una retención The fields can't be empty: Los campos no pueden estar vacíos The code can't be empty: El código no puede estar vacío -The description can't be empty: La descripción no puede estar vacía \ No newline at end of file +The description can't be empty: La descripción no puede estar vacía +Expense saved!: Gasto guardado! \ No newline at end of file From 644139324978d74a39249e9dd635fdf87c550e22 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 12 May 2022 08:47:17 +0200 Subject: [PATCH 087/141] refactor: pull request changes --- modules/ticket/back/methods/expedition-state/filter.js | 2 +- modules/ticket/back/methods/expedition/filter.js | 2 +- modules/ticket/front/expedition/index.html | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/ticket/back/methods/expedition-state/filter.js b/modules/ticket/back/methods/expedition-state/filter.js index 43c293d7d..1483780f7 100644 --- a/modules/ticket/back/methods/expedition-state/filter.js +++ b/modules/ticket/back/methods/expedition-state/filter.js @@ -29,7 +29,7 @@ module.exports = Self => { Object.assign(myOptions, options); const stmt = new ParameterizedSQL( - `SELECT es.created, u.name, u.id workerFk, est.description + `SELECT es.created, u.name, u.id workerFk, est.description state FROM vn.expeditionState es JOIN vn.expeditionStateType est ON est.id = es.typeFk JOIN account.user u ON u.id = es.userFk diff --git a/modules/ticket/back/methods/expedition/filter.js b/modules/ticket/back/methods/expedition/filter.js index 508e55617..538e19938 100644 --- a/modules/ticket/back/methods/expedition/filter.js +++ b/modules/ticket/back/methods/expedition/filter.js @@ -48,7 +48,7 @@ module.exports = Self => { es.workerFk expeditionScanWorkerFk, su.name scannerUserName, es.scanned, - est.description + est.description state FROM vn.expedition e LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk LEFT JOIN vn.item i2 ON i2.id = e.itemFk diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index e5b84509f..a41d368f6 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -20,7 +20,7 @@ Counter externalId Created - State + State @@ -45,7 +45,7 @@ {{::expedition.counter}} {{::expedition.externalId}} {{::expedition.created | date:'dd/MM/yyyy HH:mm'}} - {{::expedition.description}} + {{::expedition.state}} - {{::expeditionState.description}} + {{::expeditionState.state}} Date: Thu, 12 May 2022 09:47:47 +0200 Subject: [PATCH 088/141] refactor(clientCredit): test and types --- back/models/account.json | 2 +- back/models/autonomy.json | 2 +- back/models/bank-entity.json | 6 +-- back/models/bank.json | 14 +++--- back/models/chat-config.json | 10 ++-- back/models/company.json | 4 +- back/models/country.json | 4 +- back/models/delivery.json | 6 +-- back/models/dms-type.json | 2 +- back/models/dms.json | 2 +- back/models/email-user.json | 2 +- back/models/image-collection-size.json | 8 ++-- back/models/image-collection.json | 14 +++--- back/models/postcode.json | 2 +- back/models/sage-withholding.json | 2 +- back/models/town.json | 4 +- back/models/user-config-view.json | 8 ++-- back/models/user-log.json | 20 ++++---- back/models/user.json | 2 +- back/models/warehouse.json | 8 ++-- db/dump/fixtures.sql | 20 ++++---- loopback/common/models/field-acl.json | 10 ++-- modules/account/back/models/samba-config.json | 2 +- modules/account/back/models/sip-config.json | 2 +- modules/account/back/models/sip.json | 4 +- .../claim/back/models/claim-beginning.json | 4 +- .../claim/back/models/claim-destination.json | 4 +- .../claim/back/models/claim-development.json | 2 +- modules/claim/back/models/claim-dms.json | 2 +- modules/claim/back/models/claim-end.json | 2 +- modules/claim/back/models/claim-log.json | 20 ++++---- modules/claim/back/models/claim-ratio.json | 12 ++--- modules/claim/back/models/claim-reason.json | 4 +- .../claim/back/models/claim-redelivery.json | 4 +- .../claim/back/models/claim-responsible.json | 6 +-- modules/claim/back/models/claim-result.json | 4 +- modules/claim/back/models/claim.json | 2 +- .../back/models/address-observation.json | 2 +- modules/client/back/models/address.json | 6 +-- .../client/back/models/client-contact.json | 2 +- .../back/models/client-credit-limit.json | 48 +++++++++---------- modules/client/back/models/client-credit.json | 4 +- modules/client/back/models/client-dms.json | 4 +- modules/client/back/models/client-log.json | 20 ++++---- .../back/models/client-observation.json | 4 +- modules/client/back/models/client-risk.json | 6 +-- modules/client/back/models/client-sample.json | 2 +- modules/client/back/models/client-type.json | 8 ++-- modules/client/back/models/client-unpaid.json | 2 +- modules/client/back/models/client.json | 10 ++-- .../client/back/models/contact-channel.json | 2 +- .../back/models/credit-classification.json | 2 +- .../client/back/models/credit-insurance.json | 6 +-- modules/client/back/models/customs-agent.json | 12 ++--- modules/client/back/models/defaulter.json | 8 ++-- modules/client/back/models/greuge-config.json | 2 +- modules/client/back/models/greuge-type.json | 6 +-- modules/client/back/models/greuge.json | 8 ++-- modules/client/back/models/incoterms.json | 4 +- modules/client/back/models/mandate-type.json | 4 +- modules/client/back/models/mandate.json | 4 +- .../client/back/models/observation-type.json | 6 +-- modules/client/back/models/pay-method.json | 4 +- modules/client/back/models/recovery.json | 6 +-- modules/client/back/models/sage-tax-type.json | 2 +- .../back/models/sage-transaction-type.json | 2 +- modules/client/back/models/sms-config.json | 8 ++-- modules/client/back/models/sms.json | 12 ++--- .../back/models/specs/clientCredit.spec.js | 7 +++ modules/client/back/models/tpv-error.json | 2 +- modules/client/back/models/tpv-merchant.json | 2 +- modules/client/back/models/tpv-response.json | 2 +- .../client/back/models/tpv-transaction.json | 16 +++---- modules/entry/back/models/entry-log.json | 20 ++++---- .../entry/back/models/entry-observation.json | 4 +- .../invoiceOut/back/models/invoice-out.json | 10 ++-- modules/invoiceOut/back/models/tax-class.json | 6 +-- modules/invoiceOut/back/models/tax-code.json | 8 ++-- modules/invoiceOut/back/models/tax-type.json | 10 ++-- modules/item/back/models/expense.json | 2 +- modules/item/back/models/genus.json | 4 +- modules/item/back/models/ink.json | 4 +- modules/item/back/models/item-barcode.json | 4 +- modules/item/back/models/item-botanical.json | 2 +- modules/item/back/models/item-log.json | 20 ++++---- modules/item/back/models/item-placement.json | 8 ++-- .../item/back/models/item-shelving-sale.json | 4 +- modules/item/back/models/item-shelving.json | 12 ++--- modules/item/back/models/item-tag.json | 10 ++-- .../item/back/models/item-tax-country.json | 10 ++-- modules/item/back/models/item-type-tag.json | 4 +- modules/item/back/models/producer.json | 4 +- modules/item/back/models/specie.json | 4 +- modules/item/back/models/tag.json | 12 ++--- modules/order/back/models/order-row.json | 12 ++--- modules/order/back/models/order-ticket.json | 4 +- modules/order/back/models/order.json | 18 +++---- modules/route/back/models/deliveryPoint.json | 6 +-- modules/route/back/models/route-log.json | 20 ++++---- modules/route/back/models/route.json | 12 ++--- modules/route/back/models/vehicle.json | 14 +++--- modules/supplier/back/models/pay-dem.json | 4 +- .../back/models/supplier-account.json | 6 +-- .../back/models/supplier-contact.json | 14 +++--- .../back/models/annual-average-invoiced.json | 2 +- .../ticket/back/models/component-type.json | 4 +- modules/ticket/back/models/component.json | 14 +++--- modules/ticket/back/models/expedition.json | 6 +-- modules/ticket/back/models/sale-checked.json | 2 +- .../ticket/back/models/sale-component.json | 6 +-- modules/ticket/back/models/sale-tracking.json | 8 ++-- modules/ticket/back/models/sale.json | 12 ++--- modules/ticket/back/models/stowaway.json | 4 +- modules/ticket/back/models/ticket-config.json | 4 +- .../ticket/back/models/ticket-last-state.json | 4 +- modules/ticket/back/models/ticket-log.json | 20 ++++---- .../back/models/ticket-observation.json | 4 +- .../ticket/back/models/ticket-packaging.json | 6 +-- .../ticket/back/models/ticket-request.json | 12 ++--- .../back/models/ticket-service-type.json | 6 +-- .../ticket/back/models/ticket-service.json | 14 +++--- .../ticket/back/models/ticket-tracking.json | 8 ++-- .../back/models/ticket-update-action.json | 6 +-- modules/ticket/back/models/ticket-weekly.json | 4 +- modules/travel/back/models/thermograph.json | 4 +- modules/travel/back/models/travel-log.json | 20 ++++---- modules/travel/back/models/travel.json | 18 +++---- modules/worker/back/models/absence-type.json | 10 ++-- .../worker/back/models/calendar-holiday.json | 4 +- .../back/models/calendar-holidays-name.json | 4 +- .../back/models/calendar-holidays-type.json | 6 +-- modules/worker/back/models/calendar.json | 4 +- modules/worker/back/models/device.json | 6 +-- .../back/models/work-center-holiday.json | 6 +-- modules/worker/back/models/work-center.json | 4 +- .../worker/back/models/worker-department.json | 4 +- modules/worker/back/models/worker-dms.json | 8 ++-- modules/worker/back/models/worker-log.json | 20 ++++---- modules/worker/back/models/worker-mana.json | 4 +- modules/worker/back/models/worker-media.json | 4 +- .../back/models/worker-team-collegues.json | 4 +- modules/worker/back/models/worker-team.json | 4 +- .../back/models/worker-time-control-mail.json | 12 ++--- .../models/worker-time-control-params.json | 10 ++-- modules/zone/back/models/agency-mode.json | 8 ++-- modules/zone/back/models/delivery-method.json | 2 +- modules/zone/back/models/zone-closure.json | 2 +- .../back/models/zone-estimated-delivery.json | 8 ++-- modules/zone/back/models/zone-event.json | 16 +++---- modules/zone/back/models/zone-exclusion.json | 2 +- modules/zone/back/models/zone-geo.json | 12 ++--- modules/zone/back/models/zone-included.json | 4 +- modules/zone/back/models/zone-log.json | 20 ++++---- modules/zone/back/models/zone-warehouse.json | 4 +- 154 files changed, 565 insertions(+), 558 deletions(-) diff --git a/back/models/account.json b/back/models/account.json index 9150bc1a7..5f0b05f9b 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -47,7 +47,7 @@ "type": "date" }, "image": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/back/models/autonomy.json b/back/models/autonomy.json index ce9ac0bc6..8c9d82936 100644 --- a/back/models/autonomy.json +++ b/back/models/autonomy.json @@ -9,7 +9,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/back/models/bank-entity.json b/back/models/bank-entity.json index c45cd4336..35d1116bd 100644 --- a/back/models/bank-entity.json +++ b/back/models/bank-entity.json @@ -8,15 +8,15 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "bic": { - "type": "String" + "type": "string" }, "name": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/back/models/bank.json b/back/models/bank.json index 33a2637d6..da73b1141 100644 --- a/back/models/bank.json +++ b/back/models/bank.json @@ -8,35 +8,35 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "bank": { - "type": "String", + "type": "string", "required": true }, "account": { - "type": "String", + "type": "string", "required": true }, "accountingTypeFk": { - "type": "Number", + "type": "number", "required": true, "mysql": { "columnName": "cash" } }, "entityFk": { - "type": "Number", + "type": "number", "required": true }, "isActive": { - "type": "Boolean", + "type": "boolean", "required": true }, "currencyFk": { - "type": "Number", + "type": "number", "required": true } }, diff --git a/back/models/chat-config.json b/back/models/chat-config.json index d4f708b7a..bdfbeb60d 100644 --- a/back/models/chat-config.json +++ b/back/models/chat-config.json @@ -10,20 +10,20 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "host": { - "type": "String" + "type": "string" }, "api": { - "type": "String" + "type": "string" }, "user": { - "type": "String" + "type": "string" }, "password": { - "type": "String" + "type": "string" } }, "acls": [{ diff --git a/back/models/company.json b/back/models/company.json index eb349477b..a36b43b69 100644 --- a/back/models/company.json +++ b/back/models/company.json @@ -10,11 +10,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "code": { - "type": "String" + "type": "string" }, "expired": { "type": "date" diff --git a/back/models/country.json b/back/models/country.json index 8364636fc..8fa25b88e 100644 --- a/back/models/country.json +++ b/back/models/country.json @@ -9,7 +9,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -21,7 +21,7 @@ "type": "string" }, "isUeeMember": { - "type": "Boolean" + "type": "boolean" } }, "relations": { diff --git a/back/models/delivery.json b/back/models/delivery.json index 7c3c5c621..d25cc8f19 100644 --- a/back/models/delivery.json +++ b/back/models/delivery.json @@ -9,17 +9,17 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "date": { "type": "Date" }, "m3":{ - "type": "Number" + "type": "number" }, "warehouseFk":{ - "type": "Number" + "type": "number" } } } diff --git a/back/models/dms-type.json b/back/models/dms-type.json index b51c810ac..c7a1815fe 100644 --- a/back/models/dms-type.json +++ b/back/models/dms-type.json @@ -9,7 +9,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/back/models/dms.json b/back/models/dms.json index f517a23ff..650d80f49 100644 --- a/back/models/dms.json +++ b/back/models/dms.json @@ -13,7 +13,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/back/models/email-user.json b/back/models/email-user.json index e983635ce..81c01ab0c 100644 --- a/back/models/email-user.json +++ b/back/models/email-user.json @@ -9,7 +9,7 @@ "properties": { "userFk": { "id": true, - "type": "Number", + "type": "number", "required": true }, "email": { diff --git a/back/models/image-collection-size.json b/back/models/image-collection-size.json index adb92d16b..9452456ee 100644 --- a/back/models/image-collection-size.json +++ b/back/models/image-collection-size.json @@ -8,20 +8,20 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "width": { - "type": "Number", + "type": "number", "required": true }, "height": { - "type": "Number", + "type": "number", "required": true }, "crop": { - "type": "Boolean", + "type": "boolean", "required": true } }, diff --git a/back/models/image-collection.json b/back/models/image-collection.json index fd019ecc3..186ab0208 100644 --- a/back/models/image-collection.json +++ b/back/models/image-collection.json @@ -8,32 +8,32 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "name": { - "type": "String", + "type": "string", "required": true }, "desc": { - "type": "String", + "type": "string", "required": true }, "maxWidth": { - "type": "Number", + "type": "number", "required": true }, "maxHeight": { - "type": "Number", + "type": "number", "required": true }, "model": { - "type": "String", + "type": "string", "required": true }, "property": { - "type": "String", + "type": "string", "required": true } }, diff --git a/back/models/postcode.json b/back/models/postcode.json index e28a77dc4..eadc2c86c 100644 --- a/back/models/postcode.json +++ b/back/models/postcode.json @@ -9,7 +9,7 @@ "properties": { "code": { "id": true, - "type": "String" + "type": "string" } }, "relations": { diff --git a/back/models/sage-withholding.json b/back/models/sage-withholding.json index dddbcfd74..87f00a01c 100644 --- a/back/models/sage-withholding.json +++ b/back/models/sage-withholding.json @@ -11,7 +11,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier", "mysql": { diff --git a/back/models/town.json b/back/models/town.json index 41633fe0a..4ad729791 100644 --- a/back/models/town.json +++ b/back/models/town.json @@ -9,10 +9,10 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "name": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/back/models/user-config-view.json b/back/models/user-config-view.json index 8ffbc6f48..f9235725c 100644 --- a/back/models/user-config-view.json +++ b/back/models/user-config-view.json @@ -9,18 +9,18 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "userFk": { - "type": "String", + "type": "string", "required": true }, "tableCode": { - "type": "String", + "type": "string", "required": true }, "configuration": { - "type": "Object" + "type": "object" } }, "relations": { diff --git a/back/models/user-log.json b/back/models/user-log.json index e3e3a6752..2b9ff1732 100644 --- a/back/models/user-log.json +++ b/back/models/user-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "Number" + "type": "number" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/back/models/user.json b/back/models/user.json index 1d8f8f3a5..921362e0e 100644 --- a/back/models/user.json +++ b/back/models/user.json @@ -9,7 +9,7 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "username":{ diff --git a/back/models/warehouse.json b/back/models/warehouse.json index 1d8ca44e3..eb86e2114 100644 --- a/back/models/warehouse.json +++ b/back/models/warehouse.json @@ -10,17 +10,17 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "name": { - "type": "String" + "type": "string" }, "code": { - "type": "String" + "type": "string" }, "isInventory": { - "type": "Number" + "type": "number" }, "isManaged":{ "type": "boolean" diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 5c66315c4..20de8844b 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -393,17 +393,17 @@ DROP TEMPORARY TABLE tmp.address; INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`) VALUES - (1 , 1101, 5, 300, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), - (2 , 1101, 5, 900, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), - (3 , 1101, 5, 800, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), - (4 , 1101, 5, 700, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), - (5 , 1101, 5, 600, DATE_ADD(CURDATE(), INTERVAL -5 MONTH)), + (1 , 1101, 5, 300, DATE_ADD(CURDATE(), INTERVAL -11 MONTH)), + (2 , 1101, 5, 900, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)), + (3 , 1101, 5, 800, DATE_ADD(CURDATE(), INTERVAL -9 MONTH)), + (4 , 1101, 5, 700, DATE_ADD(CURDATE(), INTERVAL -8 MONTH)), + (5 , 1101, 5, 600, DATE_ADD(CURDATE(), INTERVAL -7 MONTH)), (6 , 1101, 5, 500, DATE_ADD(CURDATE(), INTERVAL -6 MONTH)), - (7 , 1101, 5, 400, DATE_ADD(CURDATE(), INTERVAL -7 MONTH)), - (8 , 1101, 9, 300, DATE_ADD(CURDATE(), INTERVAL -8 MONTH)), - (9 , 1101, 9, 200, DATE_ADD(CURDATE(), INTERVAL -9 MONTH)), - (10, 1101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)), - (11, 1101, 9, 50 , DATE_ADD(CURDATE(), INTERVAL -11 MONTH)), + (7 , 1101, 5, 400, DATE_ADD(CURDATE(), INTERVAL -5 MONTH)), + (8 , 1101, 9, 300, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)), + (9 , 1101, 9, 200, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)), + (10, 1101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)), + (11, 1101, 9, 50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)), (12, 1102, 9, 800, CURDATE()), (14, 1104, 9, 90 , CURDATE()), (15, 1105, 9, 90 , CURDATE()); diff --git a/loopback/common/models/field-acl.json b/loopback/common/models/field-acl.json index 25ed949b9..a3f74aca2 100644 --- a/loopback/common/models/field-acl.json +++ b/loopback/common/models/field-acl.json @@ -9,19 +9,19 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "model": { - "type": "String" + "type": "string" }, "property":{ - "type": "String" + "type": "string" }, "actionType":{ - "type": "String" + "type": "string" }, "role":{ - "type": "String" + "type": "string" } } } diff --git a/modules/account/back/models/samba-config.json b/modules/account/back/models/samba-config.json index 1bde4cdb6..732c9b071 100644 --- a/modules/account/back/models/samba-config.json +++ b/modules/account/back/models/samba-config.json @@ -29,7 +29,7 @@ "type": "string" }, "verifyCert": { - "type": "Boolean" + "type": "boolean" } } } diff --git a/modules/account/back/models/sip-config.json b/modules/account/back/models/sip-config.json index 088f18224..6c5ba3db3 100644 --- a/modules/account/back/models/sip-config.json +++ b/modules/account/back/models/sip-config.json @@ -11,7 +11,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true } } diff --git a/modules/account/back/models/sip.json b/modules/account/back/models/sip.json index 7a7cb8605..21671f4bf 100644 --- a/modules/account/back/models/sip.json +++ b/modules/account/back/models/sip.json @@ -8,7 +8,7 @@ }, "properties": { "userFk": { - "type": "Number", + "type": "number", "id": true, "description": "The user id", "mysql": { @@ -16,7 +16,7 @@ } }, "extension": { - "type": "String", + "type": "string", "required": true } }, diff --git a/modules/claim/back/models/claim-beginning.json b/modules/claim/back/models/claim-beginning.json index abdae440a..afa21f817 100644 --- a/modules/claim/back/models/claim-beginning.json +++ b/modules/claim/back/models/claim-beginning.json @@ -13,12 +13,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "quantity": { - "type": "Number", + "type": "number", "required": true } }, diff --git a/modules/claim/back/models/claim-destination.json b/modules/claim/back/models/claim-destination.json index 8782fb815..60f948899 100644 --- a/modules/claim/back/models/claim-destination.json +++ b/modules/claim/back/models/claim-destination.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true } }, diff --git a/modules/claim/back/models/claim-development.json b/modules/claim/back/models/claim-development.json index 2e8eb2f01..02061fab7 100644 --- a/modules/claim/back/models/claim-development.json +++ b/modules/claim/back/models/claim-development.json @@ -12,7 +12,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/modules/claim/back/models/claim-dms.json b/modules/claim/back/models/claim-dms.json index 9ef964886..a215b6bb7 100644 --- a/modules/claim/back/models/claim-dms.json +++ b/modules/claim/back/models/claim-dms.json @@ -17,7 +17,7 @@ ], "properties": { "dmsFk": { - "type": "Number", + "type": "number", "id": true, "required": true } diff --git a/modules/claim/back/models/claim-end.json b/modules/claim/back/models/claim-end.json index d908c252b..12d79f71b 100644 --- a/modules/claim/back/models/claim-end.json +++ b/modules/claim/back/models/claim-end.json @@ -12,7 +12,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" } diff --git a/modules/claim/back/models/claim-log.json b/modules/claim/back/models/claim-log.json index 28b3f88ec..29f22d835 100644 --- a/modules/claim/back/models/claim-log.json +++ b/modules/claim/back/models/claim-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "Number" + "type": "number" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/claim/back/models/claim-ratio.json b/modules/claim/back/models/claim-ratio.json index 196db72f6..605da98c6 100644 --- a/modules/claim/back/models/claim-ratio.json +++ b/modules/claim/back/models/claim-ratio.json @@ -9,23 +9,23 @@ "validateUpsert": true, "properties": { "clientFk": { - "type": "Number", + "type": "number", "id": true }, "yearSale": { - "type": "Number" + "type": "number" }, "claimAmount": { - "type": "Number" + "type": "number" }, "claimingRate": { - "type": "Number" + "type": "number" }, "priceIncreasing": { - "type": "Number" + "type": "number" }, "packingRate": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/claim/back/models/claim-reason.json b/modules/claim/back/models/claim-reason.json index 562acc14e..8d51b8079 100644 --- a/modules/claim/back/models/claim-reason.json +++ b/modules/claim/back/models/claim-reason.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "description": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/claim/back/models/claim-redelivery.json b/modules/claim/back/models/claim-redelivery.json index 8611a3a44..d153c7a8e 100644 --- a/modules/claim/back/models/claim-redelivery.json +++ b/modules/claim/back/models/claim-redelivery.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true } }, diff --git a/modules/claim/back/models/claim-responsible.json b/modules/claim/back/models/claim-responsible.json index 6bd06605b..bdc5df0ec 100644 --- a/modules/claim/back/models/claim-responsible.json +++ b/modules/claim/back/models/claim-responsible.json @@ -8,16 +8,16 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true }, "responsability": { - "type": "Number", + "type": "number", "required": true } }, diff --git a/modules/claim/back/models/claim-result.json b/modules/claim/back/models/claim-result.json index 468f271de..2c9630696 100644 --- a/modules/claim/back/models/claim-result.json +++ b/modules/claim/back/models/claim-result.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "description": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json index 431290812..a3490ccf4 100644 --- a/modules/claim/back/models/claim.json +++ b/modules/claim/back/models/claim.json @@ -12,7 +12,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/modules/client/back/models/address-observation.json b/modules/client/back/models/address-observation.json index 3096c8e5d..2fdb8bc0f 100644 --- a/modules/client/back/models/address-observation.json +++ b/modules/client/back/models/address-observation.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/modules/client/back/models/address.json b/modules/client/back/models/address.json index dd533cb32..0dcbbf7fe 100644 --- a/modules/client/back/models/address.json +++ b/modules/client/back/models/address.json @@ -14,7 +14,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -43,10 +43,10 @@ "type": "boolean" }, "longitude": { - "type": "Number" + "type": "number" }, "latitude": { - "type": "Number" + "type": "number" }, "isEqualizated": { "type": "boolean" diff --git a/modules/client/back/models/client-contact.json b/modules/client/back/models/client-contact.json index 5a7a7a967..514ebbf5e 100644 --- a/modules/client/back/models/client-contact.json +++ b/modules/client/back/models/client-contact.json @@ -15,7 +15,7 @@ "validateUpsert": true, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/modules/client/back/models/client-credit-limit.json b/modules/client/back/models/client-credit-limit.json index 31e60b452..740f0cf53 100644 --- a/modules/client/back/models/client-credit-limit.json +++ b/modules/client/back/models/client-credit-limit.json @@ -1,26 +1,26 @@ { - "name": "ClientCreditLimit", - "base": "VnModel", - "options": { - "mysql": { - "table": "clientCreditLimit" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "maxAmount": { - "type": "Number" - } - }, - "relations": { - "role": { - "type": "belongsTo", - "model": "Role", - "foreignKey": "roleFk" - } - } + "name": "ClientCreditLimit", + "base": "VnModel", + "options": { + "mysql": { + "table": "clientCreditLimit" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "maxAmount": { + "type": "number" + } + }, + "relations": { + "role": { + "type": "belongsTo", + "model": "Role", + "foreignKey": "roleFk" + } + } } \ No newline at end of file diff --git a/modules/client/back/models/client-credit.json b/modules/client/back/models/client-credit.json index 161cc7dcf..b92639b80 100644 --- a/modules/client/back/models/client-credit.json +++ b/modules/client/back/models/client-credit.json @@ -10,12 +10,12 @@ "validateUpsert": true, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "amount": { - "type": "Number" + "type": "number" }, "created": { "type": "date" diff --git a/modules/client/back/models/client-dms.json b/modules/client/back/models/client-dms.json index 28ad21917..88b4349df 100644 --- a/modules/client/back/models/client-dms.json +++ b/modules/client/back/models/client-dms.json @@ -13,12 +13,12 @@ }, "properties": { "dmsFk": { - "type": "Number", + "type": "number", "id": true, "required": true }, "clientFk": { - "type": "Number", + "type": "number", "required": true } }, diff --git a/modules/client/back/models/client-log.json b/modules/client/back/models/client-log.json index 50c892e85..2cebccf72 100644 --- a/modules/client/back/models/client-log.json +++ b/modules/client/back/models/client-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "Number" + "type": "number" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/client/back/models/client-observation.json b/modules/client/back/models/client-observation.json index a9c7b483a..d3059377d 100644 --- a/modules/client/back/models/client-observation.json +++ b/modules/client/back/models/client-observation.json @@ -13,12 +13,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "clientFk": { - "type": "Number" + "type": "number" }, "text": { "type": "string", diff --git a/modules/client/back/models/client-risk.json b/modules/client/back/models/client-risk.json index de7e4a42f..eac36affb 100644 --- a/modules/client/back/models/client-risk.json +++ b/modules/client/back/models/client-risk.json @@ -8,15 +8,15 @@ }, "properties": { "clientFk": { - "type": "Number", + "type": "number", "id": true }, "companyFk": { - "type": "Number", + "type": "number", "id": true }, "amount": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/client/back/models/client-sample.json b/modules/client/back/models/client-sample.json index 812da8be8..920758217 100644 --- a/modules/client/back/models/client-sample.json +++ b/modules/client/back/models/client-sample.json @@ -14,7 +14,7 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "created": { diff --git a/modules/client/back/models/client-type.json b/modules/client/back/models/client-type.json index a91cc38b6..eeae845eb 100644 --- a/modules/client/back/models/client-type.json +++ b/modules/client/back/models/client-type.json @@ -8,17 +8,17 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true }, "code": { - "type": "String" + "type": "string" }, "type": { - "type": "String" + "type": "string" }, "isCreatedAsServed": { - "type": "Number" + "type": "number" } } } \ No newline at end of file diff --git a/modules/client/back/models/client-unpaid.json b/modules/client/back/models/client-unpaid.json index 4f78ad48a..0fc3a9195 100644 --- a/modules/client/back/models/client-unpaid.json +++ b/modules/client/back/models/client-unpaid.json @@ -15,7 +15,7 @@ "type": "date" }, "amount": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index 6404cfba0..b21f23d9c 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -12,7 +12,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -55,16 +55,16 @@ "type": "boolean" }, "credit": { - "type": "Number" + "type": "number" }, "creditInsurance": { - "type": "Number" + "type": "number" }, "iban": { "type": "string" }, "dueDay": { - "type": "Number" + "type": "number" }, "isEqualizated": { "type": "boolean", @@ -105,7 +105,7 @@ "type": "boolean" }, "quality": { - "type": "Number" + "type": "number" }, "isVies": { "type": "boolean" diff --git a/modules/client/back/models/contact-channel.json b/modules/client/back/models/contact-channel.json index e9949b307..75151b9f9 100644 --- a/modules/client/back/models/contact-channel.json +++ b/modules/client/back/models/contact-channel.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/modules/client/back/models/credit-classification.json b/modules/client/back/models/credit-classification.json index 4db480f5c..543f8359e 100644 --- a/modules/client/back/models/credit-classification.json +++ b/modules/client/back/models/credit-classification.json @@ -10,7 +10,7 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "started": { diff --git a/modules/client/back/models/credit-insurance.json b/modules/client/back/models/credit-insurance.json index 6a9d04677..db4154978 100644 --- a/modules/client/back/models/credit-insurance.json +++ b/modules/client/back/models/credit-insurance.json @@ -10,11 +10,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "credit": { - "type": "Number" + "type": "number" }, "created": { "type": "date", @@ -23,7 +23,7 @@ } }, "grade": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/client/back/models/customs-agent.json b/modules/client/back/models/customs-agent.json index f72d7bf28..3a2e0258f 100644 --- a/modules/client/back/models/customs-agent.json +++ b/modules/client/back/models/customs-agent.json @@ -8,26 +8,26 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "description": "Identifier", "id": true }, "fiscalName": { - "type": "String", + "type": "string", "required": true }, "street": { - "type": "String" + "type": "string" }, "nif": { - "type": "String", + "type": "string", "required": true }, "phone": { - "type": "String" + "type": "string" }, "email": { - "type": "String" + "type": "string" } } } \ No newline at end of file diff --git a/modules/client/back/models/defaulter.json b/modules/client/back/models/defaulter.json index 829326435..ca48e12ab 100644 --- a/modules/client/back/models/defaulter.json +++ b/modules/client/back/models/defaulter.json @@ -9,19 +9,19 @@ }, "properties": { "id": { - "type": "Number" + "type": "number" }, "created": { "type": "Date" }, "amount": { - "type": "Number" + "type": "number" }, "defaulterSinced": { - "type": "Number" + "type": "number" }, "hasChanged": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/client/back/models/greuge-config.json b/modules/client/back/models/greuge-config.json index b72348023..1ba66668d 100644 --- a/modules/client/back/models/greuge-config.json +++ b/modules/client/back/models/greuge-config.json @@ -8,7 +8,7 @@ }, "properties": { "freightPickUpPrice": { - "type": "Number" + "type": "number" } }, "acls": [{ diff --git a/modules/client/back/models/greuge-type.json b/modules/client/back/models/greuge-type.json index 5c5b1870d..36b14e147 100644 --- a/modules/client/back/models/greuge-type.json +++ b/modules/client/back/models/greuge-type.json @@ -9,14 +9,14 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "name": { - "type": "String" + "type": "string" }, "code": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/client/back/models/greuge.json b/modules/client/back/models/greuge.json index 2abc33f7c..918ff0ca5 100644 --- a/modules/client/back/models/greuge.json +++ b/modules/client/back/models/greuge.json @@ -14,15 +14,15 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true }, "amount": { - "type": "Number", + "type": "number", "required": true }, "shipped": { @@ -32,7 +32,7 @@ "type": "date" }, "greugeTypeFk": { - "type": "Number", + "type": "number", "required": true } diff --git a/modules/client/back/models/incoterms.json b/modules/client/back/models/incoterms.json index 915a5b59a..fdf743c14 100644 --- a/modules/client/back/models/incoterms.json +++ b/modules/client/back/models/incoterms.json @@ -8,12 +8,12 @@ }, "properties": { "code": { - "type": "String", + "type": "string", "description": "Identifier", "id": true }, "name": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/client/back/models/mandate-type.json b/modules/client/back/models/mandate-type.json index 8bd46ce19..ec189f089 100644 --- a/modules/client/back/models/mandate-type.json +++ b/modules/client/back/models/mandate-type.json @@ -9,11 +9,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "name": { - "type": "String" + "type": "string" } } } \ No newline at end of file diff --git a/modules/client/back/models/mandate.json b/modules/client/back/models/mandate.json index a671c45f1..914b23ce2 100644 --- a/modules/client/back/models/mandate.json +++ b/modules/client/back/models/mandate.json @@ -9,11 +9,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "code": { - "type": "String" + "type": "string" }, "created": { "type": "date" diff --git a/modules/client/back/models/observation-type.json b/modules/client/back/models/observation-type.json index 5a7bdcfdd..474c5faac 100644 --- a/modules/client/back/models/observation-type.json +++ b/modules/client/back/models/observation-type.json @@ -9,15 +9,15 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true }, "code": { - "type": "String", + "type": "string", "required": true } }, diff --git a/modules/client/back/models/pay-method.json b/modules/client/back/models/pay-method.json index 4080a0953..c83c21e2f 100644 --- a/modules/client/back/models/pay-method.json +++ b/modules/client/back/models/pay-method.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -23,7 +23,7 @@ "type": "string" }, "outstandingDebt": { - "type": "Number" + "type": "number" }, "isIbanRequiredForClients": { "type": "boolean" diff --git a/modules/client/back/models/recovery.json b/modules/client/back/models/recovery.json index 24962bca8..de4183924 100644 --- a/modules/client/back/models/recovery.json +++ b/modules/client/back/models/recovery.json @@ -13,7 +13,7 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "started": { @@ -24,11 +24,11 @@ "type": "date" }, "amount": { - "type": "Number", + "type": "number", "required": true }, "period": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/client/back/models/sage-tax-type.json b/modules/client/back/models/sage-tax-type.json index b60ef20cd..97af7353c 100644 --- a/modules/client/back/models/sage-tax-type.json +++ b/modules/client/back/models/sage-tax-type.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier", "mysql": { diff --git a/modules/client/back/models/sage-transaction-type.json b/modules/client/back/models/sage-transaction-type.json index dbe8f3b39..1903c650c 100644 --- a/modules/client/back/models/sage-transaction-type.json +++ b/modules/client/back/models/sage-transaction-type.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier", "mysql": { diff --git a/modules/client/back/models/sms-config.json b/modules/client/back/models/sms-config.json index f48c6198d..ba78e4a8d 100644 --- a/modules/client/back/models/sms-config.json +++ b/modules/client/back/models/sms-config.json @@ -9,18 +9,18 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "uri": { - "type": "String" + "type": "string" }, "apiKey": { - "type": "String" + "type": "string" }, "title": { - "type": "String" + "type": "string" } } } diff --git a/modules/client/back/models/sms.json b/modules/client/back/models/sms.json index e6e6ff64c..b24f1f3d7 100644 --- a/modules/client/back/models/sms.json +++ b/modules/client/back/models/sms.json @@ -9,27 +9,27 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "sender": { - "type": "String", + "type": "string", "required": true }, "destination": { - "type": "String", + "type": "string", "required": true }, "message": { - "type": "String", + "type": "string", "required": true }, "statusCode": { - "type": "Number" + "type": "number" }, "status": { - "type": "String" + "type": "string" }, "created": { "type": "Date" diff --git a/modules/client/back/models/specs/clientCredit.spec.js b/modules/client/back/models/specs/clientCredit.spec.js index ab3924feb..fcd86c979 100644 --- a/modules/client/back/models/specs/clientCredit.spec.js +++ b/modules/client/back/models/specs/clientCredit.spec.js @@ -21,6 +21,7 @@ describe('Client Credit', () => { rowsBefore = await models.ClientCredit.find({ where: {clientFk: instance.id}, + order: 'created DESC', }, options); await models.ClientCredit.create({ @@ -31,6 +32,7 @@ describe('Client Credit', () => { rowsAfter = await models.ClientCredit.find({ where: {clientFk: instance.id}, + order: 'created DESC', }, options); await tx.rollback(); @@ -39,6 +41,11 @@ describe('Client Credit', () => { throw e; } + const FirstRowsBefore = rowsBefore[0]; + const FirstRowsAfter = rowsAfter[0]; + + expect(FirstRowsAfter.id).toBeGreaterThan(FirstRowsBefore.id); + expect(rowsBefore.length).toBeGreaterThanOrEqual(clientConfig.maxCreditRows); expect(rowsAfter.length).toEqual(clientConfig.maxCreditRows); }); diff --git a/modules/client/back/models/tpv-error.json b/modules/client/back/models/tpv-error.json index 61e2a7156..d62203f40 100644 --- a/modules/client/back/models/tpv-error.json +++ b/modules/client/back/models/tpv-error.json @@ -8,7 +8,7 @@ }, "properties": { "code": { - "type": "String", + "type": "string", "id": true, "description": "Identifier" }, diff --git a/modules/client/back/models/tpv-merchant.json b/modules/client/back/models/tpv-merchant.json index db5c937d8..d4dba6cb1 100644 --- a/modules/client/back/models/tpv-merchant.json +++ b/modules/client/back/models/tpv-merchant.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/modules/client/back/models/tpv-response.json b/modules/client/back/models/tpv-response.json index d3a382b5f..674ba434c 100644 --- a/modules/client/back/models/tpv-response.json +++ b/modules/client/back/models/tpv-response.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/modules/client/back/models/tpv-transaction.json b/modules/client/back/models/tpv-transaction.json index 011616d98..891393e6f 100644 --- a/modules/client/back/models/tpv-transaction.json +++ b/modules/client/back/models/tpv-transaction.json @@ -8,30 +8,30 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "merchantFk": { - "type": "Number" + "type": "number" }, "clientFk": { - "type": "Number" + "type": "number" }, "receiptFk": { - "type": "Number" + "type": "number" }, "amount": { - "type": "Number" + "type": "number" }, "response": { - "type": "Number" + "type": "number" }, "errorCode": { - "type": "String" + "type": "string" }, "status": { - "type": "String" + "type": "string" }, "created": { "type": "Date" diff --git a/modules/entry/back/models/entry-log.json b/modules/entry/back/models/entry-log.json index c63a55d9e..0801734fa 100644 --- a/modules/entry/back/models/entry-log.json +++ b/modules/entry/back/models/entry-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "String" + "type": "string" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/entry/back/models/entry-observation.json b/modules/entry/back/models/entry-observation.json index 535735d83..0c63dd663 100644 --- a/modules/entry/back/models/entry-observation.json +++ b/modules/entry/back/models/entry-observation.json @@ -13,11 +13,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true } }, diff --git a/modules/invoiceOut/back/models/invoice-out.json b/modules/invoiceOut/back/models/invoice-out.json index 45c4c2774..2bf5182e8 100644 --- a/modules/invoiceOut/back/models/invoice-out.json +++ b/modules/invoiceOut/back/models/invoice-out.json @@ -9,21 +9,21 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "ref": { - "type": "String", + "type": "string", "required": true }, "serial": { - "type": "String" + "type": "string" }, "issued": { "type": "date" }, "amount": { - "type": "Number" + "type": "number" }, "created": { "type": "date" @@ -35,7 +35,7 @@ "type": "date" }, "hasPdf": { - "type": "Boolean" + "type": "boolean" } }, "relations": { diff --git a/modules/invoiceOut/back/models/tax-class.json b/modules/invoiceOut/back/models/tax-class.json index fa5676466..a259b874a 100644 --- a/modules/invoiceOut/back/models/tax-class.json +++ b/modules/invoiceOut/back/models/tax-class.json @@ -8,16 +8,16 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "description": "Identifier", "id": true }, "description": { - "type": "String", + "type": "string", "required": true }, "code": { - "type": "String", + "type": "string", "required": true } }, diff --git a/modules/invoiceOut/back/models/tax-code.json b/modules/invoiceOut/back/models/tax-code.json index dfd69139e..b515ca334 100644 --- a/modules/invoiceOut/back/models/tax-code.json +++ b/modules/invoiceOut/back/models/tax-code.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -16,7 +16,7 @@ "type": "date" }, "code": { - "type": "String" + "type": "string" }, "rate": { "type": "number" @@ -25,10 +25,10 @@ "type": "number" }, "type": { - "type": "String" + "type": "string" }, "isActive": { - "type": "Boolean" + "type": "boolean" } }, "relations": { diff --git a/modules/invoiceOut/back/models/tax-type.json b/modules/invoiceOut/back/models/tax-type.json index 4e30446b0..46a73835d 100644 --- a/modules/invoiceOut/back/models/tax-type.json +++ b/modules/invoiceOut/back/models/tax-type.json @@ -8,21 +8,21 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "nickname": { - "type": "String" + "type": "string" }, "serial": { - "type": "String" + "type": "string" }, "TIPOOPE": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/item/back/models/expense.json b/modules/item/back/models/expense.json index 65af02013..b349e9dcf 100644 --- a/modules/item/back/models/expense.json +++ b/modules/item/back/models/expense.json @@ -13,7 +13,7 @@ "description": "Identifier" }, "name": { - "type": "String" + "type": "string" }, "isWithheld": { "type": "number" diff --git a/modules/item/back/models/genus.json b/modules/item/back/models/genus.json index f18d8e4ae..007454130 100644 --- a/modules/item/back/models/genus.json +++ b/modules/item/back/models/genus.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "name": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/item/back/models/ink.json b/modules/item/back/models/ink.json index a3cd857bf..6a39daafe 100644 --- a/modules/item/back/models/ink.json +++ b/modules/item/back/models/ink.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "String", + "type": "string", "id": true, "description": "Identifier" }, "name": { - "type": "String" + "type": "string" }, "showOrder": { "type": "number" diff --git a/modules/item/back/models/item-barcode.json b/modules/item/back/models/item-barcode.json index b9de53dd1..e2ce347cb 100644 --- a/modules/item/back/models/item-barcode.json +++ b/modules/item/back/models/item-barcode.json @@ -13,12 +13,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "code": { - "type": "String", + "type": "string", "required": true } }, diff --git a/modules/item/back/models/item-botanical.json b/modules/item/back/models/item-botanical.json index 6c465f0ee..8d8fd389f 100644 --- a/modules/item/back/models/item-botanical.json +++ b/modules/item/back/models/item-botanical.json @@ -12,7 +12,7 @@ }, "properties": { "itemFk": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" } diff --git a/modules/item/back/models/item-log.json b/modules/item/back/models/item-log.json index c52931193..bf06f0073 100644 --- a/modules/item/back/models/item-log.json +++ b/modules/item/back/models/item-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "Number" + "type": "number" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/item/back/models/item-placement.json b/modules/item/back/models/item-placement.json index 7bbb2dc91..0c036ef14 100644 --- a/modules/item/back/models/item-placement.json +++ b/modules/item/back/models/item-placement.json @@ -8,17 +8,17 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true }, "code": { - "type": "String" + "type": "string" }, "itemFk": { - "type": "Number" + "type": "number" }, "warehouseFk": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/item/back/models/item-shelving-sale.json b/modules/item/back/models/item-shelving-sale.json index 04f505ddd..a2e53f4f2 100644 --- a/modules/item/back/models/item-shelving-sale.json +++ b/modules/item/back/models/item-shelving-sale.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "quantity": { - "type": "Number" + "type": "number" }, "created": { "type": "Date" diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index f0391c565..b365842d1 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -8,24 +8,24 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "shelve": { - "type": "String" + "type": "string" }, "shelvingFk": { - "type": "String" + "type": "string" }, "itemFk": { - "type": "Number" + "type": "number" }, "deep": { - "type": "Number" + "type": "number" }, "quantity": { - "type": "Number" + "type": "number" }, "created": { "type": "Date" diff --git a/modules/item/back/models/item-tag.json b/modules/item/back/models/item-tag.json index 6beeb29d3..5660b3628 100644 --- a/modules/item/back/models/item-tag.json +++ b/modules/item/back/models/item-tag.json @@ -13,23 +13,23 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "value": { - "type": "String" + "type": "string" }, "itemFk": { - "type": "Number", + "type": "number", "required": true }, "tagFk": { - "type": "Number", + "type": "number", "required": true }, "priority": { - "type": "Number", + "type": "number", "required": true } }, diff --git a/modules/item/back/models/item-tax-country.json b/modules/item/back/models/item-tax-country.json index 24c621518..f10a9eb72 100644 --- a/modules/item/back/models/item-tax-country.json +++ b/modules/item/back/models/item-tax-country.json @@ -13,21 +13,21 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "effectived": { - "type": "Boolean" + "type": "boolean" }, "itemFk": { - "type": "Number" + "type": "number" }, "countryFk": { - "type": "Number" + "type": "number" }, "taxClassFk": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/item/back/models/item-type-tag.json b/modules/item/back/models/item-type-tag.json index ca374e00e..8c4d50a07 100644 --- a/modules/item/back/models/item-type-tag.json +++ b/modules/item/back/models/item-type-tag.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "priority": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/item/back/models/producer.json b/modules/item/back/models/producer.json index 81a36f8d1..593a172b5 100644 --- a/modules/item/back/models/producer.json +++ b/modules/item/back/models/producer.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "name": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/item/back/models/specie.json b/modules/item/back/models/specie.json index c5a1f455e..f24474416 100644 --- a/modules/item/back/models/specie.json +++ b/modules/item/back/models/specie.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "name": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/item/back/models/tag.json b/modules/item/back/models/tag.json index 4cd1ad74e..6c5f5c0ba 100644 --- a/modules/item/back/models/tag.json +++ b/modules/item/back/models/tag.json @@ -8,25 +8,25 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "name": { - "type": "String", + "type": "string", "required": true }, "isFree": { - "type": "Boolean" + "type": "boolean" }, "sourceTable": { - "type": "String" + "type": "string" }, "unit": { - "type": "String" + "type": "string" }, "isQuantitative": { - "type": "Boolean", + "type": "boolean", "mysql": { "columnName": "isQuantitatif" } diff --git a/modules/order/back/models/order-row.json b/modules/order/back/models/order-row.json index 44d5a103a..4b78bfdad 100644 --- a/modules/order/back/models/order-row.json +++ b/modules/order/back/models/order-row.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "warehouseFk": { - "type": "Number" + "type": "number" }, "shipped": { "type": "date", @@ -22,22 +22,22 @@ } }, "quantity": { - "type": "Number", + "type": "number", "mysql": { "columnName": "amount" } }, "price": { - "type": "Number" + "type": "number" }, "rate": { - "type": "Number" + "type": "number" }, "created": { "type": "date" }, "saleFk": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/order/back/models/order-ticket.json b/modules/order/back/models/order-ticket.json index 2875ebdfc..9fe144b47 100644 --- a/modules/order/back/models/order-ticket.json +++ b/modules/order/back/models/order-ticket.json @@ -9,11 +9,11 @@ "properties": { "orderFk": { "id": true, - "type": "Number" + "type": "number" }, "ticketFk": { "id": true, - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/order/back/models/order.json b/modules/order/back/models/order.json index 38755c2a5..8c49f614a 100644 --- a/modules/order/back/models/order.json +++ b/modules/order/back/models/order.json @@ -8,7 +8,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -20,44 +20,44 @@ } }, "clientFk": { - "type": "Number", + "type": "number", "required": true, "mysql": { "columnName": "customer_id" } }, "addressFk": { - "type": "Number", + "type": "number", "required": true, "mysql": { "columnName": "address_id" } }, "agencyModeFk": { - "type": "Number", + "type": "number", "required": true, "mysql": { "columnName": "agency_id" } }, "companyFk": { - "type": "Number", + "type": "number", "required": true, "mysql": { "columnName": "company_id" } }, "note": { - "type": "String" + "type": "string" }, "sourceApp": { - "type": "String", + "type": "string", "mysql": { "columnName": "source_app" } }, "isConfirmed": { - "type": "Number", + "type": "number", "mysql": { "columnName": "confirmed" } @@ -81,7 +81,7 @@ } }, "total": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/route/back/models/deliveryPoint.json b/modules/route/back/models/deliveryPoint.json index c6c0a2116..639f21e35 100644 --- a/modules/route/back/models/deliveryPoint.json +++ b/modules/route/back/models/deliveryPoint.json @@ -8,15 +8,15 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "name": { - "type": "String" + "type": "string" }, "ubication": { - "type": "String" + "type": "string" } } } diff --git a/modules/route/back/models/route-log.json b/modules/route/back/models/route-log.json index abaeeb722..fd803a60d 100644 --- a/modules/route/back/models/route-log.json +++ b/modules/route/back/models/route-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "Number" + "type": "number" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/route/back/models/route.json b/modules/route/back/models/route.json index bdb641096..46fb6b76f 100644 --- a/modules/route/back/models/route.json +++ b/modules/route/back/models/route.json @@ -11,7 +11,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -22,10 +22,10 @@ "type": "date" }, "kmStart": { - "type": "Number" + "type": "number" }, "kmEnd": { - "type": "Number" + "type": "number" }, "started": { "type": "date" @@ -40,13 +40,13 @@ } }, "cost": { - "type": "Number" + "type": "number" }, "m3": { - "type": "Number" + "type": "number" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/route/back/models/vehicle.json b/modules/route/back/models/vehicle.json index 399480c98..a35926bef 100644 --- a/modules/route/back/models/vehicle.json +++ b/modules/route/back/models/vehicle.json @@ -8,27 +8,27 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "numberPlate": { - "type": "String" + "type": "string" }, "tradeMark": { - "type": "String" + "type": "string" }, "model": { - "type": "String" + "type": "string" }, "m3": { - "type": "Number" + "type": "number" }, "description": { - "type": "String" + "type": "string" }, "isActive": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/supplier/back/models/pay-dem.json b/modules/supplier/back/models/pay-dem.json index f214f3e3a..1253c751c 100644 --- a/modules/supplier/back/models/pay-dem.json +++ b/modules/supplier/back/models/pay-dem.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "payDem": { - "type": "Number" + "type": "number" } } } diff --git a/modules/supplier/back/models/supplier-account.json b/modules/supplier/back/models/supplier-account.json index 8e2838fe5..2ee83338b 100644 --- a/modules/supplier/back/models/supplier-account.json +++ b/modules/supplier/back/models/supplier-account.json @@ -12,15 +12,15 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "iban": { - "type": "String" + "type": "string" }, "beneficiary": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/supplier/back/models/supplier-contact.json b/modules/supplier/back/models/supplier-contact.json index 104a3a404..9e13c33a8 100644 --- a/modules/supplier/back/models/supplier-contact.json +++ b/modules/supplier/back/models/supplier-contact.json @@ -12,27 +12,27 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "supplierFk": { - "type": "String" + "type": "string" }, "phone": { - "type": "String" + "type": "string" }, "mobile": { - "type": "String" + "type": "string" }, "email": { - "type": "String" + "type": "string" }, "observation": { - "type": "String" + "type": "string" }, "name": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/ticket/back/models/annual-average-invoiced.json b/modules/ticket/back/models/annual-average-invoiced.json index d1f582011..02f097d41 100644 --- a/modules/ticket/back/models/annual-average-invoiced.json +++ b/modules/ticket/back/models/annual-average-invoiced.json @@ -8,7 +8,7 @@ }, "properties": { "invoiced": { - "type": "Number" + "type": "number" }, "clientFk": { "id": true diff --git a/modules/ticket/back/models/component-type.json b/modules/ticket/back/models/component-type.json index d72217a24..26daf5216 100644 --- a/modules/ticket/back/models/component-type.json +++ b/modules/ticket/back/models/component-type.json @@ -9,11 +9,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "type": { - "type": "String" + "type": "string" }, "isBase":{ "type":"Boolean" diff --git a/modules/ticket/back/models/component.json b/modules/ticket/back/models/component.json index 002b4804f..46ac492c5 100644 --- a/modules/ticket/back/models/component.json +++ b/modules/ticket/back/models/component.json @@ -9,26 +9,26 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "name": { - "type": "String" + "type": "string" }, "classRate": { - "type": "Number" + "type": "number" }, "tax": { - "type": "Number" + "type": "number" }, "isRenewable": { - "type": "Number" + "type": "number" }, "typeFk": { - "type": "Number" + "type": "number" }, "code": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/ticket/back/models/expedition.json b/modules/ticket/back/models/expedition.json index c0b8d6508..518f2d347 100644 --- a/modules/ticket/back/models/expedition.json +++ b/modules/ticket/back/models/expedition.json @@ -13,17 +13,17 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "isBox": { - "type": "Number" + "type": "number" }, "created": { "type": "Date" }, "counter": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/ticket/back/models/sale-checked.json b/modules/ticket/back/models/sale-checked.json index 8ac52d598..96d790505 100644 --- a/modules/ticket/back/models/sale-checked.json +++ b/modules/ticket/back/models/sale-checked.json @@ -8,7 +8,7 @@ }, "properties": { "isChecked": { - "type": "Number" + "type": "number" }, "saleFk": { "id": true diff --git a/modules/ticket/back/models/sale-component.json b/modules/ticket/back/models/sale-component.json index 3b7991fbb..bf0f73e29 100644 --- a/modules/ticket/back/models/sale-component.json +++ b/modules/ticket/back/models/sale-component.json @@ -8,14 +8,14 @@ }, "properties": { "value": { - "type": "Number" + "type": "number" }, "saleFk": { - "type": "Number", + "type": "number", "id": 2 }, "componentFk": { - "type": "Number", + "type": "number", "id": 1 } }, diff --git a/modules/ticket/back/models/sale-tracking.json b/modules/ticket/back/models/sale-tracking.json index 43b0df160..e5727f2fd 100644 --- a/modules/ticket/back/models/sale-tracking.json +++ b/modules/ticket/back/models/sale-tracking.json @@ -9,14 +9,14 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "saleFk": { - "type": "Number" + "type": "number" }, "stateFk": { - "type": "Number" + "type": "number" }, "isChecked": { "type": "boolean" @@ -25,7 +25,7 @@ "type": "Date" }, "originalQuantity": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/ticket/back/models/sale.json b/modules/ticket/back/models/sale.json index 767a3e59e..188721a94 100644 --- a/modules/ticket/back/models/sale.json +++ b/modules/ticket/back/models/sale.json @@ -14,27 +14,27 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "concept": { - "type": "String", + "type": "string", "required": true }, "quantity": { - "type": "Number" + "type": "number" }, "price": { - "type": "Number" + "type": "number" }, "discount": { - "type": "Number" + "type": "number" }, "reserved": { "type": "boolean" }, "isPicked": { - "type": "Number" + "type": "number" }, "created": { "type": "date" diff --git a/modules/ticket/back/models/stowaway.json b/modules/ticket/back/models/stowaway.json index 5a925cd20..faebad5df 100644 --- a/modules/ticket/back/models/stowaway.json +++ b/modules/ticket/back/models/stowaway.json @@ -9,11 +9,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "shipFk": { - "type": "Number", + "type": "number", "required": false }, "created":{ diff --git a/modules/ticket/back/models/ticket-config.json b/modules/ticket/back/models/ticket-config.json index ff6818bb5..a1c96e7f6 100644 --- a/modules/ticket/back/models/ticket-config.json +++ b/modules/ticket/back/models/ticket-config.json @@ -9,11 +9,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "scopeDays": { - "type": "Number" + "type": "number" } } } diff --git a/modules/ticket/back/models/ticket-last-state.json b/modules/ticket/back/models/ticket-last-state.json index 6c8bc66d5..e871a8ee6 100644 --- a/modules/ticket/back/models/ticket-last-state.json +++ b/modules/ticket/back/models/ticket-last-state.json @@ -12,10 +12,10 @@ }, "ticketFk": { "id": true, - "type": "Number" + "type": "number" }, "ticketTrackingFk": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/ticket/back/models/ticket-log.json b/modules/ticket/back/models/ticket-log.json index 950742e98..f78a10244 100644 --- a/modules/ticket/back/models/ticket-log.json +++ b/modules/ticket/back/models/ticket-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "Number" + "type": "number" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/ticket/back/models/ticket-observation.json b/modules/ticket/back/models/ticket-observation.json index ba4f85ce8..9035e4440 100644 --- a/modules/ticket/back/models/ticket-observation.json +++ b/modules/ticket/back/models/ticket-observation.json @@ -13,11 +13,11 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true } }, diff --git a/modules/ticket/back/models/ticket-packaging.json b/modules/ticket/back/models/ticket-packaging.json index feea541fa..71b347a6d 100644 --- a/modules/ticket/back/models/ticket-packaging.json +++ b/modules/ticket/back/models/ticket-packaging.json @@ -13,17 +13,17 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "quantity": { - "type": "Number" + "type": "number" }, "created": { "type": "Date" }, "pvp": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/ticket/back/models/ticket-request.json b/modules/ticket/back/models/ticket-request.json index f216cd531..1871cd0f7 100644 --- a/modules/ticket/back/models/ticket-request.json +++ b/modules/ticket/back/models/ticket-request.json @@ -12,29 +12,29 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true }, "created": { "type": "Date" }, "quantity": { - "type": "Number", + "type": "number", "required": true }, "price": { - "type": "Number" + "type": "number" }, "isOk": { - "type": "Boolean" + "type": "boolean" }, "response": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/ticket/back/models/ticket-service-type.json b/modules/ticket/back/models/ticket-service-type.json index 623d0f398..ec2c9232a 100644 --- a/modules/ticket/back/models/ticket-service-type.json +++ b/modules/ticket/back/models/ticket-service-type.json @@ -7,16 +7,16 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "name": { - "type": "String", + "type": "string", "required": true }, "expenseFk": { - "type": "Number", + "type": "number", "mysql": { "columnName": "expenceFk" } diff --git a/modules/ticket/back/models/ticket-service.json b/modules/ticket/back/models/ticket-service.json index 8b0c490a8..347b6b976 100644 --- a/modules/ticket/back/models/ticket-service.json +++ b/modules/ticket/back/models/ticket-service.json @@ -13,32 +13,32 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "ticketFk": { - "type": "Number", + "type": "number", "required": true }, "description": { - "type": "String", + "type": "string", "required": true }, "quantity": { - "type": "Number", + "type": "number", "required": true }, "price": { - "type": "Number", + "type": "number", "required": true }, "taxClassFk": { - "type": "Number", + "type": "number", "required": true }, "ticketServiceTypeFk": { - "type": "Number", + "type": "number", "required": true } }, diff --git a/modules/ticket/back/models/ticket-tracking.json b/modules/ticket/back/models/ticket-tracking.json index c2c365013..983c3da6c 100644 --- a/modules/ticket/back/models/ticket-tracking.json +++ b/modules/ticket/back/models/ticket-tracking.json @@ -14,20 +14,20 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "created": { "type": "Date" }, "ticketFk": { - "type": "Number" + "type": "number" }, "stateFk": { - "type": "Number" + "type": "number" }, "workerFk": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/ticket/back/models/ticket-update-action.json b/modules/ticket/back/models/ticket-update-action.json index 3072c2172..e69f7e1ab 100644 --- a/modules/ticket/back/models/ticket-update-action.json +++ b/modules/ticket/back/models/ticket-update-action.json @@ -9,15 +9,15 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "description": { - "type": "String", + "type": "string", "required": true }, "code": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/ticket/back/models/ticket-weekly.json b/modules/ticket/back/models/ticket-weekly.json index 6d432831f..d81baf4ad 100644 --- a/modules/ticket/back/models/ticket-weekly.json +++ b/modules/ticket/back/models/ticket-weekly.json @@ -14,10 +14,10 @@ "properties": { "ticketFk": { "id": true, - "type": "Number" + "type": "number" }, "weekDay": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/travel/back/models/thermograph.json b/modules/travel/back/models/thermograph.json index 2519fffc4..bd9ad3119 100644 --- a/modules/travel/back/models/thermograph.json +++ b/modules/travel/back/models/thermograph.json @@ -8,13 +8,13 @@ }, "properties": { "id": { - "type": "String", + "type": "string", "id": true, "description": "Identifier", "required": true }, "model": { - "type": "String", + "type": "string", "required": true } } diff --git a/modules/travel/back/models/travel-log.json b/modules/travel/back/models/travel-log.json index d53be88f1..21a600b87 100644 --- a/modules/travel/back/models/travel-log.json +++ b/modules/travel/back/models/travel-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "String" + "type": "string" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/travel/back/models/travel.json b/modules/travel/back/models/travel.json index cd2f1d653..95330e263 100644 --- a/modules/travel/back/models/travel.json +++ b/modules/travel/back/models/travel.json @@ -12,7 +12,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -23,28 +23,28 @@ "type": "date" }, "isDelivered": { - "type": "Boolean" + "type": "boolean" }, "isReceived": { - "type": "Boolean" + "type": "boolean" }, "ref": { - "type": "String" + "type": "string" }, "totalEntries": { - "type": "Number" + "type": "number" }, "m3": { - "type": "Number" + "type": "number" }, "kg": { - "type": "Number" + "type": "number" }, "cargoSupplierFk": { - "type": "Number" + "type": "number" }, "agencyModeFk": { - "type": "Number", + "type": "number", "mysql": { "columnName": "agencyFk" } diff --git a/modules/worker/back/models/absence-type.json b/modules/worker/back/models/absence-type.json index f4e9aed18..7fc62f780 100644 --- a/modules/worker/back/models/absence-type.json +++ b/modules/worker/back/models/absence-type.json @@ -9,19 +9,19 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "name": { - "type": "String" + "type": "string" }, "rgb": { - "type": "String" + "type": "string" }, "code": { - "type": "String" + "type": "string" }, "holidayEntitlementRate": { - "type": "Number" + "type": "number" } }, "acls": [ diff --git a/modules/worker/back/models/calendar-holiday.json b/modules/worker/back/models/calendar-holiday.json index 544452553..f0f1ba442 100644 --- a/modules/worker/back/models/calendar-holiday.json +++ b/modules/worker/back/models/calendar-holiday.json @@ -9,11 +9,11 @@ "properties": { "calendarHolidaysNameFk": { "id": true, - "type": "Number" + "type": "number" }, "calendarHolidaysTypeFk": { "id": true, - "type": "Number" + "type": "number" }, "dated": { "type": "Date" diff --git a/modules/worker/back/models/calendar-holidays-name.json b/modules/worker/back/models/calendar-holidays-name.json index d04ef9c74..d2798f106 100644 --- a/modules/worker/back/models/calendar-holidays-name.json +++ b/modules/worker/back/models/calendar-holidays-name.json @@ -9,10 +9,10 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "name": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/worker/back/models/calendar-holidays-type.json b/modules/worker/back/models/calendar-holidays-type.json index 178331b87..cf738d353 100644 --- a/modules/worker/back/models/calendar-holidays-type.json +++ b/modules/worker/back/models/calendar-holidays-type.json @@ -9,13 +9,13 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "name": { - "type": "String" + "type": "string" }, "hexColour": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/worker/back/models/calendar.json b/modules/worker/back/models/calendar.json index 1da7179c4..8cd30ba02 100644 --- a/modules/worker/back/models/calendar.json +++ b/modules/worker/back/models/calendar.json @@ -13,10 +13,10 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "businessFk": { - "type": "Number" + "type": "number" }, "dated": { "type": "Date" diff --git a/modules/worker/back/models/device.json b/modules/worker/back/models/device.json index 5367faedf..566f7da7d 100644 --- a/modules/worker/back/models/device.json +++ b/modules/worker/back/models/device.json @@ -9,13 +9,13 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "sn": { - "type": "String" + "type": "string" }, "model": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/worker/back/models/work-center-holiday.json b/modules/worker/back/models/work-center-holiday.json index eddfd7af1..e5f201d9d 100644 --- a/modules/worker/back/models/work-center-holiday.json +++ b/modules/worker/back/models/work-center-holiday.json @@ -9,13 +9,13 @@ "properties": { "workCenterFk": { "id": true, - "type": "Number" + "type": "number" }, "days": { - "type": "Number" + "type": "number" }, "year": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/worker/back/models/work-center.json b/modules/worker/back/models/work-center.json index a0e651bba..2d7bab24e 100644 --- a/modules/worker/back/models/work-center.json +++ b/modules/worker/back/models/work-center.json @@ -9,10 +9,10 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "name": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/worker/back/models/worker-department.json b/modules/worker/back/models/worker-department.json index 0eeca50e7..b169cbf5e 100644 --- a/modules/worker/back/models/worker-department.json +++ b/modules/worker/back/models/worker-department.json @@ -9,10 +9,10 @@ "properties": { "workerFk": { "id": true, - "type": "Number" + "type": "number" }, "departmentFk": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/worker/back/models/worker-dms.json b/modules/worker/back/models/worker-dms.json index 80634cfcc..575cfbc24 100644 --- a/modules/worker/back/models/worker-dms.json +++ b/modules/worker/back/models/worker-dms.json @@ -13,25 +13,25 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true }, "dmsFk": { - "type": "Number", + "type": "number", "required": true, "mysql": { "columnName": "document" } }, "workerFk": { - "type": "Number", + "type": "number", "required": true, "mysql": { "columnName": "worker" } }, "isReadableByWorker": { - "type": "Boolean" + "type": "boolean" } }, "relations": { diff --git a/modules/worker/back/models/worker-log.json b/modules/worker/back/models/worker-log.json index f100f3486..8c5e59601 100644 --- a/modules/worker/back/models/worker-log.json +++ b/modules/worker/back/models/worker-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "String" + "type": "string" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/worker/back/models/worker-mana.json b/modules/worker/back/models/worker-mana.json index b98b2a325..0e50b8f63 100644 --- a/modules/worker/back/models/worker-mana.json +++ b/modules/worker/back/models/worker-mana.json @@ -8,11 +8,11 @@ }, "properties": { "amount": { - "type": "Number" + "type": "number" }, "workerFk": { "id": true, - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/worker/back/models/worker-media.json b/modules/worker/back/models/worker-media.json index 805ff383b..8a28fb422 100644 --- a/modules/worker/back/models/worker-media.json +++ b/modules/worker/back/models/worker-media.json @@ -9,10 +9,10 @@ "properties": { "workerFk": { "id": true, - "type": "Number" + "type": "number" }, "mediaValue": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/worker/back/models/worker-team-collegues.json b/modules/worker/back/models/worker-team-collegues.json index 2e4a0a4f8..18b7d90bd 100644 --- a/modules/worker/back/models/worker-team-collegues.json +++ b/modules/worker/back/models/worker-team-collegues.json @@ -9,11 +9,11 @@ "properties": { "workerFk": { "id": true, - "type": "Number" + "type": "number" }, "collegueFk": { "id": true, - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/worker/back/models/worker-team.json b/modules/worker/back/models/worker-team.json index 4cd4b1244..0b490ba6e 100644 --- a/modules/worker/back/models/worker-team.json +++ b/modules/worker/back/models/worker-team.json @@ -8,12 +8,12 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, "team": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/worker/back/models/worker-time-control-mail.json b/modules/worker/back/models/worker-time-control-mail.json index 7f8522757..533c01dfe 100644 --- a/modules/worker/back/models/worker-time-control-mail.json +++ b/modules/worker/back/models/worker-time-control-mail.json @@ -9,26 +9,26 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "required": true }, "workerFk": { - "type": "Number" + "type": "number" }, "year": { - "type": "Number" + "type": "number" }, "week": { - "type": "Number" + "type": "number" }, "state": { - "type": "String" + "type": "string" }, "updated": { "type": "Date" }, "emailResponse": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/worker/back/models/worker-time-control-params.json b/modules/worker/back/models/worker-time-control-params.json index cc904cf40..14cabbfb0 100644 --- a/modules/worker/back/models/worker-time-control-params.json +++ b/modules/worker/back/models/worker-time-control-params.json @@ -9,19 +9,19 @@ }, "properties": { "mailHost": { - "type": "String" + "type": "string" }, "mailUser": { - "type": "String" + "type": "string" }, "mailPass": { - "type": "String" + "type": "string" }, "mailSuccessFolder": { - "type": "String" + "type": "string" }, "mailErrorFolder": { - "type": "String" + "type": "string" } }, "acls": [ diff --git a/modules/zone/back/models/agency-mode.json b/modules/zone/back/models/agency-mode.json index ded58e819..027cec190 100644 --- a/modules/zone/back/models/agency-mode.json +++ b/modules/zone/back/models/agency-mode.json @@ -9,7 +9,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, @@ -24,10 +24,10 @@ "type": "number" }, "m3": { - "type": "Number" + "type": "number" }, "inflation": { - "type": "Number" + "type": "number" }, "reportMail": { "type": "string" @@ -36,7 +36,7 @@ "type": "boolean" }, "code": { - "type": "String", + "type": "string", "required": false } }, diff --git a/modules/zone/back/models/delivery-method.json b/modules/zone/back/models/delivery-method.json index 8106c1d4f..31454f2f8 100644 --- a/modules/zone/back/models/delivery-method.json +++ b/modules/zone/back/models/delivery-method.json @@ -9,7 +9,7 @@ }, "properties": { "id": { - "type": "Number", + "type": "number", "id": true, "description": "Identifier" }, diff --git a/modules/zone/back/models/zone-closure.json b/modules/zone/back/models/zone-closure.json index 895374838..92f565a57 100644 --- a/modules/zone/back/models/zone-closure.json +++ b/modules/zone/back/models/zone-closure.json @@ -9,7 +9,7 @@ "properties": { "zoneFk": { "id": true, - "type": "Number" + "type": "number" }, "dated": { "type": "Date", diff --git a/modules/zone/back/models/zone-estimated-delivery.json b/modules/zone/back/models/zone-estimated-delivery.json index d65cee3b5..b39ed8722 100644 --- a/modules/zone/back/models/zone-estimated-delivery.json +++ b/modules/zone/back/models/zone-estimated-delivery.json @@ -9,19 +9,19 @@ "properties": { "zoneFk": { "id": true, - "type": "Number" + "type": "number" }, "hourTheoretical": { "type": "date" }, "totalVolume": { - "type": "Number" + "type": "number" }, "remainingVolume": { - "type": "Number" + "type": "number" }, "speed": { - "type": "Number" + "type": "number" }, "hourEffective": { "type": "Date" diff --git a/modules/zone/back/models/zone-event.json b/modules/zone/back/models/zone-event.json index 54c9c4a7d..9a97e5e01 100644 --- a/modules/zone/back/models/zone-event.json +++ b/modules/zone/back/models/zone-event.json @@ -13,14 +13,14 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "zoneFk": { "id": true, - "type": "Number" + "type": "number" }, "type": { - "type": "String" + "type": "string" }, "dated": { "type": "Date" @@ -32,22 +32,22 @@ "type": "Date" }, "weekDays": { - "type": "String" + "type": "string" }, "hour": { "type": "Date" }, "travelingDays": { - "type": "Number" + "type": "number" }, "price": { - "type": "Number" + "type": "number" }, "bonus": { - "type": "Number" + "type": "number" }, "m3Max": { - "type": "Number" + "type": "number" } }, "relations": { diff --git a/modules/zone/back/models/zone-exclusion.json b/modules/zone/back/models/zone-exclusion.json index f1c80debd..fbd61683c 100644 --- a/modules/zone/back/models/zone-exclusion.json +++ b/modules/zone/back/models/zone-exclusion.json @@ -9,7 +9,7 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "dated": { "type": "Date", diff --git a/modules/zone/back/models/zone-geo.json b/modules/zone/back/models/zone-geo.json index 0a001235f..e9d9aa3eb 100644 --- a/modules/zone/back/models/zone-geo.json +++ b/modules/zone/back/models/zone-geo.json @@ -9,22 +9,22 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "name": { - "type": "String" + "type": "string" }, "lft": { - "type": "Number" + "type": "number" }, "rgt": { - "type": "Number" + "type": "number" }, "depth": { - "type": "Number" + "type": "number" }, "sons": { - "type": "Number" + "type": "number" } } } \ No newline at end of file diff --git a/modules/zone/back/models/zone-included.json b/modules/zone/back/models/zone-included.json index e462b7a65..595f47a78 100644 --- a/modules/zone/back/models/zone-included.json +++ b/modules/zone/back/models/zone-included.json @@ -14,10 +14,10 @@ "properties": { "zoneFk": { "id": true, - "type": "Number" + "type": "number" }, "isIncluded": { - "type": "Boolean" + "type": "boolean" } }, "relations": { diff --git a/modules/zone/back/models/zone-log.json b/modules/zone/back/models/zone-log.json index ddca9261b..66cc8165d 100644 --- a/modules/zone/back/models/zone-log.json +++ b/modules/zone/back/models/zone-log.json @@ -9,40 +9,40 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "forceId": false }, "originFk": { - "type": "Number", + "type": "number", "required": true }, "userFk": { - "type": "Number" + "type": "number" }, "action": { - "type": "String", + "type": "string", "required": true }, "changedModel": { - "type": "String" + "type": "string" }, "oldInstance": { - "type": "Object" + "type": "object" }, "newInstance": { - "type": "Object" + "type": "object" }, "creationDate": { "type": "Date" }, "changedModelId": { - "type": "String" + "type": "string" }, "changedModelValue": { - "type": "String" + "type": "string" }, "description": { - "type": "String" + "type": "string" } }, "relations": { diff --git a/modules/zone/back/models/zone-warehouse.json b/modules/zone/back/models/zone-warehouse.json index 0f0e43f4a..003e4e3c2 100644 --- a/modules/zone/back/models/zone-warehouse.json +++ b/modules/zone/back/models/zone-warehouse.json @@ -13,10 +13,10 @@ "properties": { "id": { "id": true, - "type": "Number" + "type": "number" }, "warehouseFk": { - "type": "Number", + "type": "number", "required": true } }, From cce1d93ddec96d2411d0c085b45f53afd030e257 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 12 May 2022 11:43:41 +0200 Subject: [PATCH 089/141] jasmine reporters config for CI --- Jenkinsfile | 14 ++-- .../collection/spec/newCollection.spec.js | 6 +- back/tests.js | 10 ++- .../client/specs/updatePortfolio.spec.js | 14 ++-- .../agency-term/specs/createInvoiceIn.spec.js | 12 ++-- .../methods/ticket/specs/setDeleted.spec.js | 5 +- .../travel/specs/cloneWithEntries.spec.js | 68 +++++++++---------- package.json | 5 +- 8 files changed, 74 insertions(+), 60 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 03ac84de3..e7f9d3630 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -62,13 +62,13 @@ pipeline { } } } - // stage('Backend') { - // steps { - // nodejs('node-v14') { - // sh 'gulp launchBackTest --ci' - // } - // } - // } + stage('Backend') { + steps { + nodejs('node-v14') { + sh 'npm run test:back ci' + } + } + } } } stage('Build') { diff --git a/back/methods/collection/spec/newCollection.spec.js b/back/methods/collection/spec/newCollection.spec.js index 88d105b4b..6abe73f8e 100644 --- a/back/methods/collection/spec/newCollection.spec.js +++ b/back/methods/collection/spec/newCollection.spec.js @@ -1,8 +1,8 @@ const app = require('vn-loopback/server/server'); -// #3400 analizar que hacer con rutas de back colletion -xdescribe('newCollection()', () => { - it('return a new collection', async() => { +describe('newCollection()', () => { + it('should return a new collection', async() => { + pending('#3400 analizar que hacer con rutas de back collection'); let ctx = {req: {accessToken: {userId: 1106}}}; let response = await app.models.Collection.newCollection(ctx, 1, 1, 1); diff --git a/back/tests.js b/back/tests.js index f1ca40f5a..a51b95698 100644 --- a/back/tests.js +++ b/back/tests.js @@ -10,7 +10,7 @@ process.on('warning', warning => { async function test() { let verbose = false; - if (process.argv[2] === '--v') + if (process.argv[2] === 'ci') verbose = true; const container = new Docker(); @@ -40,16 +40,20 @@ async function test() { jasmine.loadConfig({ spec_dir: '.', spec_files: backSpecs, - helpers: [], + helpers: [] }); jasmine.addReporter(new SpecReporter({ spec: { displaySuccessful: verbose, + displayPending: verbose + }, + summary: { + displayPending: false, } })); - jasmine.exitOnCompletion = false, + jasmine.exitOnCompletion = false; await jasmine.execute(); if (app) await app.disconnect(); if (container) await container.rm(); diff --git a/modules/client/back/methods/client/specs/updatePortfolio.spec.js b/modules/client/back/methods/client/specs/updatePortfolio.spec.js index 4830156fc..f56555c08 100644 --- a/modules/client/back/methods/client/specs/updatePortfolio.spec.js +++ b/modules/client/back/methods/client/specs/updatePortfolio.spec.js @@ -12,11 +12,13 @@ describe('Client updatePortfolio', () => { const expectedResult = 841.63; - await models.Client.rawSql(`UPDATE vn.client SET salesPersonFk = ${salesPersonId} WHERE id = ${clientId}; `); + const clientQuery = `UPDATE vn.client SET salesPersonFk = ${salesPersonId} WHERE id = ${clientId}; `; + await models.Client.rawSql(clientQuery); await models.Client.updatePortfolio(); - let [salesPerson] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `, null, options); + const portfolioQuery = `SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `; + const [salesPerson] = await models.Client.rawSql(portfolioQuery, null, options); expect(salesPerson.portfolioWeight).toEqual(expectedResult); @@ -26,8 +28,9 @@ describe('Client updatePortfolio', () => { throw e; } }); - // task 3817 - xit('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => { + + it('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => { + pending('task 3817'); const salesPersonId = 19; const tx = await models.Client.beginTransaction({}); @@ -40,7 +43,8 @@ describe('Client updatePortfolio', () => { await models.Client.updatePortfolio(); - let [salesPerson] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `, null, options); + const portfolioQuery = `SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `; + const [salesPerson] = await models.Client.rawSql(portfolioQuery, null, options); expect(salesPerson.portfolioWeight).toEqual(expectedResult); diff --git a/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js b/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js index 81686144d..ad4613caf 100644 --- a/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js +++ b/modules/route/back/methods/agency-term/specs/createInvoiceIn.spec.js @@ -1,7 +1,6 @@ const models = require('vn-loopback/server/server').models; -// Include after #3638 export database -xdescribe('AgencyTerm createInvoiceIn()', () => { +describe('AgencyTerm createInvoiceIn()', () => { const rows = [ { routeFk: 2, @@ -17,6 +16,7 @@ xdescribe('AgencyTerm createInvoiceIn()', () => { ]; it('should make an invoiceIn', async() => { + pending('Include after #3638 export database'); const tx = await models.AgencyTerm.beginTransaction({}); const options = {transaction: tx}; @@ -32,8 +32,12 @@ xdescribe('AgencyTerm createInvoiceIn()', () => { await models.AgencyTerm.createInvoiceIn(rows, dms, options); const [newInvoiceIn] = await models.InvoiceIn.rawSql('SELECT MAX(id) id FROM invoiceIn', null, options); - const [newInvoiceInDueDay] = await models.InvoiceInDueDay.rawSql('SELECT MAX(id) id FROM invoiceInDueDay', null, options); - const [newInvoiceInTax] = await models.InvoiceInTax.rawSql('SELECT MAX(id) id FROM invoiceInTax', null, options); + + const dueDayQuery = 'SELECT MAX(id) id FROM invoiceInDueDay'; + const [newInvoiceInDueDay] = await models.InvoiceInDueDay.rawSql(dueDayQuery, null, options); + + const taxQuery = 'SELECT MAX(id) id FROM invoiceInTax'; + const [newInvoiceInTax] = await models.InvoiceInTax.rawSql(taxQuery, null, options); expect(newInvoiceIn.id).toBeGreaterThan(oldInvoiceIn.id); expect(newInvoiceInDueDay.id).toBeGreaterThan(oldInvoiceInDueDay.id); diff --git a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js index 04e1c140a..9b629e634 100644 --- a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js @@ -28,8 +28,9 @@ describe('ticket setDeleted()', () => { expect(error.message).toEqual('You must delete the claim id %d first'); }); - // test excluded by task #3693 - xit('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get rid of the itemshelving', async() => { + + it('should delete ticket, remove stowaway and itemshelving then change stowaway state to "FIXING" ', async() => { + pending('test excluded by task #3693'); const tx = await models.Ticket.beginTransaction({}); try { diff --git a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js index b4bfecbfb..aa92fa308 100644 --- a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js +++ b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js @@ -1,7 +1,6 @@ const app = require('vn-loopback/server/server'); -// #2687 - Cannot make a data rollback because of the triggers -xdescribe('Travel cloneWithEntries()', () => { +describe('Travel cloneWithEntries()', () => { const models = app.models; const travelId = 5; const currentUserId = 1102; @@ -9,44 +8,45 @@ xdescribe('Travel cloneWithEntries()', () => { let travelBefore; let newTravelId; - afterAll(async() => { - try { - const entries = await models.Entry.find({ - where: { - travelFk: newTravelId - } - }); - const entriesId = entries.map(entry => entry.id); + // afterAll(async() => { + // try { + // const entries = await models.Entry.find({ + // where: { + // travelFk: newTravelId + // } + // }); + // const entriesId = entries.map(entry => entry.id); - // Destroy all entries buys - await models.Buy.destroyAll({ - where: { - entryFk: {inq: entriesId} - } - }); + // // Destroy all entries buys + // await models.Buy.destroyAll({ + // where: { + // entryFk: {inq: entriesId} + // } + // }); - // Destroy travel entries - await models.Entry.destroyAll({ - where: { - travelFk: newTravelId - } - }); + // // Destroy travel entries + // await models.Entry.destroyAll({ + // where: { + // travelFk: newTravelId + // } + // }); - // Destroy new travel - await models.Travel.destroyById(newTravelId); + // // Destroy new travel + // await models.Travel.destroyById(newTravelId); - // Restore original travel shipped & landed - const travel = await models.Travel.findById(travelId); - await travel.updateAttributes({ - shipped: travelBefore.shipped, - landed: travelBefore.landed - }); - } catch (error) { - console.error(error); - } - }); + // // Restore original travel shipped & landed + // const travel = await models.Travel.findById(travelId); + // await travel.updateAttributes({ + // shipped: travelBefore.shipped, + // landed: travelBefore.landed + // }); + // } catch (error) { + // console.error(error); + // } + // }); it(`should clone the travel and the containing entries`, async() => { + pending('#2687 - Cannot make a data rollback because of the triggers'); const warehouseThree = 3; const agencyModeOne = 1; const yesterday = new Date(); diff --git a/package.json b/package.json index 88ac91233..b0d6c9bd5 100644 --- a/package.json +++ b/package.json @@ -101,8 +101,9 @@ }, "scripts": { "dbtest": "nodemon -q db/tests.js -w db/tests", - "backtest": "nodemon -q back/tests.js --config back/nodemonConfig.json", - "test": "jest --watch", + "test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json", + "test:e2e": "node e2e/helpers/tests.js", + "test:front": "jest --watch", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", "lint": "eslint ./ --cache --ignore-pattern .gitignore", "docker": "docker build --progress=plain -t salix-db ./db" From 322d08756d326e9d3231869fe49087c9e0593a94 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 12 May 2022 12:00:03 +0200 Subject: [PATCH 090/141] removed packa-lock for jenkins --- package-lock.json | 42896 -------------------------------------------- 1 file changed, 42896 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 21fd11f23..000000000 --- a/package-lock.json +++ /dev/null @@ -1,42896 +0,0 @@ -{ - "name": "salix-back", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "salix-back", - "version": "1.0.0", - "license": "GPL-3.0", - "dependencies": { - "adm-zip": "^0.5.9", - "axios": "^0.25.0", - "bmp-js": "^0.1.0", - "compression": "^1.7.3", - "fs-extra": "^5.0.0", - "ftps": "^1.2.0", - "got": "^10.7.0", - "helmet": "^3.21.2", - "i18n": "^0.8.4", - "image-type": "^4.1.0", - "imap": "^0.8.19", - "ldapjs": "^2.2.0", - "loopback": "^3.26.0", - "loopback-boot": "3.3.1", - "loopback-component-explorer": "^6.5.0", - "loopback-component-storage": "3.6.1", - "loopback-connector-mysql": "^5.4.3", - "loopback-connector-remote": "^3.4.1", - "loopback-context": "^3.4.0", - "mailparser": "^2.8.0", - "md5": "^2.2.1", - "node-ssh": "^11.0.0", - "object-diff": "0.0.4", - "object.pick": "^1.3.0", - "puppeteer": "^7.1.0", - "read-chunk": "^3.2.0", - "require-yaml": "0.0.1", - "sharp": "^0.27.1", - "smbhash": "0.0.1", - "strong-error-handler": "^2.3.2", - "uuid": "^3.3.3", - "vn-loopback": "file:./loopback", - "vn-print": "file:./print", - "xml2js": "^0.4.23" - }, - "devDependencies": { - "@babel/core": "^7.7.7", - "@babel/plugin-syntax-dynamic-import": "^7.7.4", - "@babel/preset-env": "^7.11.0", - "@babel/register": "^7.7.7", - "angular-mocks": "^1.7.9", - "babel-jest": "^26.0.1", - "babel-loader": "^8.0.6", - "core-js": "^3.9.1", - "css-loader": "^2.1.0", - "del": "^2.2.2", - "eslint": "^7.11.0", - "eslint-config-google": "^0.11.0", - "eslint-plugin-jasmine": "^2.10.1", - "fancy-log": "^1.3.2", - "file-loader": "^1.1.11", - "gulp": "^4.0.2", - "gulp-concat": "^2.6.1", - "gulp-env": "^0.4.0", - "gulp-file": "^0.4.0", - "gulp-install": "^1.1.0", - "gulp-merge-json": "^1.3.1", - "gulp-nodemon": "^2.5.0", - "gulp-print": "^2.0.1", - "gulp-wrap": "^0.15.0", - "gulp-yaml": "^1.0.1", - "html-loader": "^0.4.5", - "html-loader-jest": "^0.2.1", - "html-webpack-plugin": "^4.0.0-beta.11", - "identity-obj-proxy": "^3.0.0", - "jasmine": "^4.1.0", - "jasmine-reporters": "^2.4.0", - "jasmine-spec-reporter": "^7.0.0", - "jest": "^26.0.1", - "jest-junit": "^8.0.0", - "json-loader": "^0.5.7", - "merge-stream": "^1.0.1", - "minimist": "^1.2.5", - "mysql2": "^1.7.0", - "node-sass": "^4.14.1", - "nodemon": "^2.0.16", - "plugin-error": "^1.0.1", - "raw-loader": "^1.0.0", - "regenerator-runtime": "^0.13.7", - "sass-loader": "^7.3.1", - "style-loader": "^0.23.1", - "webpack": "^4.41.5", - "webpack-cli": "^3.3.10", - "webpack-dev-server": "^3.11.0", - "webpack-merge": "^4.2.2", - "yaml-loader": "^0.5.0" - }, - "engines": { - "node": ">=14" - } - }, - "loopback": { - "name": "vn-loopback", - "version": "1.0.0", - "license": "GPL-3.0" - }, - "node_modules/@babel/code-frame": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/highlight": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.7", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helpers": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.8", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-annotate-as-pure": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-explode-assignable-expression": "^7.16.7", - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.16.4", - "@babel/helper-validator-option": "^7.16.7", - "browserslist": "^4.17.5", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "regexpu-core": "^4.7.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.13.0", - "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-plugin-utils": "^7.13.0", - "@babel/traverse": "^7.13.0", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - }, - "peerDependencies": { - "@babel/core": "^7.4.0-0" - } - }, - "node_modules/@babel/helper-environment-visitor": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-explode-assignable-expression": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-function-name": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-get-function-arity": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-get-function-arity": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-hoist-variables": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-optimise-call-expression": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-remap-async-to-generator": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-wrap-function": "^7.16.8", - "@babel/types": "^7.16.8" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-replace-supers": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-simple-access": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.16.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-split-export-declaration": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-wrap-function": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-function-name": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.8", - "@babel/types": "^7.16.8" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", - "@babel/plugin-proposal-optional-chaining": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.13.0" - } - }, - "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-remap-async-to-generator": "^7.16.8", - "@babel/plugin-syntax-async-generators": "^7.8.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-class-static-block": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0" - } - }, - "node_modules/@babel/plugin-proposal-dynamic-import": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-export-namespace-from": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-json-strings": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-json-strings": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-numeric-separator": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.16.4", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-optional-catch-binding": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-private-property-in-object": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-unicode-property-regex": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-async-to-generator": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-remap-async-to-generator": "^7.16.8" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoped-functions": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-classes": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-dotall-regex": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-duplicate-keys": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-exponentiation-operator": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-for-of": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-function-name": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-literals": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-member-expression-literals": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-modules-umd": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/plugin-transform-new-target": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-object-super": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-parameters": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-property-literals": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerator-transform": "^0.14.2" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-reserved-words": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-shorthand-properties": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-spread": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-sticky-regex": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-template-literals": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-typeof-symbol": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-unicode-regex": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-env": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.16.8", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-validator-option": "^7.16.7", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.7", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-async-generator-functions": "^7.16.8", - "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-class-static-block": "^7.16.7", - "@babel/plugin-proposal-dynamic-import": "^7.16.7", - "@babel/plugin-proposal-export-namespace-from": "^7.16.7", - "@babel/plugin-proposal-json-strings": "^7.16.7", - "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", - "@babel/plugin-proposal-numeric-separator": "^7.16.7", - "@babel/plugin-proposal-object-rest-spread": "^7.16.7", - "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", - "@babel/plugin-proposal-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-private-methods": "^7.16.7", - "@babel/plugin-proposal-private-property-in-object": "^7.16.7", - "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.16.7", - "@babel/plugin-transform-async-to-generator": "^7.16.8", - "@babel/plugin-transform-block-scoped-functions": "^7.16.7", - "@babel/plugin-transform-block-scoping": "^7.16.7", - "@babel/plugin-transform-classes": "^7.16.7", - "@babel/plugin-transform-computed-properties": "^7.16.7", - "@babel/plugin-transform-destructuring": "^7.16.7", - "@babel/plugin-transform-dotall-regex": "^7.16.7", - "@babel/plugin-transform-duplicate-keys": "^7.16.7", - "@babel/plugin-transform-exponentiation-operator": "^7.16.7", - "@babel/plugin-transform-for-of": "^7.16.7", - "@babel/plugin-transform-function-name": "^7.16.7", - "@babel/plugin-transform-literals": "^7.16.7", - "@babel/plugin-transform-member-expression-literals": "^7.16.7", - "@babel/plugin-transform-modules-amd": "^7.16.7", - "@babel/plugin-transform-modules-commonjs": "^7.16.8", - "@babel/plugin-transform-modules-systemjs": "^7.16.7", - "@babel/plugin-transform-modules-umd": "^7.16.7", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.8", - "@babel/plugin-transform-new-target": "^7.16.7", - "@babel/plugin-transform-object-super": "^7.16.7", - "@babel/plugin-transform-parameters": "^7.16.7", - "@babel/plugin-transform-property-literals": "^7.16.7", - "@babel/plugin-transform-regenerator": "^7.16.7", - "@babel/plugin-transform-reserved-words": "^7.16.7", - "@babel/plugin-transform-shorthand-properties": "^7.16.7", - "@babel/plugin-transform-spread": "^7.16.7", - "@babel/plugin-transform-sticky-regex": "^7.16.7", - "@babel/plugin-transform-template-literals": "^7.16.7", - "@babel/plugin-transform-typeof-symbol": "^7.16.7", - "@babel/plugin-transform-unicode-escapes": "^7.16.7", - "@babel/plugin-transform-unicode-regex": "^7.16.7", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.16.8", - "babel-plugin-polyfill-corejs2": "^0.3.0", - "babel-plugin-polyfill-corejs3": "^0.5.0", - "babel-plugin-polyfill-regenerator": "^0.3.0", - "core-js-compat": "^3.20.2", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-modules": { - "version": "0.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/register": { - "version": "7.16.9", - "dev": true, - "license": "MIT", - "dependencies": { - "clone-deep": "^4.0.1", - "find-cache-dir": "^2.0.0", - "make-dir": "^2.1.0", - "pirates": "^4.0.0", - "source-map-support": "^0.5.16" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/runtime": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerator-runtime": "^0.13.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/runtime-corejs3": { - "version": "7.16.8", - "license": "MIT", - "dependencies": { - "core-js-pure": "^3.20.2", - "regenerator-runtime": "^0.13.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/template": { - "version": "7.16.7", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/types": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.8", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.16.8", - "@babel/types": "^7.16.8", - "debug": "^4.1.0", - "globals": "^11.1.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.16.8", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", - "to-fast-properties": "^2.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@cnakazawa/watch": { - "version": "1.0.4", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "exec-sh": "^0.3.2", - "minimist": "^1.2.0" - }, - "bin": { - "watch": "cli.js" - }, - "engines": { - "node": ">=0.1.95" - } - }, - "node_modules/@eslint/eslintrc": { - "version": "0.4.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/@eslint/eslintrc/node_modules/globals": { - "version": "13.12.0", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@eslint/eslintrc/node_modules/type-fest": { - "version": "0.20.2", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@google-cloud/common": { - "version": "0.32.1", - "license": "Apache-2.0", - "dependencies": { - "@google-cloud/projectify": "^0.3.3", - "@google-cloud/promisify": "^0.4.0", - "@types/request": "^2.48.1", - "arrify": "^2.0.0", - "duplexify": "^3.6.0", - "ent": "^2.2.0", - "extend": "^3.0.2", - "google-auth-library": "^3.1.1", - "pify": "^4.0.1", - "retry-request": "^4.0.0", - "teeny-request": "^3.11.3" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@google-cloud/common/node_modules/arrify": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@google-cloud/common/node_modules/pify": { - "version": "4.0.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/@google-cloud/paginator": { - "version": "0.2.0", - "license": "Apache-2.0", - "dependencies": { - "arrify": "^1.0.1", - "extend": "^3.0.1", - "split-array-stream": "^2.0.0", - "stream-events": "^1.0.4" - } - }, - "node_modules/@google-cloud/projectify": { - "version": "0.3.3", - "license": "Apache-2.0" - }, - "node_modules/@google-cloud/promisify": { - "version": "0.4.0", - "license": "Apache-2.0" - }, - "node_modules/@google-cloud/storage": { - "version": "2.5.0", - "license": "Apache-2.0", - "dependencies": { - "@google-cloud/common": "^0.32.0", - "@google-cloud/paginator": "^0.2.0", - "@google-cloud/promisify": "^0.4.0", - "arrify": "^1.0.0", - "async": "^2.0.1", - "compressible": "^2.0.12", - "concat-stream": "^2.0.0", - "date-and-time": "^0.6.3", - "duplexify": "^3.5.0", - "extend": "^3.0.0", - "gcs-resumable-upload": "^1.0.0", - "hash-stream-validation": "^0.2.1", - "mime": "^2.2.0", - "mime-types": "^2.0.8", - "onetime": "^5.1.0", - "pumpify": "^1.5.1", - "snakeize": "^0.1.0", - "stream-events": "^1.0.1", - "teeny-request": "^3.11.3", - "through2": "^3.0.0", - "xdg-basedir": "^3.0.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@google-cloud/storage/node_modules/concat-stream": { - "version": "2.0.0", - "engines": [ - "node >= 6.0" - ], - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - } - }, - "node_modules/@google-cloud/storage/node_modules/readable-stream": { - "version": "3.6.0", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@google-cloud/storage/node_modules/through2": { - "version": "3.0.2", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - }, - "node_modules/@humanwhocodes/config-array": { - "version": "0.5.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/console": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^26.6.2", - "jest-util": "^26.6.2", - "slash": "^3.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/console/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/console/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/console/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/console/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/console/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/console/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/core": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^26.6.2", - "@jest/reporters": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-changed-files": "^26.6.2", - "jest-config": "^26.6.3", - "jest-haste-map": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.6.2", - "jest-resolve-dependencies": "^26.6.3", - "jest-runner": "^26.6.3", - "jest-runtime": "^26.6.3", - "jest-snapshot": "^26.6.2", - "jest-util": "^26.6.2", - "jest-validate": "^26.6.2", - "jest-watcher": "^26.6.2", - "micromatch": "^4.0.2", - "p-each-series": "^2.1.0", - "rimraf": "^3.0.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/core/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/core/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/core/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/core/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/core/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/core/node_modules/rimraf": { - "version": "3.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/@jest/core/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/environment": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/fake-timers": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "jest-mock": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/fake-timers": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "@sinonjs/fake-timers": "^6.0.1", - "@types/node": "*", - "jest-message-util": "^26.6.2", - "jest-mock": "^26.6.2", - "jest-util": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/globals": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^26.6.2", - "@jest/types": "^26.6.2", - "expect": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/reporters": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.2", - "graceful-fs": "^4.2.4", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.3", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.2", - "jest-haste-map": "^26.6.2", - "jest-resolve": "^26.6.2", - "jest-util": "^26.6.2", - "jest-worker": "^26.6.2", - "slash": "^3.0.0", - "source-map": "^0.6.0", - "string-length": "^4.0.1", - "terminal-link": "^2.0.0", - "v8-to-istanbul": "^7.0.0" - }, - "engines": { - "node": ">= 10.14.2" - }, - "optionalDependencies": { - "node-notifier": "^8.0.0" - } - }, - "node_modules/@jest/reporters/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/reporters/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/reporters/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/reporters/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/reporters/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/reporters/node_modules/istanbul-lib-instrument": { - "version": "4.0.3", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/core": "^7.7.5", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/reporters/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@jest/reporters/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/source-map": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0", - "graceful-fs": "^4.2.4", - "source-map": "^0.6.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/source-map/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@jest/test-result": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/test-sequencer": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/test-result": "^26.6.2", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^26.6.2", - "jest-runner": "^26.6.3", - "jest-runtime": "^26.6.3" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/transform": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.1.0", - "@jest/types": "^26.6.2", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^4.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-util": "^26.6.2", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/transform/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/transform/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/transform/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/transform/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/transform/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/transform/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@jest/transform/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/types": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^15.0.0", - "chalk": "^4.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/@jest/types/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@jest/types/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/@jest/types/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/@jest/types/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@jest/types/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/types/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@sindresorhus/is": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" - } - }, - "node_modules/@sinonjs/commons": { - "version": "1.8.3", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/fake-timers": { - "version": "6.0.1", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^1.7.0" - } - }, - "node_modules/@szmarczak/http-timer": { - "version": "4.0.6", - "license": "MIT", - "dependencies": { - "defer-to-connect": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/@tootallnate/once": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/@types/babel__core": { - "version": "7.1.18", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.6.4", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.14.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.3.0" - } - }, - "node_modules/@types/body-parser": { - "version": "1.19.2", - "license": "MIT", - "dependencies": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "node_modules/@types/cacheable-request": { - "version": "6.0.2", - "license": "MIT", - "dependencies": { - "@types/http-cache-semantics": "*", - "@types/keyv": "*", - "@types/node": "*", - "@types/responselike": "*" - } - }, - "node_modules/@types/caseless": { - "version": "0.12.2", - "license": "MIT" - }, - "node_modules/@types/connect": { - "version": "3.4.35", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/express": { - "version": "4.17.13", - "license": "MIT", - "dependencies": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.18", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "node_modules/@types/express-serve-static-core": { - "version": "4.17.28", - "license": "MIT", - "dependencies": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, - "node_modules/@types/glob": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "node_modules/@types/graceful-fs": { - "version": "4.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/html-minifier-terser": { - "version": "5.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/http-cache-semantics": { - "version": "4.0.1", - "license": "MIT" - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "*" - } - }, - "node_modules/@types/istanbul-reports": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/@types/json-schema": { - "version": "7.0.9", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/keyv": { - "version": "3.1.3", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/mime": { - "version": "1.3.2", - "license": "MIT" - }, - "node_modules/@types/minimatch": { - "version": "3.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "17.0.8", - "license": "MIT" - }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/prettier": { - "version": "2.4.3", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/qs": { - "version": "6.9.7", - "license": "MIT" - }, - "node_modules/@types/range-parser": { - "version": "1.2.4", - "license": "MIT" - }, - "node_modules/@types/request": { - "version": "2.48.8", - "license": "MIT", - "dependencies": { - "@types/caseless": "*", - "@types/node": "*", - "@types/tough-cookie": "*", - "form-data": "^2.5.0" - } - }, - "node_modules/@types/request/node_modules/form-data": { - "version": "2.5.1", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/@types/responselike": { - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/serve-static": { - "version": "1.13.10", - "license": "MIT", - "dependencies": { - "@types/mime": "^1", - "@types/node": "*" - } - }, - "node_modules/@types/source-list-map": { - "version": "0.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/stack-utils": { - "version": "2.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/tapable": { - "version": "1.0.8", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/tough-cookie": { - "version": "4.0.1", - "license": "MIT" - }, - "node_modules/@types/uglify-js": { - "version": "3.13.1", - "dev": true, - "license": "MIT", - "dependencies": { - "source-map": "^0.6.1" - } - }, - "node_modules/@types/uglify-js/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@types/webpack": { - "version": "4.41.32", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "@types/tapable": "^1", - "@types/uglify-js": "*", - "@types/webpack-sources": "*", - "anymatch": "^3.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/@types/webpack-sources": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "@types/source-list-map": "*", - "source-map": "^0.7.3" - } - }, - "node_modules/@types/webpack-sources/node_modules/source-map": { - "version": "0.7.3", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">= 8" - } - }, - "node_modules/@types/webpack/node_modules/anymatch": { - "version": "3.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/@types/webpack/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@types/yargs": { - "version": "15.0.14", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@types/yargs-parser": { - "version": "20.2.1", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/yauzl": { - "version": "2.9.2", - "license": "MIT", - "optional": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@webassemblyjs/ast": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/helper-module-context": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/wast-parser": "1.9.0" - } - }, - "node_modules/@webassemblyjs/floating-point-hex-parser": { - "version": "1.9.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-api-error": { - "version": "1.9.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.9.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-code-frame": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/wast-printer": "1.9.0" - } - }, - "node_modules/@webassemblyjs/helper-fsm": { - "version": "1.9.0", - "dev": true, - "license": "ISC" - }, - "node_modules/@webassemblyjs/helper-module-context": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0" - } - }, - "node_modules/@webassemblyjs/helper-wasm-bytecode": { - "version": "1.9.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0" - } - }, - "node_modules/@webassemblyjs/ieee754": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "node_modules/@webassemblyjs/leb128": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webassemblyjs/utf8": { - "version": "1.9.0", - "dev": true, - "license": "MIT" - }, - "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/helper-wasm-section": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0", - "@webassemblyjs/wasm-opt": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0", - "@webassemblyjs/wast-printer": "1.9.0" - } - }, - "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/ieee754": "1.9.0", - "@webassemblyjs/leb128": "1.9.0", - "@webassemblyjs/utf8": "1.9.0" - } - }, - "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0" - } - }, - "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-api-error": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/ieee754": "1.9.0", - "@webassemblyjs/leb128": "1.9.0", - "@webassemblyjs/utf8": "1.9.0" - } - }, - "node_modules/@webassemblyjs/wast-parser": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/floating-point-hex-parser": "1.9.0", - "@webassemblyjs/helper-api-error": "1.9.0", - "@webassemblyjs/helper-code-frame": "1.9.0", - "@webassemblyjs/helper-fsm": "1.9.0", - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webassemblyjs/wast-printer": { - "version": "1.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/wast-parser": "1.9.0", - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@xmldom/xmldom": { - "version": "0.7.5", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/@xtuc/ieee754": { - "version": "1.2.0", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/@xtuc/long": { - "version": "4.2.2", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/abab": { - "version": "2.0.5", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/abbrev": { - "version": "1.1.1", - "dev": true, - "license": "ISC" - }, - "node_modules/abort-controller": { - "version": "2.0.3", - "license": "MIT", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/abstract-logging": { - "version": "2.0.1", - "license": "MIT" - }, - "node_modules/accept-language": { - "version": "3.0.18", - "license": "MIT", - "dependencies": { - "bcp47": "^1.1.2", - "stable": "^0.1.6" - } - }, - "node_modules/accepts": { - "version": "1.3.7", - "license": "MIT", - "dependencies": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/acorn": { - "version": "7.4.1", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-globals": { - "version": "6.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1" - } - }, - "node_modules/acorn-jsx": { - "version": "5.3.2", - "dev": true, - "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/acorn-walk": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/adm-zip": { - "version": "0.5.9", - "license": "MIT", - "engines": { - "node": ">=6.0" - } - }, - "node_modules/agent-base": { - "version": "6.0.2", - "license": "MIT", - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/ajv": { - "version": "6.12.6", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/ajv-errors": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "peerDependencies": { - "ajv": ">=5.0.0" - } - }, - "node_modules/ajv-keywords": { - "version": "3.5.2", - "dev": true, - "license": "MIT", - "peerDependencies": { - "ajv": "^6.9.1" - } - }, - "node_modules/amdefine": { - "version": "1.0.1", - "dev": true, - "license": "BSD-3-Clause OR MIT", - "engines": { - "node": ">=0.4.2" - } - }, - "node_modules/angular-mocks": { - "version": "1.8.2", - "dev": true, - "license": "MIT" - }, - "node_modules/ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dev": true, - "dependencies": { - "string-width": "^4.1.0" - } - }, - "node_modules/ansi-align/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-align/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-colors": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-escapes/node_modules/type-fest": { - "version": "0.21.3", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-gray": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-wrap": "0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ansi-html-community": { - "version": "0.0.8", - "dev": true, - "engines": [ - "node >= 0.8.0" - ], - "license": "Apache-2.0", - "bin": { - "ansi-html": "bin/ansi-html" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/ansi-wrap": { - "version": "0.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - } - }, - "node_modules/anymatch/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch/node_modules/micromatch": { - "version": "3.1.10", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/anymatch/node_modules/normalize-path": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "remove-trailing-separator": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/append-buffer": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-equal": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/aproba": { - "version": "1.2.0", - "license": "ISC" - }, - "node_modules/archy": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/are-we-there-yet": { - "version": "1.1.7", - "license": "ISC", - "dependencies": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "node_modules/argparse": { - "version": "1.0.10", - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/argparse/node_modules/sprintf-js": { - "version": "1.0.3", - "license": "BSD-3-Clause" - }, - "node_modules/arr-diff": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arr-filter": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "make-iterator": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arr-flatten": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arr-map": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "make-iterator": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arr-union": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-differ": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-each": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-find-index": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "license": "MIT" - }, - "node_modules/array-initial": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "array-slice": "^1.0.0", - "is-number": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-initial/node_modules/is-number": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-last": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-last/node_modules/is-number": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-slice": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-sort": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "default-compare": "^1.0.0", - "get-value": "^2.0.6", - "kind-of": "^5.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-sort/node_modules/kind-of": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-union": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "array-uniq": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-uniq": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/array-unique": { - "version": "0.3.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/arrify": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/asn1": { - "version": "0.2.6", - "license": "MIT", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/asn1.js": { - "version": "5.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/asn1.js/node_modules/bn.js": { - "version": "4.12.0", - "dev": true, - "license": "MIT" - }, - "node_modules/assert": { - "version": "1.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "object-assign": "^4.1.1", - "util": "0.10.3" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/assert/node_modules/inherits": { - "version": "2.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/assert/node_modules/util": { - "version": "0.10.3", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "2.0.1" - } - }, - "node_modules/assign-symbols": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ast-types": { - "version": "0.9.6", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/astral-regex": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/async": { - "version": "2.6.3", - "license": "MIT", - "dependencies": { - "lodash": "^4.17.14" - } - }, - "node_modules/async-done": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.2", - "process-nextick-args": "^2.0.0", - "stream-exhaust": "^1.0.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/async-each": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/async-foreach": { - "version": "0.1.3", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/async-hook-jl": { - "version": "1.7.6", - "license": "MIT", - "dependencies": { - "stack-chain": "^1.3.7" - }, - "engines": { - "node": "^4.7 || >=6.9 || >=7.3" - } - }, - "node_modules/async-limiter": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/async-settle": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "async-done": "^1.2.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/asynckit": { - "version": "0.4.0", - "license": "MIT" - }, - "node_modules/atob": { - "version": "2.1.2", - "dev": true, - "license": "(MIT OR Apache-2.0)", - "bin": { - "atob": "bin/atob.js" - }, - "engines": { - "node": ">= 4.5.0" - } - }, - "node_modules/aws-sdk": { - "version": "2.1057.0", - "license": "Apache-2.0", - "dependencies": { - "buffer": "4.9.2", - "events": "1.1.1", - "ieee754": "1.1.13", - "jmespath": "0.15.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "uuid": "3.3.2", - "xml2js": "0.4.19" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/aws-sdk/node_modules/uuid": { - "version": "3.3.2", - "license": "MIT", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/aws-sdk/node_modules/xml2js": { - "version": "0.4.19", - "license": "MIT", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - } - }, - "node_modules/aws-sdk/node_modules/xmlbuilder": { - "version": "9.0.7", - "license": "MIT", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/aws4": { - "version": "1.11.0", - "license": "MIT" - }, - "node_modules/axios": { - "version": "0.25.0", - "license": "MIT", - "dependencies": { - "follow-redirects": "^1.14.7" - } - }, - "node_modules/babel-jest": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/babel__core": "^7.1.7", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^26.6.2", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "slash": "^3.0.0" - }, - "engines": { - "node": ">= 10.14.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/babel-jest/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/babel-jest/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/babel-jest/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/babel-jest/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/babel-jest/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-jest/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-loader": { - "version": "8.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "find-cache-dir": "^3.3.1", - "loader-utils": "^1.4.0", - "make-dir": "^3.1.0", - "schema-utils": "^2.6.5" - }, - "engines": { - "node": ">= 8.9" - }, - "peerDependencies": { - "@babel/core": "^7.0.0", - "webpack": ">=2" - } - }, - "node_modules/babel-loader/node_modules/find-cache-dir": { - "version": "3.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/avajs/find-cache-dir?sponsor=1" - } - }, - "node_modules/babel-loader/node_modules/make-dir": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/babel-loader/node_modules/pkg-dir": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "object.assign": "^4.1.0" - } - }, - "node_modules/babel-plugin-istanbul": { - "version": "6.1.1", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-jest-hoist": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.0.0", - "@types/babel__traverse": "^7.0.6" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.13.11", - "@babel/helper-define-polyfill-provider": "^0.3.0", - "semver": "^6.1.1" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.0", - "core-js-compat": "^3.20.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.3.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/babel-preset-current-node-syntax": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/babel-preset-jest": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "babel-plugin-jest-hoist": "^26.6.2", - "babel-preset-current-node-syntax": "^1.0.0" - }, - "engines": { - "node": ">= 10.14.2" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/bach": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-filter": "^1.1.1", - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "array-each": "^1.0.0", - "array-initial": "^1.0.0", - "array-last": "^1.1.1", - "async-done": "^1.2.2", - "async-settle": "^1.0.0", - "now-and-later": "^2.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/backoff": { - "version": "2.5.0", - "license": "MIT", - "dependencies": { - "precond": "0.2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/base": { - "version": "0.11.2", - "dev": true, - "license": "MIT", - "dependencies": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/base/node_modules/define-property": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/base/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/base/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/base/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/batch": { - "version": "0.6.1", - "dev": true, - "license": "MIT" - }, - "node_modules/bcp47": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "license": "BSD-3-Clause", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "node_modules/bcryptjs": { - "version": "2.4.3", - "license": "MIT" - }, - "node_modules/beeper": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/big.js": { - "version": "5.2.2", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/bigdecimal": { - "version": "0.6.1", - "engines": [ - "node" - ], - "bin": { - "bigdecimal.js": "repl.js" - } - }, - "node_modules/bignumber.js": { - "version": "9.0.0", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/binary-extensions": { - "version": "1.13.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, - "node_modules/bl": { - "version": "2.2.1", - "license": "MIT", - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/block-stream": { - "version": "0.0.9", - "dev": true, - "license": "ISC", - "dependencies": { - "inherits": "~2.0.0" - }, - "engines": { - "node": "0.4 || >=0.5.8" - } - }, - "node_modules/bluebird": { - "version": "3.7.2", - "license": "MIT" - }, - "node_modules/bmp-js": { - "version": "0.1.0", - "license": "MIT" - }, - "node_modules/bn.js": { - "version": "5.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/body-parser": { - "version": "1.19.1", - "license": "MIT", - "dependencies": { - "bytes": "3.1.1", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.8.1", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.9.6", - "raw-body": "2.4.2", - "type-is": "~1.6.18" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/body-parser/node_modules/bytes": { - "version": "3.1.1", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/body-parser/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/body-parser/node_modules/depd": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/body-parser/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/bonjour": { - "version": "3.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "array-flatten": "^2.1.0", - "deep-equal": "^1.0.1", - "dns-equal": "^1.0.0", - "dns-txt": "^2.0.2", - "multicast-dns": "^6.0.1", - "multicast-dns-service-types": "^1.1.0" - } - }, - "node_modules/bonjour/node_modules/array-flatten": { - "version": "2.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/boolbase": { - "version": "1.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/bops": { - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "base64-js": "1.0.2", - "to-utf8": "0.0.1" - } - }, - "node_modules/bops/node_modules/base64-js": { - "version": "1.0.2", - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/bowser": { - "version": "2.9.0", - "license": "MIT" - }, - "node_modules/boxen": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", - "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dev": true, - "dependencies": { - "ansi-align": "^3.0.0", - "camelcase": "^6.2.0", - "chalk": "^4.1.0", - "cli-boxes": "^2.2.1", - "string-width": "^4.2.2", - "type-fest": "^0.20.2", - "widest-line": "^3.1.0", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/boxen/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/boxen/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/boxen/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/boxen/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/boxen/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/boxen/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/boxen/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/boxen/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/boxen/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/boxen/node_modules/type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/boxen/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "2.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "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.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/brorand": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/browser-process-hrtime": { - "version": "1.0.0", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/browserify-aes": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/browserify-cipher": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "node_modules/browserify-des": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/browserify-rsa": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "node_modules/browserify-sign": { - "version": "4.2.1", - "dev": true, - "license": "ISC", - "dependencies": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, - "node_modules/browserify-sign/node_modules/readable-stream": { - "version": "3.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/browserify-sign/node_modules/safe-buffer": { - "version": "5.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/browserify-zlib": { - "version": "0.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pako": "~1.0.5" - } - }, - "node_modules/browserslist": { - "version": "4.19.1", - "dev": true, - "license": "MIT", - "dependencies": { - "caniuse-lite": "^1.0.30001286", - "electron-to-chromium": "^1.4.17", - "escalade": "^3.1.1", - "node-releases": "^2.0.1", - "picocolors": "^1.0.0" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } - }, - "node_modules/bser": { - "version": "2.1.1", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "node-int64": "^0.4.0" - } - }, - "node_modules/btoa": { - "version": "1.2.1", - "license": "(MIT OR Apache-2.0)", - "bin": { - "btoa": "bin/btoa.js" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/buffer": { - "version": "4.9.2", - "license": "MIT", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/buffer-equal": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/buffer-equal-constant-time": { - "version": "1.0.1", - "license": "BSD-3-Clause" - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "license": "MIT" - }, - "node_modules/buffer-indexof": { - "version": "1.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/buffer-xor": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/bufferstreams": { - "version": "1.1.0", - "dev": true, - "dependencies": { - "readable-stream": "^2.0.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/builtin-status-codes": { - "version": "3.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/bytes": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/cacache": { - "version": "12.0.4", - "dev": true, - "license": "ISC", - "dependencies": { - "bluebird": "^3.5.5", - "chownr": "^1.1.1", - "figgy-pudding": "^3.5.1", - "glob": "^7.1.4", - "graceful-fs": "^4.1.15", - "infer-owner": "^1.0.3", - "lru-cache": "^5.1.1", - "mississippi": "^3.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.3", - "ssri": "^6.0.1", - "unique-filename": "^1.1.1", - "y18n": "^4.0.0" - } - }, - "node_modules/cacache/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/cache-base": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "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" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/cacheable-lookup": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "@types/keyv": "^3.1.1", - "keyv": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/cacheable-request": { - "version": "7.0.2", - "license": "MIT", - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/call-bind": { - "version": "1.0.2", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camel-case": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "no-case": "^2.2.0", - "upper-case": "^1.1.1" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase-keys": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/camelcase-keys/node_modules/camelcase": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/camelize": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001299", - "dev": true, - "license": "CC-BY-4.0", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } - }, - "node_modules/canonical-json": { - "version": "0.0.4", - "license": "BSD" - }, - "node_modules/capture-exit": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "rsvp": "^4.8.4" - }, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/caseless": { - "version": "0.12.0", - "license": "Apache-2.0" - }, - "node_modules/chalk": { - "version": "2.4.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/char-regex": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/charenc": { - "version": "0.0.2", - "license": "BSD-3-Clause", - "engines": { - "node": "*" - } - }, - "node_modules/chokidar": { - "version": "2.1.8", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - }, - "optionalDependencies": { - "fsevents": "^1.2.7" - } - }, - "node_modules/chokidar/node_modules/fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "deprecated": "fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "3.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "node_modules/chokidar/node_modules/glob-parent/node_modules/is-glob": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/chownr": { - "version": "1.1.4", - "license": "ISC" - }, - "node_modules/chrome-trace-event": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0" - } - }, - "node_modules/ci-info": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/cipher-base": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/cjs-module-lexer": { - "version": "0.6.0", - "dev": true, - "license": "MIT" - }, - "node_modules/class-utils": { - "version": "0.3.6", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/cldrjs": { - "version": "0.5.5" - }, - "node_modules/clean-css": { - "version": "4.2.4", - "dev": true, - "license": "MIT", - "dependencies": { - "source-map": "~0.6.0" - }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/clean-css/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/cli-boxes": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/cliui": { - "version": "3.2.0", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - } - }, - "node_modules/cliui/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/cliui/node_modules/strip-ansi": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/clone": { - "version": "2.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/clone-buffer": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/clone-deep": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/clone-response": { - "version": "1.0.2", - "license": "MIT", - "dependencies": { - "mimic-response": "^1.0.0" - } - }, - "node_modules/clone-response/node_modules/mimic-response": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/clone-stats": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/cloneable-readable": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" - } - }, - "node_modules/cls-hooked": { - "version": "4.2.2", - "license": "BSD-2-Clause", - "dependencies": { - "async-hook-jl": "^1.7.6", - "emitter-listener": "^1.0.1", - "semver": "^5.4.1" - }, - "engines": { - "node": "^4.7 || >=6.9 || >=7.3 || >=8.2.1" - } - }, - "node_modules/cls-hooked/node_modules/semver": { - "version": "5.7.1", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/co": { - "version": "4.6.0", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">= 1.0.0", - "node": ">= 0.12.0" - } - }, - "node_modules/code-point-at": { - "version": "1.1.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/collect-v8-coverage": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/collection-map": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-map": "^2.0.2", - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/collection-visit": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/color": { - "version": "3.2.1", - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.3", - "color-string": "^1.6.0" - } - }, - "node_modules/color-convert": { - "version": "1.9.3", - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/color-name": { - "version": "1.1.3", - "license": "MIT" - }, - "node_modules/color-string": { - "version": "1.9.0", - "license": "MIT", - "dependencies": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } - }, - "node_modules/color-support": { - "version": "1.1.3", - "dev": true, - "license": "ISC", - "bin": { - "color-support": "bin.js" - } - }, - "node_modules/colors": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.1.90" - } - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/commander": { - "version": "2.17.1", - "license": "MIT" - }, - "node_modules/commondir": { - "version": "1.0.1", - "license": "MIT" - }, - "node_modules/component-emitter": { - "version": "1.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/compressible": { - "version": "2.0.18", - "license": "MIT", - "dependencies": { - "mime-db": ">= 1.43.0 < 2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/compression": { - "version": "1.7.4", - "license": "MIT", - "dependencies": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.16", - "debug": "2.6.9", - "on-headers": "~1.0.2", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/compression/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/compression/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "license": "MIT" - }, - "node_modules/concat-stream": { - "version": "1.6.2", - "dev": true, - "engines": [ - "node >= 0.8" - ], - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "node_modules/concat-with-sourcemaps": { - "version": "1.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "source-map": "^0.6.1" - } - }, - "node_modules/concat-with-sourcemaps/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/configstore": { - "version": "4.0.0", - "license": "BSD-2-Clause", - "dependencies": { - "dot-prop": "^4.1.0", - "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "unique-string": "^1.0.0", - "write-file-atomic": "^2.0.0", - "xdg-basedir": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/configstore/node_modules/make-dir": { - "version": "1.3.0", - "license": "MIT", - "dependencies": { - "pify": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/configstore/node_modules/pify": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/configstore/node_modules/write-file-atomic": { - "version": "2.4.3", - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - }, - "node_modules/connect-history-api-fallback": { - "version": "1.6.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/console-browserify": { - "version": "1.2.0", - "dev": true - }, - "node_modules/console-control-strings": { - "version": "1.1.0", - "license": "ISC" - }, - "node_modules/consolidate": { - "version": "0.15.1", - "dev": true, - "license": "MIT", - "dependencies": { - "bluebird": "^3.1.1" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/constants-browserify": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "license": "MIT", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-disposition/node_modules/safe-buffer": { - "version": "5.2.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/content-security-policy-builder": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/content-type": { - "version": "1.0.4", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/convert-source-map": { - "version": "1.8.0", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.1" - } - }, - "node_modules/cookie": { - "version": "0.4.1", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "license": "MIT" - }, - "node_modules/copy-concurrently": { - "version": "1.0.5", - "dev": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - } - }, - "node_modules/copy-concurrently/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/copy-descriptor": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/copy-props": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "each-props": "^1.3.2", - "is-plain-object": "^5.0.0" - } - }, - "node_modules/copy-props/node_modules/is-plain-object": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/core-js": { - "version": "3.20.2", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/core-js-compat": { - "version": "3.20.2", - "dev": true, - "license": "MIT", - "dependencies": { - "browserslist": "^4.19.1", - "semver": "7.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/core-js-compat/node_modules/semver": { - "version": "7.0.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/core-js-pure": { - "version": "3.20.2", - "hasInstallScript": true, - "license": "MIT", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/core-js" - } - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "license": "MIT" - }, - "node_modules/create-ecdh": { - "version": "4.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - } - }, - "node_modules/create-ecdh/node_modules/bn.js": { - "version": "4.12.0", - "dev": true, - "license": "MIT" - }, - "node_modules/create-hash": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "node_modules/create-hmac": { - "version": "1.1.7", - "dev": true, - "license": "MIT", - "dependencies": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "node_modules/cross-fetch": { - "version": "3.1.4", - "license": "MIT", - "dependencies": { - "node-fetch": "2.6.1" - } - }, - "node_modules/cross-fetch/node_modules/node-fetch": { - "version": "2.6.1", - "license": "MIT", - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/crypt": { - "version": "0.0.2", - "license": "BSD-3-Clause", - "engines": { - "node": "*" - } - }, - "node_modules/crypto-browserify": { - "version": "3.12.0", - "dev": true, - "license": "MIT", - "dependencies": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - }, - "engines": { - "node": "*" - } - }, - "node_modules/crypto-random-string": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/css-loader": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^5.2.0", - "icss-utils": "^4.1.0", - "loader-utils": "^1.2.3", - "normalize-path": "^3.0.0", - "postcss": "^7.0.14", - "postcss-modules-extract-imports": "^2.0.0", - "postcss-modules-local-by-default": "^2.0.6", - "postcss-modules-scope": "^2.1.0", - "postcss-modules-values": "^2.0.0", - "postcss-value-parser": "^3.3.0", - "schema-utils": "^1.0.0" - }, - "engines": { - "node": ">= 6.9.0" - }, - "peerDependencies": { - "webpack": "^4.0.0" - } - }, - "node_modules/css-loader/node_modules/schema-utils": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/css-select": { - "version": "4.2.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^5.1.0", - "domhandler": "^4.3.0", - "domutils": "^2.8.0", - "nth-check": "^2.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/css-select/node_modules/dom-serializer": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/css-select/node_modules/domelementtype": { - "version": "2.2.0", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "BSD-2-Clause" - }, - "node_modules/css-select/node_modules/domhandler": { - "version": "4.3.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "^2.2.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/css-select/node_modules/domutils": { - "version": "2.8.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/css-select/node_modules/entities": { - "version": "2.2.0", - "dev": true, - "license": "BSD-2-Clause", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/css-what": { - "version": "5.1.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" - } - }, - "node_modules/cssesc": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "bin": { - "cssesc": "bin/cssesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/cssom": { - "version": "0.4.4", - "dev": true, - "license": "MIT" - }, - "node_modules/cssstyle": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cssom": "~0.3.6" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cssstyle/node_modules/cssom": { - "version": "0.3.8", - "dev": true, - "license": "MIT" - }, - "node_modules/currently-unhandled": { - "version": "0.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "array-find-index": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/cyclist": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/d": { - "version": "1.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, - "node_modules/dargs": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/dashdash": { - "version": "1.14.1", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/dasherize": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/data-urls": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "abab": "^2.0.3", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/date-and-time": { - "version": "0.6.3", - "license": "MIT" - }, - "node_modules/dateformat": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/debug": { - "version": "4.3.3", - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decimal.js": { - "version": "10.3.1", - "dev": true, - "license": "MIT" - }, - "node_modules/decode-uri-component": { - "version": "0.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/decompress-response": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "mimic-response": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/deep-equal": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-arguments": "^1.0.4", - "is-date-object": "^1.0.1", - "is-regex": "^1.0.4", - "object-is": "^1.0.1", - "object-keys": "^1.1.1", - "regexp.prototype.flags": "^1.2.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/deep-extend": { - "version": "0.6.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/deep-is": { - "version": "0.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/deepmerge": { - "version": "4.2.2", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/default-compare": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^5.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/default-compare/node_modules/kind-of": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/default-gateway": { - "version": "4.2.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "execa": "^1.0.0", - "ip-regex": "^2.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/default-gateway/node_modules/cross-spawn": { - "version": "6.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/default-gateway/node_modules/execa": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/default-gateway/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/default-gateway/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/default-gateway/node_modules/npm-run-path": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/default-gateway/node_modules/path-key": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/default-gateway/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/default-gateway/node_modules/shebang-command": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/default-gateway/node_modules/shebang-regex": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/default-gateway/node_modules/which": { - "version": "1.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/default-resolution": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/defer-to-connect": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/define-properties": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "object-keys": "^1.0.12" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/define-property": { - "version": "0.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/del": { - "version": "2.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "globby": "^5.0.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "rimraf": "^2.2.8" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/delegates": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/denque": { - "version": "1.5.1", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/deprecate": { - "version": "1.1.1", - "dev": true, - "license": "MIT" - }, - "node_modules/des.js": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "node_modules/destroy": { - "version": "1.0.4", - "license": "MIT" - }, - "node_modules/detect-file": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/detect-libc": { - "version": "1.0.3", - "license": "Apache-2.0", - "bin": { - "detect-libc": "bin/detect-libc.js" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/detect-newline": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/detect-node": { - "version": "2.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/devtools-protocol": { - "version": "0.0.847576", - "license": "BSD-3-Clause" - }, - "node_modules/diff": { - "version": "1.4.0", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/diff-sequences": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/diffie-hellman": { - "version": "5.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "node_modules/diffie-hellman/node_modules/bn.js": { - "version": "4.12.0", - "dev": true, - "license": "MIT" - }, - "node_modules/dns-equal": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/dns-packet": { - "version": "1.3.4", - "dev": true, - "license": "MIT", - "dependencies": { - "ip": "^1.1.0", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/dns-txt": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-indexof": "^1.0.0" - } - }, - "node_modules/doctrine": { - "version": "3.0.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/dom-converter": { - "version": "0.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "utila": "~0.4" - } - }, - "node_modules/dom-serializer": { - "version": "0.2.2", - "license": "MIT", - "dependencies": { - "domelementtype": "^2.0.1", - "entities": "^2.0.0" - } - }, - "node_modules/dom-serializer/node_modules/domelementtype": { - "version": "2.2.0", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "BSD-2-Clause" - }, - "node_modules/dom-serializer/node_modules/entities": { - "version": "2.2.0", - "license": "BSD-2-Clause", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/domain-browser": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.4", - "npm": ">=1.2" - } - }, - "node_modules/domelementtype": { - "version": "1.3.1", - "license": "BSD-2-Clause" - }, - "node_modules/domexception": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "webidl-conversions": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/domexception/node_modules/webidl-conversions": { - "version": "5.0.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=8" - } - }, - "node_modules/domhandler": { - "version": "2.4.2", - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "1" - } - }, - "node_modules/domutils": { - "version": "1.7.0", - "license": "BSD-2-Clause", - "dependencies": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "node_modules/dont-sniff-mimetype": { - "version": "1.1.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/dot-case": { - "version": "3.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, - "node_modules/dot-case/node_modules/lower-case": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "tslib": "^2.0.3" - } - }, - "node_modules/dot-case/node_modules/no-case": { - "version": "3.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - }, - "node_modules/dot-prop": { - "version": "4.2.1", - "license": "MIT", - "dependencies": { - "is-obj": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/duplex": { - "version": "1.0.0" - }, - "node_modules/duplex-child-process": { - "version": "0.0.5", - "license": "MIT" - }, - "node_modules/duplexer": { - "version": "0.0.4" - }, - "node_modules/duplexer2": { - "version": "0.0.2", - "dev": true, - "license": "BSD", - "dependencies": { - "readable-stream": "~1.1.9" - } - }, - "node_modules/duplexer2/node_modules/isarray": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/duplexer2/node_modules/readable-stream": { - "version": "1.1.14", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/duplexer2/node_modules/string_decoder": { - "version": "0.10.31", - "dev": true, - "license": "MIT" - }, - "node_modules/duplexer3": { - "version": "0.1.4", - "license": "BSD-3-Clause" - }, - "node_modules/duplexify": { - "version": "3.7.1", - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - } - }, - "node_modules/each-props": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.1", - "object.defaults": "^1.1.0" - } - }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "license": "MIT", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "node_modules/ecdsa-sig-formatter": { - "version": "1.0.11", - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "license": "MIT" - }, - "node_modules/ejs": { - "version": "2.7.4", - "hasInstallScript": true, - "license": "Apache-2.0", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.4.45", - "dev": true, - "license": "ISC" - }, - "node_modules/elliptic": { - "version": "6.5.4", - "dev": true, - "license": "MIT", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "dev": true, - "license": "MIT" - }, - "node_modules/emitter-listener": { - "version": "1.1.2", - "license": "BSD-2-Clause", - "dependencies": { - "shimmer": "^1.2.0" - } - }, - "node_modules/emittery": { - "version": "0.7.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/emittery?sponsor=1" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/emojis-list": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/encoding-japanese": { - "version": "1.0.30", - "license": "MIT" - }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "license": "MIT", - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/enhanced-resolve": { - "version": "4.5.0", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.5.0", - "tapable": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/enhanced-resolve/node_modules/memory-fs": { - "version": "0.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - }, - "engines": { - "node": ">=4.3.0 <5.0.0 || >=5.10" - } - }, - "node_modules/enquirer": { - "version": "2.3.6", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-colors": "^4.1.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/ent": { - "version": "2.2.0", - "license": "MIT" - }, - "node_modules/entities": { - "version": "1.1.2", - "license": "BSD-2-Clause" - }, - "node_modules/errno": { - "version": "0.1.8", - "dev": true, - "license": "MIT", - "dependencies": { - "prr": "~1.0.1" - }, - "bin": { - "errno": "cli.js" - } - }, - "node_modules/error-ex": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/errs": { - "version": "0.3.2", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/es-abstract": { - "version": "1.19.1", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", - "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es-to-primitive": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/es5-ext": { - "version": "0.10.53", - "dev": true, - "license": "ISC", - "dependencies": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.3", - "next-tick": "~1.0.0" - } - }, - "node_modules/es6-iterator": { - "version": "2.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/es6-promise": { - "version": "4.2.8", - "license": "MIT" - }, - "node_modules/es6-promisify": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "es6-promise": "^4.0.3" - } - }, - "node_modules/es6-symbol": { - "version": "3.1.3", - "dev": true, - "license": "ISC", - "dependencies": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, - "node_modules/es6-templates": { - "version": "0.2.3", - "dev": true, - "license": "Apache 2", - "dependencies": { - "recast": "~0.11.12", - "through": "~2.3.6" - } - }, - "node_modules/es6-weak-map": { - "version": "2.0.3", - "dev": true, - "license": "ISC", - "dependencies": { - "d": "1", - "es5-ext": "^0.10.46", - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/escalade": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "license": "MIT" - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/escodegen": { - "version": "2.0.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=6.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/escodegen/node_modules/estraverse": { - "version": "5.3.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/escodegen/node_modules/levn": { - "version": "0.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/optionator": { - "version": "0.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.6", - "levn": "~0.3.0", - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2", - "word-wrap": "~1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/prelude-ls": { - "version": "1.1.2", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/escodegen/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/escodegen/node_modules/type-check": { - "version": "0.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/eslint": { - "version": "7.32.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "bin": { - "eslint": "bin/eslint.js" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint-config-google": { - "version": "0.11.0", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=0.10.0" - }, - "peerDependencies": { - "eslint": ">=5.4.0" - } - }, - "node_modules/eslint-plugin-jasmine": { - "version": "2.10.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4", - "npm": ">=2" - } - }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/eslint-utils": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "eslint-visitor-keys": "^1.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=4" - } - }, - "node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint/node_modules/@babel/code-frame": { - "version": "7.12.11", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/highlight": "^7.10.4" - } - }, - "node_modules/eslint/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/eslint/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/eslint/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/eslint/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/eslint/node_modules/escape-string-regexp": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/globals": { - "version": "13.12.0", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.20.2" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/lru-cache": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint/node_modules/semver": { - "version": "7.3.5", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/eslint/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/eslint/node_modules/type-fest": { - "version": "0.20.2", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/eslint/node_modules/yallist": { - "version": "4.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/espree": { - "version": "7.3.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/espree/node_modules/eslint-visitor-keys": { - "version": "1.3.0", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=4" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/esquery": { - "version": "1.4.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "estraverse": "^5.1.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse": { - "version": "4.3.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "4.3.0", - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/etag": { - "version": "1.8.1", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/eventemitter2": { - "version": "5.0.1", - "license": "MIT" - }, - "node_modules/eventemitter3": { - "version": "4.0.7", - "dev": true, - "license": "MIT" - }, - "node_modules/events": { - "version": "1.1.1", - "license": "MIT", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/eventsource": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "original": "^1.0.0" - }, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/evp_bytestokey": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/exec-sh": { - "version": "0.3.6", - "dev": true, - "license": "MIT" - }, - "node_modules/execa": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/execa/node_modules/merge-stream": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/exit": { - "version": "0.1.2", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/expand-brackets": { - "version": "2.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expand-brackets/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/expand-brackets/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/expand-template": { - "version": "2.0.3", - "license": "(MIT OR WTFPL)", - "engines": { - "node": ">=6" - } - }, - "node_modules/expand-tilde": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "homedir-polyfill": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/expect": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "ansi-styles": "^4.0.0", - "jest-get-type": "^26.3.0", - "jest-matcher-utils": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-regex-util": "^26.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/expect/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/expect/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/expect/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/express": { - "version": "4.17.2", - "license": "MIT", - "dependencies": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.4.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.9.6", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.17.2", - "serve-static": "1.14.2", - "setprototypeof": "1.2.0", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/express/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/express/node_modules/depd": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/express/node_modules/safe-buffer": { - "version": "5.2.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/ext": { - "version": "1.6.0", - "dev": true, - "license": "ISC", - "dependencies": { - "type": "^2.5.0" - } - }, - "node_modules/ext/node_modules/type": { - "version": "2.5.0", - "dev": true, - "license": "ISC" - }, - "node_modules/extend": { - "version": "3.0.2", - "license": "MIT" - }, - "node_modules/extend-shallow": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "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" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/define-property": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extglob/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/extract-zip": { - "version": "2.0.1", - "license": "BSD-2-Clause", - "dependencies": { - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - }, - "engines": { - "node": ">= 10.17.0" - }, - "optionalDependencies": { - "@types/yauzl": "^2.9.1" - } - }, - "node_modules/extsprintf": { - "version": "1.3.0", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT" - }, - "node_modules/eyes": { - "version": "0.1.8", - "engines": { - "node": "> 0.1.90" - } - }, - "node_modules/fancy-log": { - "version": "1.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-gray": "^0.1.1", - "color-support": "^1.1.3", - "parse-node-version": "^1.0.0", - "time-stamp": "^1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "license": "MIT" - }, - "node_modules/fast-json-patch": { - "version": "2.2.1", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^2.0.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/fast-json-patch/node_modules/fast-deep-equal": { - "version": "2.0.1", - "license": "MIT" - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "license": "MIT" - }, - "node_modules/fast-levenshtein": { - "version": "2.0.6", - "dev": true, - "license": "MIT" - }, - "node_modules/fast-safe-stringify": { - "version": "2.1.1", - "license": "MIT" - }, - "node_modules/fast-text-encoding": { - "version": "1.0.3", - "license": "Apache-2.0" - }, - "node_modules/fastparse": { - "version": "1.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/faye-websocket": { - "version": "0.11.4", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "websocket-driver": ">=0.5.1" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/fb-watchman": { - "version": "2.0.1", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "bser": "2.1.1" - } - }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "license": "MIT", - "dependencies": { - "pend": "~1.2.0" - } - }, - "node_modules/feature-policy": { - "version": "0.3.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/figgy-pudding": { - "version": "3.5.2", - "dev": true, - "license": "ISC" - }, - "node_modules/file-entry-cache": { - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "flat-cache": "^3.0.4" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/file-loader": { - "version": "1.1.11", - "dev": true, - "license": "MIT", - "dependencies": { - "loader-utils": "^1.0.2", - "schema-utils": "^0.4.5" - }, - "engines": { - "node": ">= 4.3 < 5.0.0 || >= 5.10" - }, - "peerDependencies": { - "webpack": "^2.0.0 || ^3.0.0 || ^4.0.0" - } - }, - "node_modules/file-loader/node_modules/schema-utils": { - "version": "0.4.7", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/file-type": { - "version": "10.11.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, - "node_modules/filed-mimefix": { - "version": "0.1.3", - "license": "ASL 2.0", - "dependencies": { - "mime": "^1.4.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/filed-mimefix/node_modules/mime": { - "version": "1.6.0", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/filelist": { - "version": "1.0.2", - "license": "Apache-2.0", - "dependencies": { - "minimatch": "^3.0.4" - } - }, - "node_modules/fill-range": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/finalhandler": { - "version": "1.1.2", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/finalhandler/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/finalhandler/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/find-cache-dir": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/findup-sync": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/findup-sync/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/findup-sync/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/findup-sync/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/findup-sync/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/findup-sync/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/findup-sync/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/findup-sync/node_modules/micromatch": { - "version": "3.1.10", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fined": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^2.0.3", - "object.defaults": "^1.1.0", - "object.pick": "^1.2.0", - "parse-filepath": "^1.0.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/flagged-respawn": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/flat-cache": { - "version": "3.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^10.12.0 || >=12.0.0" - } - }, - "node_modules/flat-cache/node_modules/rimraf": { - "version": "3.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/flatted": { - "version": "3.2.4", - "dev": true, - "license": "ISC" - }, - "node_modules/flush-write-stream": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "readable-stream": "^2.3.6" - } - }, - "node_modules/follow-redirects": { - "version": "1.14.7", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "license": "MIT", - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/for-in": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/for-own": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "for-in": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/forever-agent": { - "version": "0.6.1", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/form-data": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/form-data-encoder": { - "version": "1.7.1", - "license": "MIT" - }, - "node_modules/formdata-node": { - "version": "4.3.2", - "license": "MIT", - "dependencies": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.1" - }, - "engines": { - "node": ">= 12.20" - } - }, - "node_modules/formidable": { - "version": "1.2.6", - "license": "MIT", - "funding": { - "url": "https://ko-fi.com/tunnckoCore/commissions" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fragment-cache": { - "version": "0.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "map-cache": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/from2": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - } - }, - "node_modules/fs-constants": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/fs-extra": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "node_modules/fs-mkdirp-stream": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.11", - "through2": "^2.0.3" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/fs-readfile-promise": { - "version": "3.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.11" - } - }, - "node_modules/fs-write-stream-atomic": { - "version": "1.0.10", - "dev": true, - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "license": "ISC" - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/fstream": { - "version": "1.0.12", - "dev": true, - "license": "ISC", - "dependencies": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "engines": { - "node": ">=0.6" - } - }, - "node_modules/fstream/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/ftps": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "duplex-child-process": "0.0.5", - "lodash": "^4.4.0" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "license": "MIT" - }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/g11n-pipeline": { - "version": "2.0.6", - "license": "Apache-2.0", - "dependencies": { - "swagger-client": "^3.8.3" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/gauge": { - "version": "2.7.4", - "license": "ISC", - "dependencies": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "node_modules/gauge/node_modules/ansi-regex": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gauge/node_modules/strip-ansi": { - "version": "3.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gaxios": { - "version": "1.8.4", - "license": "Apache-2.0", - "dependencies": { - "abort-controller": "^3.0.0", - "extend": "^3.0.2", - "https-proxy-agent": "^2.2.1", - "node-fetch": "^2.3.0" - } - }, - "node_modules/gaxios/node_modules/abort-controller": { - "version": "3.0.0", - "license": "MIT", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/gaxios/node_modules/agent-base": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "es6-promisify": "^5.0.0" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/gaxios/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/gaxios/node_modules/https-proxy-agent": { - "version": "2.2.4", - "license": "MIT", - "dependencies": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "engines": { - "node": ">= 4.5.0" - } - }, - "node_modules/gaze": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "globule": "^1.0.0" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/gcp-metadata": { - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "gaxios": "^1.0.2", - "json-bigint": "^0.3.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/gcs-resumable-upload": { - "version": "1.1.0", - "license": "MIT", - "dependencies": { - "abort-controller": "^2.0.2", - "configstore": "^4.0.0", - "gaxios": "^1.5.0", - "google-auth-library": "^3.0.0", - "pumpify": "^1.5.1", - "stream-events": "^1.0.4" - }, - "bin": { - "gcs-upload": "build/src/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/generate-function": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-property": "^1.0.2" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "1.0.3", - "dev": true, - "license": "ISC" - }, - "node_modules/get-intrinsic": { - "version": "1.1.1", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-package-type": { - "version": "0.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/get-stdin": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/get-stream": { - "version": "5.2.0", - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/get-symbol-description": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-value": { - "version": "2.0.6", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/getpass": { - "version": "0.1.7", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, - "node_modules/github-from-package": { - "version": "0.0.0", - "license": "MIT" - }, - "node_modules/glob": { - "version": "7.2.0", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/glob-stream": { - "version": "6.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "extend": "^3.0.0", - "glob": "^7.1.1", - "glob-parent": "^3.1.0", - "is-negated-glob": "^1.0.0", - "ordered-read-streams": "^1.0.0", - "pumpify": "^1.3.5", - "readable-stream": "^2.1.5", - "remove-trailing-separator": "^1.0.1", - "to-absolute-glob": "^2.0.0", - "unique-stream": "^2.0.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/glob-stream/node_modules/glob-parent": { - "version": "3.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "node_modules/glob-stream/node_modules/is-glob": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/glob-watcher": { - "version": "5.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "anymatch": "^2.0.0", - "async-done": "^1.2.0", - "chokidar": "^2.0.0", - "is-negated-glob": "^1.0.0", - "just-debounce": "^1.0.0", - "normalize-path": "^3.0.0", - "object.defaults": "^1.1.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/global-dirs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", - "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", - "dev": true, - "dependencies": { - "ini": "2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/global-dirs/node_modules/ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/global-modules": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/global-prefix": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/global-prefix/node_modules/which": { - "version": "1.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/globalize": { - "version": "1.7.0", - "license": "MIT", - "dependencies": { - "cldrjs": "^0.5.4" - } - }, - "node_modules/globals": { - "version": "11.12.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/globby": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/globule": { - "version": "1.3.3", - "dev": true, - "license": "MIT", - "dependencies": { - "glob": "~7.1.1", - "lodash": "~4.17.10", - "minimatch": "~3.0.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/globule/node_modules/glob": { - "version": "7.1.7", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glogg": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "sparkles": "^1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/google-auth-library": { - "version": "3.1.2", - "license": "Apache-2.0", - "dependencies": { - "base64-js": "^1.3.0", - "fast-text-encoding": "^1.0.0", - "gaxios": "^1.2.1", - "gcp-metadata": "^1.0.0", - "gtoken": "^2.3.2", - "https-proxy-agent": "^2.2.1", - "jws": "^3.1.5", - "lru-cache": "^5.0.0", - "semver": "^5.5.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/google-auth-library/node_modules/agent-base": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "es6-promisify": "^5.0.0" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/google-auth-library/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/google-auth-library/node_modules/https-proxy-agent": { - "version": "2.2.4", - "license": "MIT", - "dependencies": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "engines": { - "node": ">= 4.5.0" - } - }, - "node_modules/google-auth-library/node_modules/semver": { - "version": "5.7.1", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/google-p12-pem": { - "version": "1.0.5", - "license": "MIT", - "dependencies": { - "node-forge": "^0.10.0", - "pify": "^4.0.0" - }, - "bin": { - "gp12-pem": "build/src/bin/gp12-pem.js" - } - }, - "node_modules/google-p12-pem/node_modules/pify": { - "version": "4.0.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/got": { - "version": "10.7.0", - "license": "MIT", - "dependencies": { - "@sindresorhus/is": "^2.0.0", - "@szmarczak/http-timer": "^4.0.0", - "@types/cacheable-request": "^6.0.1", - "cacheable-lookup": "^2.0.0", - "cacheable-request": "^7.0.1", - "decompress-response": "^5.0.0", - "duplexer3": "^0.1.4", - "get-stream": "^5.0.0", - "lowercase-keys": "^2.0.0", - "mimic-response": "^2.1.0", - "p-cancelable": "^2.0.0", - "p-event": "^4.0.0", - "responselike": "^2.0.0", - "to-readable-stream": "^2.0.0", - "type-fest": "^0.10.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.9", - "license": "ISC" - }, - "node_modules/growl": { - "version": "1.9.2", - "license": "MIT" - }, - "node_modules/growly": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "optional": true - }, - "node_modules/gtoken": { - "version": "2.3.3", - "license": "MIT", - "dependencies": { - "gaxios": "^1.0.4", - "google-p12-pem": "^1.0.0", - "jws": "^3.1.5", - "mime": "^2.2.0", - "pify": "^4.0.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/gtoken/node_modules/pify": { - "version": "4.0.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/gulp": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "glob-watcher": "^5.0.3", - "gulp-cli": "^2.2.0", - "undertaker": "^1.2.1", - "vinyl-fs": "^3.0.0" - }, - "bin": { - "gulp": "bin/gulp.js" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/gulp-cli": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-colors": "^1.0.1", - "archy": "^1.0.0", - "array-sort": "^1.0.0", - "color-support": "^1.1.3", - "concat-stream": "^1.6.0", - "copy-props": "^2.0.1", - "fancy-log": "^1.3.2", - "gulplog": "^1.0.0", - "interpret": "^1.4.0", - "isobject": "^3.0.1", - "liftoff": "^3.1.0", - "matchdep": "^2.0.0", - "mute-stdout": "^1.0.0", - "pretty-hrtime": "^1.0.0", - "replace-homedir": "^1.0.0", - "semver-greatest-satisfied-range": "^1.1.0", - "v8flags": "^3.2.0", - "yargs": "^7.1.0" - }, - "bin": { - "gulp": "bin/gulp.js" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/gulp-cli/node_modules/ansi-colors": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-wrap": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gulp-concat": { - "version": "2.6.1", - "dev": true, - "license": "MIT", - "dependencies": { - "concat-with-sourcemaps": "^1.0.0", - "through2": "^2.0.0", - "vinyl": "^2.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/gulp-env": { - "version": "0.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ini": "^1.3.4", - "through2": "^2.0.0" - } - }, - "node_modules/gulp-file": { - "version": "0.4.0", - "dev": true, - "license": "BSD", - "dependencies": { - "through2": "^0.4.1", - "vinyl": "^2.1.0" - } - }, - "node_modules/gulp-file/node_modules/isarray": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/gulp-file/node_modules/object-keys": { - "version": "0.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/gulp-file/node_modules/readable-stream": { - "version": "1.0.34", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/gulp-file/node_modules/string_decoder": { - "version": "0.10.31", - "dev": true, - "license": "MIT" - }, - "node_modules/gulp-file/node_modules/through2": { - "version": "0.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "~1.0.17", - "xtend": "~2.1.1" - } - }, - "node_modules/gulp-file/node_modules/xtend": { - "version": "2.1.2", - "dev": true, - "dependencies": { - "object-keys": "~0.4.0" - }, - "engines": { - "node": ">=0.4" - } - }, - "node_modules/gulp-install": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "dargs": "^5.1.0", - "gulp-util": "^3.0.7", - "lodash.groupby": "^4.6.0", - "p-queue": "^1.0.0", - "through2": "^2.0.3", - "which": "^1.2.14" - } - }, - "node_modules/gulp-install/node_modules/which": { - "version": "1.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/gulp-merge-json": { - "version": "1.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "deprecate": "^1.0.0", - "json5": "^1.0.1", - "lodash.mergewith": "^4.6.1", - "plugin-error": "^1.0.1", - "through": "^2.3.8", - "vinyl": "^2.1.0" - } - }, - "node_modules/gulp-merge-json/node_modules/json5": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, - "node_modules/gulp-nodemon": { - "version": "2.5.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "colors": "^1.2.1", - "gulp": "^4.0.0", - "nodemon": "^2.0.2" - } - }, - "node_modules/gulp-print": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "gulp-util": "^3.0.6", - "map-stream": "~0.0.6" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">=1.2.10" - } - }, - "node_modules/gulp-util": { - "version": "3.0.8", - "dev": true, - "license": "MIT", - "dependencies": { - "array-differ": "^1.0.0", - "array-uniq": "^1.0.2", - "beeper": "^1.0.0", - "chalk": "^1.0.0", - "dateformat": "^2.0.0", - "fancy-log": "^1.1.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.0.0", - "minimist": "^1.1.0", - "multipipe": "^0.1.2", - "object-assign": "^3.0.0", - "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl": "^0.5.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/gulp-util/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gulp-util/node_modules/ansi-styles": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gulp-util/node_modules/chalk": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gulp-util/node_modules/clone": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "node_modules/gulp-util/node_modules/clone-stats": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/gulp-util/node_modules/object-assign": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gulp-util/node_modules/strip-ansi": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gulp-util/node_modules/supports-color": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/gulp-util/node_modules/vinyl": { - "version": "0.5.3", - "dev": true, - "license": "MIT", - "dependencies": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" - }, - "engines": { - "node": ">= 0.9" - } - }, - "node_modules/gulp-wrap": { - "version": "0.15.0", - "dev": true, - "dependencies": { - "consolidate": "^0.15.1", - "es6-promise": "^4.2.6", - "fs-readfile-promise": "^3.0.1", - "js-yaml": "^3.13.0", - "lodash": "^4.17.11", - "node.extend": "2.0.2", - "plugin-error": "^1.0.1", - "through2": "^3.0.1", - "tryit": "^1.0.1", - "vinyl-bufferstream": "^1.0.1" - }, - "engines": { - "node": ">=6.14", - "npm": ">=1.4.3" - } - }, - "node_modules/gulp-wrap/node_modules/through2": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - }, - "node_modules/gulp-yaml": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "bufferstreams": "1.1.0", - "gulp-util": "^3.0.6", - "js-yaml": "^3.4.3", - "through2": "^2.0.0", - "xtend": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/gulplog": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "glogg": "^1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/handle-thing": { - "version": "2.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/har-schema": { - "version": "2.0.0", - "license": "ISC", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "license": "MIT", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/harmony-reflect": { - "version": "1.6.2", - "dev": true, - "license": "(Apache-2.0 OR MPL-1.1)" - }, - "node_modules/has": { - "version": "1.0.3", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-ansi": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-ansi/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-bigints": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/has-gulplog": { - "version": "0.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "sparkles": "^1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/has-symbols": { - "version": "1.0.2", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-tostringtag": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-unicode": { - "version": "2.0.1", - "license": "ISC" - }, - "node_modules/has-value": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-values": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-values/node_modules/kind-of": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/hash-base": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/hash-base/node_modules/readable-stream": { - "version": "3.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/hash-base/node_modules/safe-buffer": { - "version": "5.2.1", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/hash-stream-validation": { - "version": "0.2.4", - "license": "MIT" - }, - "node_modules/hash.js": { - "version": "1.1.7", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/he": { - "version": "1.2.0", - "license": "MIT", - "bin": { - "he": "bin/he" - } - }, - "node_modules/helmet": { - "version": "3.23.3", - "license": "MIT", - "dependencies": { - "depd": "2.0.0", - "dont-sniff-mimetype": "1.1.0", - "feature-policy": "0.3.0", - "helmet-crossdomain": "0.4.0", - "helmet-csp": "2.10.0", - "hide-powered-by": "1.1.0", - "hpkp": "2.0.0", - "hsts": "2.2.0", - "nocache": "2.1.0", - "referrer-policy": "1.2.0", - "x-xss-protection": "1.3.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/helmet-crossdomain": { - "version": "0.4.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/helmet-csp": { - "version": "2.10.0", - "license": "MIT", - "dependencies": { - "bowser": "2.9.0", - "camelize": "1.0.0", - "content-security-policy-builder": "2.1.0", - "dasherize": "2.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/hide-powered-by": { - "version": "1.1.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/homedir-polyfill": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "parse-passwd": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/hosted-git-info": { - "version": "2.8.9", - "dev": true, - "license": "ISC" - }, - "node_modules/hpack.js": { - "version": "2.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - } - }, - "node_modules/hpkp": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/hsts": { - "version": "2.2.0", - "license": "MIT", - "dependencies": { - "depd": "2.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/html-encoding-sniffer": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "whatwg-encoding": "^1.0.5" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/html-entities": { - "version": "1.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/html-loader": { - "version": "0.4.5", - "dev": true, - "license": "MIT", - "dependencies": { - "es6-templates": "^0.2.2", - "fastparse": "^1.1.1", - "html-minifier": "^3.0.1", - "loader-utils": "^1.0.2", - "object-assign": "^4.1.0" - } - }, - "node_modules/html-loader-jest": { - "version": "0.2.1", - "dev": true, - "license": "ISC", - "dependencies": { - "html-loader": "^0.5.1" - } - }, - "node_modules/html-loader-jest/node_modules/html-loader": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "es6-templates": "^0.2.3", - "fastparse": "^1.1.1", - "html-minifier": "^3.5.8", - "loader-utils": "^1.1.0", - "object-assign": "^4.1.1" - } - }, - "node_modules/html-minifier": { - "version": "3.5.21", - "dev": true, - "license": "MIT", - "dependencies": { - "camel-case": "3.0.x", - "clean-css": "4.2.x", - "commander": "2.17.x", - "he": "1.2.x", - "param-case": "2.1.x", - "relateurl": "0.2.x", - "uglify-js": "3.4.x" - }, - "bin": { - "html-minifier": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/html-minifier-terser": { - "version": "5.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "camel-case": "^4.1.1", - "clean-css": "^4.2.3", - "commander": "^4.1.1", - "he": "^1.2.0", - "param-case": "^3.0.3", - "relateurl": "^0.2.7", - "terser": "^4.6.3" - }, - "bin": { - "html-minifier-terser": "cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/html-minifier-terser/node_modules/camel-case": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "pascal-case": "^3.1.2", - "tslib": "^2.0.3" - } - }, - "node_modules/html-minifier-terser/node_modules/commander": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/html-minifier-terser/node_modules/param-case": { - "version": "3.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "dot-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, - "node_modules/html-to-text": { - "version": "5.1.1", - "license": "MIT", - "dependencies": { - "he": "^1.2.0", - "htmlparser2": "^3.10.1", - "lodash": "^4.17.11", - "minimist": "^1.2.0" - }, - "bin": { - "html-to-text": "bin/cli.js" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/html-webpack-plugin": { - "version": "4.5.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/html-minifier-terser": "^5.0.0", - "@types/tapable": "^1.0.5", - "@types/webpack": "^4.41.8", - "html-minifier-terser": "^5.0.1", - "loader-utils": "^1.2.3", - "lodash": "^4.17.20", - "pretty-error": "^2.1.1", - "tapable": "^1.1.3", - "util.promisify": "1.0.0" - }, - "engines": { - "node": ">=6.9" - }, - "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" - } - }, - "node_modules/htmlparser2": { - "version": "3.10.1", - "license": "MIT", - "dependencies": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - } - }, - "node_modules/htmlparser2/node_modules/readable-stream": { - "version": "3.6.0", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/http-cache-semantics": { - "version": "4.1.0", - "license": "BSD-2-Clause" - }, - "node_modules/http-deceiver": { - "version": "1.2.7", - "dev": true, - "license": "MIT" - }, - "node_modules/http-errors": { - "version": "1.8.1", - "license": "MIT", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/http-errors/node_modules/depd": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/http-parser-js": { - "version": "0.5.5", - "dev": true, - "license": "MIT" - }, - "node_modules/http-proxy": { - "version": "1.18.1", - "dev": true, - "license": "MIT", - "dependencies": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/http-proxy-agent": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/http-proxy-middleware": { - "version": "0.19.1", - "dev": true, - "license": "MIT", - "dependencies": { - "http-proxy": "^1.17.0", - "is-glob": "^4.0.0", - "lodash": "^4.17.11", - "micromatch": "^3.1.10" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/http-proxy-middleware/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/http-proxy-middleware/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/http-proxy-middleware/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/http-proxy-middleware/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/http-proxy-middleware/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/http-proxy-middleware/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/http-proxy-middleware/node_modules/micromatch": { - "version": "3.1.10", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/http-signature": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, - "node_modules/http-status": { - "version": "1.5.0", - "license": "BSD-3-Clause", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/httpntlm": { - "version": "1.6.1", - "dependencies": { - "httpreq": ">=0.4.22", - "underscore": "~1.7.0" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/httpreq": { - "version": "0.5.2", - "license": "MIT", - "engines": { - "node": ">= 6.15.1" - } - }, - "node_modules/https-browserify": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/https-proxy-agent": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/human-signals": { - "version": "1.1.1", - "license": "Apache-2.0", - "engines": { - "node": ">=8.12.0" - } - }, - "node_modules/i18n": { - "version": "0.8.6", - "license": "MIT", - "dependencies": { - "debug": "*", - "make-plural": "^6.0.1", - "math-interval-parser": "^2.0.1", - "messageformat": "^2.3.0", - "mustache": "*", - "sprintf-js": "^1.1.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/icss-replace-symbols": { - "version": "1.1.0", - "dev": true, - "license": "ISC" - }, - "node_modules/icss-utils": { - "version": "4.1.1", - "dev": true, - "license": "ISC", - "dependencies": { - "postcss": "^7.0.14" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/identity-obj-proxy": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "harmony-reflect": "^1.4.6" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/ieee754": { - "version": "1.1.13", - "license": "BSD-3-Clause" - }, - "node_modules/iferr": { - "version": "0.1.5", - "dev": true, - "license": "MIT" - }, - "node_modules/ignore": { - "version": "4.0.6", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/image-type": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "file-type": "^10.10.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/imap": { - "version": "0.8.19", - "dependencies": { - "readable-stream": "1.1.x", - "utf7": ">=1.0.2" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/imap/node_modules/isarray": { - "version": "0.0.1", - "license": "MIT" - }, - "node_modules/imap/node_modules/readable-stream": { - "version": "1.1.14", - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/imap/node_modules/string_decoder": { - "version": "0.10.31", - "license": "MIT" - }, - "node_modules/import-fresh": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-fresh/node_modules/resolve-from": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/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, - "engines": { - "node": ">=4" - } - }, - "node_modules/import-local": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/import-local/node_modules/pkg-dir": { - "version": "4.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/in-publish": { - "version": "2.0.1", - "dev": true, - "license": "ISC", - "bin": { - "in-install": "in-install.js", - "in-publish": "in-publish.js", - "not-in-install": "not-in-install.js", - "not-in-publish": "not-in-publish.js" - } - }, - "node_modules/indent-string": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "repeating": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/infer-owner": { - "version": "1.0.4", - "dev": true, - "license": "ISC" - }, - "node_modules/inflection": { - "version": "1.13.1", - "engines": [ - "node >= 0.4.0" - ], - "license": "MIT" - }, - "node_modules/inflight": { - "version": "1.0.6", - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "license": "ISC" - }, - "node_modules/ini": { - "version": "1.3.8", - "license": "ISC" - }, - "node_modules/internal-ip": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "default-gateway": "^4.2.0", - "ipaddr.js": "^1.9.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/internal-slot": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/interpret": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/invert-kv": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/ip": { - "version": "1.1.5", - "license": "MIT" - }, - "node_modules/ip-regex": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/is-absolute": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-absolute-url": { - "version": "3.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-accessor-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-arguments": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "dev": true, - "license": "MIT" - }, - "node_modules/is-bigint": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "has-bigints": "^1.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-binary-path": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "binary-extensions": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-boolean-object": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-buffer": { - "version": "1.1.6", - "license": "MIT" - }, - "node_modules/is-callable": { - "version": "1.2.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-ci": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ci-info": "^2.0.0" - }, - "bin": { - "is-ci": "bin.js" - } - }, - "node_modules/is-core-module": { - "version": "2.8.1", - "dev": true, - "license": "MIT", - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-data-descriptor/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-date-object": { - "version": "1.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-descriptor": { - "version": "0.1.6", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-descriptor/node_modules/kind-of": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-docker": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "optional": true, - "bin": { - "is-docker": "cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-extendable": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-finite": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "number-is-nan": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-generator-fn": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-installed-globally": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", - "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, - "dependencies": { - "global-dirs": "^3.0.0", - "is-path-inside": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-installed-globally/node_modules/is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-negated-glob": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-negative-zero": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-npm": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", - "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-number": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number-object": { - "version": "1.0.6", - "dev": true, - "license": "MIT", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-number/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-obj": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-path-cwd": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-path-in-cwd": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-path-inside": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-path-inside": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "path-is-inside": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-potential-custom-element-name": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/is-property": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/is-regex": { - "version": "1.1.4", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-relative": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-unc-path": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-shared-array-buffer": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/is-stream-ended": { - "version": "0.1.4", - "license": "MIT" - }, - "node_modules/is-string": { - "version": "1.0.7", - "dev": true, - "license": "MIT", - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-symbol": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "has-symbols": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/is-unc-path": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "unc-path-regex": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-utf8": { - "version": "0.2.1", - "dev": true, - "license": "MIT" - }, - "node_modules/is-valid-glob": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-weakref": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-windows": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-wsl": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "is-docker": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true - }, - "node_modules/isarray": { - "version": "1.0.0", - "license": "MIT" - }, - "node_modules/isemail": { - "version": "3.2.0", - "license": "BSD-3-Clause", - "dependencies": { - "punycode": "2.x.x" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "license": "ISC" - }, - "node_modules/isobject": { - "version": "3.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/isstream": { - "version": "0.1.2", - "license": "MIT" - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.0", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "5.1.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report/node_modules/make-dir": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/istanbul-lib-report/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-lib-source-maps/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/istanbul-reports": { - "version": "3.1.3", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jade": { - "version": "0.26.3", - "dependencies": { - "commander": "0.6.1", - "mkdirp": "0.3.0" - }, - "bin": { - "jade": "bin/jade" - } - }, - "node_modules/jade/node_modules/commander": { - "version": "0.6.1", - "engines": { - "node": ">= 0.4.x" - } - }, - "node_modules/jade/node_modules/mkdirp": { - "version": "0.3.0", - "license": "MIT/X11", - "engines": { - "node": "*" - } - }, - "node_modules/jake": { - "version": "10.8.2", - "license": "Apache-2.0", - "dependencies": { - "async": "0.9.x", - "chalk": "^2.4.2", - "filelist": "^1.0.1", - "minimatch": "^3.0.4" - }, - "bin": { - "jake": "bin/cli.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/jake/node_modules/async": { - "version": "0.9.2", - "license": "MIT" - }, - "node_modules/jasmine": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.1.0.tgz", - "integrity": "sha512-4VhjbUgwfNS9CBnUMoSWr9tdNgOoOhNIjAD8YRxTn+PmOf4qTSC0Uqhk66dWGnz2vJxtNIU0uBjiwnsp4Ud9VA==", - "dev": true, - "dependencies": { - "glob": "^7.1.6", - "jasmine-core": "^4.1.0" - }, - "bin": { - "jasmine": "bin/jasmine.js" - } - }, - "node_modules/jasmine-core": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.1.1.tgz", - "integrity": "sha512-lmUfT5XcK9KKvt3lLYzn93hc4MGzlUBowExFVgzbSW0ZCrdeyS574dfsyfRhxbg81Wj4gk+RxUiTnj7KBfDA1g==", - "dev": true - }, - "node_modules/jasmine-reporters": { - "version": "2.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@xmldom/xmldom": "^0.7.3", - "mkdirp": "^1.0.4" - } - }, - "node_modules/jasmine-spec-reporter": { - "version": "7.0.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "colors": "1.4.0" - } - }, - "node_modules/jayson": { - "version": "2.1.2", - "license": "MIT", - "dependencies": { - "@types/node": "^10.3.5", - "commander": "^2.12.2", - "es6-promisify": "^5.0.0", - "eyes": "^0.1.8", - "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.1", - "lodash": "^4.17.11", - "uuid": "^3.2.1" - }, - "bin": { - "jayson": "bin/jayson.js" - } - }, - "node_modules/jayson/node_modules/@types/node": { - "version": "10.17.60", - "license": "MIT" - }, - "node_modules/jest": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/core": "^26.6.3", - "import-local": "^3.0.2", - "jest-cli": "^26.6.3" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-changed-files": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "execa": "^4.0.0", - "throat": "^5.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-cli": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/core": "^26.6.3", - "@jest/test-result": "^26.6.2", - "@jest/types": "^26.6.2", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "import-local": "^3.0.2", - "is-ci": "^2.0.0", - "jest-config": "^26.6.3", - "jest-util": "^26.6.2", - "jest-validate": "^26.6.2", - "prompts": "^2.0.1", - "yargs": "^15.4.1" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-cli/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-cli/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-cli/node_modules/cliui": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/jest-cli/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-cli/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-cli/node_modules/get-caller-file": { - "version": "2.0.5", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/jest-cli/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli/node_modules/require-main-filename": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/jest-cli/node_modules/string-width": { - "version": "4.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli/node_modules/which-module": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/jest-cli/node_modules/wrap-ansi": { - "version": "6.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli/node_modules/yargs": { - "version": "15.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-cli/node_modules/yargs-parser": { - "version": "18.1.3", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-config": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^26.6.3", - "@jest/types": "^26.6.2", - "babel-jest": "^26.6.3", - "chalk": "^4.0.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.1", - "graceful-fs": "^4.2.4", - "jest-environment-jsdom": "^26.6.2", - "jest-environment-node": "^26.6.2", - "jest-get-type": "^26.3.0", - "jest-jasmine2": "^26.6.3", - "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.6.2", - "jest-util": "^26.6.2", - "jest-validate": "^26.6.2", - "micromatch": "^4.0.2", - "pretty-format": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - }, - "peerDependencies": { - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "ts-node": { - "optional": true - } - } - }, - "node_modules/jest-config/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-config/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-config/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-config/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-config/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-config/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-diff": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^26.6.2", - "jest-get-type": "^26.3.0", - "pretty-format": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-diff/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-diff/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-diff/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-diff/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-diff/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-diff/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-docblock": { - "version": "26.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "detect-newline": "^3.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-each": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "chalk": "^4.0.0", - "jest-get-type": "^26.3.0", - "jest-util": "^26.6.2", - "pretty-format": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-each/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-each/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-each/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-each/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-each/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-each/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-environment-jsdom": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^26.6.2", - "@jest/fake-timers": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "jest-mock": "^26.6.2", - "jest-util": "^26.6.2", - "jsdom": "^16.4.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-environment-node": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^26.6.2", - "@jest/fake-timers": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "jest-mock": "^26.6.2", - "jest-util": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-get-type": { - "version": "26.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-haste-map": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "@types/graceful-fs": "^4.1.2", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.4", - "jest-regex-util": "^26.0.0", - "jest-serializer": "^26.6.2", - "jest-util": "^26.6.2", - "jest-worker": "^26.6.2", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7" - }, - "engines": { - "node": ">= 10.14.2" - }, - "optionalDependencies": { - "fsevents": "^2.1.2" - } - }, - "node_modules/jest-haste-map/node_modules/anymatch": { - "version": "3.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/jest-jasmine2": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^26.6.2", - "@jest/source-map": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "expect": "^26.6.2", - "is-generator-fn": "^2.0.0", - "jest-each": "^26.6.2", - "jest-matcher-utils": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-runtime": "^26.6.3", - "jest-snapshot": "^26.6.2", - "jest-util": "^26.6.2", - "pretty-format": "^26.6.2", - "throat": "^5.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-jasmine2/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-jasmine2/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-jasmine2/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-jasmine2/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-jasmine2/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-jasmine2/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-junit": { - "version": "8.0.0", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "jest-validate": "^24.0.0", - "mkdirp": "^0.5.1", - "strip-ansi": "^4.0.0", - "xml": "^1.0.1" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/jest-junit/node_modules/@jest/types": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^13.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-junit/node_modules/@types/istanbul-reports": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "*", - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/jest-junit/node_modules/@types/yargs": { - "version": "13.0.12", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/jest-junit/node_modules/ansi-regex": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-junit/node_modules/jest-get-type": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-junit/node_modules/jest-validate": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "camelcase": "^5.3.1", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "leven": "^3.1.0", - "pretty-format": "^24.9.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-junit/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/jest-junit/node_modules/pretty-format": { - "version": "24.9.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^24.9.0", - "ansi-regex": "^4.0.0", - "ansi-styles": "^3.2.0", - "react-is": "^16.8.4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/jest-junit/node_modules/react-is": { - "version": "16.13.1", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-junit/node_modules/strip-ansi": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-junit/node_modules/strip-ansi/node_modules/ansi-regex": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/jest-leak-detector": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-get-type": "^26.3.0", - "pretty-format": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-matcher-utils": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "jest-diff": "^26.6.2", - "jest-get-type": "^26.3.0", - "pretty-format": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-matcher-utils/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-matcher-utils/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-matcher-utils/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-matcher-utils/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-matcher-utils/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-matcher-utils/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-message-util": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "@jest/types": "^26.6.2", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "micromatch": "^4.0.2", - "pretty-format": "^26.6.2", - "slash": "^3.0.0", - "stack-utils": "^2.0.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-message-util/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-message-util/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-message-util/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-message-util/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-message-util/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-message-util/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-mock": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "@types/node": "*" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-pnp-resolver": { - "version": "1.2.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jest-resolve": "*" - }, - "peerDependenciesMeta": { - "jest-resolve": { - "optional": true - } - } - }, - "node_modules/jest-regex-util": { - "version": "26.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-resolve": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^26.6.2", - "read-pkg-up": "^7.0.1", - "resolve": "^1.18.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-resolve-dependencies": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-snapshot": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-resolve/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-resolve/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-resolve/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-resolve/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-resolve/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-resolve/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runner": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^26.6.2", - "@jest/environment": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.7.1", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-config": "^26.6.3", - "jest-docblock": "^26.0.0", - "jest-haste-map": "^26.6.2", - "jest-leak-detector": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-resolve": "^26.6.2", - "jest-runtime": "^26.6.3", - "jest-util": "^26.6.2", - "jest-worker": "^26.6.2", - "source-map-support": "^0.5.6", - "throat": "^5.0.0" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-runner/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-runner/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-runner/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-runner/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-runner/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runner/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime": { - "version": "26.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^26.6.2", - "@jest/environment": "^26.6.2", - "@jest/fake-timers": "^26.6.2", - "@jest/globals": "^26.6.2", - "@jest/source-map": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/yargs": "^15.0.0", - "chalk": "^4.0.0", - "cjs-module-lexer": "^0.6.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.4", - "jest-config": "^26.6.3", - "jest-haste-map": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-mock": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.6.2", - "jest-snapshot": "^26.6.2", - "jest-util": "^26.6.2", - "jest-validate": "^26.6.2", - "slash": "^3.0.0", - "strip-bom": "^4.0.0", - "yargs": "^15.4.1" - }, - "bin": { - "jest-runtime": "bin/jest-runtime.js" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-runtime/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-runtime/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-runtime/node_modules/cliui": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/jest-runtime/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-runtime/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-runtime/node_modules/get-caller-file": { - "version": "2.0.5", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/jest-runtime/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime/node_modules/require-main-filename": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/jest-runtime/node_modules/string-width": { - "version": "4.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime/node_modules/which-module": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/jest-runtime/node_modules/wrap-ansi": { - "version": "6.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime/node_modules/yargs": { - "version": "15.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-runtime/node_modules/yargs-parser": { - "version": "18.1.3", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jest-serializer": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "graceful-fs": "^4.2.4" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-snapshot": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0", - "@jest/types": "^26.6.2", - "@types/babel__traverse": "^7.0.4", - "@types/prettier": "^2.0.0", - "chalk": "^4.0.0", - "expect": "^26.6.2", - "graceful-fs": "^4.2.4", - "jest-diff": "^26.6.2", - "jest-get-type": "^26.3.0", - "jest-haste-map": "^26.6.2", - "jest-matcher-utils": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-resolve": "^26.6.2", - "natural-compare": "^1.4.0", - "pretty-format": "^26.6.2", - "semver": "^7.3.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-snapshot/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-snapshot/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-snapshot/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-snapshot/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-snapshot/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-snapshot/node_modules/lru-cache": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.3.5", - "dev": true, - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jest-snapshot/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-snapshot/node_modules/yallist": { - "version": "4.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/jest-util": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "@types/node": "*", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "is-ci": "^2.0.0", - "micromatch": "^4.0.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-util/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-util/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-util/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-util/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-util/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-util/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-validate": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "camelcase": "^6.0.0", - "chalk": "^4.0.0", - "jest-get-type": "^26.3.0", - "leven": "^3.1.0", - "pretty-format": "^26.6.2" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-validate/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-validate/node_modules/camelcase": { - "version": "6.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/jest-validate/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-validate/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-validate/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-validate/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-validate/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-watcher": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/test-result": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "jest-util": "^26.6.2", - "string-length": "^4.0.1" - }, - "engines": { - "node": ">= 10.14.2" - } - }, - "node_modules/jest-watcher/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/jest-watcher/node_modules/chalk": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/jest-watcher/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/jest-watcher/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-watcher/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-watcher/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/jest-worker/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/jest-worker/node_modules/merge-stream": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jmespath": { - "version": "0.15.0", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/js-base64": { - "version": "2.6.4", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "3.14.1", - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/js2xmlparser": { - "version": "3.0.0", - "license": "Apache-2.0", - "dependencies": { - "xmlcreate": "^1.0.1" - } - }, - "node_modules/jsbn": { - "version": "0.1.1", - "license": "MIT" - }, - "node_modules/jsdom": { - "version": "16.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "abab": "^2.0.5", - "acorn": "^8.2.4", - "acorn-globals": "^6.0.0", - "cssom": "^0.4.4", - "cssstyle": "^2.3.0", - "data-urls": "^2.0.0", - "decimal.js": "^10.2.1", - "domexception": "^2.0.1", - "escodegen": "^2.0.0", - "form-data": "^3.0.0", - "html-encoding-sniffer": "^2.0.1", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.0", - "parse5": "6.0.1", - "saxes": "^5.0.1", - "symbol-tree": "^3.2.4", - "tough-cookie": "^4.0.0", - "w3c-hr-time": "^1.0.2", - "w3c-xmlserializer": "^2.0.0", - "webidl-conversions": "^6.1.0", - "whatwg-encoding": "^1.0.5", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.5.0", - "ws": "^7.4.6", - "xml-name-validator": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "peerDependencies": { - "canvas": "^2.5.0" - }, - "peerDependenciesMeta": { - "canvas": { - "optional": true - } - } - }, - "node_modules/jsdom/node_modules/acorn": { - "version": "8.7.0", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/jsesc": { - "version": "2.5.2", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/json-bigint": { - "version": "0.3.1", - "license": "MIT", - "dependencies": { - "bignumber.js": "^9.0.0" - } - }, - "node_modules/json-buffer": { - "version": "3.0.1", - "license": "MIT" - }, - "node_modules/json-loader": { - "version": "0.5.7", - "dev": true, - "license": "MIT" - }, - "node_modules/json-parse-better-errors": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "dev": true, - "license": "MIT" - }, - "node_modules/json-schema": { - "version": "0.4.0", - "license": "(AFL-2.1 OR BSD-3-Clause)" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "license": "MIT" - }, - "node_modules/json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "license": "ISC" - }, - "node_modules/json3": { - "version": "3.3.3", - "dev": true, - "license": "MIT" - }, - "node_modules/json5": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/jsonfile": { - "version": "4.0.0", - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/jsonparse": { - "version": "1.3.1", - "engines": [ - "node >= 0.2.0" - ], - "license": "MIT" - }, - "node_modules/JSONStream": { - "version": "1.3.5", - "license": "(MIT OR Apache-2.0)", - "dependencies": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - }, - "bin": { - "JSONStream": "bin.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/jsprim": { - "version": "1.4.2", - "license": "MIT", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/jsprim/node_modules/core-util-is": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/jsprim/node_modules/verror": { - "version": "1.10.0", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/just-debounce": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/jwa": { - "version": "1.4.1", - "license": "MIT", - "dependencies": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/jws": { - "version": "3.2.2", - "license": "MIT", - "dependencies": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/keyv": { - "version": "4.0.5", - "license": "MIT", - "dependencies": { - "json-buffer": "3.0.1" - } - }, - "node_modules/killable": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/kind-of": { - "version": "6.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/kleur": { - "version": "3.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/last-run": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "default-resolution": "^2.0.0", - "es6-weak-map": "^2.0.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, - "dependencies": { - "package-json": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lazystream": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "^2.0.5" - }, - "engines": { - "node": ">= 0.6.3" - } - }, - "node_modules/lcid": { - "version": "2.0.0", - "license": "MIT", - "dependencies": { - "invert-kv": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/ldap-filter": { - "version": "0.3.3", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/ldapjs": { - "version": "2.3.1", - "license": "MIT", - "dependencies": { - "abstract-logging": "^2.0.0", - "asn1": "^0.2.4", - "assert-plus": "^1.0.0", - "backoff": "^2.5.0", - "ldap-filter": "^0.3.3", - "once": "^1.4.0", - "vasync": "^2.2.0", - "verror": "^1.8.1" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/lead": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "flush-write-stream": "^1.0.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/leven": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/levn": { - "version": "0.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/libbase64": { - "version": "1.2.1", - "license": "MIT" - }, - "node_modules/libmime": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "encoding-japanese": "1.0.30", - "iconv-lite": "0.6.2", - "libbase64": "1.2.1", - "libqp": "1.1.0" - } - }, - "node_modules/libmime/node_modules/iconv-lite": { - "version": "0.6.2", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/liboneandone": { - "version": "1.2.0", - "license": "BSD", - "dependencies": { - "mocha": "^2.5.3", - "request": "^2.74.0" - } - }, - "node_modules/libqp": { - "version": "1.1.0", - "license": "MIT" - }, - "node_modules/liftoff": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "extend": "^3.0.0", - "findup-sync": "^3.0.0", - "fined": "^1.0.1", - "flagged-respawn": "^1.0.0", - "is-plain-object": "^2.0.4", - "object.map": "^1.0.0", - "rechoir": "^0.6.2", - "resolve": "^1.1.7" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "dev": true, - "license": "MIT" - }, - "node_modules/linkify-it": { - "version": "3.0.2", - "license": "MIT", - "dependencies": { - "uc.micro": "^1.0.1" - } - }, - "node_modules/load-json-file": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/load-json-file/node_modules/parse-json": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "error-ex": "^1.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/load-json-file/node_modules/strip-bom": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-utf8": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/loader-runner": { - "version": "2.4.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4.3.0 <5.0.0 || >=5.10" - } - }, - "node_modules/loader-utils": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^1.0.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/loader-utils/node_modules/json5": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.0" - }, - "bin": { - "json5": "lib/cli.js" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "license": "MIT" - }, - "node_modules/lodash._basecopy": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._basetostring": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._basevalues": { - "version": "3.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._getnative": { - "version": "3.9.1", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._isiterateecall": { - "version": "3.0.9", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._reescape": { - "version": "3.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._reevaluate": { - "version": "3.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._reinterpolate": { - "version": "3.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash._root": { - "version": "3.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.debounce": { - "version": "4.0.8", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.escape": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash._root": "^3.0.0" - } - }, - "node_modules/lodash.groupby": { - "version": "4.6.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.isarguments": { - "version": "3.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.isarray": { - "version": "3.0.4", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.keys": { - "version": "3.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, - "node_modules/lodash.merge": { - "version": "4.6.2", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.mergewith": { - "version": "4.6.2", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.restparam": { - "version": "3.6.1", - "dev": true, - "license": "MIT" - }, - "node_modules/lodash.template": { - "version": "3.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", - "lodash._basevalues": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0", - "lodash.keys": "^3.0.0", - "lodash.restparam": "^3.0.0", - "lodash.templatesettings": "^3.0.0" - } - }, - "node_modules/lodash.templatesettings": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" - } - }, - "node_modules/lodash.truncate": { - "version": "4.4.2", - "dev": true, - "license": "MIT" - }, - "node_modules/loglevel": { - "version": "1.8.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - }, - "funding": { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/loglevel" - } - }, - "node_modules/long": { - "version": "4.0.0", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/loopback": { - "version": "3.28.0", - "license": "MIT", - "dependencies": { - "async": "^2.0.1", - "bcryptjs": "^2.1.0", - "bluebird": "^3.1.1", - "body-parser": "^1.12.0", - "canonical-json": "0.0.4", - "debug": "^2.1.2", - "depd": "^1.0.0", - "ejs": "^2.3.1", - "express": "^4.14.0", - "inflection": "^1.6.0", - "isemail": "^3.2.0", - "loopback-connector-remote": "^3.0.0", - "loopback-datasource-juggler": "^3.28.0", - "loopback-filters": "^1.0.0", - "loopback-phase": "^3.0.0", - "nodemailer": "^6.4.16", - "nodemailer-direct-transport": "^3.3.2", - "nodemailer-stub-transport": "^1.1.0", - "serve-favicon": "^2.2.0", - "stable": "^0.1.5", - "strong-globalize": "^4.1.1", - "strong-remoting": "^3.11.0", - "uid2": "0.0.3", - "underscore.string": "^3.3.5" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-boot": { - "version": "3.3.1", - "license": "MIT", - "dependencies": { - "async": "^2.4.0", - "bluebird": "^3.5.3", - "commondir": "^1.0.1", - "debug": "^4.1.1", - "lodash": "^4.17.11", - "semver": "^5.1.0", - "strong-globalize": "^4.1.1", - "toposort": "^2.0.2" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/loopback-boot/node_modules/semver": { - "version": "5.7.1", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/loopback-component-explorer": { - "version": "6.5.1", - "license": "MIT", - "dependencies": { - "debug": "^3.1.0", - "lodash": "^4.17.11", - "loopback-swagger": "^5.0.0", - "strong-globalize": "^4.1.1", - "swagger-ui": "^2.2.5" - }, - "engines": { - "node": ">=8.9" - } - }, - "node_modules/loopback-component-explorer/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/loopback-component-storage": { - "version": "3.6.1", - "license": "Artistic-2.0", - "dependencies": { - "async": "^2.6.1", - "debug": "^3.1.0", - "formidable": "^1.2.1", - "pkgcloud": "^2.0.0", - "strong-globalize": "^4.1.1", - "uuid": "^3.2.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-component-storage/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/loopback-connector": { - "version": "4.11.1", - "license": "MIT", - "dependencies": { - "async": "^3.2.0", - "bluebird": "^3.7.2", - "debug": "^4.1.1", - "msgpack5": "^4.2.0", - "strong-globalize": "^5.1.0", - "uuid": "^7.0.3" - }, - "engines": { - "node": ">=8.9" - } - }, - "node_modules/loopback-connector-mysql": { - "version": "5.4.4", - "license": "MIT", - "dependencies": { - "async": "^2.6.1", - "debug": "^3.1.0", - "lodash": "^4.17.11", - "loopback-connector": "^4.0.0", - "mysql": "^2.11.1", - "strong-globalize": "^5.0.5" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-connector-mysql/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/loopback-connector-mysql/node_modules/invert-kv": { - "version": "3.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sindresorhus/invert-kv?sponsor=1" - } - }, - "node_modules/loopback-connector-mysql/node_modules/lcid": { - "version": "3.1.1", - "license": "MIT", - "dependencies": { - "invert-kv": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-connector-mysql/node_modules/mem": { - "version": "5.1.1", - "license": "MIT", - "dependencies": { - "map-age-cleaner": "^0.1.3", - "mimic-fn": "^2.1.0", - "p-is-promise": "^2.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-connector-mysql/node_modules/mkdirp": { - "version": "0.5.5", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/loopback-connector-mysql/node_modules/os-locale": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "execa": "^4.0.0", - "lcid": "^3.0.0", - "mem": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/loopback-connector-mysql/node_modules/strong-globalize": { - "version": "5.1.0", - "license": "Artistic-2.0", - "dependencies": { - "accept-language": "^3.0.18", - "debug": "^4.1.1", - "globalize": "^1.5.0", - "lodash": "^4.17.15", - "md5": "^2.2.1", - "mkdirp": "^0.5.5", - "os-locale": "^5.0.0", - "yamljs": "^0.3.0" - }, - "engines": { - "node": ">=8.9" - } - }, - "node_modules/loopback-connector-mysql/node_modules/strong-globalize/node_modules/debug": { - "version": "4.3.3", - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/loopback-connector-remote": { - "version": "3.4.1", - "license": "MIT", - "dependencies": { - "loopback-datasource-juggler": "^3.0.0", - "strong-remoting": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/loopback-connector/node_modules/async": { - "version": "3.2.3", - "license": "MIT" - }, - "node_modules/loopback-connector/node_modules/invert-kv": { - "version": "3.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sindresorhus/invert-kv?sponsor=1" - } - }, - "node_modules/loopback-connector/node_modules/lcid": { - "version": "3.1.1", - "license": "MIT", - "dependencies": { - "invert-kv": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-connector/node_modules/mem": { - "version": "5.1.1", - "license": "MIT", - "dependencies": { - "map-age-cleaner": "^0.1.3", - "mimic-fn": "^2.1.0", - "p-is-promise": "^2.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-connector/node_modules/mkdirp": { - "version": "0.5.5", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/loopback-connector/node_modules/os-locale": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "execa": "^4.0.0", - "lcid": "^3.0.0", - "mem": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/loopback-connector/node_modules/strong-globalize": { - "version": "5.1.0", - "license": "Artistic-2.0", - "dependencies": { - "accept-language": "^3.0.18", - "debug": "^4.1.1", - "globalize": "^1.5.0", - "lodash": "^4.17.15", - "md5": "^2.2.1", - "mkdirp": "^0.5.5", - "os-locale": "^5.0.0", - "yamljs": "^0.3.0" - }, - "engines": { - "node": ">=8.9" - } - }, - "node_modules/loopback-connector/node_modules/uuid": { - "version": "7.0.3", - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/loopback-context": { - "version": "3.5.2", - "license": "MIT", - "dependencies": { - "cls-hooked": "^4.2.0" - }, - "engines": { - "node": "^8.2.1 || ^10.14 || ^12.15" - } - }, - "node_modules/loopback-datasource-juggler": { - "version": "3.36.1", - "license": "MIT", - "dependencies": { - "async": "^2.6.0", - "bluebird": "^3.1.1", - "debug": "^3.1.0", - "depd": "^1.0.0", - "inflection": "^1.6.0", - "lodash": "^4.17.4", - "loopback-connector": "^4.4.0", - "minimatch": "^3.0.3", - "qs": "^6.5.0", - "shortid": "^2.2.6", - "strong-globalize": "^4.1.1", - "traverse": "^0.6.6", - "uuid": "^3.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-datasource-juggler/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/loopback-datasource-juggler/node_modules/depd": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/loopback-datatype-geopoint": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/loopback-filters": { - "version": "1.1.1", - "license": "MIT", - "dependencies": { - "debug": "^3.1.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/loopback-filters/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/loopback-phase": { - "version": "3.4.0", - "license": "MIT", - "dependencies": { - "async": "^2.6.1", - "debug": "^3.1.0", - "strong-globalize": "^4.1.1" - }, - "engines": { - "node": ">=8.9" - } - }, - "node_modules/loopback-phase/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/loopback-swagger": { - "version": "5.9.0", - "license": "MIT", - "dependencies": { - "async": "^2.1.4", - "debug": "^3.1.0", - "ejs": "^2.5.5", - "lodash": "^4.17.11", - "strong-globalize": "^4.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/loopback-swagger/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/loopback/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/loopback/node_modules/depd": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/loopback/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/loud-rejection": { - "version": "1.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/lower-case": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/lowercase-keys": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/mailparser": { - "version": "2.8.1", - "license": "(MIT OR EUPL-1.1+)", - "dependencies": { - "encoding-japanese": "1.0.30", - "he": "1.2.0", - "html-to-text": "5.1.1", - "iconv-lite": "0.6.2", - "libmime": "5.0.0", - "linkify-it": "3.0.2", - "mailsplit": "5.0.0", - "nodemailer": "6.4.11", - "tlds": "1.208.0" - } - }, - "node_modules/mailparser/node_modules/iconv-lite": { - "version": "0.6.2", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mailparser/node_modules/nodemailer": { - "version": "6.4.11", - "hasInstallScript": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/mailsplit": { - "version": "5.0.0", - "license": "(MIT OR EUPL-1.1+)", - "dependencies": { - "libbase64": "1.2.1", - "libmime": "4.2.1", - "libqp": "1.1.0" - } - }, - "node_modules/mailsplit/node_modules/iconv-lite": { - "version": "0.5.0", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mailsplit/node_modules/libmime": { - "version": "4.2.1", - "license": "MIT", - "dependencies": { - "encoding-japanese": "1.0.30", - "iconv-lite": "0.5.0", - "libbase64": "1.2.1", - "libqp": "1.1.0" - } - }, - "node_modules/make-dir": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pify": "^4.0.1", - "semver": "^5.6.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/make-dir/node_modules/pify": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/make-iterator": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/make-plural": { - "version": "6.2.2", - "license": "ISC" - }, - "node_modules/makeerror": { - "version": "1.0.12", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "tmpl": "1.0.5" - } - }, - "node_modules/map-age-cleaner": { - "version": "0.1.3", - "license": "MIT", - "dependencies": { - "p-defer": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/map-cache": { - "version": "0.2.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/map-obj": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/map-stream": { - "version": "0.0.7", - "dev": true, - "license": "MIT" - }, - "node_modules/map-visit": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "object-visit": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/matchdep": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "findup-sync": "^2.0.0", - "micromatch": "^3.0.4", - "resolve": "^1.4.0", - "stack-trace": "0.0.10" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/matchdep/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/matchdep/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/matchdep/node_modules/findup-sync": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "detect-file": "^1.0.0", - "is-glob": "^3.1.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/matchdep/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/matchdep/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/matchdep/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/matchdep/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/matchdep/node_modules/is-glob": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-extglob": "^2.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/matchdep/node_modules/micromatch": { - "version": "3.1.10", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/math-interval-parser": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/md5": { - "version": "2.3.0", - "license": "BSD-3-Clause", - "dependencies": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, - "node_modules/md5.js": { - "version": "1.3.5", - "dev": true, - "license": "MIT", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mem": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/memory-fs": { - "version": "0.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, - "node_modules/meow": { - "version": "3.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/meow/node_modules/find-up": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/meow/node_modules/path-exists": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/meow/node_modules/read-pkg": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/meow/node_modules/read-pkg-up": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "license": "MIT" - }, - "node_modules/merge-stream": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "^2.0.1" - } - }, - "node_modules/messageformat": { - "version": "2.3.0", - "license": "MIT", - "dependencies": { - "make-plural": "^4.3.0", - "messageformat-formatters": "^2.0.1", - "messageformat-parser": "^4.1.2" - } - }, - "node_modules/messageformat-formatters": { - "version": "2.0.1", - "license": "MIT" - }, - "node_modules/messageformat-parser": { - "version": "4.1.3", - "license": "MIT" - }, - "node_modules/messageformat/node_modules/make-plural": { - "version": "4.3.0", - "license": "ISC", - "bin": { - "make-plural": "bin/make-plural" - }, - "optionalDependencies": { - "minimist": "^1.2.0" - } - }, - "node_modules/methods": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/micromatch": { - "version": "4.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/micromatch/node_modules/braces": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/micromatch/node_modules/fill-range": { - "version": "7.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/micromatch/node_modules/is-number": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/micromatch/node_modules/to-regex-range": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/miller-rabin": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - }, - "bin": { - "miller-rabin": "bin/miller-rabin" - } - }, - "node_modules/miller-rabin/node_modules/bn.js": { - "version": "4.12.0", - "dev": true, - "license": "MIT" - }, - "node_modules/mime": { - "version": "2.6.0", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mime-db": { - "version": "1.51.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.34", - "license": "MIT", - "dependencies": { - "mime-db": "1.51.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/mimic-response": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/minimatch": { - "version": "3.0.4", - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.5", - "license": "MIT" - }, - "node_modules/mississippi": { - "version": "3.0.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^3.0.0", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mixin-deep": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mixin-deep/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/mkdirp": { - "version": "1.0.4", - "license": "MIT", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "license": "MIT" - }, - "node_modules/mktmpdir": { - "version": "0.1.1", - "license": "MIT", - "dependencies": { - "rimraf": "~2.2.8" - } - }, - "node_modules/mktmpdir/node_modules/rimraf": { - "version": "2.2.8", - "license": "MIT", - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/mocha": { - "version": "2.5.3", - "license": "MIT", - "dependencies": { - "commander": "2.3.0", - "debug": "2.2.0", - "diff": "1.4.0", - "escape-string-regexp": "1.0.2", - "glob": "3.2.11", - "growl": "1.9.2", - "jade": "0.26.3", - "mkdirp": "0.5.1", - "supports-color": "1.2.0", - "to-iso-string": "0.0.2" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 0.8.x" - } - }, - "node_modules/mocha/node_modules/commander": { - "version": "2.3.0", - "engines": { - "node": ">= 0.6.x" - } - }, - "node_modules/mocha/node_modules/debug": { - "version": "2.2.0", - "license": "MIT", - "dependencies": { - "ms": "0.7.1" - } - }, - "node_modules/mocha/node_modules/escape-string-regexp": { - "version": "1.0.2", - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/mocha/node_modules/glob": { - "version": "3.2.11", - "license": "BSD", - "dependencies": { - "inherits": "2", - "minimatch": "0.3" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mocha/node_modules/lru-cache": { - "version": "2.7.3", - "license": "ISC" - }, - "node_modules/mocha/node_modules/minimatch": { - "version": "0.3.0", - "license": "MIT", - "dependencies": { - "lru-cache": "2", - "sigmund": "~1.0.0" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mocha/node_modules/minimist": { - "version": "0.0.8", - "license": "MIT" - }, - "node_modules/mocha/node_modules/mkdirp": { - "version": "0.5.1", - "license": "MIT", - "dependencies": { - "minimist": "0.0.8" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/mocha/node_modules/ms": { - "version": "0.7.1" - }, - "node_modules/mocha/node_modules/supports-color": { - "version": "1.2.0", - "license": "MIT", - "bin": { - "supports-color": "cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/move-concurrently": { - "version": "1.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - } - }, - "node_modules/move-concurrently/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/ms": { - "version": "2.1.2", - "license": "MIT" - }, - "node_modules/msgpack-js": { - "version": "0.3.0", - "dependencies": { - "bops": "~0.0.6" - } - }, - "node_modules/msgpack-js/node_modules/base64-js": { - "version": "0.0.2", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/msgpack-js/node_modules/bops": { - "version": "0.0.7", - "license": "MIT", - "dependencies": { - "base64-js": "0.0.2", - "to-utf8": "0.0.1" - } - }, - "node_modules/msgpack-stream": { - "version": "0.0.13", - "license": "MIT", - "dependencies": { - "bops": "1.0.0", - "msgpack-js": "0.3.0", - "through": "2.3.4" - } - }, - "node_modules/msgpack-stream/node_modules/through": { - "version": "2.3.4", - "license": "MIT" - }, - "node_modules/msgpack5": { - "version": "4.5.1", - "license": "MIT", - "dependencies": { - "bl": "^2.0.1", - "inherits": "^2.0.3", - "readable-stream": "^2.3.6", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/multicast-dns": { - "version": "6.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "dns-packet": "^1.3.1", - "thunky": "^1.0.2" - }, - "bin": { - "multicast-dns": "cli.js" - } - }, - "node_modules/multicast-dns-service-types": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/multipipe": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "duplexer2": "0.0.2" - } - }, - "node_modules/mustache": { - "version": "4.2.0", - "license": "MIT", - "bin": { - "mustache": "bin/mustache" - } - }, - "node_modules/mute-stdout": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/mux-demux": { - "version": "3.7.9", - "dependencies": { - "duplex": "~1.0.0", - "json-buffer": "~2.0.4", - "msgpack-stream": "~0.0.10", - "stream-combiner": "0.0.2", - "stream-serializer": "~1.1.1", - "through": "~2.3.1", - "xtend": "~1.0.3" - } - }, - "node_modules/mux-demux/node_modules/json-buffer": { - "version": "2.0.11", - "license": "MIT" - }, - "node_modules/mux-demux/node_modules/xtend": { - "version": "1.0.3", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/mysql": { - "version": "2.18.1", - "license": "MIT", - "dependencies": { - "bignumber.js": "9.0.0", - "readable-stream": "2.3.7", - "safe-buffer": "5.1.2", - "sqlstring": "2.3.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mysql2": { - "version": "1.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "denque": "^1.4.1", - "generate-function": "^2.3.1", - "iconv-lite": "^0.5.0", - "long": "^4.0.0", - "lru-cache": "^5.1.1", - "named-placeholders": "^1.1.2", - "seq-queue": "^0.0.5", - "sqlstring": "^2.3.1" - }, - "engines": { - "node": ">= 8.0" - } - }, - "node_modules/mysql2/node_modules/iconv-lite": { - "version": "0.5.2", - "dev": true, - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/named-placeholders": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "lru-cache": "^4.1.3" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/named-placeholders/node_modules/lru-cache": { - "version": "4.1.5", - "dev": true, - "license": "ISC", - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "node_modules/named-placeholders/node_modules/yallist": { - "version": "2.1.2", - "dev": true, - "license": "ISC" - }, - "node_modules/nan": { - "version": "2.15.0", - "dev": true, - "license": "MIT" - }, - "node_modules/nanoid": { - "version": "2.1.11", - "license": "MIT" - }, - "node_modules/nanomatch": { - "version": "1.2.13", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanomatch/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanomatch/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanomatch/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanomatch/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanomatch/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nanomatch/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/napi-build-utils": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/negotiator": { - "version": "0.6.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/neo-async": { - "version": "2.6.2", - "dev": true, - "license": "MIT" - }, - "node_modules/next-tick": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/nice-try": { - "version": "1.0.5", - "license": "MIT" - }, - "node_modules/no-case": { - "version": "2.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "lower-case": "^1.1.1" - } - }, - "node_modules/nocache": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/node-abi": { - "version": "2.30.1", - "license": "MIT", - "dependencies": { - "semver": "^5.4.1" - } - }, - "node_modules/node-abi/node_modules/semver": { - "version": "5.7.1", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/node-addon-api": { - "version": "3.2.1", - "license": "MIT" - }, - "node_modules/node-domexception": { - "version": "1.0.0", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "license": "MIT", - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "2.6.6", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - } - }, - "node_modules/node-fetch/node_modules/tr46": { - "version": "0.0.3", - "license": "MIT" - }, - "node_modules/node-fetch/node_modules/webidl-conversions": { - "version": "3.0.1", - "license": "BSD-2-Clause" - }, - "node_modules/node-fetch/node_modules/whatwg-url": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/node-forge": { - "version": "0.10.0", - "license": "(BSD-3-Clause OR GPL-2.0)", - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/node-gyp": { - "version": "3.8.0", - "dev": true, - "license": "MIT", - "dependencies": { - "fstream": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "osenv": "0", - "request": "^2.87.0", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^2.0.0", - "which": "1" - }, - "bin": { - "node-gyp": "bin/node-gyp.js" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/node-gyp/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/node-gyp/node_modules/semver": { - "version": "5.3.0", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/node-gyp/node_modules/which": { - "version": "1.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/node-int64": { - "version": "0.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/node-libs-browser": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^3.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "0.0.1", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.11.0", - "vm-browserify": "^1.0.1" - } - }, - "node_modules/node-libs-browser/node_modules/events": { - "version": "3.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.x" - } - }, - "node_modules/node-libs-browser/node_modules/punycode": { - "version": "1.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/node-libs-browser/node_modules/url": { - "version": "0.11.0", - "dev": true, - "license": "MIT", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/node-libs-browser/node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "dev": true, - "license": "MIT" - }, - "node_modules/node-notifier": { - "version": "8.0.2", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "growly": "^1.3.0", - "is-wsl": "^2.2.0", - "semver": "^7.3.2", - "shellwords": "^0.1.1", - "uuid": "^8.3.0", - "which": "^2.0.2" - } - }, - "node_modules/node-notifier/node_modules/lru-cache": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "optional": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-notifier/node_modules/semver": { - "version": "7.3.5", - "dev": true, - "license": "ISC", - "optional": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-notifier/node_modules/uuid": { - "version": "8.3.2", - "dev": true, - "license": "MIT", - "optional": true, - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/node-notifier/node_modules/yallist": { - "version": "4.0.0", - "dev": true, - "license": "ISC", - "optional": true - }, - "node_modules/node-releases": { - "version": "2.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/node-sass": { - "version": "4.14.1", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "dependencies": { - "async-foreach": "^0.1.3", - "chalk": "^1.1.1", - "cross-spawn": "^3.0.0", - "gaze": "^1.0.0", - "get-stdin": "^4.0.1", - "glob": "^7.0.3", - "in-publish": "^2.0.0", - "lodash": "^4.17.15", - "meow": "^3.7.0", - "mkdirp": "^0.5.1", - "nan": "^2.13.2", - "node-gyp": "^3.8.0", - "npmlog": "^4.0.0", - "request": "^2.88.0", - "sass-graph": "2.2.5", - "stdout-stream": "^1.4.0", - "true-case-path": "^1.0.2" - }, - "bin": { - "node-sass": "bin/node-sass" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/ansi-styles": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/chalk": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/cross-spawn": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - } - }, - "node_modules/node-sass/node_modules/lru-cache": { - "version": "4.1.5", - "dev": true, - "license": "ISC", - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "node_modules/node-sass/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/node-sass/node_modules/strip-ansi": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/node-sass/node_modules/supports-color": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/node-sass/node_modules/which": { - "version": "1.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/node-sass/node_modules/yallist": { - "version": "2.1.2", - "dev": true, - "license": "ISC" - }, - "node_modules/node-ssh": { - "version": "11.1.1", - "license": "MIT", - "dependencies": { - "make-dir": "^3.1.0", - "sb-promise-queue": "^2.1.0", - "sb-scandir": "^3.1.0", - "shell-escape": "^0.2.0", - "ssh2": "^0.8.9" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/node-ssh/node_modules/make-dir": { - "version": "3.1.0", - "license": "MIT", - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/node.extend": { - "version": "2.0.2", - "dev": true, - "license": "(MIT OR GPL-2.0)", - "dependencies": { - "has": "^1.0.3", - "is": "^3.2.1" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/nodemailer": { - "version": "6.7.2", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/nodemailer-direct-transport": { - "version": "3.3.2", - "license": "MIT", - "dependencies": { - "nodemailer-shared": "1.1.0", - "smtp-connection": "2.12.0" - } - }, - "node_modules/nodemailer-fetch": { - "version": "1.6.0", - "license": "MIT" - }, - "node_modules/nodemailer-shared": { - "version": "1.1.0", - "license": "MIT", - "dependencies": { - "nodemailer-fetch": "1.6.0" - } - }, - "node_modules/nodemailer-stub-transport": { - "version": "1.1.0", - "license": "MIT" - }, - "node_modules/nodemon": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.16.tgz", - "integrity": "sha512-zsrcaOfTWRuUzBn3P44RDliLlp263Z/76FPoHFr3cFFkOz0lTPAcIw8dCzfdVIx/t3AtDYCZRCDkoCojJqaG3w==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.0.4", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5", - "update-notifier": "^5.1.0" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=8.10.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nodemon/node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/nodemon/node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/nodemon/node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/nodemon/node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/nodemon/node_modules/debug": { - "version": "3.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/nodemon/node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/nodemon/node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/nodemon/node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/nodemon/node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/nodemon/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/nodemon/node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/nopt": { - "version": "3.0.6", - "dev": true, - "license": "ISC", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/normalize-package-data": { - "version": "2.5.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/normalize-url": { - "version": "6.1.0", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/now-and-later": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "once": "^1.3.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "license": "MIT", - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/npmlog": { - "version": "4.1.2", - "license": "ISC", - "dependencies": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "node_modules/nth-check": { - "version": "2.0.1", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "^1.0.0" - }, - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - } - }, - "node_modules/number-is-nan": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/nwsapi": { - "version": "2.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy": { - "version": "0.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-copy/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-diff": { - "version": "0.0.4", - "license": "MIT" - }, - "node_modules/object-inspect": { - "version": "1.12.0", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-is": { - "version": "1.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object-keys": { - "version": "1.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object-visit": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.assign": { - "version": "4.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.defaults": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.getownpropertydescriptors": { - "version": "2.1.3", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - }, - "engines": { - "node": ">= 0.8" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.map": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.pick": { - "version": "1.3.0", - "license": "MIT", - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object.reduce": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/obuf": { - "version": "1.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/on-finished": { - "version": "2.3.0", - "license": "MIT", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/on-headers": { - "version": "1.0.2", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/once": { - "version": "1.4.0", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "license": "MIT", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/opn": { - "version": "5.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-wsl": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/opn/node_modules/is-wsl": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/optional": { - "version": "0.1.4", - "license": "MIT" - }, - "node_modules/optionator": { - "version": "0.9.1", - "dev": true, - "license": "MIT", - "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/options": { - "version": "0.0.6", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ordered-read-streams": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "^2.0.1" - } - }, - "node_modules/original": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "url-parse": "^1.4.3" - } - }, - "node_modules/os-browserify": { - "version": "0.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/os-homedir": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/os-locale": { - "version": "3.1.0", - "license": "MIT", - "dependencies": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/os-locale/node_modules/cross-spawn": { - "version": "6.0.5", - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/os-locale/node_modules/execa": { - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/os-locale/node_modules/get-stream": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/os-locale/node_modules/is-stream": { - "version": "1.1.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/os-locale/node_modules/npm-run-path": { - "version": "2.0.2", - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/os-locale/node_modules/path-key": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/os-locale/node_modules/semver": { - "version": "5.7.1", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/os-locale/node_modules/shebang-command": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/os-locale/node_modules/shebang-regex": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/os-locale/node_modules/which": { - "version": "1.3.1", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/osenv": { - "version": "0.1.5", - "dev": true, - "license": "ISC", - "dependencies": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "node_modules/p-cancelable": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/p-defer": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/p-each-series": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-event": { - "version": "4.2.0", - "license": "MIT", - "dependencies": { - "p-timeout": "^3.1.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-finally": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/p-is-promise": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/p-limit": { - "version": "2.3.0", - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-map": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/p-queue": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/p-retry": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "retry": "^0.12.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/p-timeout": { - "version": "3.2.0", - "license": "MIT", - "dependencies": { - "p-finally": "^1.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, - "dependencies": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "dependencies": { - "defer-to-connect": "^1.0.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "dependencies": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "dependencies": { - "mimic-response": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/package-json/node_modules/defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, - "node_modules/package-json/node_modules/got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "dependencies": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/package-json/node_modules/got/node_modules/get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/got/node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/package-json/node_modules/json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, - "node_modules/package-json/node_modules/keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "dependencies": { - "json-buffer": "3.0.0" - } - }, - "node_modules/package-json/node_modules/mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/package-json/node_modules/normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/package-json/node_modules/p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/package-json/node_modules/responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "dependencies": { - "lowercase-keys": "^1.0.0" - } - }, - "node_modules/package-json/node_modules/responselike/node_modules/lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/package-json/node_modules/to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/pako": { - "version": "1.0.11", - "dev": true, - "license": "(MIT AND Zlib)" - }, - "node_modules/parallel-transform": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cyclist": "^1.0.1", - "inherits": "^2.0.3", - "readable-stream": "^2.1.5" - } - }, - "node_modules/param-case": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "no-case": "^2.2.0" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-asn1": { - "version": "5.1.6", - "dev": true, - "license": "ISC", - "dependencies": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/parse-filepath": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/parse-node-version": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/parse-passwd": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/parse5": { - "version": "6.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/parseurl": { - "version": "1.3.3", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/pascal-case": { - "version": "3.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - } - }, - "node_modules/pascal-case/node_modules/lower-case": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "tslib": "^2.0.3" - } - }, - "node_modules/pascal-case/node_modules/no-case": { - "version": "3.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - }, - "node_modules/pascalcase": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-browserify": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/path-dirname": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/path-exists": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-is-inside": { - "version": "1.0.2", - "dev": true, - "license": "(WTFPL OR MIT)" - }, - "node_modules/path-key": { - "version": "3.1.1", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "dev": true, - "license": "MIT" - }, - "node_modules/path-root": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "path-root-regex": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-root-regex": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "license": "MIT" - }, - "node_modules/path-type": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pbkdf2": { - "version": "3.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/pend": { - "version": "1.2.0", - "license": "MIT" - }, - "node_modules/performance-now": { - "version": "2.1.0", - "license": "MIT" - }, - "node_modules/picocolors": { - "version": "1.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pify": { - "version": "2.3.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie": { - "version": "2.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pinkie-promise": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/pirates": { - "version": "4.0.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/pkg-dir": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-dir/node_modules/find-up": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-dir/node_modules/locate-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-dir/node_modules/p-locate": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/pkg-dir/node_modules/path-exists": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/pkgcloud": { - "version": "2.2.0", - "dependencies": { - "@google-cloud/storage": "^2.4.3", - "async": "^2.6.1", - "aws-sdk": "^2.382.0", - "errs": "^0.3.2", - "eventemitter2": "^5.0.1", - "fast-json-patch": "^2.1.0", - "filed-mimefix": "^0.1.3", - "ip": "^1.1.5", - "liboneandone": "^1.2.0", - "lodash": "^4.17.10", - "mime": "^2.4.1", - "qs": "^6.5.2", - "request": "^2.88.0", - "through2": "^3.0.1", - "url-join": "^4.0.0", - "xml2js": "^0.4.19" - }, - "engines": { - "node": ">= 8.0.0" - } - }, - "node_modules/pkgcloud/node_modules/through2": { - "version": "3.0.2", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - }, - "node_modules/plugin-error": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-colors": "^1.0.1", - "arr-diff": "^4.0.0", - "arr-union": "^3.1.0", - "extend-shallow": "^3.0.2" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/plugin-error/node_modules/ansi-colors": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-wrap": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/plugin-error/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/plugin-error/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/portfinder": { - "version": "1.0.28", - "dev": true, - "license": "MIT", - "dependencies": { - "async": "^2.6.2", - "debug": "^3.1.1", - "mkdirp": "^0.5.5" - }, - "engines": { - "node": ">= 0.12.0" - } - }, - "node_modules/portfinder/node_modules/debug": { - "version": "3.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/portfinder/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/posix-character-classes": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/posix-getopt": { - "version": "1.2.1", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/postcss": { - "version": "7.0.39", - "dev": true, - "license": "MIT", - "dependencies": { - "picocolors": "^0.2.1", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=6.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - } - }, - "node_modules/postcss-modules-extract-imports": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "postcss": "^7.0.5" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/postcss-modules-local-by-default": { - "version": "2.0.6", - "dev": true, - "license": "MIT", - "dependencies": { - "postcss": "^7.0.6", - "postcss-selector-parser": "^6.0.0", - "postcss-value-parser": "^3.3.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/postcss-modules-scope": { - "version": "2.2.0", - "dev": true, - "license": "ISC", - "dependencies": { - "postcss": "^7.0.6", - "postcss-selector-parser": "^6.0.0" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/postcss-modules-values": { - "version": "2.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "icss-replace-symbols": "^1.1.0", - "postcss": "^7.0.6" - } - }, - "node_modules/postcss-selector-parser": { - "version": "6.0.8", - "dev": true, - "license": "MIT", - "dependencies": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/postcss-value-parser": { - "version": "3.3.1", - "dev": true, - "license": "MIT" - }, - "node_modules/postcss/node_modules/picocolors": { - "version": "0.2.1", - "dev": true, - "license": "ISC" - }, - "node_modules/postcss/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/prebuild-install": { - "version": "6.1.4", - "license": "MIT", - "dependencies": { - "detect-libc": "^1.0.3", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^2.21.0", - "npmlog": "^4.0.1", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^3.0.3", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/prebuild-install/node_modules/decompress-response": { - "version": "4.2.1", - "license": "MIT", - "dependencies": { - "mimic-response": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/prebuild-install/node_modules/simple-get": { - "version": "3.1.0", - "license": "MIT", - "dependencies": { - "decompress-response": "^4.2.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "node_modules/precond": { - "version": "0.2.3", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/prelude-ls": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/pretty-error": { - "version": "2.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash": "^4.17.20", - "renderkid": "^2.0.4" - } - }, - "node_modules/pretty-format": { - "version": "26.6.2", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^26.6.2", - "ansi-regex": "^5.0.0", - "ansi-styles": "^4.0.0", - "react-is": "^17.0.1" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/pretty-format/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/pretty-format/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/pretty-hrtime": { - "version": "1.0.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/private": { - "version": "0.1.8", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/process": { - "version": "0.11.10", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - } - }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "license": "MIT" - }, - "node_modules/progress": { - "version": "2.0.3", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/promise-inflight": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/prompts": { - "version": "2.4.2", - "dev": true, - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "license": "MIT", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "license": "MIT" - }, - "node_modules/prr": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/pseudomap": { - "version": "1.0.2", - "license": "ISC" - }, - "node_modules/psl": { - "version": "1.8.0", - "license": "MIT" - }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "dev": true, - "license": "MIT" - }, - "node_modules/public-encrypt": { - "version": "4.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/public-encrypt/node_modules/bn.js": { - "version": "4.12.0", - "dev": true, - "license": "MIT" - }, - "node_modules/pump": { - "version": "3.0.0", - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/pumpify": { - "version": "1.5.1", - "license": "MIT", - "dependencies": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - } - }, - "node_modules/pumpify/node_modules/pump": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/punycode": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/pupa": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", - "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, - "dependencies": { - "escape-goat": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer": { - "version": "7.1.0", - "hasInstallScript": true, - "license": "Apache-2.0", - "dependencies": { - "debug": "^4.1.0", - "devtools-protocol": "0.0.847576", - "extract-zip": "^2.0.0", - "https-proxy-agent": "^5.0.0", - "node-fetch": "^2.6.1", - "pkg-dir": "^4.2.0", - "progress": "^2.0.1", - "proxy-from-env": "^1.1.0", - "rimraf": "^3.0.2", - "tar-fs": "^2.0.0", - "unbzip2-stream": "^1.3.3", - "ws": "^7.2.3" - }, - "engines": { - "node": ">=10.18.1" - } - }, - "node_modules/puppeteer/node_modules/pkg-dir": { - "version": "4.2.0", - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/puppeteer/node_modules/rimraf": { - "version": "3.0.2", - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/qs": { - "version": "6.9.6", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/querystring": { - "version": "0.2.0", - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/querystring-es3": { - "version": "0.2.1", - "dev": true, - "engines": { - "node": ">=0.4.x" - } - }, - "node_modules/querystringify": { - "version": "2.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/randombytes": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/randomfill": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.4.2", - "license": "MIT", - "dependencies": { - "bytes": "3.1.1", - "http-errors": "1.8.1", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/raw-body/node_modules/bytes": { - "version": "3.1.1", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/raw-loader": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "loader-utils": "^1.1.0", - "schema-utils": "^1.0.0" - }, - "engines": { - "node": ">= 6.9.0" - }, - "peerDependencies": { - "webpack": "^4.3.0" - } - }, - "node_modules/raw-loader/node_modules/schema-utils": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/rc": { - "version": "1.2.8", - "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-is": { - "version": "17.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/read-chunk": { - "version": "3.2.0", - "license": "MIT", - "dependencies": { - "pify": "^4.0.1", - "with-open-file": "^0.1.6" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/read-chunk/node_modules/pify": { - "version": "4.0.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/read-pkg": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg-up": { - "version": "7.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/type-fest": { - "version": "0.8.1", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/read-pkg/node_modules/type-fest": { - "version": "0.6.0", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - } - }, - "node_modules/readable-stream": { - "version": "2.3.7", - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/readdirp": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/readdirp/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/readdirp/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/readdirp/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/readdirp/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/readdirp/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/readdirp/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/readdirp/node_modules/micromatch": { - "version": "3.1.10", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/recast": { - "version": "0.11.23", - "dev": true, - "license": "MIT", - "dependencies": { - "ast-types": "0.9.6", - "esprima": "~3.1.0", - "private": "~0.1.5", - "source-map": "~0.5.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/recast/node_modules/esprima": { - "version": "3.1.3", - "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/rechoir": { - "version": "0.6.2", - "dev": true, - "dependencies": { - "resolve": "^1.1.6" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/redent": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/referrer-policy": { - "version": "1.2.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/regenerate": { - "version": "1.4.2", - "dev": true, - "license": "MIT" - }, - "node_modules/regenerate-unicode-properties": { - "version": "9.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerate": "^1.4.2" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.13.9", - "license": "MIT" - }, - "node_modules/regenerator-transform": { - "version": "0.14.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.8.4" - } - }, - "node_modules/regex-not": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/regex-not/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/regex-not/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/regexp.prototype.flags": { - "version": "1.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/regexpp": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, - "node_modules/regexpu-core": { - "version": "4.8.0", - "dev": true, - "license": "MIT", - "dependencies": { - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^9.0.0", - "regjsgen": "^0.5.2", - "regjsparser": "^0.7.0", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, - "dependencies": { - "rc": "^1.2.8" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/regjsgen": { - "version": "0.5.2", - "dev": true, - "license": "MIT" - }, - "node_modules/regjsparser": { - "version": "0.7.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "jsesc": "~0.5.0" - }, - "bin": { - "regjsparser": "bin/parser" - } - }, - "node_modules/regjsparser/node_modules/jsesc": { - "version": "0.5.0", - "dev": true, - "bin": { - "jsesc": "bin/jsesc" - } - }, - "node_modules/relateurl": { - "version": "0.2.7", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/remove-bom-buffer": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5", - "is-utf8": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/remove-bom-stream": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "remove-bom-buffer": "^3.0.0", - "safe-buffer": "^5.1.0", - "through2": "^2.0.3" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "dev": true, - "license": "ISC" - }, - "node_modules/renderkid": { - "version": "2.0.7", - "dev": true, - "license": "MIT", - "dependencies": { - "css-select": "^4.1.3", - "dom-converter": "^0.2.0", - "htmlparser2": "^6.1.0", - "lodash": "^4.17.21", - "strip-ansi": "^3.0.1" - } - }, - "node_modules/renderkid/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/renderkid/node_modules/dom-serializer": { - "version": "1.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "node_modules/renderkid/node_modules/domelementtype": { - "version": "2.2.0", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "BSD-2-Clause" - }, - "node_modules/renderkid/node_modules/domhandler": { - "version": "4.3.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "^2.2.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "node_modules/renderkid/node_modules/domutils": { - "version": "2.8.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/renderkid/node_modules/entities": { - "version": "2.2.0", - "dev": true, - "license": "BSD-2-Clause", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/renderkid/node_modules/htmlparser2": { - "version": "6.1.0", - "dev": true, - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "MIT", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", - "domutils": "^2.5.2", - "entities": "^2.0.0" - } - }, - "node_modules/renderkid/node_modules/strip-ansi": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/repeat-element": { - "version": "1.1.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/repeat-string": { - "version": "1.6.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/repeating": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-finite": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/replace-ext": { - "version": "0.0.1", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/replace-homedir": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "homedir-polyfill": "^1.0.1", - "is-absolute": "^1.0.0", - "remove-trailing-separator": "^1.1.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/request": { - "version": "2.88.2", - "license": "Apache-2.0", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request/node_modules/form-data": { - "version": "2.3.3", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "node_modules/request/node_modules/qs": { - "version": "6.5.3", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/request/node_modules/tough-cookie": { - "version": "2.5.0", - "license": "BSD-3-Clause", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-from-string": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-main-filename": { - "version": "1.0.1", - "dev": true, - "license": "ISC" - }, - "node_modules/require-yaml": { - "version": "0.0.1", - "license": "BSD", - "dependencies": { - "js-yaml": "" - } - }, - "node_modules/requires-port": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/resolve": { - "version": "1.21.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-core-module": "^2.8.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-cwd": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-dir": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-options": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "value-or-function": "^3.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/resolve-url": { - "version": "0.2.1", - "dev": true, - "license": "MIT" - }, - "node_modules/responselike": { - "version": "2.0.0", - "license": "MIT", - "dependencies": { - "lowercase-keys": "^2.0.0" - } - }, - "node_modules/ret": { - "version": "0.1.15", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12" - } - }, - "node_modules/retry": { - "version": "0.12.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/retry-request": { - "version": "4.2.2", - "license": "MIT", - "dependencies": { - "debug": "^4.1.1", - "extend": "^3.0.2" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/rimraf": { - "version": "2.7.1", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/ripemd160": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "node_modules/rsvp": { - "version": "4.8.5", - "dev": true, - "license": "MIT", - "engines": { - "node": "6.* || >= 7.*" - } - }, - "node_modules/run-queue": { - "version": "1.0.3", - "dev": true, - "license": "ISC", - "dependencies": { - "aproba": "^1.1.1" - } - }, - "node_modules/safe-buffer": { - "version": "5.1.2", - "license": "MIT" - }, - "node_modules/safe-regex": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ret": "~0.1.10" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "license": "MIT" - }, - "node_modules/sane": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@cnakazawa/watch": "^1.0.3", - "anymatch": "^2.0.0", - "capture-exit": "^2.0.0", - "exec-sh": "^0.3.2", - "execa": "^1.0.0", - "fb-watchman": "^2.0.0", - "micromatch": "^3.1.4", - "minimist": "^1.1.1", - "walker": "~1.0.5" - }, - "bin": { - "sane": "src/cli.js" - }, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/sane/node_modules/cross-spawn": { - "version": "6.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/sane/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/execa": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sane/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/get-stream": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sane/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/is-stream": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/micromatch": { - "version": "3.1.10", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/npm-run-path": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/sane/node_modules/path-key": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/sane/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/sane/node_modules/shebang-command": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/shebang-regex": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sane/node_modules/which": { - "version": "1.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/sass-graph": { - "version": "2.2.5", - "dev": true, - "license": "MIT", - "dependencies": { - "glob": "^7.0.0", - "lodash": "^4.0.0", - "scss-tokenizer": "^0.2.3", - "yargs": "^13.3.2" - }, - "bin": { - "sassgraph": "bin/sassgraph" - } - }, - "node_modules/sass-graph/node_modules/ansi-regex": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/sass-graph/node_modules/cliui": { - "version": "5.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "node_modules/sass-graph/node_modules/emoji-regex": { - "version": "7.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/sass-graph/node_modules/find-up": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sass-graph/node_modules/get-caller-file": { - "version": "2.0.5", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/sass-graph/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/sass-graph/node_modules/locate-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sass-graph/node_modules/p-locate": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sass-graph/node_modules/path-exists": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/sass-graph/node_modules/require-main-filename": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/sass-graph/node_modules/string-width": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sass-graph/node_modules/strip-ansi": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sass-graph/node_modules/which-module": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/sass-graph/node_modules/wrap-ansi": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/sass-graph/node_modules/yargs": { - "version": "13.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "node_modules/sass-graph/node_modules/yargs-parser": { - "version": "13.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/sass-loader": { - "version": "7.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "clone-deep": "^4.0.1", - "loader-utils": "^1.0.1", - "neo-async": "^2.5.0", - "pify": "^4.0.1", - "semver": "^6.3.0" - }, - "engines": { - "node": ">= 6.9.0" - }, - "peerDependencies": { - "webpack": "^3.0.0 || ^4.0.0" - } - }, - "node_modules/sass-loader/node_modules/pify": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/sax": { - "version": "1.2.1", - "license": "ISC" - }, - "node_modules/saxes": { - "version": "5.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "xmlchars": "^2.2.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/sb-promise-queue": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, - "node_modules/sb-scandir": { - "version": "3.1.0", - "license": "MIT", - "dependencies": { - "sb-promise-queue": "^2.1.0" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/schema-utils": { - "version": "2.7.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/json-schema": "^7.0.5", - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 8.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/scss-tokenizer": { - "version": "0.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "js-base64": "^2.1.8", - "source-map": "^0.4.2" - } - }, - "node_modules/scss-tokenizer/node_modules/source-map": { - "version": "0.4.4", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "amdefine": ">=0.0.4" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/select-hose": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/selfsigned": { - "version": "1.10.14", - "dev": true, - "license": "MIT", - "dependencies": { - "node-forge": "^0.10.0" - } - }, - "node_modules/semver": { - "version": "6.3.0", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/semver-diff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", - "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, - "dependencies": { - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/semver-greatest-satisfied-range": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "sver-compat": "^1.5.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/send": { - "version": "0.17.2", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "1.8.1", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/send/node_modules/depd": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/send/node_modules/mime": { - "version": "1.6.0", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "license": "MIT" - }, - "node_modules/seq-queue": { - "version": "0.0.5", - "dev": true - }, - "node_modules/serialize-javascript": { - "version": "4.0.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/serve-favicon": { - "version": "2.5.0", - "license": "MIT", - "dependencies": { - "etag": "~1.8.1", - "fresh": "0.5.2", - "ms": "2.1.1", - "parseurl": "~1.3.2", - "safe-buffer": "5.1.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/serve-favicon/node_modules/ms": { - "version": "2.1.1", - "license": "MIT" - }, - "node_modules/serve-favicon/node_modules/safe-buffer": { - "version": "5.1.1", - "license": "MIT" - }, - "node_modules/serve-index": { - "version": "1.9.1", - "dev": true, - "license": "MIT", - "dependencies": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/serve-index/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/serve-index/node_modules/depd": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/serve-index/node_modules/http-errors": { - "version": "1.6.3", - "dev": true, - "license": "MIT", - "dependencies": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/serve-index/node_modules/inherits": { - "version": "2.0.3", - "dev": true, - "license": "ISC" - }, - "node_modules/serve-index/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/serve-index/node_modules/setprototypeof": { - "version": "1.1.0", - "dev": true, - "license": "ISC" - }, - "node_modules/serve-static": { - "version": "1.14.2", - "license": "MIT", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "license": "ISC" - }, - "node_modules/set-value": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/setimmediate": { - "version": "1.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "license": "ISC" - }, - "node_modules/sha.js": { - "version": "2.4.11", - "dev": true, - "license": "(MIT AND BSD-3-Clause)", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - }, - "bin": { - "sha.js": "bin.js" - } - }, - "node_modules/shallow-clone": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/sharp": { - "version": "0.27.2", - "hasInstallScript": true, - "license": "Apache-2.0", - "dependencies": { - "array-flatten": "^3.0.0", - "color": "^3.1.3", - "detect-libc": "^1.0.3", - "node-addon-api": "^3.1.0", - "npmlog": "^4.1.2", - "prebuild-install": "^6.0.1", - "semver": "^7.3.4", - "simple-get": "^4.0.0", - "tar-fs": "^2.1.1", - "tunnel-agent": "^0.6.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://opencollective.com/libvips" - } - }, - "node_modules/sharp/node_modules/array-flatten": { - "version": "3.0.0", - "license": "MIT" - }, - "node_modules/sharp/node_modules/lru-cache": { - "version": "6.0.0", - "license": "ISC", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/sharp/node_modules/semver": { - "version": "7.3.5", - "license": "ISC", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/sharp/node_modules/yallist": { - "version": "4.0.0", - "license": "ISC" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/shell-escape": { - "version": "0.2.0", - "license": "MIT" - }, - "node_modules/shellwords": { - "version": "0.1.1", - "dev": true, - "license": "MIT", - "optional": true - }, - "node_modules/shimmer": { - "version": "1.2.1", - "license": "BSD-2-Clause" - }, - "node_modules/shortid": { - "version": "2.2.16", - "license": "MIT", - "dependencies": { - "nanoid": "^2.1.0" - } - }, - "node_modules/side-channel": { - "version": "1.0.4", - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/sigmund": { - "version": "1.0.1", - "license": "ISC" - }, - "node_modules/signal-exit": { - "version": "3.0.6", - "license": "ISC" - }, - "node_modules/simple-concat": { - "version": "1.0.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/simple-get": { - "version": "4.0.0", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, - "node_modules/simple-get/node_modules/decompress-response": { - "version": "6.0.0", - "license": "MIT", - "dependencies": { - "mimic-response": "^3.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/simple-get/node_modules/mimic-response": { - "version": "3.1.0", - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/simple-swizzle": { - "version": "0.2.2", - "license": "MIT", - "dependencies": { - "is-arrayish": "^0.3.1" - } - }, - "node_modules/simple-swizzle/node_modules/is-arrayish": { - "version": "0.3.2", - "license": "MIT" - }, - "node_modules/sisteransi": { - "version": "1.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/slash": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/slice-ansi": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/slice-ansi?sponsor=1" - } - }, - "node_modules/slice-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/slice-ansi/node_modules/color-convert": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/slice-ansi/node_modules/color-name": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/smbhash": { - "version": "0.0.1", - "engines": [ - "node" - ], - "dependencies": { - "bigdecimal": ">= 0.6.0" - } - }, - "node_modules/smtp-connection": { - "version": "2.12.0", - "license": "MIT", - "dependencies": { - "httpntlm": "1.6.1", - "nodemailer-shared": "1.1.0" - } - }, - "node_modules/snakeize": { - "version": "0.1.0", - "license": "MIT" - }, - "node_modules/snapdragon": { - "version": "0.8.2", - "dev": true, - "license": "MIT", - "dependencies": { - "base": "^0.11.1", - "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.0", - "use": "^3.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node/node_modules/define-property": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-node/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-util": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.2.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon-util/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/debug": { - "version": "2.6.9", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/snapdragon/node_modules/ms": { - "version": "2.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/sockjs": { - "version": "0.3.24", - "dev": true, - "license": "MIT", - "dependencies": { - "faye-websocket": "^0.11.3", - "uuid": "^8.3.2", - "websocket-driver": "^0.7.4" - } - }, - "node_modules/sockjs-client": { - "version": "1.5.2", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^3.2.6", - "eventsource": "^1.0.7", - "faye-websocket": "^0.11.3", - "inherits": "^2.0.4", - "json3": "^3.3.3", - "url-parse": "^1.5.3" - } - }, - "node_modules/sockjs-client/node_modules/debug": { - "version": "3.2.7", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/sockjs/node_modules/uuid": { - "version": "8.3.2", - "dev": true, - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/source-list-map": { - "version": "2.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/source-map": { - "version": "0.5.7", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-resolve": { - "version": "0.5.3", - "dev": true, - "license": "MIT", - "dependencies": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.21", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/source-map-support/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-url": { - "version": "0.4.1", - "dev": true, - "license": "MIT" - }, - "node_modules/sparkles": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/spdx-correct": { - "version": "3.1.1", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-exceptions": { - "version": "2.3.0", - "dev": true, - "license": "CC-BY-3.0" - }, - "node_modules/spdx-expression-parse": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "node_modules/spdx-license-ids": { - "version": "3.0.11", - "dev": true, - "license": "CC0-1.0" - }, - "node_modules/spdy": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.1.0", - "handle-thing": "^2.0.0", - "http-deceiver": "^1.2.7", - "select-hose": "^2.0.0", - "spdy-transport": "^3.0.0" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/spdy-transport": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "debug": "^4.1.0", - "detect-node": "^2.0.4", - "hpack.js": "^2.1.6", - "obuf": "^1.1.2", - "readable-stream": "^3.0.6", - "wbuf": "^1.7.3" - } - }, - "node_modules/spdy-transport/node_modules/readable-stream": { - "version": "3.6.0", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/split-array-stream": { - "version": "2.0.0", - "license": "MIT", - "dependencies": { - "is-stream-ended": "^0.1.4" - } - }, - "node_modules/split-string": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "extend-shallow": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/split-string/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/split-string/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.1.2", - "license": "BSD-3-Clause" - }, - "node_modules/sqlstring": { - "version": "2.3.1", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/sse": { - "version": "0.0.8", - "dependencies": { - "options": "0.0.6" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ssh2": { - "version": "0.8.9", - "dependencies": { - "ssh2-streams": "~0.4.10" - }, - "engines": { - "node": ">=5.2.0" - } - }, - "node_modules/ssh2-streams": { - "version": "0.4.10", - "dependencies": { - "asn1": "~0.2.0", - "bcrypt-pbkdf": "^1.0.2", - "streamsearch": "~0.1.2" - }, - "engines": { - "node": ">=5.2.0" - } - }, - "node_modules/sshpk": { - "version": "1.17.0", - "license": "MIT", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ssri": { - "version": "6.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "figgy-pudding": "^3.5.1" - } - }, - "node_modules/stable": { - "version": "0.1.8", - "license": "MIT" - }, - "node_modules/stack-chain": { - "version": "1.3.7", - "license": "MIT" - }, - "node_modules/stack-trace": { - "version": "0.0.10", - "dev": true, - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/stack-utils": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/stack-utils/node_modules/escape-string-regexp": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/static-extend": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/statuses": { - "version": "1.5.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/stdout-stream": { - "version": "1.4.1", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "^2.0.1" - } - }, - "node_modules/stream-browserify": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" - } - }, - "node_modules/stream-combiner": { - "version": "0.0.2", - "license": "MIT", - "dependencies": { - "duplexer": "~0.0.3" - } - }, - "node_modules/stream-each": { - "version": "1.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "stream-shift": "^1.0.0" - } - }, - "node_modules/stream-events": { - "version": "1.0.5", - "license": "MIT", - "dependencies": { - "stubs": "^3.0.0" - } - }, - "node_modules/stream-exhaust": { - "version": "1.0.2", - "dev": true, - "license": "MIT" - }, - "node_modules/stream-http": { - "version": "2.8.3", - "dev": true, - "license": "MIT", - "dependencies": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" - } - }, - "node_modules/stream-serializer": { - "version": "1.1.2", - "license": "MIT" - }, - "node_modules/stream-shift": { - "version": "1.0.1", - "license": "MIT" - }, - "node_modules/streamsearch": { - "version": "0.1.2", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/string_decoder": { - "version": "1.1.1", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string-length": { - "version": "4.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/string-width": { - "version": "1.0.2", - "license": "MIT", - "dependencies": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "3.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/string.prototype.trimend": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/string.prototype.trimstart": { - "version": "1.0.4", - "dev": true, - "license": "MIT", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-eof": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-indent": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "get-stdin": "^4.0.1" - }, - "bin": { - "strip-indent": "cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strong-error-handler": { - "version": "2.3.2", - "license": "MIT", - "dependencies": { - "accepts": "^1.3.3", - "debug": "^2.2.0", - "ejs": "^2.5.7", - "http-status": "^1.0.0", - "js2xmlparser": "^3.0.0", - "strong-globalize": "^3.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/strong-error-handler/node_modules/cross-spawn": { - "version": "5.1.0", - "license": "MIT", - "dependencies": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "node_modules/strong-error-handler/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/strong-error-handler/node_modules/execa": { - "version": "0.7.0", - "license": "MIT", - "dependencies": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/strong-error-handler/node_modules/get-stream": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/strong-error-handler/node_modules/invert-kv": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strong-error-handler/node_modules/is-stream": { - "version": "1.1.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strong-error-handler/node_modules/lcid": { - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "invert-kv": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strong-error-handler/node_modules/lru-cache": { - "version": "4.1.5", - "license": "ISC", - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "node_modules/strong-error-handler/node_modules/mem": { - "version": "1.1.0", - "license": "MIT", - "dependencies": { - "mimic-fn": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/strong-error-handler/node_modules/mimic-fn": { - "version": "1.2.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/strong-error-handler/node_modules/mkdirp": { - "version": "0.5.5", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/strong-error-handler/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/strong-error-handler/node_modules/npm-run-path": { - "version": "2.0.2", - "license": "MIT", - "dependencies": { - "path-key": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/strong-error-handler/node_modules/os-locale": { - "version": "2.1.0", - "license": "MIT", - "dependencies": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/strong-error-handler/node_modules/path-key": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/strong-error-handler/node_modules/shebang-command": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strong-error-handler/node_modules/shebang-regex": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strong-error-handler/node_modules/strong-globalize": { - "version": "3.3.0", - "license": "Artistic-2.0", - "dependencies": { - "accept-language": "^3.0.18", - "async": "^2.4.1", - "debug": "^3.1.0", - "esprima": "^4.0.0", - "estraverse": "^4.2.0", - "g11n-pipeline": "^2.0.1", - "globalize": "^1.3.0", - "htmlparser2": "^3.9.2", - "lodash": "^4.17.4", - "md5": "^2.2.1", - "mkdirp": "^0.5.1", - "mktmpdir": "^0.1.1", - "optional": "^0.1.3", - "os-locale": "^2.0.0", - "posix-getopt": "^1.2.0", - "word-count": "^0.2.2", - "xtend": "^4.0.1", - "yamljs": "^0.3.0" - }, - "bin": { - "slt-globalize": "bin/slt-globalize.js" - } - }, - "node_modules/strong-error-handler/node_modules/strong-globalize/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/strong-error-handler/node_modules/strong-globalize/node_modules/ms": { - "version": "2.1.3", - "license": "MIT" - }, - "node_modules/strong-error-handler/node_modules/which": { - "version": "1.3.1", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/strong-error-handler/node_modules/yallist": { - "version": "2.1.2", - "license": "ISC" - }, - "node_modules/strong-globalize": { - "version": "4.1.3", - "license": "Artistic-2.0", - "dependencies": { - "accept-language": "^3.0.18", - "debug": "^4.1.1", - "globalize": "^1.4.2", - "lodash": "^4.17.4", - "md5": "^2.2.1", - "mkdirp": "^0.5.1", - "os-locale": "^3.1.0", - "yamljs": "^0.3.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/strong-globalize/node_modules/mkdirp": { - "version": "0.5.5", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/strong-remoting": { - "version": "3.17.0", - "license": "Artistic-2.0", - "dependencies": { - "async": "^3.1.0", - "body-parser": "^1.12.4", - "debug": "^4.1.1", - "depd": "^2.0.0", - "escape-string-regexp": "^2.0.0", - "eventemitter2": "^5.0.1", - "express": "4.x", - "inflection": "^1.7.1", - "jayson": "^2.0.5", - "js2xmlparser": "^3.0.0", - "loopback-datatype-geopoint": "^1.0.0", - "loopback-phase": "^3.1.0", - "mux-demux": "^3.7.9", - "qs": "^6.2.1", - "request": "^2.83.0", - "sse": "0.0.8", - "strong-error-handler": "^3.0.0", - "strong-globalize": "^5.0.2", - "traverse": "^0.6.6", - "xml2js": "^0.4.8" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strong-remoting/node_modules/async": { - "version": "3.2.3", - "license": "MIT" - }, - "node_modules/strong-remoting/node_modules/ejs": { - "version": "3.1.6", - "license": "Apache-2.0", - "dependencies": { - "jake": "^10.6.1" - }, - "bin": { - "ejs": "bin/cli.js" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/strong-remoting/node_modules/escape-string-regexp": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/strong-remoting/node_modules/invert-kv": { - "version": "3.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sindresorhus/invert-kv?sponsor=1" - } - }, - "node_modules/strong-remoting/node_modules/lcid": { - "version": "3.1.1", - "license": "MIT", - "dependencies": { - "invert-kv": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strong-remoting/node_modules/mem": { - "version": "5.1.1", - "license": "MIT", - "dependencies": { - "map-age-cleaner": "^0.1.3", - "mimic-fn": "^2.1.0", - "p-is-promise": "^2.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strong-remoting/node_modules/os-locale": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "execa": "^4.0.0", - "lcid": "^3.0.0", - "mem": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/strong-remoting/node_modules/strong-error-handler": { - "version": "3.5.0", - "license": "MIT", - "dependencies": { - "@types/express": "^4.16.0", - "accepts": "^1.3.3", - "debug": "^4.1.1", - "ejs": "^3.1.3", - "fast-safe-stringify": "^2.0.6", - "http-status": "^1.1.2", - "js2xmlparser": "^4.0.0", - "strong-globalize": "^6.0.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/strong-remoting/node_modules/strong-error-handler/node_modules/js2xmlparser": { - "version": "4.0.2", - "license": "Apache-2.0", - "dependencies": { - "xmlcreate": "^2.0.4" - } - }, - "node_modules/strong-remoting/node_modules/strong-error-handler/node_modules/strong-globalize": { - "version": "6.0.5", - "license": "Artistic-2.0", - "dependencies": { - "accept-language": "^3.0.18", - "debug": "^4.2.0", - "globalize": "^1.6.0", - "lodash": "^4.17.20", - "md5": "^2.3.0", - "mkdirp": "^1.0.4", - "os-locale": "^5.0.0", - "yamljs": "^0.3.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/strong-remoting/node_modules/strong-globalize": { - "version": "5.1.0", - "license": "Artistic-2.0", - "dependencies": { - "accept-language": "^3.0.18", - "debug": "^4.1.1", - "globalize": "^1.5.0", - "lodash": "^4.17.15", - "md5": "^2.2.1", - "mkdirp": "^0.5.5", - "os-locale": "^5.0.0", - "yamljs": "^0.3.0" - }, - "engines": { - "node": ">=8.9" - } - }, - "node_modules/strong-remoting/node_modules/strong-globalize/node_modules/mkdirp": { - "version": "0.5.5", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/strong-remoting/node_modules/xmlcreate": { - "version": "2.0.4", - "license": "Apache-2.0" - }, - "node_modules/stubs": { - "version": "3.0.0", - "license": "MIT" - }, - "node_modules/style-loader": { - "version": "0.23.1", - "dev": true, - "license": "MIT", - "dependencies": { - "loader-utils": "^1.1.0", - "schema-utils": "^1.0.0" - }, - "engines": { - "node": ">= 0.12.0" - } - }, - "node_modules/style-loader/node_modules/schema-utils": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/supports-hyperlinks": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-hyperlinks/node_modules/has-flag": { - "version": "4.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-hyperlinks/node_modules/supports-color": { - "version": "7.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/sver-compat": { - "version": "1.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "es6-iterator": "^2.0.1", - "es6-symbol": "^3.1.1" - } - }, - "node_modules/swagger-client": { - "version": "3.18.1", - "license": "Apache-2.0", - "dependencies": { - "@babel/runtime-corejs3": "^7.11.2", - "btoa": "^1.2.1", - "cookie": "~0.4.1", - "cross-fetch": "^3.1.4", - "deepmerge": "~4.2.2", - "fast-json-patch": "^3.0.0-1", - "form-data-encoder": "^1.4.3", - "formdata-node": "^4.0.0", - "is-plain-object": "^5.0.0", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21", - "qs": "^6.10.2", - "traverse": "~0.6.6", - "url": "~0.11.0" - } - }, - "node_modules/swagger-client/node_modules/argparse": { - "version": "2.0.1", - "license": "Python-2.0" - }, - "node_modules/swagger-client/node_modules/fast-json-patch": { - "version": "3.1.0", - "license": "MIT" - }, - "node_modules/swagger-client/node_modules/is-plain-object": { - "version": "5.0.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/swagger-client/node_modules/js-yaml": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/swagger-client/node_modules/punycode": { - "version": "1.3.2", - "license": "MIT" - }, - "node_modules/swagger-client/node_modules/qs": { - "version": "6.10.3", - "license": "BSD-3-Clause", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/swagger-client/node_modules/url": { - "version": "0.11.0", - "license": "MIT", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/swagger-ui": { - "version": "2.2.10", - "license": "Apache-2.0" - }, - "node_modules/symbol-tree": { - "version": "3.2.4", - "dev": true, - "license": "MIT" - }, - "node_modules/table": { - "version": "6.8.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/table/node_modules/ajv": { - "version": "8.8.2", - "dev": true, - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "node_modules/table/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/table/node_modules/json-schema-traverse": { - "version": "1.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/table/node_modules/string-width": { - "version": "4.2.3", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/tapable": { - "version": "1.1.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/tar": { - "version": "2.2.2", - "dev": true, - "license": "ISC", - "dependencies": { - "block-stream": "*", - "fstream": "^1.0.12", - "inherits": "2" - } - }, - "node_modules/tar-fs": { - "version": "2.1.1", - "license": "MIT", - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "node_modules/tar-stream": { - "version": "2.2.0", - "license": "MIT", - "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tar-stream/node_modules/bl": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "node_modules/tar-stream/node_modules/buffer": { - "version": "5.7.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.0", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/teeny-request": { - "version": "3.11.3", - "license": "Apache-2.0", - "dependencies": { - "https-proxy-agent": "^2.2.1", - "node-fetch": "^2.2.0", - "uuid": "^3.3.2" - } - }, - "node_modules/teeny-request/node_modules/agent-base": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "es6-promisify": "^5.0.0" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/teeny-request/node_modules/debug": { - "version": "3.2.7", - "license": "MIT", - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/teeny-request/node_modules/https-proxy-agent": { - "version": "2.2.4", - "license": "MIT", - "dependencies": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - }, - "engines": { - "node": ">= 4.5.0" - } - }, - "node_modules/terminal-link": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-escapes": "^4.2.1", - "supports-hyperlinks": "^2.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/terser": { - "version": "4.8.0", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "commander": "^2.20.0", - "source-map": "~0.6.1", - "source-map-support": "~0.5.12" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/terser-webpack-plugin": { - "version": "1.4.5", - "dev": true, - "license": "MIT", - "dependencies": { - "cacache": "^12.0.2", - "find-cache-dir": "^2.1.0", - "is-wsl": "^1.1.0", - "schema-utils": "^1.0.0", - "serialize-javascript": "^4.0.0", - "source-map": "^0.6.1", - "terser": "^4.1.2", - "webpack-sources": "^1.4.0", - "worker-farm": "^1.7.0" - }, - "engines": { - "node": ">= 6.9.0" - }, - "peerDependencies": { - "webpack": "^4.0.0" - } - }, - "node_modules/terser-webpack-plugin/node_modules/is-wsl": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/terser-webpack-plugin/node_modules/schema-utils": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/terser-webpack-plugin/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/terser/node_modules/commander": { - "version": "2.20.3", - "dev": true, - "license": "MIT" - }, - "node_modules/terser/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/text-table": { - "version": "0.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/throat": { - "version": "5.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/through": { - "version": "2.3.8", - "license": "MIT" - }, - "node_modules/through2": { - "version": "2.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "node_modules/through2-filter": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "through2": "~2.0.0", - "xtend": "~4.0.0" - } - }, - "node_modules/thunky": { - "version": "1.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/time-stamp": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/timers-browserify": { - "version": "2.0.12", - "dev": true, - "license": "MIT", - "dependencies": { - "setimmediate": "^1.0.4" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/tlds": { - "version": "1.208.0", - "license": "MIT", - "bin": { - "tlds": "bin.js" - } - }, - "node_modules/tmpl": { - "version": "1.0.5", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/to-absolute-glob": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-arraybuffer": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/to-iso-string": { - "version": "0.0.2", - "license": "MIT" - }, - "node_modules/to-object-path": { - "version": "0.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-object-path/node_modules/kind-of": { - "version": "3.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-buffer": "^1.1.5" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-readable-stream": { - "version": "2.1.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/to-regex": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex-range": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-regex/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/to-through": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "through2": "^2.0.3" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/to-utf8": { - "version": "0.0.1", - "license": "MIT" - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/toposort": { - "version": "2.0.2", - "license": "MIT" - }, - "node_modules/touch": { - "version": "3.1.0", - "dev": true, - "license": "ISC", - "dependencies": { - "nopt": "~1.0.10" - }, - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/touch/node_modules/nopt": { - "version": "1.0.10", - "dev": true, - "license": "MIT", - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - } - }, - "node_modules/tough-cookie": { - "version": "4.0.0", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.1.2" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tr46": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/traverse": { - "version": "0.6.6", - "license": "MIT" - }, - "node_modules/trim-newlines": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/true-case-path": { - "version": "1.0.3", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "glob": "^7.1.2" - } - }, - "node_modules/tryit": { - "version": "1.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/tslib": { - "version": "2.3.1", - "dev": true, - "license": "0BSD" - }, - "node_modules/tty-browserify": { - "version": "0.0.0", - "dev": true, - "license": "MIT" - }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "license": "Unlicense" - }, - "node_modules/type": { - "version": "1.2.0", - "dev": true, - "license": "ISC" - }, - "node_modules/type-check": { - "version": "0.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "prelude-ls": "^1.2.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "version": "0.10.0", - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "license": "MIT", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/typedarray": { - "version": "0.0.6", - "license": "MIT" - }, - "node_modules/typedarray-to-buffer": { - "version": "3.1.5", - "dev": true, - "license": "MIT", - "dependencies": { - "is-typedarray": "^1.0.0" - } - }, - "node_modules/uc.micro": { - "version": "1.0.6", - "license": "MIT" - }, - "node_modules/uglify-js": { - "version": "3.4.10", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "commander": "~2.19.0", - "source-map": "~0.6.1" - }, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/uglify-js/node_modules/commander": { - "version": "2.19.0", - "dev": true, - "license": "MIT" - }, - "node_modules/uglify-js/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/uid2": { - "version": "0.0.3" - }, - "node_modules/unbox-primitive": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/unbzip2-stream": { - "version": "1.4.3", - "license": "MIT", - "dependencies": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } - }, - "node_modules/unbzip2-stream/node_modules/buffer": { - "version": "5.7.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/unc-path-regex": { - "version": "0.1.2", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "dev": true, - "license": "MIT" - }, - "node_modules/underscore": { - "version": "1.7.0" - }, - "node_modules/underscore.string": { - "version": "3.3.5", - "license": "MIT", - "dependencies": { - "sprintf-js": "^1.0.3", - "util-deprecate": "^1.0.2" - }, - "engines": { - "node": "*" - } - }, - "node_modules/undertaker": { - "version": "1.3.0", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "bach": "^1.0.0", - "collection-map": "^1.0.0", - "es6-weak-map": "^2.0.1", - "fast-levenshtein": "^1.0.0", - "last-run": "^1.1.0", - "object.defaults": "^1.0.0", - "object.reduce": "^1.0.0", - "undertaker-registry": "^1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/undertaker-registry": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/undertaker/node_modules/fast-levenshtein": { - "version": "1.1.4", - "dev": true, - "license": "MIT" - }, - "node_modules/unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-ecmascript": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/unicode-property-aliases-ecmascript": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/union-value": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unique-filename": { - "version": "1.1.1", - "dev": true, - "license": "ISC", - "dependencies": { - "unique-slug": "^2.0.0" - } - }, - "node_modules/unique-slug": { - "version": "2.0.2", - "dev": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4" - } - }, - "node_modules/unique-stream": { - "version": "2.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "json-stable-stringify-without-jsonify": "^1.0.1", - "through2-filter": "^3.0.0" - } - }, - "node_modules/unique-string": { - "version": "1.0.0", - "license": "MIT", - "dependencies": { - "crypto-random-string": "^1.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/universalify": { - "version": "0.1.2", - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/unpipe": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/unset-value": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/has-value": { - "version": "0.3.1", - "dev": true, - "license": "MIT", - "dependencies": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/has-value/node_modules/isobject": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "isarray": "1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/unset-value/node_modules/has-values": { - "version": "0.1.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/upath": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4", - "yarn": "*" - } - }, - "node_modules/update-notifier": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", - "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dev": true, - "dependencies": { - "boxen": "^5.0.0", - "chalk": "^4.1.0", - "configstore": "^5.0.1", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.4.0", - "is-npm": "^5.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.1.0", - "pupa": "^2.1.1", - "semver": "^7.3.4", - "semver-diff": "^3.1.1", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/yeoman/update-notifier?sponsor=1" - } - }, - "node_modules/update-notifier/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/update-notifier/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/update-notifier/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/update-notifier/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/update-notifier/node_modules/configstore": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", - "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, - "dependencies": { - "dot-prop": "^5.2.0", - "graceful-fs": "^4.1.2", - "make-dir": "^3.0.0", - "unique-string": "^2.0.0", - "write-file-atomic": "^3.0.0", - "xdg-basedir": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier/node_modules/crypto-random-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier/node_modules/dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "dependencies": { - "is-obj": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier/node_modules/is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/update-notifier/node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "dependencies": { - "semver": "^6.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/update-notifier/node_modules/make-dir/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/update-notifier/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/update-notifier/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier/node_modules/unique-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", - "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, - "dependencies": { - "crypto-random-string": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier/node_modules/xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/update-notifier/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/upper-case": { - "version": "1.1.3", - "dev": true, - "license": "MIT" - }, - "node_modules/uri-js": { - "version": "4.4.1", - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/urix": { - "version": "0.1.0", - "dev": true, - "license": "MIT" - }, - "node_modules/url": { - "version": "0.10.3", - "license": "MIT", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/url-join": { - "version": "4.0.1", - "license": "MIT" - }, - "node_modules/url-parse": { - "version": "1.5.4", - "dev": true, - "license": "MIT", - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "node_modules/url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "dependencies": { - "prepend-http": "^2.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "license": "MIT" - }, - "node_modules/use": { - "version": "3.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/utf7": { - "version": "1.0.2", - "dependencies": { - "semver": "~5.3.0" - } - }, - "node_modules/utf7/node_modules/semver": { - "version": "5.3.0", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/util": { - "version": "0.11.1", - "dev": true, - "license": "MIT", - "dependencies": { - "inherits": "2.0.3" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/util.promisify": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - }, - "node_modules/util/node_modules/inherits": { - "version": "2.0.3", - "dev": true, - "license": "ISC" - }, - "node_modules/utila": { - "version": "0.4.0", - "dev": true, - "license": "MIT" - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/uuid": { - "version": "3.4.0", - "license": "MIT", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/v8-compile-cache": { - "version": "2.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/v8-to-istanbul": { - "version": "7.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0", - "source-map": "^0.7.3" - }, - "engines": { - "node": ">=10.10.0" - } - }, - "node_modules/v8-to-istanbul/node_modules/source-map": { - "version": "0.7.3", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">= 8" - } - }, - "node_modules/v8flags": { - "version": "3.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "homedir-polyfill": "^1.0.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/validate-npm-package-license": { - "version": "3.0.4", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "node_modules/value-or-function": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "license": "MIT", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/vasync": { - "version": "2.2.1", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "verror": "1.10.0" - } - }, - "node_modules/vasync/node_modules/core-util-is": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/vasync/node_modules/verror": { - "version": "1.10.0", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "node_modules/verror": { - "version": "1.10.1", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/verror/node_modules/core-util-is": { - "version": "1.0.2", - "license": "MIT" - }, - "node_modules/vinyl": { - "version": "2.2.1", - "dev": true, - "license": "MIT", - "dependencies": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/vinyl-bufferstream": { - "version": "1.0.1", - "dev": true, - "dependencies": { - "bufferstreams": "1.0.1" - } - }, - "node_modules/vinyl-bufferstream/node_modules/bufferstreams": { - "version": "1.0.1", - "dev": true, - "dependencies": { - "readable-stream": "^1.0.33" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/vinyl-bufferstream/node_modules/isarray": { - "version": "0.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/vinyl-bufferstream/node_modules/readable-stream": { - "version": "1.1.14", - "dev": true, - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "node_modules/vinyl-bufferstream/node_modules/string_decoder": { - "version": "0.10.31", - "dev": true, - "license": "MIT" - }, - "node_modules/vinyl-fs": { - "version": "3.0.3", - "dev": true, - "license": "MIT", - "dependencies": { - "fs-mkdirp-stream": "^1.0.0", - "glob-stream": "^6.1.0", - "graceful-fs": "^4.0.0", - "is-valid-glob": "^1.0.0", - "lazystream": "^1.0.0", - "lead": "^1.0.0", - "object.assign": "^4.0.4", - "pumpify": "^1.3.5", - "readable-stream": "^2.3.3", - "remove-bom-buffer": "^3.0.0", - "remove-bom-stream": "^1.2.0", - "resolve-options": "^1.1.0", - "through2": "^2.0.0", - "to-through": "^2.0.0", - "value-or-function": "^3.0.0", - "vinyl": "^2.0.0", - "vinyl-sourcemap": "^1.1.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/vinyl-sourcemap": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "append-buffer": "^1.0.2", - "convert-source-map": "^1.5.0", - "graceful-fs": "^4.1.6", - "normalize-path": "^2.1.1", - "now-and-later": "^2.0.0", - "remove-bom-buffer": "^3.0.0", - "vinyl": "^2.0.0" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/vinyl-sourcemap/node_modules/normalize-path": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "remove-trailing-separator": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/vinyl/node_modules/replace-ext": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/vm-browserify": { - "version": "1.1.2", - "dev": true, - "license": "MIT" - }, - "node_modules/vn-loopback": { - "resolved": "loopback", - "link": true - }, - "node_modules/vn-print": { - "resolved": "print", - "link": true - }, - "node_modules/w3c-hr-time": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "browser-process-hrtime": "^1.0.0" - } - }, - "node_modules/w3c-xmlserializer": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "xml-name-validator": "^3.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/walker": { - "version": "1.0.8", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "makeerror": "1.0.12" - } - }, - "node_modules/watchpack": { - "version": "1.7.5", - "dev": true, - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "neo-async": "^2.5.0" - }, - "optionalDependencies": { - "chokidar": "^3.4.1", - "watchpack-chokidar2": "^2.0.1" - } - }, - "node_modules/watchpack-chokidar2": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "chokidar": "^2.1.8" - } - }, - "node_modules/watchpack/node_modules/anymatch": { - "version": "3.1.2", - "dev": true, - "license": "ISC", - "optional": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/watchpack/node_modules/binary-extensions": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/watchpack/node_modules/braces": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/watchpack/node_modules/chokidar": { - "version": "3.5.2", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/watchpack/node_modules/fill-range": { - "version": "7.0.1", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/watchpack/node_modules/is-binary-path": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/watchpack/node_modules/is-number": { - "version": "7.0.0", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/watchpack/node_modules/readdirp": { - "version": "3.6.0", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/watchpack/node_modules/to-regex-range": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "optional": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/wbuf": { - "version": "1.7.3", - "dev": true, - "license": "MIT", - "dependencies": { - "minimalistic-assert": "^1.0.0" - } - }, - "node_modules/web-streams-polyfill": { - "version": "4.0.0-beta.1", - "license": "MIT", - "engines": { - "node": ">= 12" - } - }, - "node_modules/webidl-conversions": { - "version": "6.1.0", - "dev": true, - "license": "BSD-2-Clause", - "engines": { - "node": ">=10.4" - } - }, - "node_modules/webpack": { - "version": "4.46.0", - "dev": true, - "license": "MIT", - "dependencies": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-module-context": "1.9.0", - "@webassemblyjs/wasm-edit": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0", - "acorn": "^6.4.1", - "ajv": "^6.10.2", - "ajv-keywords": "^3.4.1", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^4.5.0", - "eslint-scope": "^4.0.3", - "json-parse-better-errors": "^1.0.2", - "loader-runner": "^2.4.0", - "loader-utils": "^1.2.3", - "memory-fs": "^0.4.1", - "micromatch": "^3.1.10", - "mkdirp": "^0.5.3", - "neo-async": "^2.6.1", - "node-libs-browser": "^2.2.1", - "schema-utils": "^1.0.0", - "tapable": "^1.1.3", - "terser-webpack-plugin": "^1.4.3", - "watchpack": "^1.7.4", - "webpack-sources": "^1.4.1" - }, - "bin": { - "webpack": "bin/webpack.js" - }, - "engines": { - "node": ">=6.11.5" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - }, - "webpack-command": { - "optional": true - } - } - }, - "node_modules/webpack-cli": { - "version": "3.3.12", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^2.4.2", - "cross-spawn": "^6.0.5", - "enhanced-resolve": "^4.1.1", - "findup-sync": "^3.0.0", - "global-modules": "^2.0.0", - "import-local": "^2.0.0", - "interpret": "^1.4.0", - "loader-utils": "^1.4.0", - "supports-color": "^6.1.0", - "v8-compile-cache": "^2.1.1", - "yargs": "^13.3.2" - }, - "bin": { - "webpack-cli": "bin/cli.js" - }, - "engines": { - "node": ">=6.11.5" - }, - "peerDependencies": { - "webpack": "4.x.x" - } - }, - "node_modules/webpack-cli/node_modules/ansi-regex": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/cliui": { - "version": "5.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "node_modules/webpack-cli/node_modules/cross-spawn": { - "version": "6.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "node_modules/webpack-cli/node_modules/emoji-regex": { - "version": "7.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/webpack-cli/node_modules/find-up": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/get-caller-file": { - "version": "2.0.5", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/webpack-cli/node_modules/global-modules": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "global-prefix": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/global-prefix": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ini": "^1.3.5", - "kind-of": "^6.0.2", - "which": "^1.3.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/import-local": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-cli/node_modules/locate-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/p-locate": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/path-exists": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-cli/node_modules/path-key": { - "version": "2.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-cli/node_modules/require-main-filename": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/webpack-cli/node_modules/resolve-cwd": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve-from": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-cli/node_modules/resolve-from": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-cli/node_modules/semver": { - "version": "5.7.1", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/webpack-cli/node_modules/shebang-command": { - "version": "1.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack-cli/node_modules/shebang-regex": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack-cli/node_modules/string-width": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/strip-ansi": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/supports-color": { - "version": "6.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/which": { - "version": "1.3.1", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "node_modules/webpack-cli/node_modules/which-module": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/webpack-cli/node_modules/wrap-ansi": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-cli/node_modules/yargs": { - "version": "13.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "node_modules/webpack-cli/node_modules/yargs-parser": { - "version": "13.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/webpack-dev-middleware": { - "version": "3.7.3", - "dev": true, - "license": "MIT", - "dependencies": { - "memory-fs": "^0.4.1", - "mime": "^2.4.4", - "mkdirp": "^0.5.1", - "range-parser": "^1.2.1", - "webpack-log": "^2.0.0" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" - } - }, - "node_modules/webpack-dev-middleware/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/webpack-dev-server": { - "version": "3.11.3", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-html-community": "0.0.8", - "bonjour": "^3.5.0", - "chokidar": "^2.1.8", - "compression": "^1.7.4", - "connect-history-api-fallback": "^1.6.0", - "debug": "^4.1.1", - "del": "^4.1.1", - "express": "^4.17.1", - "html-entities": "^1.3.1", - "http-proxy-middleware": "0.19.1", - "import-local": "^2.0.0", - "internal-ip": "^4.3.0", - "ip": "^1.1.5", - "is-absolute-url": "^3.0.3", - "killable": "^1.0.1", - "loglevel": "^1.6.8", - "opn": "^5.5.0", - "p-retry": "^3.0.1", - "portfinder": "^1.0.26", - "schema-utils": "^1.0.0", - "selfsigned": "^1.10.8", - "semver": "^6.3.0", - "serve-index": "^1.9.1", - "sockjs": "^0.3.21", - "sockjs-client": "^1.5.0", - "spdy": "^4.0.2", - "strip-ansi": "^3.0.1", - "supports-color": "^6.1.0", - "url": "^0.11.0", - "webpack-dev-middleware": "^3.7.2", - "webpack-log": "^2.0.0", - "ws": "^6.2.1", - "yargs": "^13.3.2" - }, - "bin": { - "webpack-dev-server": "bin/webpack-dev-server.js" - }, - "engines": { - "node": ">= 6.11.5" - }, - "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" - }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - } - } - }, - "node_modules/webpack-dev-server/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack-dev-server/node_modules/cliui": { - "version": "5.0.0", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "node_modules/webpack-dev-server/node_modules/cliui/node_modules/ansi-regex": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/cliui/node_modules/strip-ansi": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/del": { - "version": "4.1.1", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/glob": "^7.1.1", - "globby": "^6.1.0", - "is-path-cwd": "^2.0.0", - "is-path-in-cwd": "^2.0.0", - "p-map": "^2.0.0", - "pify": "^4.0.1", - "rimraf": "^2.6.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/del/node_modules/pify": { - "version": "4.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/emoji-regex": { - "version": "7.0.3", - "dev": true, - "license": "MIT" - }, - "node_modules/webpack-dev-server/node_modules/find-up": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/get-caller-file": { - "version": "2.0.5", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/webpack-dev-server/node_modules/globby": { - "version": "6.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack-dev-server/node_modules/import-local": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-dev-server/node_modules/is-path-cwd": { - "version": "2.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/is-path-in-cwd": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "is-path-inside": "^2.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/is-path-inside": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "path-is-inside": "^1.0.2" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/locate-path": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/p-locate": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/path-exists": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-dev-server/node_modules/punycode": { - "version": "1.3.2", - "dev": true, - "license": "MIT" - }, - "node_modules/webpack-dev-server/node_modules/require-main-filename": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/webpack-dev-server/node_modules/resolve-cwd": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve-from": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-dev-server/node_modules/resolve-from": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/webpack-dev-server/node_modules/schema-utils": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/webpack-dev-server/node_modules/string-width": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/string-width/node_modules/ansi-regex": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/string-width/node_modules/strip-ansi": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/strip-ansi": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack-dev-server/node_modules/supports-color": { - "version": "6.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/url": { - "version": "0.11.0", - "dev": true, - "license": "MIT", - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "node_modules/webpack-dev-server/node_modules/which-module": { - "version": "2.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/webpack-dev-server/node_modules/wrap-ansi": { - "version": "5.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "4.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "5.2.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^4.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-dev-server/node_modules/ws": { - "version": "6.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "async-limiter": "~1.0.0" - } - }, - "node_modules/webpack-dev-server/node_modules/yargs": { - "version": "13.3.2", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "node_modules/webpack-dev-server/node_modules/yargs-parser": { - "version": "13.1.2", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "node_modules/webpack-log": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-colors": "^3.0.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/webpack-log/node_modules/ansi-colors": { - "version": "3.2.4", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/webpack-merge": { - "version": "4.2.2", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash": "^4.17.15" - } - }, - "node_modules/webpack-sources": { - "version": "1.4.3", - "dev": true, - "license": "MIT", - "dependencies": { - "source-list-map": "^2.0.0", - "source-map": "~0.6.1" - } - }, - "node_modules/webpack-sources/node_modules/source-map": { - "version": "0.6.1", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/acorn": { - "version": "6.4.2", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/webpack/node_modules/define-property": { - "version": "2.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/eslint-scope": { - "version": "4.0.3", - "dev": true, - "license": "BSD-2-Clause", - "dependencies": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/webpack/node_modules/extend-shallow": { - "version": "3.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "kind-of": "^6.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/is-descriptor": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/is-extendable": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "is-plain-object": "^2.0.4" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/micromatch": { - "version": "3.1.10", - "dev": true, - "license": "MIT", - "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/webpack/node_modules/mkdirp": { - "version": "0.5.5", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/webpack/node_modules/schema-utils": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - }, - "engines": { - "node": ">= 4" - } - }, - "node_modules/websocket-driver": { - "version": "0.7.4", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "http-parser-js": ">=0.5.1", - "safe-buffer": ">=5.1.0", - "websocket-extensions": ">=0.1.1" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/websocket-extensions": { - "version": "0.1.4", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/whatwg-encoding": { - "version": "1.0.5", - "dev": true, - "license": "MIT", - "dependencies": { - "iconv-lite": "0.4.24" - } - }, - "node_modules/whatwg-mimetype": { - "version": "2.3.0", - "dev": true, - "license": "MIT" - }, - "node_modules/whatwg-url": { - "version": "8.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lodash": "^4.7.0", - "tr46": "^2.1.0", - "webidl-conversions": "^6.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/which": { - "version": "2.0.2", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/which-boxed-primitive": { - "version": "1.0.2", - "dev": true, - "license": "MIT", - "dependencies": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/which-module": { - "version": "1.0.0", - "dev": true, - "license": "ISC" - }, - "node_modules/wide-align": { - "version": "1.1.5", - "license": "ISC", - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, - "node_modules/widest-line": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", - "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, - "dependencies": { - "string-width": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/widest-line/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/widest-line/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/with-open-file": { - "version": "0.1.7", - "license": "MIT", - "dependencies": { - "p-finally": "^1.0.0", - "p-try": "^2.1.0", - "pify": "^4.0.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/with-open-file/node_modules/pify": { - "version": "4.0.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/word-count": { - "version": "0.2.2", - "license": "MIT" - }, - "node_modules/word-wrap": { - "version": "1.2.3", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/worker-farm": { - "version": "1.7.0", - "dev": true, - "license": "MIT", - "dependencies": { - "errno": "~0.1.7" - } - }, - "node_modules/wrap-ansi": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "2.1.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "3.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "license": "ISC" - }, - "node_modules/write-file-atomic": { - "version": "3.0.3", - "dev": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "node_modules/ws": { - "version": "7.5.6", - "license": "MIT", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/x-xss-protection": { - "version": "1.3.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/xdg-basedir": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/xml": { - "version": "1.0.1", - "dev": true, - "license": "MIT" - }, - "node_modules/xml-name-validator": { - "version": "3.0.0", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/xml2js": { - "version": "0.4.23", - "license": "MIT", - "dependencies": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/xmlbuilder": { - "version": "11.0.1", - "license": "MIT", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/xmlchars": { - "version": "2.2.0", - "dev": true, - "license": "MIT" - }, - "node_modules/xmlcreate": { - "version": "1.0.2", - "license": "Apache-2.0" - }, - "node_modules/xtend": { - "version": "4.0.2", - "license": "MIT", - "engines": { - "node": ">=0.4" - } - }, - "node_modules/y18n": { - "version": "4.0.3", - "dev": true, - "license": "ISC" - }, - "node_modules/yallist": { - "version": "3.1.1", - "license": "ISC" - }, - "node_modules/yaml-loader": { - "version": "0.5.0", - "dev": true, - "license": "MIT", - "dependencies": { - "js-yaml": "^3.5.2" - } - }, - "node_modules/yamljs": { - "version": "0.3.0", - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "glob": "^7.0.5" - }, - "bin": { - "json2yaml": "bin/json2yaml", - "yaml2json": "bin/yaml2json" - } - }, - "node_modules/yargs": { - "version": "7.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "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.1" - } - }, - "node_modules/yargs-parser": { - "version": "5.0.1", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^3.0.0", - "object.assign": "^4.1.0" - } - }, - "node_modules/yargs-parser/node_modules/camelcase": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/camelcase": { - "version": "3.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/find-up": { - "version": "1.1.2", - "dev": true, - "license": "MIT", - "dependencies": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/invert-kv": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/lcid": { - "version": "1.0.0", - "dev": true, - "license": "MIT", - "dependencies": { - "invert-kv": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/os-locale": { - "version": "1.4.0", - "dev": true, - "license": "MIT", - "dependencies": { - "lcid": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/path-exists": { - "version": "2.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "pinkie-promise": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/read-pkg": { - "version": "1.1.0", - "dev": true, - "license": "MIT", - "dependencies": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/read-pkg-up": { - "version": "1.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/yargs/node_modules/y18n": { - "version": "3.2.2", - "dev": true, - "license": "ISC" - }, - "node_modules/yauzl": { - "version": "2.10.0", - "license": "MIT", - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - }, - "print": { - "name": "vn-print", - "version": "2.0.0", - "license": "GPL-3.0", - "dependencies": { - "fs-extra": "^7.0.1", - "intl": "^1.2.5", - "js-yaml": "^3.13.1", - "jsonexport": "^3.2.0", - "juice": "^5.2.0", - "mysql2": "^1.7.0", - "nodemailer": "^4.7.0", - "puppeteer": "^2.0.0", - "qrcode": "^1.4.2", - "strftime": "^0.10.0", - "vue": "^2.6.10", - "vue-i18n": "^8.15.0", - "vue-server-renderer": "^2.6.10" - } - }, - "print/node_modules/@types/mime-types": { - "version": "2.1.1", - "license": "MIT" - }, - "print/node_modules/agent-base": { - "version": "5.1.1", - "license": "MIT", - "engines": { - "node": ">= 6.0.0" - } - }, - "print/node_modules/ajv": { - "version": "6.12.6", - "license": "MIT", - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, - "print/node_modules/ansi-regex": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/ansi-styles": { - "version": "2.2.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/argparse": { - "version": "1.0.10", - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "print/node_modules/asn1": { - "version": "0.2.6", - "license": "MIT", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "print/node_modules/assert-plus": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.8" - } - }, - "print/node_modules/async": { - "version": "3.2.3", - "license": "MIT" - }, - "print/node_modules/async-limiter": { - "version": "1.0.1", - "license": "MIT" - }, - "print/node_modules/asynckit": { - "version": "0.4.0", - "license": "MIT" - }, - "print/node_modules/aws-sign2": { - "version": "0.7.0", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "print/node_modules/aws4": { - "version": "1.11.0", - "license": "MIT" - }, - "print/node_modules/balanced-match": { - "version": "1.0.2", - "license": "MIT" - }, - "print/node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "license": "BSD-3-Clause", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "print/node_modules/boolbase": { - "version": "1.0.0", - "license": "ISC" - }, - "print/node_modules/brace-expansion": { - "version": "1.1.11", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "print/node_modules/buffer-crc32": { - "version": "0.2.13", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "print/node_modules/buffer-from": { - "version": "1.1.2", - "license": "MIT" - }, - "print/node_modules/camelcase": { - "version": "5.3.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "print/node_modules/caseless": { - "version": "0.12.0", - "license": "Apache-2.0" - }, - "print/node_modules/chalk": { - "version": "1.1.3", - "license": "MIT", - "dependencies": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/cheerio": { - "version": "0.22.0", - "license": "MIT", - "dependencies": { - "css-select": "~1.2.0", - "dom-serializer": "~0.1.0", - "entities": "~1.1.1", - "htmlparser2": "^3.9.1", - "lodash.assignin": "^4.0.9", - "lodash.bind": "^4.1.4", - "lodash.defaults": "^4.0.1", - "lodash.filter": "^4.4.0", - "lodash.flatten": "^4.2.0", - "lodash.foreach": "^4.3.0", - "lodash.map": "^4.4.0", - "lodash.merge": "^4.4.0", - "lodash.pick": "^4.2.1", - "lodash.reduce": "^4.4.0", - "lodash.reject": "^4.4.0", - "lodash.some": "^4.4.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "print/node_modules/cliui": { - "version": "6.0.0", - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "print/node_modules/cliui/node_modules/ansi-regex": { - "version": "5.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "print/node_modules/cliui/node_modules/strip-ansi": { - "version": "6.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/color-convert": { - "version": "1.9.3", - "license": "MIT", - "dependencies": { - "color-name": "1.1.3" - } - }, - "print/node_modules/color-name": { - "version": "1.1.3", - "license": "MIT" - }, - "print/node_modules/combined-stream": { - "version": "1.0.8", - "license": "MIT", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "print/node_modules/commander": { - "version": "2.20.3", - "license": "MIT" - }, - "print/node_modules/concat-map": { - "version": "0.0.1", - "license": "MIT" - }, - "print/node_modules/concat-stream": { - "version": "1.6.2", - "engines": [ - "node >= 0.8" - ], - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "print/node_modules/concat-stream/node_modules/readable-stream": { - "version": "2.3.7", - "license": "MIT", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "print/node_modules/concat-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "license": "MIT" - }, - "print/node_modules/concat-stream/node_modules/string_decoder": { - "version": "1.1.1", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "print/node_modules/core-util-is": { - "version": "1.0.2", - "license": "MIT" - }, - "print/node_modules/cross-spawn": { - "version": "6.0.5", - "license": "MIT", - "dependencies": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "engines": { - "node": ">=4.8" - } - }, - "print/node_modules/css-select": { - "version": "1.2.0", - "license": "BSD-like", - "dependencies": { - "boolbase": "~1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "~1.0.1" - } - }, - "print/node_modules/css-what": { - "version": "2.1.3", - "license": "BSD-2-Clause", - "engines": { - "node": "*" - } - }, - "print/node_modules/dashdash": { - "version": "1.14.1", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - }, - "engines": { - "node": ">=0.10" - } - }, - "print/node_modules/datauri": { - "version": "2.0.0", - "license": "MIT", - "dependencies": { - "image-size": "^0.7.3", - "mimer": "^1.0.0" - }, - "engines": { - "node": ">= 4" - } - }, - "print/node_modules/debug": { - "version": "4.3.3", - "license": "MIT", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "print/node_modules/decamelize": { - "version": "1.2.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/deep-extend": { - "version": "0.6.0", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, - "print/node_modules/delayed-stream": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "print/node_modules/denque": { - "version": "1.5.1", - "license": "Apache-2.0", - "engines": { - "node": ">=0.10" - } - }, - "print/node_modules/dijkstrajs": { - "version": "1.0.2", - "license": "MIT" - }, - "print/node_modules/dom-serializer": { - "version": "0.1.1", - "license": "MIT", - "dependencies": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, - "print/node_modules/domelementtype": { - "version": "1.3.1", - "license": "BSD-2-Clause" - }, - "print/node_modules/domhandler": { - "version": "2.4.2", - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "1" - } - }, - "print/node_modules/domutils": { - "version": "1.5.1", - "dependencies": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "print/node_modules/ecc-jsbn": { - "version": "0.1.2", - "license": "MIT", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "print/node_modules/emoji-regex": { - "version": "8.0.0", - "license": "MIT" - }, - "print/node_modules/encode-utf8": { - "version": "1.0.3", - "license": "MIT" - }, - "print/node_modules/entities": { - "version": "1.1.2", - "license": "BSD-2-Clause" - }, - "print/node_modules/escape-string-regexp": { - "version": "1.0.5", - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "print/node_modules/esprima": { - "version": "4.0.1", - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "print/node_modules/extend": { - "version": "3.0.2", - "license": "MIT" - }, - "print/node_modules/extract-zip": { - "version": "1.7.0", - "license": "BSD-2-Clause", - "dependencies": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - } - }, - "print/node_modules/extract-zip/node_modules/debug": { - "version": "2.6.9", - "license": "MIT", - "dependencies": { - "ms": "2.0.0" - } - }, - "print/node_modules/extract-zip/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "print/node_modules/extsprintf": { - "version": "1.3.0", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT" - }, - "print/node_modules/fast-deep-equal": { - "version": "3.1.3", - "license": "MIT" - }, - "print/node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "license": "MIT" - }, - "print/node_modules/fd-slicer": { - "version": "1.1.0", - "license": "MIT", - "dependencies": { - "pend": "~1.2.0" - } - }, - "print/node_modules/find-up": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/forever-agent": { - "version": "0.6.1", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "print/node_modules/form-data": { - "version": "2.3.3", - "license": "MIT", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } - }, - "print/node_modules/fs-extra": { - "version": "7.0.1", - "license": "MIT", - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - }, - "engines": { - "node": ">=6 <7 || >=8" - } - }, - "print/node_modules/fs.realpath": { - "version": "1.0.0", - "license": "ISC" - }, - "print/node_modules/function-bind": { - "version": "1.1.1", - "license": "MIT" - }, - "print/node_modules/generate-function": { - "version": "2.3.1", - "license": "MIT", - "dependencies": { - "is-property": "^1.0.2" - } - }, - "print/node_modules/get-caller-file": { - "version": "2.0.5", - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "print/node_modules/getpass": { - "version": "0.1.7", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0" - } - }, - "print/node_modules/glob": { - "version": "7.2.0", - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "print/node_modules/graceful-fs": { - "version": "4.2.9", - "license": "ISC" - }, - "print/node_modules/har-schema": { - "version": "2.0.0", - "license": "ISC", - "engines": { - "node": ">=4" - } - }, - "print/node_modules/har-validator": { - "version": "5.1.5", - "license": "MIT", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "print/node_modules/has": { - "version": "1.0.3", - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "print/node_modules/has-ansi": { - "version": "2.0.0", - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/has-flag": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "print/node_modules/hash-sum": { - "version": "1.0.2", - "license": "MIT" - }, - "print/node_modules/he": { - "version": "1.2.0", - "license": "MIT", - "bin": { - "he": "bin/he" - } - }, - "print/node_modules/htmlparser2": { - "version": "3.10.1", - "license": "MIT", - "dependencies": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - } - }, - "print/node_modules/http-signature": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - } - }, - "print/node_modules/https-proxy-agent": { - "version": "4.0.0", - "license": "MIT", - "dependencies": { - "agent-base": "5", - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "print/node_modules/iconv-lite": { - "version": "0.5.2", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/image-size": { - "version": "0.7.5", - "license": "MIT", - "bin": { - "image-size": "bin/image-size.js" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "print/node_modules/inflight": { - "version": "1.0.6", - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "print/node_modules/inherits": { - "version": "2.0.4", - "license": "ISC" - }, - "print/node_modules/intl": { - "version": "1.2.5", - "license": "MIT" - }, - "print/node_modules/is-core-module": { - "version": "2.8.1", - "license": "MIT", - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "print/node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "print/node_modules/is-property": { - "version": "1.0.2", - "license": "MIT" - }, - "print/node_modules/is-typedarray": { - "version": "1.0.0", - "license": "MIT" - }, - "print/node_modules/isarray": { - "version": "1.0.0", - "license": "MIT" - }, - "print/node_modules/isexe": { - "version": "2.0.0", - "license": "ISC" - }, - "print/node_modules/isstream": { - "version": "0.1.2", - "license": "MIT" - }, - "print/node_modules/js-yaml": { - "version": "3.14.1", - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "print/node_modules/jsbn": { - "version": "0.1.1", - "license": "MIT" - }, - "print/node_modules/json-schema": { - "version": "0.4.0", - "license": "(AFL-2.1 OR BSD-3-Clause)" - }, - "print/node_modules/json-schema-traverse": { - "version": "0.4.1", - "license": "MIT" - }, - "print/node_modules/json-stringify-safe": { - "version": "5.0.1", - "license": "ISC" - }, - "print/node_modules/jsonexport": { - "version": "3.2.0", - "license": "Apache-2.0", - "bin": { - "jsonexport": "bin/jsonexport.js" - } - }, - "print/node_modules/jsonfile": { - "version": "4.0.0", - "license": "MIT", - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "print/node_modules/jsprim": { - "version": "1.4.2", - "license": "MIT", - "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "print/node_modules/juice": { - "version": "5.2.0", - "license": "MIT", - "dependencies": { - "cheerio": "^0.22.0", - "commander": "^2.15.1", - "cross-spawn": "^6.0.5", - "deep-extend": "^0.6.0", - "mensch": "^0.3.3", - "slick": "^1.12.2", - "web-resource-inliner": "^4.3.1" - }, - "bin": { - "juice": "bin/juice" - }, - "engines": { - "node": ">=4.2.0" - } - }, - "print/node_modules/locate-path": { - "version": "5.0.0", - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/lodash._reinterpolate": { - "version": "3.0.0", - "license": "MIT" - }, - "print/node_modules/lodash.assignin": { - "version": "4.2.0", - "license": "MIT" - }, - "print/node_modules/lodash.bind": { - "version": "4.2.1", - "license": "MIT" - }, - "print/node_modules/lodash.defaults": { - "version": "4.2.0", - "license": "MIT" - }, - "print/node_modules/lodash.filter": { - "version": "4.6.0", - "license": "MIT" - }, - "print/node_modules/lodash.flatten": { - "version": "4.4.0", - "license": "MIT" - }, - "print/node_modules/lodash.foreach": { - "version": "4.5.0", - "license": "MIT" - }, - "print/node_modules/lodash.map": { - "version": "4.6.0", - "license": "MIT" - }, - "print/node_modules/lodash.merge": { - "version": "4.6.2", - "license": "MIT" - }, - "print/node_modules/lodash.pick": { - "version": "4.4.0", - "license": "MIT" - }, - "print/node_modules/lodash.reduce": { - "version": "4.6.0", - "license": "MIT" - }, - "print/node_modules/lodash.reject": { - "version": "4.6.0", - "license": "MIT" - }, - "print/node_modules/lodash.some": { - "version": "4.6.0", - "license": "MIT" - }, - "print/node_modules/lodash.template": { - "version": "4.5.0", - "license": "MIT", - "dependencies": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" - } - }, - "print/node_modules/lodash.templatesettings": { - "version": "4.2.0", - "license": "MIT", - "dependencies": { - "lodash._reinterpolate": "^3.0.0" - } - }, - "print/node_modules/lodash.unescape": { - "version": "4.0.1", - "license": "MIT" - }, - "print/node_modules/lodash.uniq": { - "version": "4.5.0", - "license": "MIT" - }, - "print/node_modules/long": { - "version": "4.0.0", - "license": "Apache-2.0" - }, - "print/node_modules/lru-cache": { - "version": "5.1.1", - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "print/node_modules/mensch": { - "version": "0.3.4", - "license": "MIT" - }, - "print/node_modules/mime": { - "version": "2.6.0", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "print/node_modules/mime-db": { - "version": "1.51.0", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "print/node_modules/mime-types": { - "version": "2.1.34", - "license": "MIT", - "dependencies": { - "mime-db": "1.51.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "print/node_modules/mimer": { - "version": "1.1.1", - "license": "MIT", - "bin": { - "mimer": "bin/mimer" - }, - "engines": { - "node": ">= 6.0" - } - }, - "print/node_modules/minimatch": { - "version": "3.0.4", - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "print/node_modules/minimist": { - "version": "1.2.5", - "license": "MIT" - }, - "print/node_modules/mkdirp": { - "version": "0.5.5", - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "print/node_modules/ms": { - "version": "2.1.2", - "license": "MIT" - }, - "print/node_modules/mysql2": { - "version": "1.7.0", - "license": "MIT", - "dependencies": { - "denque": "^1.4.1", - "generate-function": "^2.3.1", - "iconv-lite": "^0.5.0", - "long": "^4.0.0", - "lru-cache": "^5.1.1", - "named-placeholders": "^1.1.2", - "seq-queue": "^0.0.5", - "sqlstring": "^2.3.1" - }, - "engines": { - "node": ">= 8.0" - } - }, - "print/node_modules/named-placeholders": { - "version": "1.1.2", - "license": "MIT", - "dependencies": { - "lru-cache": "^4.1.3" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "print/node_modules/named-placeholders/node_modules/lru-cache": { - "version": "4.1.5", - "license": "ISC", - "dependencies": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "print/node_modules/named-placeholders/node_modules/yallist": { - "version": "2.1.2", - "license": "ISC" - }, - "print/node_modules/nice-try": { - "version": "1.0.5", - "license": "MIT" - }, - "print/node_modules/nodemailer": { - "version": "4.7.0", - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "print/node_modules/nth-check": { - "version": "1.0.2", - "license": "BSD-2-Clause", - "dependencies": { - "boolbase": "~1.0.0" - } - }, - "print/node_modules/oauth-sign": { - "version": "0.9.0", - "license": "Apache-2.0", - "engines": { - "node": "*" - } - }, - "print/node_modules/once": { - "version": "1.4.0", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "print/node_modules/p-limit": { - "version": "2.3.0", - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "print/node_modules/p-locate": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/p-try": { - "version": "2.2.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "print/node_modules/path-exists": { - "version": "4.0.0", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "print/node_modules/path-is-absolute": { - "version": "1.0.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/path-key": { - "version": "2.0.1", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "print/node_modules/path-parse": { - "version": "1.0.7", - "license": "MIT" - }, - "print/node_modules/pend": { - "version": "1.2.0", - "license": "MIT" - }, - "print/node_modules/performance-now": { - "version": "2.1.0", - "license": "MIT" - }, - "print/node_modules/pngjs": { - "version": "5.0.0", - "license": "MIT", - "engines": { - "node": ">=10.13.0" - } - }, - "print/node_modules/process-nextick-args": { - "version": "2.0.1", - "license": "MIT" - }, - "print/node_modules/progress": { - "version": "2.0.3", - "license": "MIT", - "engines": { - "node": ">=0.4.0" - } - }, - "print/node_modules/proxy-from-env": { - "version": "1.1.0", - "license": "MIT" - }, - "print/node_modules/pseudomap": { - "version": "1.0.2", - "license": "ISC" - }, - "print/node_modules/psl": { - "version": "1.8.0", - "license": "MIT" - }, - "print/node_modules/punycode": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "print/node_modules/puppeteer": { - "version": "2.1.1", - "hasInstallScript": true, - "license": "Apache-2.0", - "dependencies": { - "@types/mime-types": "^2.1.0", - "debug": "^4.1.0", - "extract-zip": "^1.6.6", - "https-proxy-agent": "^4.0.0", - "mime": "^2.0.3", - "mime-types": "^2.1.25", - "progress": "^2.0.1", - "proxy-from-env": "^1.0.0", - "rimraf": "^2.6.1", - "ws": "^6.1.0" - }, - "engines": { - "node": ">=8.16.0" - } - }, - "print/node_modules/qrcode": { - "version": "1.5.0", - "license": "MIT", - "dependencies": { - "dijkstrajs": "^1.0.1", - "encode-utf8": "^1.0.3", - "pngjs": "^5.0.0", - "yargs": "^15.3.1" - }, - "bin": { - "qrcode": "bin/qrcode" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "print/node_modules/qs": { - "version": "6.5.3", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.6" - } - }, - "print/node_modules/randombytes": { - "version": "2.1.0", - "license": "MIT", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "print/node_modules/readable-stream": { - "version": "3.6.0", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "print/node_modules/request": { - "version": "2.88.2", - "license": "Apache-2.0", - "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "print/node_modules/require-directory": { - "version": "2.1.1", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/require-main-filename": { - "version": "2.0.0", - "license": "ISC" - }, - "print/node_modules/resolve": { - "version": "1.21.0", - "license": "MIT", - "dependencies": { - "is-core-module": "^2.8.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "print/node_modules/rimraf": { - "version": "2.7.1", - "license": "ISC", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "print/node_modules/safe-buffer": { - "version": "5.2.1", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "print/node_modules/safer-buffer": { - "version": "2.1.2", - "license": "MIT" - }, - "print/node_modules/semver": { - "version": "5.7.1", - "license": "ISC", - "bin": { - "semver": "bin/semver" - } - }, - "print/node_modules/seq-queue": { - "version": "0.0.5" - }, - "print/node_modules/serialize-javascript": { - "version": "3.1.0", - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "print/node_modules/set-blocking": { - "version": "2.0.0", - "license": "ISC" - }, - "print/node_modules/shebang-command": { - "version": "1.2.0", - "license": "MIT", - "dependencies": { - "shebang-regex": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/shebang-regex": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/slick": { - "version": "1.12.2", - "license": "MIT (http://mootools.net/license.txt)", - "engines": { - "node": "*" - } - }, - "print/node_modules/source-map": { - "version": "0.5.6", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/sprintf-js": { - "version": "1.0.3", - "license": "BSD-3-Clause" - }, - "print/node_modules/sqlstring": { - "version": "2.3.2", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, - "print/node_modules/sshpk": { - "version": "1.17.0", - "license": "MIT", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - }, - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/strftime": { - "version": "0.10.1", - "license": "MIT", - "engines": { - "node": ">=0.2.0" - } - }, - "print/node_modules/string_decoder": { - "version": "1.3.0", - "license": "MIT", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "print/node_modules/string-width": { - "version": "4.2.3", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/string-width/node_modules/ansi-regex": { - "version": "5.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "print/node_modules/string-width/node_modules/strip-ansi": { - "version": "6.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/strip-ansi": { - "version": "3.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^2.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "print/node_modules/supports-color": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=0.8.0" - } - }, - "print/node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "print/node_modules/tough-cookie": { - "version": "2.5.0", - "license": "BSD-3-Clause", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, - "engines": { - "node": ">=0.8" - } - }, - "print/node_modules/tunnel-agent": { - "version": "0.6.0", - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, - "print/node_modules/tweetnacl": { - "version": "0.14.5", - "license": "Unlicense" - }, - "print/node_modules/typedarray": { - "version": "0.0.6", - "license": "MIT" - }, - "print/node_modules/universalify": { - "version": "0.1.2", - "license": "MIT", - "engines": { - "node": ">= 4.0.0" - } - }, - "print/node_modules/uri-js": { - "version": "4.4.1", - "license": "BSD-2-Clause", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "print/node_modules/util-deprecate": { - "version": "1.0.2", - "license": "MIT" - }, - "print/node_modules/uuid": { - "version": "3.4.0", - "license": "MIT", - "bin": { - "uuid": "bin/uuid" - } - }, - "print/node_modules/valid-data-url": { - "version": "2.0.0", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "print/node_modules/verror": { - "version": "1.10.0", - "engines": [ - "node >=0.6.0" - ], - "license": "MIT", - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "print/node_modules/vue": { - "version": "2.6.14", - "license": "MIT" - }, - "print/node_modules/vue-i18n": { - "version": "8.26.8", - "license": "MIT" - }, - "print/node_modules/vue-server-renderer": { - "version": "2.6.14", - "license": "MIT", - "dependencies": { - "chalk": "^1.1.3", - "hash-sum": "^1.0.2", - "he": "^1.1.0", - "lodash.template": "^4.5.0", - "lodash.uniq": "^4.5.0", - "resolve": "^1.2.0", - "serialize-javascript": "^3.1.0", - "source-map": "0.5.6" - } - }, - "print/node_modules/web-resource-inliner": { - "version": "4.3.4", - "license": "MIT", - "dependencies": { - "async": "^3.1.0", - "chalk": "^2.4.2", - "datauri": "^2.0.0", - "htmlparser2": "^4.0.0", - "lodash.unescape": "^4.0.1", - "request": "^2.88.0", - "safer-buffer": "^2.1.2", - "valid-data-url": "^2.0.0", - "xtend": "^4.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "print/node_modules/web-resource-inliner/node_modules/ansi-styles": { - "version": "3.2.1", - "license": "MIT", - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "print/node_modules/web-resource-inliner/node_modules/chalk": { - "version": "2.4.2", - "license": "MIT", - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "print/node_modules/web-resource-inliner/node_modules/dom-serializer": { - "version": "1.3.2", - "license": "MIT", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" - } - }, - "print/node_modules/web-resource-inliner/node_modules/dom-serializer/node_modules/domhandler": { - "version": "4.3.0", - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "^2.2.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "print/node_modules/web-resource-inliner/node_modules/domelementtype": { - "version": "2.2.0", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "license": "BSD-2-Clause" - }, - "print/node_modules/web-resource-inliner/node_modules/domhandler": { - "version": "3.3.0", - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "^2.0.1" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "print/node_modules/web-resource-inliner/node_modules/domutils": { - "version": "2.8.0", - "license": "BSD-2-Clause", - "dependencies": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "print/node_modules/web-resource-inliner/node_modules/domutils/node_modules/domhandler": { - "version": "4.3.0", - "license": "BSD-2-Clause", - "dependencies": { - "domelementtype": "^2.2.0" - }, - "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" - } - }, - "print/node_modules/web-resource-inliner/node_modules/entities": { - "version": "2.2.0", - "license": "BSD-2-Clause", - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "print/node_modules/web-resource-inliner/node_modules/htmlparser2": { - "version": "4.1.0", - "license": "MIT", - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^3.0.0", - "domutils": "^2.0.0", - "entities": "^2.0.0" - } - }, - "print/node_modules/web-resource-inliner/node_modules/supports-color": { - "version": "5.5.0", - "license": "MIT", - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "print/node_modules/which": { - "version": "1.3.1", - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "which": "bin/which" - } - }, - "print/node_modules/which-module": { - "version": "2.0.0", - "license": "ISC" - }, - "print/node_modules/wrap-ansi": { - "version": "6.2.0", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "5.0.1", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "print/node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "4.3.0", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "print/node_modules/wrap-ansi/node_modules/color-convert": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "print/node_modules/wrap-ansi/node_modules/color-name": { - "version": "1.1.4", - "license": "MIT" - }, - "print/node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "6.0.1", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/wrappy": { - "version": "1.0.2", - "license": "ISC" - }, - "print/node_modules/ws": { - "version": "6.2.2", - "license": "MIT", - "dependencies": { - "async-limiter": "~1.0.0" - } - }, - "print/node_modules/xtend": { - "version": "4.0.2", - "license": "MIT", - "engines": { - "node": ">=0.4" - } - }, - "print/node_modules/y18n": { - "version": "4.0.3", - "license": "ISC" - }, - "print/node_modules/yallist": { - "version": "3.1.1", - "license": "ISC" - }, - "print/node_modules/yargs": { - "version": "15.4.1", - "license": "MIT", - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "print/node_modules/yargs-parser": { - "version": "18.1.3", - "license": "ISC", - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - }, - "print/node_modules/yauzl": { - "version": "2.10.0", - "license": "MIT", - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - } - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/highlight": "^7.16.7" - } - }, - "@babel/compat-data": { - "version": "7.16.8", - "dev": true - }, - "@babel/core": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.7", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helpers": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7", - "convert-source-map": "^1.7.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.1.2", - "semver": "^6.3.0", - "source-map": "^0.5.0" - } - }, - "@babel/generator": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/types": "^7.16.8", - "jsesc": "^2.5.1", - "source-map": "^0.5.0" - } - }, - "@babel/helper-annotate-as-pure": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-explode-assignable-expression": "^7.16.7", - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-compilation-targets": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/compat-data": "^7.16.4", - "@babel/helper-validator-option": "^7.16.7", - "browserslist": "^4.17.5", - "semver": "^6.3.0" - } - }, - "@babel/helper-create-class-features-plugin": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7" - } - }, - "@babel/helper-create-regexp-features-plugin": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "regexpu-core": "^4.7.1" - } - }, - "@babel/helper-define-polyfill-provider": { - "version": "0.3.0", - "dev": true, - "requires": { - "@babel/helper-compilation-targets": "^7.13.0", - "@babel/helper-module-imports": "^7.12.13", - "@babel/helper-plugin-utils": "^7.13.0", - "@babel/traverse": "^7.13.0", - "debug": "^4.1.1", - "lodash.debounce": "^4.0.8", - "resolve": "^1.14.2", - "semver": "^6.1.2" - } - }, - "@babel/helper-environment-visitor": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-explode-assignable-expression": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-function-name": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-get-function-arity": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-get-function-arity": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-member-expression-to-functions": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-module-imports": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-module-transforms": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-optimise-call-expression": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-plugin-utils": { - "version": "7.16.7", - "dev": true - }, - "@babel/helper-remap-async-to-generator": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-wrap-function": "^7.16.8", - "@babel/types": "^7.16.8" - } - }, - "@babel/helper-replace-supers": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-member-expression-to-functions": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-simple-access": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-skip-transparent-expression-wrappers": { - "version": "7.16.0", - "dev": true, - "requires": { - "@babel/types": "^7.16.0" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/types": "^7.16.7" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.16.7", - "dev": true - }, - "@babel/helper-validator-option": { - "version": "7.16.7", - "dev": true - }, - "@babel/helper-wrap-function": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/helper-function-name": "^7.16.7", - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.8", - "@babel/types": "^7.16.8" - } - }, - "@babel/helpers": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/template": "^7.16.7", - "@babel/traverse": "^7.16.7", - "@babel/types": "^7.16.7" - } - }, - "@babel/highlight": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.16.7", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.16.8", - "dev": true - }, - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", - "@babel/plugin-proposal-optional-chaining": "^7.16.7" - } - }, - "@babel/plugin-proposal-async-generator-functions": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-remap-async-to-generator": "^7.16.8", - "@babel/plugin-syntax-async-generators": "^7.8.4" - } - }, - "@babel/plugin-proposal-class-properties": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-proposal-class-static-block": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-class-static-block": "^7.14.5" - } - }, - "@babel/plugin-proposal-dynamic-import": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-dynamic-import": "^7.8.3" - } - }, - "@babel/plugin-proposal-export-namespace-from": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3" - } - }, - "@babel/plugin-proposal-json-strings": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-json-strings": "^7.8.3" - } - }, - "@babel/plugin-proposal-logical-assignment-operators": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" - } - }, - "@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - } - }, - "@babel/plugin-proposal-numeric-separator": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - } - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/compat-data": "^7.16.4", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.16.7" - } - }, - "@babel/plugin-proposal-optional-catch-binding": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" - } - }, - "@babel/plugin-proposal-optional-chaining": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - } - }, - "@babel/plugin-proposal-private-methods": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-proposal-private-property-in-object": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-create-class-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5" - } - }, - "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.12.13" - } - }, - "@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-dynamic-import": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-export-namespace-from": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.3" - } - }, - "@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.10.4" - } - }, - "@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.8.0" - } - }, - "@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.14.5" - } - }, - "@babel/plugin-transform-arrow-functions": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-async-to-generator": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-remap-async-to-generator": "^7.16.8" - } - }, - "@babel/plugin-transform-block-scoped-functions": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-block-scoping": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-classes": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-annotate-as-pure": "^7.16.7", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-optimise-call-expression": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "globals": "^11.1.0" - } - }, - "@babel/plugin-transform-computed-properties": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-destructuring": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-dotall-regex": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-duplicate-keys": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-exponentiation-operator": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-for-of": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-function-name": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-literals": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-member-expression-literals": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-modules-amd": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-commonjs": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-simple-access": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-systemjs": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-validator-identifier": "^7.16.7", - "babel-plugin-dynamic-import-node": "^2.3.3" - } - }, - "@babel/plugin-transform-modules-umd": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-module-transforms": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7" - } - }, - "@babel/plugin-transform-new-target": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-object-super": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-replace-supers": "^7.16.7" - } - }, - "@babel/plugin-transform-parameters": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-property-literals": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-regenerator": { - "version": "7.16.7", - "dev": true, - "requires": { - "regenerator-transform": "^0.14.2" - } - }, - "@babel/plugin-transform-reserved-words": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-shorthand-properties": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-spread": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" - } - }, - "@babel/plugin-transform-sticky-regex": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-template-literals": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-typeof-symbol": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-unicode-escapes": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/plugin-transform-unicode-regex": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/helper-create-regexp-features-plugin": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7" - } - }, - "@babel/preset-env": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/compat-data": "^7.16.8", - "@babel/helper-compilation-targets": "^7.16.7", - "@babel/helper-plugin-utils": "^7.16.7", - "@babel/helper-validator-option": "^7.16.7", - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.7", - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-async-generator-functions": "^7.16.8", - "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-class-static-block": "^7.16.7", - "@babel/plugin-proposal-dynamic-import": "^7.16.7", - "@babel/plugin-proposal-export-namespace-from": "^7.16.7", - "@babel/plugin-proposal-json-strings": "^7.16.7", - "@babel/plugin-proposal-logical-assignment-operators": "^7.16.7", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7", - "@babel/plugin-proposal-numeric-separator": "^7.16.7", - "@babel/plugin-proposal-object-rest-spread": "^7.16.7", - "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", - "@babel/plugin-proposal-optional-chaining": "^7.16.7", - "@babel/plugin-proposal-private-methods": "^7.16.7", - "@babel/plugin-proposal-private-property-in-object": "^7.16.7", - "@babel/plugin-proposal-unicode-property-regex": "^7.16.7", - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-dynamic-import": "^7.8.3", - "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5", - "@babel/plugin-transform-arrow-functions": "^7.16.7", - "@babel/plugin-transform-async-to-generator": "^7.16.8", - "@babel/plugin-transform-block-scoped-functions": "^7.16.7", - "@babel/plugin-transform-block-scoping": "^7.16.7", - "@babel/plugin-transform-classes": "^7.16.7", - "@babel/plugin-transform-computed-properties": "^7.16.7", - "@babel/plugin-transform-destructuring": "^7.16.7", - "@babel/plugin-transform-dotall-regex": "^7.16.7", - "@babel/plugin-transform-duplicate-keys": "^7.16.7", - "@babel/plugin-transform-exponentiation-operator": "^7.16.7", - "@babel/plugin-transform-for-of": "^7.16.7", - "@babel/plugin-transform-function-name": "^7.16.7", - "@babel/plugin-transform-literals": "^7.16.7", - "@babel/plugin-transform-member-expression-literals": "^7.16.7", - "@babel/plugin-transform-modules-amd": "^7.16.7", - "@babel/plugin-transform-modules-commonjs": "^7.16.8", - "@babel/plugin-transform-modules-systemjs": "^7.16.7", - "@babel/plugin-transform-modules-umd": "^7.16.7", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.8", - "@babel/plugin-transform-new-target": "^7.16.7", - "@babel/plugin-transform-object-super": "^7.16.7", - "@babel/plugin-transform-parameters": "^7.16.7", - "@babel/plugin-transform-property-literals": "^7.16.7", - "@babel/plugin-transform-regenerator": "^7.16.7", - "@babel/plugin-transform-reserved-words": "^7.16.7", - "@babel/plugin-transform-shorthand-properties": "^7.16.7", - "@babel/plugin-transform-spread": "^7.16.7", - "@babel/plugin-transform-sticky-regex": "^7.16.7", - "@babel/plugin-transform-template-literals": "^7.16.7", - "@babel/plugin-transform-typeof-symbol": "^7.16.7", - "@babel/plugin-transform-unicode-escapes": "^7.16.7", - "@babel/plugin-transform-unicode-regex": "^7.16.7", - "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.16.8", - "babel-plugin-polyfill-corejs2": "^0.3.0", - "babel-plugin-polyfill-corejs3": "^0.5.0", - "babel-plugin-polyfill-regenerator": "^0.3.0", - "core-js-compat": "^3.20.2", - "semver": "^6.3.0" - } - }, - "@babel/preset-modules": { - "version": "0.1.5", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "esutils": "^2.0.2" - } - }, - "@babel/register": { - "version": "7.16.9", - "dev": true, - "requires": { - "clone-deep": "^4.0.1", - "find-cache-dir": "^2.0.0", - "make-dir": "^2.1.0", - "pirates": "^4.0.0", - "source-map-support": "^0.5.16" - } - }, - "@babel/runtime": { - "version": "7.16.7", - "dev": true, - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, - "@babel/runtime-corejs3": { - "version": "7.16.8", - "requires": { - "core-js-pure": "^3.20.2", - "regenerator-runtime": "^0.13.4" - } - }, - "@babel/template": { - "version": "7.16.7", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/parser": "^7.16.7", - "@babel/types": "^7.16.7" - } - }, - "@babel/traverse": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/code-frame": "^7.16.7", - "@babel/generator": "^7.16.8", - "@babel/helper-environment-visitor": "^7.16.7", - "@babel/helper-function-name": "^7.16.7", - "@babel/helper-hoist-variables": "^7.16.7", - "@babel/helper-split-export-declaration": "^7.16.7", - "@babel/parser": "^7.16.8", - "@babel/types": "^7.16.8", - "debug": "^4.1.0", - "globals": "^11.1.0" - } - }, - "@babel/types": { - "version": "7.16.8", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.16.7", - "to-fast-properties": "^2.0.0" - } - }, - "@bcoe/v8-coverage": { - "version": "0.2.3", - "dev": true - }, - "@cnakazawa/watch": { - "version": "1.0.4", - "dev": true, - "requires": { - "exec-sh": "^0.3.2", - "minimist": "^1.2.0" - } - }, - "@eslint/eslintrc": { - "version": "0.4.3", - "dev": true, - "requires": { - "ajv": "^6.12.4", - "debug": "^4.1.1", - "espree": "^7.3.0", - "globals": "^13.9.0", - "ignore": "^4.0.6", - "import-fresh": "^3.2.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "strip-json-comments": "^3.1.1" - }, - "dependencies": { - "globals": { - "version": "13.12.0", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "type-fest": { - "version": "0.20.2", - "dev": true - } - } - }, - "@google-cloud/common": { - "version": "0.32.1", - "requires": { - "@google-cloud/projectify": "^0.3.3", - "@google-cloud/promisify": "^0.4.0", - "@types/request": "^2.48.1", - "arrify": "^2.0.0", - "duplexify": "^3.6.0", - "ent": "^2.2.0", - "extend": "^3.0.2", - "google-auth-library": "^3.1.1", - "pify": "^4.0.1", - "retry-request": "^4.0.0", - "teeny-request": "^3.11.3" - }, - "dependencies": { - "arrify": { - "version": "2.0.1" - }, - "pify": { - "version": "4.0.1" - } - } - }, - "@google-cloud/paginator": { - "version": "0.2.0", - "requires": { - "arrify": "^1.0.1", - "extend": "^3.0.1", - "split-array-stream": "^2.0.0", - "stream-events": "^1.0.4" - } - }, - "@google-cloud/projectify": { - "version": "0.3.3" - }, - "@google-cloud/promisify": { - "version": "0.4.0" - }, - "@google-cloud/storage": { - "version": "2.5.0", - "requires": { - "@google-cloud/common": "^0.32.0", - "@google-cloud/paginator": "^0.2.0", - "@google-cloud/promisify": "^0.4.0", - "arrify": "^1.0.0", - "async": "^2.0.1", - "compressible": "^2.0.12", - "concat-stream": "^2.0.0", - "date-and-time": "^0.6.3", - "duplexify": "^3.5.0", - "extend": "^3.0.0", - "gcs-resumable-upload": "^1.0.0", - "hash-stream-validation": "^0.2.1", - "mime": "^2.2.0", - "mime-types": "^2.0.8", - "onetime": "^5.1.0", - "pumpify": "^1.5.1", - "snakeize": "^0.1.0", - "stream-events": "^1.0.1", - "teeny-request": "^3.11.3", - "through2": "^3.0.0", - "xdg-basedir": "^3.0.0" - }, - "dependencies": { - "concat-stream": { - "version": "2.0.0", - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.0.2", - "typedarray": "^0.0.6" - } - }, - "readable-stream": { - "version": "3.6.0", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "through2": { - "version": "3.0.2", - "requires": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - } - } - }, - "@humanwhocodes/config-array": { - "version": "0.5.0", - "dev": true, - "requires": { - "@humanwhocodes/object-schema": "^1.2.0", - "debug": "^4.1.1", - "minimatch": "^3.0.4" - } - }, - "@humanwhocodes/object-schema": { - "version": "1.2.1", - "dev": true - }, - "@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "dev": true, - "requires": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - } - }, - "@istanbuljs/schema": { - "version": "0.1.3", - "dev": true - }, - "@jest/console": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^26.6.2", - "jest-util": "^26.6.2", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/core": { - "version": "26.6.3", - "dev": true, - "requires": { - "@jest/console": "^26.6.2", - "@jest/reporters": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-changed-files": "^26.6.2", - "jest-config": "^26.6.3", - "jest-haste-map": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.6.2", - "jest-resolve-dependencies": "^26.6.3", - "jest-runner": "^26.6.3", - "jest-runtime": "^26.6.3", - "jest-snapshot": "^26.6.2", - "jest-util": "^26.6.2", - "jest-validate": "^26.6.2", - "jest-watcher": "^26.6.2", - "micromatch": "^4.0.2", - "p-each-series": "^2.1.0", - "rimraf": "^3.0.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/environment": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/fake-timers": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "jest-mock": "^26.6.2" - } - }, - "@jest/fake-timers": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "@sinonjs/fake-timers": "^6.0.1", - "@types/node": "*", - "jest-message-util": "^26.6.2", - "jest-mock": "^26.6.2", - "jest-util": "^26.6.2" - } - }, - "@jest/globals": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/environment": "^26.6.2", - "@jest/types": "^26.6.2", - "expect": "^26.6.2" - } - }, - "@jest/reporters": { - "version": "26.6.2", - "dev": true, - "requires": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.2", - "graceful-fs": "^4.2.4", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^4.0.3", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.0.2", - "jest-haste-map": "^26.6.2", - "jest-resolve": "^26.6.2", - "jest-util": "^26.6.2", - "jest-worker": "^26.6.2", - "node-notifier": "^8.0.0", - "slash": "^3.0.0", - "source-map": "^0.6.0", - "string-length": "^4.0.1", - "terminal-link": "^2.0.0", - "v8-to-istanbul": "^7.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "istanbul-lib-instrument": { - "version": "4.0.3", - "dev": true, - "requires": { - "@babel/core": "^7.7.5", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.0.0", - "semver": "^6.3.0" - } - }, - "source-map": { - "version": "0.6.1", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/source-map": { - "version": "26.6.2", - "dev": true, - "requires": { - "callsites": "^3.0.0", - "graceful-fs": "^4.2.4", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "@jest/test-result": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/console": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - } - }, - "@jest/test-sequencer": { - "version": "26.6.3", - "dev": true, - "requires": { - "@jest/test-result": "^26.6.2", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^26.6.2", - "jest-runner": "^26.6.3", - "jest-runtime": "^26.6.3" - } - }, - "@jest/transform": { - "version": "26.6.2", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/types": "^26.6.2", - "babel-plugin-istanbul": "^6.0.0", - "chalk": "^4.0.0", - "convert-source-map": "^1.4.0", - "fast-json-stable-stringify": "^2.0.0", - "graceful-fs": "^4.2.4", - "jest-haste-map": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-util": "^26.6.2", - "micromatch": "^4.0.2", - "pirates": "^4.0.1", - "slash": "^3.0.0", - "source-map": "^0.6.1", - "write-file-atomic": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@jest/types": { - "version": "26.6.2", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^15.0.0", - "chalk": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "@sindresorhus/is": { - "version": "2.1.1" - }, - "@sinonjs/commons": { - "version": "1.8.3", - "dev": true, - "requires": { - "type-detect": "4.0.8" - } - }, - "@sinonjs/fake-timers": { - "version": "6.0.1", - "dev": true, - "requires": { - "@sinonjs/commons": "^1.7.0" - } - }, - "@szmarczak/http-timer": { - "version": "4.0.6", - "requires": { - "defer-to-connect": "^2.0.0" - } - }, - "@tootallnate/once": { - "version": "1.1.2", - "dev": true - }, - "@types/babel__core": { - "version": "7.1.18", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "@types/babel__generator": { - "version": "7.6.4", - "dev": true, - "requires": { - "@babel/types": "^7.0.0" - } - }, - "@types/babel__template": { - "version": "7.4.1", - "dev": true, - "requires": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "@types/babel__traverse": { - "version": "7.14.2", - "dev": true, - "requires": { - "@babel/types": "^7.3.0" - } - }, - "@types/body-parser": { - "version": "1.19.2", - "requires": { - "@types/connect": "*", - "@types/node": "*" - } - }, - "@types/cacheable-request": { - "version": "6.0.2", - "requires": { - "@types/http-cache-semantics": "*", - "@types/keyv": "*", - "@types/node": "*", - "@types/responselike": "*" - } - }, - "@types/caseless": { - "version": "0.12.2" - }, - "@types/connect": { - "version": "3.4.35", - "requires": { - "@types/node": "*" - } - }, - "@types/express": { - "version": "4.17.13", - "requires": { - "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.18", - "@types/qs": "*", - "@types/serve-static": "*" - } - }, - "@types/express-serve-static-core": { - "version": "4.17.28", - "requires": { - "@types/node": "*", - "@types/qs": "*", - "@types/range-parser": "*" - } - }, - "@types/glob": { - "version": "7.2.0", - "dev": true, - "requires": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, - "@types/graceful-fs": { - "version": "4.1.5", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/html-minifier-terser": { - "version": "5.1.2", - "dev": true - }, - "@types/http-cache-semantics": { - "version": "4.0.1" - }, - "@types/istanbul-lib-coverage": { - "version": "2.0.4", - "dev": true - }, - "@types/istanbul-lib-report": { - "version": "3.0.0", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*" - } - }, - "@types/istanbul-reports": { - "version": "3.0.1", - "dev": true, - "requires": { - "@types/istanbul-lib-report": "*" - } - }, - "@types/json-schema": { - "version": "7.0.9", - "dev": true - }, - "@types/keyv": { - "version": "3.1.3", - "requires": { - "@types/node": "*" - } - }, - "@types/mime": { - "version": "1.3.2" - }, - "@types/minimatch": { - "version": "3.0.5", - "dev": true - }, - "@types/node": { - "version": "17.0.8" - }, - "@types/normalize-package-data": { - "version": "2.4.1", - "dev": true - }, - "@types/prettier": { - "version": "2.4.3", - "dev": true - }, - "@types/qs": { - "version": "6.9.7" - }, - "@types/range-parser": { - "version": "1.2.4" - }, - "@types/request": { - "version": "2.48.8", - "requires": { - "@types/caseless": "*", - "@types/node": "*", - "@types/tough-cookie": "*", - "form-data": "^2.5.0" - }, - "dependencies": { - "form-data": { - "version": "2.5.1", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - } - } - }, - "@types/responselike": { - "version": "1.0.0", - "requires": { - "@types/node": "*" - } - }, - "@types/serve-static": { - "version": "1.13.10", - "requires": { - "@types/mime": "^1", - "@types/node": "*" - } - }, - "@types/source-list-map": { - "version": "0.1.2", - "dev": true - }, - "@types/stack-utils": { - "version": "2.0.1", - "dev": true - }, - "@types/tapable": { - "version": "1.0.8", - "dev": true - }, - "@types/tough-cookie": { - "version": "4.0.1" - }, - "@types/uglify-js": { - "version": "3.13.1", - "dev": true, - "requires": { - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "@types/webpack": { - "version": "4.41.32", - "dev": true, - "requires": { - "@types/node": "*", - "@types/tapable": "^1", - "@types/uglify-js": "*", - "@types/webpack-sources": "*", - "anymatch": "^3.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "anymatch": { - "version": "3.1.2", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "@types/webpack-sources": { - "version": "3.2.0", - "dev": true, - "requires": { - "@types/node": "*", - "@types/source-list-map": "*", - "source-map": "^0.7.3" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "dev": true - } - } - }, - "@types/yargs": { - "version": "15.0.14", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "@types/yargs-parser": { - "version": "20.2.1", - "dev": true - }, - "@types/yauzl": { - "version": "2.9.2", - "optional": true, - "requires": { - "@types/node": "*" - } - }, - "@webassemblyjs/ast": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/helper-module-context": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/wast-parser": "1.9.0" - } - }, - "@webassemblyjs/floating-point-hex-parser": { - "version": "1.9.0", - "dev": true - }, - "@webassemblyjs/helper-api-error": { - "version": "1.9.0", - "dev": true - }, - "@webassemblyjs/helper-buffer": { - "version": "1.9.0", - "dev": true - }, - "@webassemblyjs/helper-code-frame": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/wast-printer": "1.9.0" - } - }, - "@webassemblyjs/helper-fsm": { - "version": "1.9.0", - "dev": true - }, - "@webassemblyjs/helper-module-context": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0" - } - }, - "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.9.0", - "dev": true - }, - "@webassemblyjs/helper-wasm-section": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0" - } - }, - "@webassemblyjs/ieee754": { - "version": "1.9.0", - "dev": true, - "requires": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "@webassemblyjs/leb128": { - "version": "1.9.0", - "dev": true, - "requires": { - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/utf8": { - "version": "1.9.0", - "dev": true - }, - "@webassemblyjs/wasm-edit": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/helper-wasm-section": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0", - "@webassemblyjs/wasm-opt": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0", - "@webassemblyjs/wast-printer": "1.9.0" - } - }, - "@webassemblyjs/wasm-gen": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/ieee754": "1.9.0", - "@webassemblyjs/leb128": "1.9.0", - "@webassemblyjs/utf8": "1.9.0" - } - }, - "@webassemblyjs/wasm-opt": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-buffer": "1.9.0", - "@webassemblyjs/wasm-gen": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0" - } - }, - "@webassemblyjs/wasm-parser": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-api-error": "1.9.0", - "@webassemblyjs/helper-wasm-bytecode": "1.9.0", - "@webassemblyjs/ieee754": "1.9.0", - "@webassemblyjs/leb128": "1.9.0", - "@webassemblyjs/utf8": "1.9.0" - } - }, - "@webassemblyjs/wast-parser": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/floating-point-hex-parser": "1.9.0", - "@webassemblyjs/helper-api-error": "1.9.0", - "@webassemblyjs/helper-code-frame": "1.9.0", - "@webassemblyjs/helper-fsm": "1.9.0", - "@xtuc/long": "4.2.2" - } - }, - "@webassemblyjs/wast-printer": { - "version": "1.9.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/wast-parser": "1.9.0", - "@xtuc/long": "4.2.2" - } - }, - "@xmldom/xmldom": { - "version": "0.7.5", - "dev": true - }, - "@xtuc/ieee754": { - "version": "1.2.0", - "dev": true - }, - "@xtuc/long": { - "version": "4.2.2", - "dev": true - }, - "abab": { - "version": "2.0.5", - "dev": true - }, - "abbrev": { - "version": "1.1.1", - "dev": true - }, - "abort-controller": { - "version": "2.0.3", - "requires": { - "event-target-shim": "^5.0.0" - } - }, - "abstract-logging": { - "version": "2.0.1" - }, - "accept-language": { - "version": "3.0.18", - "requires": { - "bcp47": "^1.1.2", - "stable": "^0.1.6" - } - }, - "accepts": { - "version": "1.3.7", - "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - } - }, - "acorn": { - "version": "7.4.1", - "dev": true - }, - "acorn-globals": { - "version": "6.0.0", - "dev": true, - "requires": { - "acorn": "^7.1.1", - "acorn-walk": "^7.1.1" - } - }, - "acorn-jsx": { - "version": "5.3.2", - "dev": true, - "requires": {} - }, - "acorn-walk": { - "version": "7.2.0", - "dev": true - }, - "adm-zip": { - "version": "0.5.9" - }, - "agent-base": { - "version": "6.0.2", - "requires": { - "debug": "4" - } - }, - "ajv": { - "version": "6.12.6", - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ajv-errors": { - "version": "1.0.1", - "dev": true, - "requires": {} - }, - "ajv-keywords": { - "version": "3.5.2", - "dev": true, - "requires": {} - }, - "amdefine": { - "version": "1.0.1", - "dev": true - }, - "angular-mocks": { - "version": "1.8.2", - "dev": true - }, - "ansi-align": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", - "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", - "dev": true, - "requires": { - "string-width": "^4.1.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - } - } - }, - "ansi-colors": { - "version": "4.1.1", - "dev": true - }, - "ansi-escapes": { - "version": "4.3.2", - "dev": true, - "requires": { - "type-fest": "^0.21.3" - }, - "dependencies": { - "type-fest": { - "version": "0.21.3", - "dev": true - } - } - }, - "ansi-gray": { - "version": "0.1.1", - "dev": true, - "requires": { - "ansi-wrap": "0.1.0" - } - }, - "ansi-html-community": { - "version": "0.0.8", - "dev": true - }, - "ansi-regex": { - "version": "5.0.1", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "requires": { - "color-convert": "^1.9.0" - } - }, - "ansi-wrap": { - "version": "0.1.0", - "dev": true - }, - "anymatch": { - "version": "2.0.0", - "dev": true, - "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "micromatch": { - "version": "3.1.10", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "normalize-path": { - "version": "2.1.1", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "append-buffer": { - "version": "1.0.2", - "dev": true, - "requires": { - "buffer-equal": "^1.0.0" - } - }, - "aproba": { - "version": "1.2.0" - }, - "archy": { - "version": "1.0.0", - "dev": true - }, - "are-we-there-yet": { - "version": "1.1.7", - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "argparse": { - "version": "1.0.10", - "requires": { - "sprintf-js": "~1.0.2" - }, - "dependencies": { - "sprintf-js": { - "version": "1.0.3" - } - } - }, - "arr-diff": { - "version": "4.0.0", - "dev": true - }, - "arr-filter": { - "version": "1.1.2", - "dev": true, - "requires": { - "make-iterator": "^1.0.0" - } - }, - "arr-flatten": { - "version": "1.1.0", - "dev": true - }, - "arr-map": { - "version": "2.0.2", - "dev": true, - "requires": { - "make-iterator": "^1.0.0" - } - }, - "arr-union": { - "version": "3.1.0", - "dev": true - }, - "array-differ": { - "version": "1.0.0", - "dev": true - }, - "array-each": { - "version": "1.0.1", - "dev": true - }, - "array-find-index": { - "version": "1.0.2", - "dev": true - }, - "array-flatten": { - "version": "1.1.1" - }, - "array-initial": { - "version": "1.1.0", - "dev": true, - "requires": { - "array-slice": "^1.0.0", - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "dev": true - } - } - }, - "array-last": { - "version": "1.3.0", - "dev": true, - "requires": { - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "dev": true - } - } - }, - "array-slice": { - "version": "1.1.0", - "dev": true - }, - "array-sort": { - "version": "1.0.0", - "dev": true, - "requires": { - "default-compare": "^1.0.0", - "get-value": "^2.0.6", - "kind-of": "^5.0.2" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "dev": true - } - } - }, - "array-union": { - "version": "1.0.2", - "dev": true, - "requires": { - "array-uniq": "^1.0.1" - } - }, - "array-uniq": { - "version": "1.0.3", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "dev": true - }, - "arrify": { - "version": "1.0.1" - }, - "asn1": { - "version": "0.2.6", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "asn1.js": { - "version": "5.4.1", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "dev": true - } - } - }, - "assert": { - "version": "1.5.0", - "dev": true, - "requires": { - "object-assign": "^4.1.1", - "util": "0.10.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "dev": true - }, - "util": { - "version": "0.10.3", - "dev": true, - "requires": { - "inherits": "2.0.1" - } - } - } - }, - "assert-plus": { - "version": "1.0.0" - }, - "assign-symbols": { - "version": "1.0.0", - "dev": true - }, - "ast-types": { - "version": "0.9.6", - "dev": true - }, - "astral-regex": { - "version": "2.0.0", - "dev": true - }, - "async": { - "version": "2.6.3", - "requires": { - "lodash": "^4.17.14" - } - }, - "async-done": { - "version": "1.3.2", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.2", - "process-nextick-args": "^2.0.0", - "stream-exhaust": "^1.0.1" - } - }, - "async-each": { - "version": "1.0.3", - "dev": true - }, - "async-foreach": { - "version": "0.1.3", - "dev": true - }, - "async-hook-jl": { - "version": "1.7.6", - "requires": { - "stack-chain": "^1.3.7" - } - }, - "async-limiter": { - "version": "1.0.1", - "dev": true - }, - "async-settle": { - "version": "1.0.0", - "dev": true, - "requires": { - "async-done": "^1.2.2" - } - }, - "asynckit": { - "version": "0.4.0" - }, - "atob": { - "version": "2.1.2", - "dev": true - }, - "aws-sdk": { - "version": "2.1057.0", - "requires": { - "buffer": "4.9.2", - "events": "1.1.1", - "ieee754": "1.1.13", - "jmespath": "0.15.0", - "querystring": "0.2.0", - "sax": "1.2.1", - "url": "0.10.3", - "uuid": "3.3.2", - "xml2js": "0.4.19" - }, - "dependencies": { - "uuid": { - "version": "3.3.2" - }, - "xml2js": { - "version": "0.4.19", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~9.0.1" - } - }, - "xmlbuilder": { - "version": "9.0.7" - } - } - }, - "aws-sign2": { - "version": "0.7.0" - }, - "aws4": { - "version": "1.11.0" - }, - "axios": { - "version": "0.25.0", - "requires": { - "follow-redirects": "^1.14.7" - } - }, - "babel-jest": { - "version": "26.6.3", - "dev": true, - "requires": { - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/babel__core": "^7.1.7", - "babel-plugin-istanbul": "^6.0.0", - "babel-preset-jest": "^26.6.2", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "babel-loader": { - "version": "8.2.3", - "dev": true, - "requires": { - "find-cache-dir": "^3.3.1", - "loader-utils": "^1.4.0", - "make-dir": "^3.1.0", - "schema-utils": "^2.6.5" - }, - "dependencies": { - "find-cache-dir": { - "version": "3.3.2", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^3.0.2", - "pkg-dir": "^4.1.0" - } - }, - "make-dir": { - "version": "3.1.0", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "pkg-dir": { - "version": "4.2.0", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - } - } - }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, - "babel-plugin-istanbul": { - "version": "6.1.1", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - } - }, - "babel-plugin-jest-hoist": { - "version": "26.6.2", - "dev": true, - "requires": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.0.0", - "@types/babel__traverse": "^7.0.6" - } - }, - "babel-plugin-polyfill-corejs2": { - "version": "0.3.0", - "dev": true, - "requires": { - "@babel/compat-data": "^7.13.11", - "@babel/helper-define-polyfill-provider": "^0.3.0", - "semver": "^6.1.1" - } - }, - "babel-plugin-polyfill-corejs3": { - "version": "0.5.0", - "dev": true, - "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.0", - "core-js-compat": "^3.20.0" - } - }, - "babel-plugin-polyfill-regenerator": { - "version": "0.3.0", - "dev": true, - "requires": { - "@babel/helper-define-polyfill-provider": "^0.3.0" - } - }, - "babel-preset-current-node-syntax": { - "version": "1.0.1", - "dev": true, - "requires": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.8.3", - "@babel/plugin-syntax-import-meta": "^7.8.3", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.8.3", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-top-level-await": "^7.8.3" - } - }, - "babel-preset-jest": { - "version": "26.6.2", - "dev": true, - "requires": { - "babel-plugin-jest-hoist": "^26.6.2", - "babel-preset-current-node-syntax": "^1.0.0" - } - }, - "bach": { - "version": "1.2.0", - "dev": true, - "requires": { - "arr-filter": "^1.1.1", - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "array-each": "^1.0.0", - "array-initial": "^1.0.0", - "array-last": "^1.1.1", - "async-done": "^1.2.2", - "async-settle": "^1.0.0", - "now-and-later": "^2.0.0" - } - }, - "backoff": { - "version": "2.5.0", - "requires": { - "precond": "0.2" - } - }, - "balanced-match": { - "version": "1.0.2" - }, - "base": { - "version": "0.11.2", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "base64-js": { - "version": "1.5.1" - }, - "batch": { - "version": "0.6.1", - "dev": true - }, - "bcp47": { - "version": "1.1.2" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "bcryptjs": { - "version": "2.4.3" - }, - "beeper": { - "version": "1.1.1", - "dev": true - }, - "big.js": { - "version": "5.2.2", - "dev": true - }, - "bigdecimal": { - "version": "0.6.1" - }, - "bignumber.js": { - "version": "9.0.0" - }, - "binary-extensions": { - "version": "1.13.1", - "dev": true - }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "requires": { - "file-uri-to-path": "1.0.0" - } - }, - "bl": { - "version": "2.2.1", - "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "block-stream": { - "version": "0.0.9", - "dev": true, - "requires": { - "inherits": "~2.0.0" - } - }, - "bluebird": { - "version": "3.7.2" - }, - "bmp-js": { - "version": "0.1.0" - }, - "bn.js": { - "version": "5.2.0", - "dev": true - }, - "body-parser": { - "version": "1.19.1", - "requires": { - "bytes": "3.1.1", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.8.1", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.9.6", - "raw-body": "2.4.2", - "type-is": "~1.6.18" - }, - "dependencies": { - "bytes": { - "version": "3.1.1" - }, - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "1.1.2" - }, - "ms": { - "version": "2.0.0" - } - } - }, - "bonjour": { - "version": "3.5.0", - "dev": true, - "requires": { - "array-flatten": "^2.1.0", - "deep-equal": "^1.0.1", - "dns-equal": "^1.0.0", - "dns-txt": "^2.0.2", - "multicast-dns": "^6.0.1", - "multicast-dns-service-types": "^1.1.0" - }, - "dependencies": { - "array-flatten": { - "version": "2.1.2", - "dev": true - } - } - }, - "boolbase": { - "version": "1.0.0", - "dev": true - }, - "bops": { - "version": "1.0.0", - "requires": { - "base64-js": "1.0.2", - "to-utf8": "0.0.1" - }, - "dependencies": { - "base64-js": { - "version": "1.0.2" - } - } - }, - "bowser": { - "version": "2.9.0" - }, - "boxen": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", - "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", - "dev": true, - "requires": { - "ansi-align": "^3.0.0", - "camelcase": "^6.2.0", - "chalk": "^4.1.0", - "cli-boxes": "^2.2.1", - "string-width": "^4.2.2", - "type-fest": "^0.20.2", - "widest-line": "^3.1.0", - "wrap-ansi": "^7.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - } - } - }, - "brace-expansion": { - "version": "1.1.11", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "2.3.2", - "dev": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "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.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - } - }, - "brorand": { - "version": "1.1.0", - "dev": true - }, - "browser-process-hrtime": { - "version": "1.0.0", - "dev": true - }, - "browserify-aes": { - "version": "1.2.0", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.2", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "browserify-rsa": { - "version": "4.1.0", - "dev": true, - "requires": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sign": { - "version": "4.2.1", - "dev": true, - "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.0", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "dev": true - } - } - }, - "browserify-zlib": { - "version": "0.2.0", - "dev": true, - "requires": { - "pako": "~1.0.5" - } - }, - "browserslist": { - "version": "4.19.1", - "dev": true, - "requires": { - "caniuse-lite": "^1.0.30001286", - "electron-to-chromium": "^1.4.17", - "escalade": "^3.1.1", - "node-releases": "^2.0.1", - "picocolors": "^1.0.0" - } - }, - "bser": { - "version": "2.1.1", - "dev": true, - "requires": { - "node-int64": "^0.4.0" - } - }, - "btoa": { - "version": "1.2.1" - }, - "buffer": { - "version": "4.9.2", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, - "buffer-crc32": { - "version": "0.2.13" - }, - "buffer-equal": { - "version": "1.0.0", - "dev": true - }, - "buffer-equal-constant-time": { - "version": "1.0.1" - }, - "buffer-from": { - "version": "1.1.2" - }, - "buffer-indexof": { - "version": "1.1.1", - "dev": true - }, - "buffer-xor": { - "version": "1.0.3", - "dev": true - }, - "bufferstreams": { - "version": "1.1.0", - "dev": true, - "requires": { - "readable-stream": "^2.0.2" - } - }, - "builtin-status-codes": { - "version": "3.0.0", - "dev": true - }, - "bytes": { - "version": "3.0.0" - }, - "cacache": { - "version": "12.0.4", - "dev": true, - "requires": { - "bluebird": "^3.5.5", - "chownr": "^1.1.1", - "figgy-pudding": "^3.5.1", - "glob": "^7.1.4", - "graceful-fs": "^4.1.15", - "infer-owner": "^1.0.3", - "lru-cache": "^5.1.1", - "mississippi": "^3.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.3", - "ssri": "^6.0.1", - "unique-filename": "^1.1.1", - "y18n": "^4.0.0" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - } - } - }, - "cache-base": { - "version": "1.0.1", - "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" - } - }, - "cacheable-lookup": { - "version": "2.0.1", - "requires": { - "@types/keyv": "^3.1.1", - "keyv": "^4.0.0" - } - }, - "cacheable-request": { - "version": "7.0.2", - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^6.0.1", - "responselike": "^2.0.0" - } - }, - "call-bind": { - "version": "1.0.2", - "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" - } - }, - "callsites": { - "version": "3.1.0", - "dev": true - }, - "camel-case": { - "version": "3.0.0", - "dev": true, - "requires": { - "no-case": "^2.2.0", - "upper-case": "^1.1.1" - } - }, - "camelcase": { - "version": "5.3.1", - "dev": true - }, - "camelcase-keys": { - "version": "2.1.0", - "dev": true, - "requires": { - "camelcase": "^2.0.0", - "map-obj": "^1.0.0" - }, - "dependencies": { - "camelcase": { - "version": "2.1.1", - "dev": true - } - } - }, - "camelize": { - "version": "1.0.0" - }, - "caniuse-lite": { - "version": "1.0.30001299", - "dev": true - }, - "canonical-json": { - "version": "0.0.4" - }, - "capture-exit": { - "version": "2.0.0", - "dev": true, - "requires": { - "rsvp": "^4.8.4" - } - }, - "caseless": { - "version": "0.12.0" - }, - "chalk": { - "version": "2.4.2", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "char-regex": { - "version": "1.0.2", - "dev": true - }, - "charenc": { - "version": "0.0.2" - }, - "chokidar": { - "version": "2.1.8", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - }, - "dependencies": { - "fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "dev": true, - "optional": true, - "requires": { - "bindings": "^1.5.0", - "nan": "^2.12.1" - } - }, - "glob-parent": { - "version": "3.1.0", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - } - } - }, - "chownr": { - "version": "1.1.4" - }, - "chrome-trace-event": { - "version": "1.0.3", - "dev": true - }, - "ci-info": { - "version": "2.0.0", - "dev": true - }, - "cipher-base": { - "version": "1.0.4", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "cjs-module-lexer": { - "version": "0.6.0", - "dev": true - }, - "class-utils": { - "version": "0.3.6", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - } - }, - "cldrjs": { - "version": "0.5.5" - }, - "clean-css": { - "version": "4.2.4", - "dev": true, - "requires": { - "source-map": "~0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "cli-boxes": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", - "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wrap-ansi": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "clone": { - "version": "2.1.2", - "dev": true - }, - "clone-buffer": { - "version": "1.0.0", - "dev": true - }, - "clone-deep": { - "version": "4.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4", - "kind-of": "^6.0.2", - "shallow-clone": "^3.0.0" - } - }, - "clone-response": { - "version": "1.0.2", - "requires": { - "mimic-response": "^1.0.0" - }, - "dependencies": { - "mimic-response": { - "version": "1.0.1" - } - } - }, - "clone-stats": { - "version": "1.0.0", - "dev": true - }, - "cloneable-readable": { - "version": "1.1.3", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "process-nextick-args": "^2.0.0", - "readable-stream": "^2.3.5" - } - }, - "cls-hooked": { - "version": "4.2.2", - "requires": { - "async-hook-jl": "^1.7.6", - "emitter-listener": "^1.0.1", - "semver": "^5.4.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1" - } - } - }, - "co": { - "version": "4.6.0", - "dev": true - }, - "code-point-at": { - "version": "1.1.0" - }, - "collect-v8-coverage": { - "version": "1.0.1", - "dev": true - }, - "collection-map": { - "version": "1.0.0", - "dev": true, - "requires": { - "arr-map": "^2.0.2", - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "collection-visit": { - "version": "1.0.0", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color": { - "version": "3.2.1", - "requires": { - "color-convert": "^1.9.3", - "color-string": "^1.6.0" - } - }, - "color-convert": { - "version": "1.9.3", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3" - }, - "color-string": { - "version": "1.9.0", - "requires": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } - }, - "color-support": { - "version": "1.1.3", - "dev": true - }, - "colors": { - "version": "1.4.0", - "dev": true - }, - "combined-stream": { - "version": "1.0.8", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.17.1" - }, - "commondir": { - "version": "1.0.1" - }, - "component-emitter": { - "version": "1.3.0", - "dev": true - }, - "compressible": { - "version": "2.0.18", - "requires": { - "mime-db": ">= 1.43.0 < 2" - } - }, - "compression": { - "version": "1.7.4", - "requires": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.16", - "debug": "2.6.9", - "on-headers": "~1.0.2", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0" - } - } - }, - "concat-map": { - "version": "0.0.1" - }, - "concat-stream": { - "version": "1.6.2", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "concat-with-sourcemaps": { - "version": "1.1.0", - "dev": true, - "requires": { - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "configstore": { - "version": "4.0.0", - "requires": { - "dot-prop": "^4.1.0", - "graceful-fs": "^4.1.2", - "make-dir": "^1.0.0", - "unique-string": "^1.0.0", - "write-file-atomic": "^2.0.0", - "xdg-basedir": "^3.0.0" - }, - "dependencies": { - "make-dir": { - "version": "1.3.0", - "requires": { - "pify": "^3.0.0" - } - }, - "pify": { - "version": "3.0.0" - }, - "write-file-atomic": { - "version": "2.4.3", - "requires": { - "graceful-fs": "^4.1.11", - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.2" - } - } - } - }, - "connect-history-api-fallback": { - "version": "1.6.0", - "dev": true - }, - "console-browserify": { - "version": "1.2.0", - "dev": true - }, - "console-control-strings": { - "version": "1.1.0" - }, - "consolidate": { - "version": "0.15.1", - "dev": true, - "requires": { - "bluebird": "^3.1.1" - } - }, - "constants-browserify": { - "version": "1.0.0", - "dev": true - }, - "content-disposition": { - "version": "0.5.4", - "requires": { - "safe-buffer": "5.2.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.2.1" - } - } - }, - "content-security-policy-builder": { - "version": "2.1.0" - }, - "content-type": { - "version": "1.0.4" - }, - "convert-source-map": { - "version": "1.8.0", - "dev": true, - "requires": { - "safe-buffer": "~5.1.1" - } - }, - "cookie": { - "version": "0.4.1" - }, - "cookie-signature": { - "version": "1.0.6" - }, - "copy-concurrently": { - "version": "1.0.5", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - } - } - }, - "copy-descriptor": { - "version": "0.1.1", - "dev": true - }, - "copy-props": { - "version": "2.0.5", - "dev": true, - "requires": { - "each-props": "^1.3.2", - "is-plain-object": "^5.0.0" - }, - "dependencies": { - "is-plain-object": { - "version": "5.0.0", - "dev": true - } - } - }, - "core-js": { - "version": "3.20.2", - "dev": true - }, - "core-js-compat": { - "version": "3.20.2", - "dev": true, - "requires": { - "browserslist": "^4.19.1", - "semver": "7.0.0" - }, - "dependencies": { - "semver": { - "version": "7.0.0", - "dev": true - } - } - }, - "core-js-pure": { - "version": "3.20.2" - }, - "core-util-is": { - "version": "1.0.3" - }, - "create-ecdh": { - "version": "4.0.4", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "dev": true - } - } - }, - "create-hash": { - "version": "1.2.0", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "dev": true, - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "cross-fetch": { - "version": "3.1.4", - "requires": { - "node-fetch": "2.6.1" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.1" - } - } - }, - "cross-spawn": { - "version": "7.0.3", - "requires": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - } - }, - "crypt": { - "version": "0.0.2" - }, - "crypto-browserify": { - "version": "3.12.0", - "dev": true, - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "crypto-random-string": { - "version": "1.0.0" - }, - "css-loader": { - "version": "2.1.1", - "dev": true, - "requires": { - "camelcase": "^5.2.0", - "icss-utils": "^4.1.0", - "loader-utils": "^1.2.3", - "normalize-path": "^3.0.0", - "postcss": "^7.0.14", - "postcss-modules-extract-imports": "^2.0.0", - "postcss-modules-local-by-default": "^2.0.6", - "postcss-modules-scope": "^2.1.0", - "postcss-modules-values": "^2.0.0", - "postcss-value-parser": "^3.3.0", - "schema-utils": "^1.0.0" - }, - "dependencies": { - "schema-utils": { - "version": "1.0.0", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "css-select": { - "version": "4.2.1", - "dev": true, - "requires": { - "boolbase": "^1.0.0", - "css-what": "^5.1.0", - "domhandler": "^4.3.0", - "domutils": "^2.8.0", - "nth-check": "^2.0.1" - }, - "dependencies": { - "dom-serializer": { - "version": "1.3.2", - "dev": true, - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - } - }, - "domelementtype": { - "version": "2.2.0", - "dev": true - }, - "domhandler": { - "version": "4.3.0", - "dev": true, - "requires": { - "domelementtype": "^2.2.0" - } - }, - "domutils": { - "version": "2.8.0", - "dev": true, - "requires": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - } - }, - "entities": { - "version": "2.2.0", - "dev": true - } - } - }, - "css-what": { - "version": "5.1.0", - "dev": true - }, - "cssesc": { - "version": "3.0.0", - "dev": true - }, - "cssom": { - "version": "0.4.4", - "dev": true - }, - "cssstyle": { - "version": "2.3.0", - "dev": true, - "requires": { - "cssom": "~0.3.6" - }, - "dependencies": { - "cssom": { - "version": "0.3.8", - "dev": true - } - } - }, - "currently-unhandled": { - "version": "0.4.1", - "dev": true, - "requires": { - "array-find-index": "^1.0.1" - } - }, - "cyclist": { - "version": "1.0.1", - "dev": true - }, - "d": { - "version": "1.0.1", - "dev": true, - "requires": { - "es5-ext": "^0.10.50", - "type": "^1.0.1" - } - }, - "dargs": { - "version": "5.1.0", - "dev": true - }, - "dashdash": { - "version": "1.14.1", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "dasherize": { - "version": "2.0.0" - }, - "data-urls": { - "version": "2.0.0", - "dev": true, - "requires": { - "abab": "^2.0.3", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.0.0" - } - }, - "date-and-time": { - "version": "0.6.3" - }, - "dateformat": { - "version": "2.2.0", - "dev": true - }, - "debug": { - "version": "4.3.3", - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "1.2.0", - "dev": true - }, - "decimal.js": { - "version": "10.3.1", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.0", - "dev": true - }, - "decompress-response": { - "version": "5.0.0", - "requires": { - "mimic-response": "^2.0.0" - } - }, - "deep-equal": { - "version": "1.1.1", - "dev": true, - "requires": { - "is-arguments": "^1.0.4", - "is-date-object": "^1.0.1", - "is-regex": "^1.0.4", - "object-is": "^1.0.1", - "object-keys": "^1.1.1", - "regexp.prototype.flags": "^1.2.0" - } - }, - "deep-extend": { - "version": "0.6.0" - }, - "deep-is": { - "version": "0.1.4", - "dev": true - }, - "deepmerge": { - "version": "4.2.2" - }, - "default-compare": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^5.0.2" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "dev": true - } - } - }, - "default-gateway": { - "version": "4.2.0", - "dev": true, - "requires": { - "execa": "^1.0.0", - "ip-regex": "^2.1.0" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "1.1.0", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "path-key": { - "version": "2.0.1", - "dev": true - }, - "semver": { - "version": "5.7.1", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "dev": true - }, - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "default-resolution": { - "version": "2.0.0", - "dev": true - }, - "defer-to-connect": { - "version": "2.0.1" - }, - "define-properties": { - "version": "1.1.3", - "dev": true, - "requires": { - "object-keys": "^1.0.12" - } - }, - "define-property": { - "version": "0.2.5", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "del": { - "version": "2.2.2", - "dev": true, - "requires": { - "globby": "^5.0.0", - "is-path-cwd": "^1.0.0", - "is-path-in-cwd": "^1.0.0", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "rimraf": "^2.2.8" - } - }, - "delayed-stream": { - "version": "1.0.0" - }, - "delegates": { - "version": "1.0.0" - }, - "denque": { - "version": "1.5.1", - "dev": true - }, - "depd": { - "version": "2.0.0" - }, - "deprecate": { - "version": "1.1.1", - "dev": true - }, - "des.js": { - "version": "1.0.1", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "destroy": { - "version": "1.0.4" - }, - "detect-file": { - "version": "1.0.0", - "dev": true - }, - "detect-libc": { - "version": "1.0.3" - }, - "detect-newline": { - "version": "3.1.0", - "dev": true - }, - "detect-node": { - "version": "2.1.0", - "dev": true - }, - "devtools-protocol": { - "version": "0.0.847576" - }, - "diff": { - "version": "1.4.0" - }, - "diff-sequences": { - "version": "26.6.2", - "dev": true - }, - "diffie-hellman": { - "version": "5.0.3", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "dev": true - } - } - }, - "dns-equal": { - "version": "1.0.0", - "dev": true - }, - "dns-packet": { - "version": "1.3.4", - "dev": true, - "requires": { - "ip": "^1.1.0", - "safe-buffer": "^5.0.1" - } - }, - "dns-txt": { - "version": "2.0.2", - "dev": true, - "requires": { - "buffer-indexof": "^1.0.0" - } - }, - "doctrine": { - "version": "3.0.0", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - }, - "dom-converter": { - "version": "0.2.0", - "dev": true, - "requires": { - "utila": "~0.4" - } - }, - "dom-serializer": { - "version": "0.2.2", - "requires": { - "domelementtype": "^2.0.1", - "entities": "^2.0.0" - }, - "dependencies": { - "domelementtype": { - "version": "2.2.0" - }, - "entities": { - "version": "2.2.0" - } - } - }, - "domain-browser": { - "version": "1.2.0", - "dev": true - }, - "domelementtype": { - "version": "1.3.1" - }, - "domexception": { - "version": "2.0.1", - "dev": true, - "requires": { - "webidl-conversions": "^5.0.0" - }, - "dependencies": { - "webidl-conversions": { - "version": "5.0.0", - "dev": true - } - } - }, - "domhandler": { - "version": "2.4.2", - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.7.0", - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "dont-sniff-mimetype": { - "version": "1.1.0" - }, - "dot-case": { - "version": "3.0.4", - "dev": true, - "requires": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - }, - "dependencies": { - "lower-case": { - "version": "2.0.2", - "dev": true, - "requires": { - "tslib": "^2.0.3" - } - }, - "no-case": { - "version": "3.0.4", - "dev": true, - "requires": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - } - } - }, - "dot-prop": { - "version": "4.2.1", - "requires": { - "is-obj": "^1.0.0" - } - }, - "duplex": { - "version": "1.0.0" - }, - "duplex-child-process": { - "version": "0.0.5" - }, - "duplexer": { - "version": "0.0.4" - }, - "duplexer2": { - "version": "0.0.2", - "dev": true, - "requires": { - "readable-stream": "~1.1.9" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "dev": true - }, - "readable-stream": { - "version": "1.1.14", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "dev": true - } - } - }, - "duplexer3": { - "version": "0.1.4" - }, - "duplexify": { - "version": "3.7.1", - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - } - }, - "each-props": { - "version": "1.3.2", - "dev": true, - "requires": { - "is-plain-object": "^2.0.1", - "object.defaults": "^1.1.0" - } - }, - "ecc-jsbn": { - "version": "0.1.2", - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "ecdsa-sig-formatter": { - "version": "1.0.11", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "ee-first": { - "version": "1.1.1" - }, - "ejs": { - "version": "2.7.4" - }, - "electron-to-chromium": { - "version": "1.4.45", - "dev": true - }, - "elliptic": { - "version": "6.5.4", - "dev": true, - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "dev": true - } - } - }, - "emitter-listener": { - "version": "1.1.2", - "requires": { - "shimmer": "^1.2.0" - } - }, - "emittery": { - "version": "0.7.2", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "dev": true - }, - "emojis-list": { - "version": "3.0.0", - "dev": true - }, - "encodeurl": { - "version": "1.0.2" - }, - "encoding-japanese": { - "version": "1.0.30" - }, - "end-of-stream": { - "version": "1.4.4", - "requires": { - "once": "^1.4.0" - } - }, - "enhanced-resolve": { - "version": "4.5.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.5.0", - "tapable": "^1.0.0" - }, - "dependencies": { - "memory-fs": { - "version": "0.5.0", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - } - } - }, - "enquirer": { - "version": "2.3.6", - "dev": true, - "requires": { - "ansi-colors": "^4.1.1" - } - }, - "ent": { - "version": "2.2.0" - }, - "entities": { - "version": "1.1.2" - }, - "errno": { - "version": "0.1.8", - "dev": true, - "requires": { - "prr": "~1.0.1" - } - }, - "error-ex": { - "version": "1.3.2", - "dev": true, - "requires": { - "is-arrayish": "^0.2.1" - } - }, - "errs": { - "version": "0.3.2" - }, - "es-abstract": { - "version": "1.19.1", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "get-symbol-description": "^1.0.0", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "internal-slot": "^1.0.3", - "is-callable": "^1.2.4", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.4", - "is-shared-array-buffer": "^1.0.1", - "is-string": "^1.0.7", - "is-weakref": "^1.0.1", - "object-inspect": "^1.11.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.1" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" - } - }, - "es5-ext": { - "version": "0.10.53", - "dev": true, - "requires": { - "es6-iterator": "~2.0.3", - "es6-symbol": "~3.1.3", - "next-tick": "~1.0.0" - } - }, - "es6-iterator": { - "version": "2.0.3", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.35", - "es6-symbol": "^3.1.1" - } - }, - "es6-promise": { - "version": "4.2.8" - }, - "es6-promisify": { - "version": "5.0.0", - "requires": { - "es6-promise": "^4.0.3" - } - }, - "es6-symbol": { - "version": "3.1.3", - "dev": true, - "requires": { - "d": "^1.0.1", - "ext": "^1.1.2" - } - }, - "es6-templates": { - "version": "0.2.3", - "dev": true, - "requires": { - "recast": "~0.11.12", - "through": "~2.3.6" - } - }, - "es6-weak-map": { - "version": "2.0.3", - "dev": true, - "requires": { - "d": "1", - "es5-ext": "^0.10.46", - "es6-iterator": "^2.0.3", - "es6-symbol": "^3.1.1" - } - }, - "escalade": { - "version": "3.1.1", - "dev": true - }, - "escape-goat": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", - "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", - "dev": true - }, - "escape-html": { - "version": "1.0.3" - }, - "escape-string-regexp": { - "version": "1.0.5" - }, - "escodegen": { - "version": "2.0.0", - "dev": true, - "requires": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "dev": true - }, - "levn": { - "version": "0.3.0", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "optionator": { - "version": "0.8.3", - "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", - "word-wrap": "~1.2.3" - } - }, - "prelude-ls": { - "version": "1.1.2", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "dev": true, - "optional": true - }, - "type-check": { - "version": "0.3.2", - "dev": true, - "requires": { - "prelude-ls": "~1.1.2" - } - } - } - }, - "eslint": { - "version": "7.32.0", - "dev": true, - "requires": { - "@babel/code-frame": "7.12.11", - "@eslint/eslintrc": "^0.4.3", - "@humanwhocodes/config-array": "^0.5.0", - "ajv": "^6.10.0", - "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", - "debug": "^4.0.1", - "doctrine": "^3.0.0", - "enquirer": "^2.3.5", - "escape-string-regexp": "^4.0.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^2.1.0", - "eslint-visitor-keys": "^2.0.0", - "espree": "^7.3.1", - "esquery": "^1.4.0", - "esutils": "^2.0.2", - "fast-deep-equal": "^3.1.3", - "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^5.1.2", - "globals": "^13.6.0", - "ignore": "^4.0.6", - "import-fresh": "^3.0.0", - "imurmurhash": "^0.1.4", - "is-glob": "^4.0.0", - "js-yaml": "^3.13.1", - "json-stable-stringify-without-jsonify": "^1.0.1", - "levn": "^0.4.1", - "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", - "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "progress": "^2.0.0", - "regexpp": "^3.1.0", - "semver": "^7.2.1", - "strip-ansi": "^6.0.0", - "strip-json-comments": "^3.1.0", - "table": "^6.0.9", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.12.11", - "dev": true, - "requires": { - "@babel/highlight": "^7.10.4" - } - }, - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "dev": true - }, - "globals": { - "version": "13.12.0", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "lru-cache": { - "version": "6.0.0", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.5", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "type-fest": { - "version": "0.20.2", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "dev": true - } - } - }, - "eslint-config-google": { - "version": "0.11.0", - "dev": true, - "requires": {} - }, - "eslint-plugin-jasmine": { - "version": "2.10.1", - "dev": true - }, - "eslint-scope": { - "version": "5.1.1", - "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - } - }, - "eslint-utils": { - "version": "2.1.0", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "dev": true - } - } - }, - "eslint-visitor-keys": { - "version": "2.1.0", - "dev": true - }, - "espree": { - "version": "7.3.1", - "dev": true, - "requires": { - "acorn": "^7.4.0", - "acorn-jsx": "^5.3.1", - "eslint-visitor-keys": "^1.3.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "1.3.0", - "dev": true - } - } - }, - "esprima": { - "version": "4.0.1" - }, - "esquery": { - "version": "1.4.0", - "dev": true, - "requires": { - "estraverse": "^5.1.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "dev": true - } - } - }, - "esrecurse": { - "version": "4.3.0", - "dev": true, - "requires": { - "estraverse": "^5.2.0" - }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "dev": true - } - } - }, - "estraverse": { - "version": "4.3.0" - }, - "esutils": { - "version": "2.0.3", - "dev": true - }, - "etag": { - "version": "1.8.1" - }, - "event-target-shim": { - "version": "5.0.1" - }, - "eventemitter2": { - "version": "5.0.1" - }, - "eventemitter3": { - "version": "4.0.7", - "dev": true - }, - "events": { - "version": "1.1.1" - }, - "eventsource": { - "version": "1.1.0", - "dev": true, - "requires": { - "original": "^1.0.0" - } - }, - "evp_bytestokey": { - "version": "1.0.3", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "exec-sh": { - "version": "0.3.6", - "dev": true - }, - "execa": { - "version": "4.1.0", - "requires": { - "cross-spawn": "^7.0.0", - "get-stream": "^5.0.0", - "human-signals": "^1.1.1", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.0", - "onetime": "^5.1.0", - "signal-exit": "^3.0.2", - "strip-final-newline": "^2.0.0" - }, - "dependencies": { - "merge-stream": { - "version": "2.0.0" - } - } - }, - "exit": { - "version": "0.1.2", - "dev": true - }, - "expand-brackets": { - "version": "2.1.4", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "expand-template": { - "version": "2.0.3" - }, - "expand-tilde": { - "version": "2.0.2", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, - "expect": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "ansi-styles": "^4.0.0", - "jest-get-type": "^26.3.0", - "jest-matcher-utils": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-regex-util": "^26.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - } - } - }, - "express": { - "version": "4.17.2", - "requires": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.1", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.4.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.9.6", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.17.2", - "serve-static": "1.14.2", - "setprototypeof": "1.2.0", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "1.1.2" - }, - "ms": { - "version": "2.0.0" - }, - "safe-buffer": { - "version": "5.2.1" - } - } - }, - "ext": { - "version": "1.6.0", - "dev": true, - "requires": { - "type": "^2.5.0" - }, - "dependencies": { - "type": { - "version": "2.5.0", - "dev": true - } - } - }, - "extend": { - "version": "3.0.2" - }, - "extend-shallow": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "extglob": { - "version": "2.0.4", - "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" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "extract-zip": { - "version": "2.0.1", - "requires": { - "@types/yauzl": "^2.9.1", - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - } - }, - "extsprintf": { - "version": "1.3.0" - }, - "eyes": { - "version": "0.1.8" - }, - "fancy-log": { - "version": "1.3.3", - "dev": true, - "requires": { - "ansi-gray": "^0.1.1", - "color-support": "^1.1.3", - "parse-node-version": "^1.0.0", - "time-stamp": "^1.0.0" - } - }, - "fast-deep-equal": { - "version": "3.1.3" - }, - "fast-json-patch": { - "version": "2.2.1", - "requires": { - "fast-deep-equal": "^2.0.1" - }, - "dependencies": { - "fast-deep-equal": { - "version": "2.0.1" - } - } - }, - "fast-json-stable-stringify": { - "version": "2.1.0" - }, - "fast-levenshtein": { - "version": "2.0.6", - "dev": true - }, - "fast-safe-stringify": { - "version": "2.1.1" - }, - "fast-text-encoding": { - "version": "1.0.3" - }, - "fastparse": { - "version": "1.1.2", - "dev": true - }, - "faye-websocket": { - "version": "0.11.4", - "dev": true, - "requires": { - "websocket-driver": ">=0.5.1" - } - }, - "fb-watchman": { - "version": "2.0.1", - "dev": true, - "requires": { - "bser": "2.1.1" - } - }, - "fd-slicer": { - "version": "1.1.0", - "requires": { - "pend": "~1.2.0" - } - }, - "feature-policy": { - "version": "0.3.0" - }, - "figgy-pudding": { - "version": "3.5.2", - "dev": true - }, - "file-entry-cache": { - "version": "6.0.1", - "dev": true, - "requires": { - "flat-cache": "^3.0.4" - } - }, - "file-loader": { - "version": "1.1.11", - "dev": true, - "requires": { - "loader-utils": "^1.0.2", - "schema-utils": "^0.4.5" - }, - "dependencies": { - "schema-utils": { - "version": "0.4.7", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "file-type": { - "version": "10.11.0" - }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", - "dev": true, - "optional": true - }, - "filed-mimefix": { - "version": "0.1.3", - "requires": { - "mime": "^1.4.0" - }, - "dependencies": { - "mime": { - "version": "1.6.0" - } - } - }, - "filelist": { - "version": "1.0.2", - "requires": { - "minimatch": "^3.0.4" - } - }, - "fill-range": { - "version": "4.0.0", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - } - }, - "finalhandler": { - "version": "1.1.2", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0" - } - } - }, - "find-cache-dir": { - "version": "2.1.0", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - } - }, - "find-up": { - "version": "4.1.0", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "findup-sync": { - "version": "3.0.0", - "dev": true, - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - }, - "dependencies": { - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "micromatch": { - "version": "3.1.10", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "fined": { - "version": "1.2.0", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "is-plain-object": "^2.0.3", - "object.defaults": "^1.1.0", - "object.pick": "^1.2.0", - "parse-filepath": "^1.0.1" - } - }, - "flagged-respawn": { - "version": "1.0.1", - "dev": true - }, - "flat-cache": { - "version": "3.0.4", - "dev": true, - "requires": { - "flatted": "^3.1.0", - "rimraf": "^3.0.2" - }, - "dependencies": { - "rimraf": { - "version": "3.0.2", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } - } - }, - "flatted": { - "version": "3.2.4", - "dev": true - }, - "flush-write-stream": { - "version": "1.1.1", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "readable-stream": "^2.3.6" - } - }, - "follow-redirects": { - "version": "1.14.7" - }, - "for-in": { - "version": "1.0.2", - "dev": true - }, - "for-own": { - "version": "1.0.0", - "dev": true, - "requires": { - "for-in": "^1.0.1" - } - }, - "forever-agent": { - "version": "0.6.1" - }, - "form-data": { - "version": "3.0.1", - "dev": true, - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - } - }, - "form-data-encoder": { - "version": "1.7.1" - }, - "formdata-node": { - "version": "4.3.2", - "requires": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.1" - } - }, - "formidable": { - "version": "1.2.6" - }, - "forwarded": { - "version": "0.2.0" - }, - "fragment-cache": { - "version": "0.2.1", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "fresh": { - "version": "0.5.2" - }, - "from2": { - "version": "2.3.0", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - } - }, - "fs-constants": { - "version": "1.0.0" - }, - "fs-extra": { - "version": "5.0.0", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs-mkdirp-stream": { - "version": "1.0.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "through2": "^2.0.3" - } - }, - "fs-readfile-promise": { - "version": "3.0.1", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11" - } - }, - "fs-write-stream-atomic": { - "version": "1.0.10", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - } - }, - "fs.realpath": { - "version": "1.0.0" - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "fstream": { - "version": "1.0.12", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - } - } - }, - "ftps": { - "version": "1.2.0", - "requires": { - "duplex-child-process": "0.0.5", - "lodash": "^4.4.0" - } - }, - "function-bind": { - "version": "1.1.1" - }, - "functional-red-black-tree": { - "version": "1.0.1", - "dev": true - }, - "g11n-pipeline": { - "version": "2.0.6", - "requires": { - "swagger-client": "^3.8.3" - } - }, - "gauge": { - "version": "2.7.4", - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1" - }, - "strip-ansi": { - "version": "3.0.1", - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "gaxios": { - "version": "1.8.4", - "requires": { - "abort-controller": "^3.0.0", - "extend": "^3.0.2", - "https-proxy-agent": "^2.2.1", - "node-fetch": "^2.3.0" - }, - "dependencies": { - "abort-controller": { - "version": "3.0.0", - "requires": { - "event-target-shim": "^5.0.0" - } - }, - "agent-base": { - "version": "4.3.0", - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - }, - "https-proxy-agent": { - "version": "2.2.4", - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - } - } - } - }, - "gaze": { - "version": "1.1.3", - "dev": true, - "requires": { - "globule": "^1.0.0" - } - }, - "gcp-metadata": { - "version": "1.0.0", - "requires": { - "gaxios": "^1.0.2", - "json-bigint": "^0.3.0" - } - }, - "gcs-resumable-upload": { - "version": "1.1.0", - "requires": { - "abort-controller": "^2.0.2", - "configstore": "^4.0.0", - "gaxios": "^1.5.0", - "google-auth-library": "^3.0.0", - "pumpify": "^1.5.1", - "stream-events": "^1.0.4" - } - }, - "generate-function": { - "version": "2.3.1", - "dev": true, - "requires": { - "is-property": "^1.0.2" - } - }, - "gensync": { - "version": "1.0.0-beta.2", - "dev": true - }, - "get-caller-file": { - "version": "1.0.3", - "dev": true - }, - "get-intrinsic": { - "version": "1.1.1", - "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.1" - } - }, - "get-package-type": { - "version": "0.1.0", - "dev": true - }, - "get-stdin": { - "version": "4.0.1", - "dev": true - }, - "get-stream": { - "version": "5.2.0", - "requires": { - "pump": "^3.0.0" - } - }, - "get-symbol-description": { - "version": "1.0.0", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "get-intrinsic": "^1.1.1" - } - }, - "get-value": { - "version": "2.0.6", - "dev": true - }, - "getpass": { - "version": "0.1.7", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "github-from-package": { - "version": "0.0.0" - }, - "glob": { - "version": "7.2.0", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "5.1.2", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "glob-stream": { - "version": "6.1.0", - "dev": true, - "requires": { - "extend": "^3.0.0", - "glob": "^7.1.1", - "glob-parent": "^3.1.0", - "is-negated-glob": "^1.0.0", - "ordered-read-streams": "^1.0.0", - "pumpify": "^1.3.5", - "readable-stream": "^2.1.5", - "remove-trailing-separator": "^1.0.1", - "to-absolute-glob": "^2.0.0", - "unique-stream": "^2.0.2" - }, - "dependencies": { - "glob-parent": { - "version": "3.1.0", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "is-glob": { - "version": "3.1.0", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - }, - "glob-watcher": { - "version": "5.0.5", - "dev": true, - "requires": { - "anymatch": "^2.0.0", - "async-done": "^1.2.0", - "chokidar": "^2.0.0", - "is-negated-glob": "^1.0.0", - "just-debounce": "^1.0.0", - "normalize-path": "^3.0.0", - "object.defaults": "^1.1.0" - } - }, - "global-dirs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", - "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", - "dev": true, - "requires": { - "ini": "2.0.0" - }, - "dependencies": { - "ini": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", - "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", - "dev": true - } - } - }, - "global-modules": { - "version": "1.0.0", - "dev": true, - "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - } - }, - "global-prefix": { - "version": "1.0.2", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "globalize": { - "version": "1.7.0", - "requires": { - "cldrjs": "^0.5.4" - } - }, - "globals": { - "version": "11.12.0", - "dev": true - }, - "globby": { - "version": "5.0.0", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "arrify": "^1.0.0", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "globule": { - "version": "1.3.3", - "dev": true, - "requires": { - "glob": "~7.1.1", - "lodash": "~4.17.10", - "minimatch": "~3.0.2" - }, - "dependencies": { - "glob": { - "version": "7.1.7", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, - "glogg": { - "version": "1.0.2", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, - "google-auth-library": { - "version": "3.1.2", - "requires": { - "base64-js": "^1.3.0", - "fast-text-encoding": "^1.0.0", - "gaxios": "^1.2.1", - "gcp-metadata": "^1.0.0", - "gtoken": "^2.3.2", - "https-proxy-agent": "^2.2.1", - "jws": "^3.1.5", - "lru-cache": "^5.0.0", - "semver": "^5.5.0" - }, - "dependencies": { - "agent-base": { - "version": "4.3.0", - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - }, - "https-proxy-agent": { - "version": "2.2.4", - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - } - }, - "semver": { - "version": "5.7.1" - } - } - }, - "google-p12-pem": { - "version": "1.0.5", - "requires": { - "node-forge": "^0.10.0", - "pify": "^4.0.0" - }, - "dependencies": { - "pify": { - "version": "4.0.1" - } - } - }, - "got": { - "version": "10.7.0", - "requires": { - "@sindresorhus/is": "^2.0.0", - "@szmarczak/http-timer": "^4.0.0", - "@types/cacheable-request": "^6.0.1", - "cacheable-lookup": "^2.0.0", - "cacheable-request": "^7.0.1", - "decompress-response": "^5.0.0", - "duplexer3": "^0.1.4", - "get-stream": "^5.0.0", - "lowercase-keys": "^2.0.0", - "mimic-response": "^2.1.0", - "p-cancelable": "^2.0.0", - "p-event": "^4.0.0", - "responselike": "^2.0.0", - "to-readable-stream": "^2.0.0", - "type-fest": "^0.10.0" - } - }, - "graceful-fs": { - "version": "4.2.9" - }, - "growl": { - "version": "1.9.2" - }, - "growly": { - "version": "1.3.0", - "dev": true, - "optional": true - }, - "gtoken": { - "version": "2.3.3", - "requires": { - "gaxios": "^1.0.4", - "google-p12-pem": "^1.0.0", - "jws": "^3.1.5", - "mime": "^2.2.0", - "pify": "^4.0.0" - }, - "dependencies": { - "pify": { - "version": "4.0.1" - } - } - }, - "gulp": { - "version": "4.0.2", - "dev": true, - "requires": { - "glob-watcher": "^5.0.3", - "gulp-cli": "^2.2.0", - "undertaker": "^1.2.1", - "vinyl-fs": "^3.0.0" - } - }, - "gulp-cli": { - "version": "2.3.0", - "dev": true, - "requires": { - "ansi-colors": "^1.0.1", - "archy": "^1.0.0", - "array-sort": "^1.0.0", - "color-support": "^1.1.3", - "concat-stream": "^1.6.0", - "copy-props": "^2.0.1", - "fancy-log": "^1.3.2", - "gulplog": "^1.0.0", - "interpret": "^1.4.0", - "isobject": "^3.0.1", - "liftoff": "^3.1.0", - "matchdep": "^2.0.0", - "mute-stdout": "^1.0.0", - "pretty-hrtime": "^1.0.0", - "replace-homedir": "^1.0.0", - "semver-greatest-satisfied-range": "^1.1.0", - "v8flags": "^3.2.0", - "yargs": "^7.1.0" - }, - "dependencies": { - "ansi-colors": { - "version": "1.1.0", - "dev": true, - "requires": { - "ansi-wrap": "^0.1.0" - } - } - } - }, - "gulp-concat": { - "version": "2.6.1", - "dev": true, - "requires": { - "concat-with-sourcemaps": "^1.0.0", - "through2": "^2.0.0", - "vinyl": "^2.0.0" - } - }, - "gulp-env": { - "version": "0.4.0", - "dev": true, - "requires": { - "ini": "^1.3.4", - "through2": "^2.0.0" - } - }, - "gulp-file": { - "version": "0.4.0", - "dev": true, - "requires": { - "through2": "^0.4.1", - "vinyl": "^2.1.0" - }, - "dependencies": { - "isarray": { - "version": "0.0.1", - "dev": true - }, - "object-keys": { - "version": "0.4.0", - "dev": true - }, - "readable-stream": { - "version": "1.0.34", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "dev": true - }, - "through2": { - "version": "0.4.2", - "dev": true, - "requires": { - "readable-stream": "~1.0.17", - "xtend": "~2.1.1" - } - }, - "xtend": { - "version": "2.1.2", - "dev": true, - "requires": { - "object-keys": "~0.4.0" - } - } - } - }, - "gulp-install": { - "version": "1.1.0", - "dev": true, - "requires": { - "dargs": "^5.1.0", - "gulp-util": "^3.0.7", - "lodash.groupby": "^4.6.0", - "p-queue": "^1.0.0", - "through2": "^2.0.3", - "which": "^1.2.14" - }, - "dependencies": { - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "gulp-merge-json": { - "version": "1.3.1", - "dev": true, - "requires": { - "deprecate": "^1.0.0", - "json5": "^1.0.1", - "lodash.mergewith": "^4.6.1", - "plugin-error": "^1.0.1", - "through": "^2.3.8", - "vinyl": "^2.1.0" - }, - "dependencies": { - "json5": { - "version": "1.0.1", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - } - } - }, - "gulp-nodemon": { - "version": "2.5.0", - "dev": true, - "requires": { - "colors": "^1.2.1", - "gulp": "^4.0.0", - "nodemon": "^2.0.2" - } - }, - "gulp-print": { - "version": "2.0.1", - "dev": true, - "requires": { - "gulp-util": "^3.0.6", - "map-stream": "~0.0.6" - } - }, - "gulp-util": { - "version": "3.0.8", - "dev": true, - "requires": { - "array-differ": "^1.0.0", - "array-uniq": "^1.0.2", - "beeper": "^1.0.0", - "chalk": "^1.0.0", - "dateformat": "^2.0.0", - "fancy-log": "^1.1.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.0.0", - "minimist": "^1.1.0", - "multipipe": "^0.1.2", - "object-assign": "^3.0.0", - "replace-ext": "0.0.1", - "through2": "^2.0.0", - "vinyl": "^0.5.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "clone": { - "version": "1.0.4", - "dev": true - }, - "clone-stats": { - "version": "0.0.1", - "dev": true - }, - "object-assign": { - "version": "3.0.0", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "dev": true - }, - "vinyl": { - "version": "0.5.3", - "dev": true, - "requires": { - "clone": "^1.0.0", - "clone-stats": "^0.0.1", - "replace-ext": "0.0.1" - } - } - } - }, - "gulp-wrap": { - "version": "0.15.0", - "dev": true, - "requires": { - "consolidate": "^0.15.1", - "es6-promise": "^4.2.6", - "fs-readfile-promise": "^3.0.1", - "js-yaml": "^3.13.0", - "lodash": "^4.17.11", - "node.extend": "2.0.2", - "plugin-error": "^1.0.1", - "through2": "^3.0.1", - "tryit": "^1.0.1", - "vinyl-bufferstream": "^1.0.1" - }, - "dependencies": { - "through2": { - "version": "3.0.2", - "dev": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - } - } - }, - "gulp-yaml": { - "version": "1.0.1", - "dev": true, - "requires": { - "bufferstreams": "1.1.0", - "gulp-util": "^3.0.6", - "js-yaml": "^3.4.3", - "through2": "^2.0.0", - "xtend": "^4.0.0" - } - }, - "gulplog": { - "version": "1.0.0", - "dev": true, - "requires": { - "glogg": "^1.0.0" - } - }, - "handle-thing": { - "version": "2.0.1", - "dev": true - }, - "har-schema": { - "version": "2.0.0" - }, - "har-validator": { - "version": "5.1.5", - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, - "harmony-reflect": { - "version": "1.6.2", - "dev": true - }, - "has": { - "version": "1.0.3", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - } - } - }, - "has-bigints": { - "version": "1.0.1", - "dev": true - }, - "has-flag": { - "version": "3.0.0" - }, - "has-gulplog": { - "version": "0.1.0", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, - "has-symbols": { - "version": "1.0.2" - }, - "has-tostringtag": { - "version": "1.0.0", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, - "has-unicode": { - "version": "2.0.1" - }, - "has-value": { - "version": "1.0.0", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "has-yarn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", - "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", - "dev": true - }, - "hash-base": { - "version": "3.1.0", - "dev": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.0", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "dev": true - } - } - }, - "hash-stream-validation": { - "version": "0.2.4" - }, - "hash.js": { - "version": "1.1.7", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "he": { - "version": "1.2.0" - }, - "helmet": { - "version": "3.23.3", - "requires": { - "depd": "2.0.0", - "dont-sniff-mimetype": "1.1.0", - "feature-policy": "0.3.0", - "helmet-crossdomain": "0.4.0", - "helmet-csp": "2.10.0", - "hide-powered-by": "1.1.0", - "hpkp": "2.0.0", - "hsts": "2.2.0", - "nocache": "2.1.0", - "referrer-policy": "1.2.0", - "x-xss-protection": "1.3.0" - } - }, - "helmet-crossdomain": { - "version": "0.4.0" - }, - "helmet-csp": { - "version": "2.10.0", - "requires": { - "bowser": "2.9.0", - "camelize": "1.0.0", - "content-security-policy-builder": "2.1.0", - "dasherize": "2.0.0" - } - }, - "hide-powered-by": { - "version": "1.1.0" - }, - "hmac-drbg": { - "version": "1.0.1", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "homedir-polyfill": { - "version": "1.0.3", - "dev": true, - "requires": { - "parse-passwd": "^1.0.0" - } - }, - "hosted-git-info": { - "version": "2.8.9", - "dev": true - }, - "hpack.js": { - "version": "2.1.6", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "obuf": "^1.0.0", - "readable-stream": "^2.0.1", - "wbuf": "^1.1.0" - } - }, - "hpkp": { - "version": "2.0.0" - }, - "hsts": { - "version": "2.2.0", - "requires": { - "depd": "2.0.0" - } - }, - "html-encoding-sniffer": { - "version": "2.0.1", - "dev": true, - "requires": { - "whatwg-encoding": "^1.0.5" - } - }, - "html-entities": { - "version": "1.4.0", - "dev": true - }, - "html-escaper": { - "version": "2.0.2", - "dev": true - }, - "html-loader": { - "version": "0.4.5", - "dev": true, - "requires": { - "es6-templates": "^0.2.2", - "fastparse": "^1.1.1", - "html-minifier": "^3.0.1", - "loader-utils": "^1.0.2", - "object-assign": "^4.1.0" - } - }, - "html-loader-jest": { - "version": "0.2.1", - "dev": true, - "requires": { - "html-loader": "^0.5.1" - }, - "dependencies": { - "html-loader": { - "version": "0.5.5", - "dev": true, - "requires": { - "es6-templates": "^0.2.3", - "fastparse": "^1.1.1", - "html-minifier": "^3.5.8", - "loader-utils": "^1.1.0", - "object-assign": "^4.1.1" - } - } - } - }, - "html-minifier": { - "version": "3.5.21", - "dev": true, - "requires": { - "camel-case": "3.0.x", - "clean-css": "4.2.x", - "commander": "2.17.x", - "he": "1.2.x", - "param-case": "2.1.x", - "relateurl": "0.2.x", - "uglify-js": "3.4.x" - } - }, - "html-minifier-terser": { - "version": "5.1.1", - "dev": true, - "requires": { - "camel-case": "^4.1.1", - "clean-css": "^4.2.3", - "commander": "^4.1.1", - "he": "^1.2.0", - "param-case": "^3.0.3", - "relateurl": "^0.2.7", - "terser": "^4.6.3" - }, - "dependencies": { - "camel-case": { - "version": "4.1.2", - "dev": true, - "requires": { - "pascal-case": "^3.1.2", - "tslib": "^2.0.3" - } - }, - "commander": { - "version": "4.1.1", - "dev": true - }, - "param-case": { - "version": "3.0.4", - "dev": true, - "requires": { - "dot-case": "^3.0.4", - "tslib": "^2.0.3" - } - } - } - }, - "html-to-text": { - "version": "5.1.1", - "requires": { - "he": "^1.2.0", - "htmlparser2": "^3.10.1", - "lodash": "^4.17.11", - "minimist": "^1.2.0" - } - }, - "html-webpack-plugin": { - "version": "4.5.2", - "dev": true, - "requires": { - "@types/html-minifier-terser": "^5.0.0", - "@types/tapable": "^1.0.5", - "@types/webpack": "^4.41.8", - "html-minifier-terser": "^5.0.1", - "loader-utils": "^1.2.3", - "lodash": "^4.17.20", - "pretty-error": "^2.1.1", - "tapable": "^1.1.3", - "util.promisify": "1.0.0" - } - }, - "htmlparser2": { - "version": "3.10.1", - "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.0", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "http-cache-semantics": { - "version": "4.1.0" - }, - "http-deceiver": { - "version": "1.2.7", - "dev": true - }, - "http-errors": { - "version": "1.8.1", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.1" - }, - "dependencies": { - "depd": { - "version": "1.1.2" - } - } - }, - "http-parser-js": { - "version": "0.5.5", - "dev": true - }, - "http-proxy": { - "version": "1.18.1", - "dev": true, - "requires": { - "eventemitter3": "^4.0.0", - "follow-redirects": "^1.0.0", - "requires-port": "^1.0.0" - } - }, - "http-proxy-agent": { - "version": "4.0.1", - "dev": true, - "requires": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - } - }, - "http-proxy-middleware": { - "version": "0.19.1", - "dev": true, - "requires": { - "http-proxy": "^1.17.0", - "is-glob": "^4.0.0", - "lodash": "^4.17.11", - "micromatch": "^3.1.10" - }, - "dependencies": { - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "micromatch": { - "version": "3.1.10", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "http-signature": { - "version": "1.2.0", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "http-status": { - "version": "1.5.0" - }, - "httpntlm": { - "version": "1.6.1", - "requires": { - "httpreq": ">=0.4.22", - "underscore": "~1.7.0" - } - }, - "httpreq": { - "version": "0.5.2" - }, - "https-browserify": { - "version": "1.0.0", - "dev": true - }, - "https-proxy-agent": { - "version": "5.0.0", - "requires": { - "agent-base": "6", - "debug": "4" - } - }, - "human-signals": { - "version": "1.1.1" - }, - "i18n": { - "version": "0.8.6", - "requires": { - "debug": "*", - "make-plural": "^6.0.1", - "math-interval-parser": "^2.0.1", - "messageformat": "^2.3.0", - "mustache": "*", - "sprintf-js": "^1.1.2" - } - }, - "iconv-lite": { - "version": "0.4.24", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "icss-replace-symbols": { - "version": "1.1.0", - "dev": true - }, - "icss-utils": { - "version": "4.1.1", - "dev": true, - "requires": { - "postcss": "^7.0.14" - } - }, - "identity-obj-proxy": { - "version": "3.0.0", - "dev": true, - "requires": { - "harmony-reflect": "^1.4.6" - } - }, - "ieee754": { - "version": "1.1.13" - }, - "iferr": { - "version": "0.1.5", - "dev": true - }, - "ignore": { - "version": "4.0.6", - "dev": true - }, - "ignore-by-default": { - "version": "1.0.1", - "dev": true - }, - "image-type": { - "version": "4.1.0", - "requires": { - "file-type": "^10.10.0" - } - }, - "imap": { - "version": "0.8.19", - "requires": { - "readable-stream": "1.1.x", - "utf7": ">=1.0.2" - }, - "dependencies": { - "isarray": { - "version": "0.0.1" - }, - "readable-stream": { - "version": "1.1.14", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31" - } - } - }, - "import-fresh": { - "version": "3.3.0", - "dev": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "4.0.0", - "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 - }, - "import-local": { - "version": "3.1.0", - "dev": true, - "requires": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "dependencies": { - "pkg-dir": { - "version": "4.2.0", - "dev": true, - "requires": { - "find-up": "^4.0.0" - } - } - } - }, - "imurmurhash": { - "version": "0.1.4" - }, - "in-publish": { - "version": "2.0.1", - "dev": true - }, - "indent-string": { - "version": "2.1.0", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, - "infer-owner": { - "version": "1.0.4", - "dev": true - }, - "inflection": { - "version": "1.13.1" - }, - "inflight": { - "version": "1.0.6", - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4" - }, - "ini": { - "version": "1.3.8" - }, - "internal-ip": { - "version": "4.3.0", - "dev": true, - "requires": { - "default-gateway": "^4.2.0", - "ipaddr.js": "^1.9.0" - } - }, - "internal-slot": { - "version": "1.0.3", - "dev": true, - "requires": { - "get-intrinsic": "^1.1.0", - "has": "^1.0.3", - "side-channel": "^1.0.4" - } - }, - "interpret": { - "version": "1.4.0", - "dev": true - }, - "invert-kv": { - "version": "2.0.0" - }, - "ip": { - "version": "1.1.5" - }, - "ip-regex": { - "version": "2.1.0", - "dev": true - }, - "ipaddr.js": { - "version": "1.9.1" - }, - "is": { - "version": "3.3.0", - "dev": true - }, - "is-absolute": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-relative": "^1.0.0", - "is-windows": "^1.0.1" - } - }, - "is-absolute-url": { - "version": "3.0.3", - "dev": true - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-arguments": { - "version": "1.1.1", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-arrayish": { - "version": "0.2.1", - "dev": true - }, - "is-bigint": { - "version": "1.0.4", - "dev": true, - "requires": { - "has-bigints": "^1.0.1" - } - }, - "is-binary-path": { - "version": "1.0.1", - "dev": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-boolean-object": { - "version": "1.1.2", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-buffer": { - "version": "1.1.6" - }, - "is-callable": { - "version": "1.2.4", - "dev": true - }, - "is-ci": { - "version": "2.0.0", - "dev": true, - "requires": { - "ci-info": "^2.0.0" - } - }, - "is-core-module": { - "version": "2.8.1", - "dev": true, - "requires": { - "has": "^1.0.3" - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-date-object": { - "version": "1.0.5", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-descriptor": { - "version": "0.1.6", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "dev": true - } - } - }, - "is-docker": { - "version": "2.2.1", - "dev": true, - "optional": true - }, - "is-extendable": { - "version": "0.1.1", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "dev": true - }, - "is-finite": { - "version": "1.1.0", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-generator-fn": { - "version": "2.1.0", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-installed-globally": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", - "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", - "dev": true, - "requires": { - "global-dirs": "^3.0.0", - "is-path-inside": "^3.0.2" - }, - "dependencies": { - "is-path-inside": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", - "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", - "dev": true - } - } - }, - "is-negated-glob": { - "version": "1.0.0", - "dev": true - }, - "is-negative-zero": { - "version": "2.0.2", - "dev": true - }, - "is-npm": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", - "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", - "dev": true - }, - "is-number": { - "version": "3.0.0", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-number-object": { - "version": "1.0.6", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-obj": { - "version": "1.0.1" - }, - "is-path-cwd": { - "version": "1.0.0", - "dev": true - }, - "is-path-in-cwd": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-path-inside": "^1.0.0" - } - }, - "is-path-inside": { - "version": "1.0.1", - "dev": true, - "requires": { - "path-is-inside": "^1.0.1" - } - }, - "is-plain-object": { - "version": "2.0.4", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-potential-custom-element-name": { - "version": "1.0.1", - "dev": true - }, - "is-property": { - "version": "1.0.2", - "dev": true - }, - "is-regex": { - "version": "1.1.4", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - } - }, - "is-relative": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-unc-path": "^1.0.0" - } - }, - "is-shared-array-buffer": { - "version": "1.0.1", - "dev": true - }, - "is-stream": { - "version": "2.0.1" - }, - "is-stream-ended": { - "version": "0.1.4" - }, - "is-string": { - "version": "1.0.7", - "dev": true, - "requires": { - "has-tostringtag": "^1.0.0" - } - }, - "is-symbol": { - "version": "1.0.4", - "dev": true, - "requires": { - "has-symbols": "^1.0.2" - } - }, - "is-typedarray": { - "version": "1.0.0" - }, - "is-unc-path": { - "version": "1.0.0", - "dev": true, - "requires": { - "unc-path-regex": "^0.1.2" - } - }, - "is-utf8": { - "version": "0.2.1", - "dev": true - }, - "is-valid-glob": { - "version": "1.0.0", - "dev": true - }, - "is-weakref": { - "version": "1.0.2", - "dev": true, - "requires": { - "call-bind": "^1.0.2" - } - }, - "is-windows": { - "version": "1.0.2", - "dev": true - }, - "is-wsl": { - "version": "2.2.0", - "dev": true, - "optional": true, - "requires": { - "is-docker": "^2.0.0" - } - }, - "is-yarn-global": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", - "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", - "dev": true - }, - "isarray": { - "version": "1.0.0" - }, - "isemail": { - "version": "3.2.0", - "requires": { - "punycode": "2.x.x" - } - }, - "isexe": { - "version": "2.0.0" - }, - "isobject": { - "version": "3.0.1" - }, - "isstream": { - "version": "0.1.2" - }, - "istanbul-lib-coverage": { - "version": "3.2.0", - "dev": true - }, - "istanbul-lib-instrument": { - "version": "5.1.0", - "dev": true, - "requires": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - } - }, - "istanbul-lib-report": { - "version": "3.0.0", - "dev": true, - "requires": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "make-dir": { - "version": "3.1.0", - "dev": true, - "requires": { - "semver": "^6.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "istanbul-lib-source-maps": { - "version": "4.0.1", - "dev": true, - "requires": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "istanbul-reports": { - "version": "3.1.3", - "dev": true, - "requires": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - } - }, - "jade": { - "version": "0.26.3", - "requires": { - "commander": "0.6.1", - "mkdirp": "0.3.0" - }, - "dependencies": { - "commander": { - "version": "0.6.1" - }, - "mkdirp": { - "version": "0.3.0" - } - } - }, - "jake": { - "version": "10.8.2", - "requires": { - "async": "0.9.x", - "chalk": "^2.4.2", - "filelist": "^1.0.1", - "minimatch": "^3.0.4" - }, - "dependencies": { - "async": { - "version": "0.9.2" - } - } - }, - "jasmine": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-4.1.0.tgz", - "integrity": "sha512-4VhjbUgwfNS9CBnUMoSWr9tdNgOoOhNIjAD8YRxTn+PmOf4qTSC0Uqhk66dWGnz2vJxtNIU0uBjiwnsp4Ud9VA==", - "dev": true, - "requires": { - "glob": "^7.1.6", - "jasmine-core": "^4.1.0" - } - }, - "jasmine-core": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-4.1.1.tgz", - "integrity": "sha512-lmUfT5XcK9KKvt3lLYzn93hc4MGzlUBowExFVgzbSW0ZCrdeyS574dfsyfRhxbg81Wj4gk+RxUiTnj7KBfDA1g==", - "dev": true - }, - "jasmine-reporters": { - "version": "2.5.0", - "dev": true, - "requires": { - "@xmldom/xmldom": "^0.7.3", - "mkdirp": "^1.0.4" - } - }, - "jasmine-spec-reporter": { - "version": "7.0.0", - "dev": true, - "requires": { - "colors": "1.4.0" - } - }, - "jayson": { - "version": "2.1.2", - "requires": { - "@types/node": "^10.3.5", - "commander": "^2.12.2", - "es6-promisify": "^5.0.0", - "eyes": "^0.1.8", - "json-stringify-safe": "^5.0.1", - "JSONStream": "^1.3.1", - "lodash": "^4.17.11", - "uuid": "^3.2.1" - }, - "dependencies": { - "@types/node": { - "version": "10.17.60" - } - } - }, - "jest": { - "version": "26.6.3", - "dev": true, - "requires": { - "@jest/core": "^26.6.3", - "import-local": "^3.0.2", - "jest-cli": "^26.6.3" - } - }, - "jest-changed-files": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "execa": "^4.0.0", - "throat": "^5.0.0" - } - }, - "jest-cli": { - "version": "26.6.3", - "dev": true, - "requires": { - "@jest/core": "^26.6.3", - "@jest/test-result": "^26.6.2", - "@jest/types": "^26.6.2", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "import-local": "^3.0.2", - "is-ci": "^2.0.0", - "jest-config": "^26.6.3", - "jest-util": "^26.6.2", - "jest-validate": "^26.6.2", - "prompts": "^2.0.1", - "yargs": "^15.4.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "cliui": { - "version": "6.0.0", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "dev": true - }, - "wrap-ansi": { - "version": "6.2.0", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "yargs": { - "version": "15.4.1", - "dev": true, - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - } - }, - "yargs-parser": { - "version": "18.1.3", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "jest-config": { - "version": "26.6.3", - "dev": true, - "requires": { - "@babel/core": "^7.1.0", - "@jest/test-sequencer": "^26.6.3", - "@jest/types": "^26.6.2", - "babel-jest": "^26.6.3", - "chalk": "^4.0.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.1", - "graceful-fs": "^4.2.4", - "jest-environment-jsdom": "^26.6.2", - "jest-environment-node": "^26.6.2", - "jest-get-type": "^26.3.0", - "jest-jasmine2": "^26.6.3", - "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.6.2", - "jest-util": "^26.6.2", - "jest-validate": "^26.6.2", - "micromatch": "^4.0.2", - "pretty-format": "^26.6.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-diff": { - "version": "26.6.2", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "diff-sequences": "^26.6.2", - "jest-get-type": "^26.3.0", - "pretty-format": "^26.6.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-docblock": { - "version": "26.0.0", - "dev": true, - "requires": { - "detect-newline": "^3.0.0" - } - }, - "jest-each": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "chalk": "^4.0.0", - "jest-get-type": "^26.3.0", - "jest-util": "^26.6.2", - "pretty-format": "^26.6.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-environment-jsdom": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/environment": "^26.6.2", - "@jest/fake-timers": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "jest-mock": "^26.6.2", - "jest-util": "^26.6.2", - "jsdom": "^16.4.0" - } - }, - "jest-environment-node": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/environment": "^26.6.2", - "@jest/fake-timers": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "jest-mock": "^26.6.2", - "jest-util": "^26.6.2" - } - }, - "jest-get-type": { - "version": "26.3.0", - "dev": true - }, - "jest-haste-map": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "@types/graceful-fs": "^4.1.2", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "fsevents": "^2.1.2", - "graceful-fs": "^4.2.4", - "jest-regex-util": "^26.0.0", - "jest-serializer": "^26.6.2", - "jest-util": "^26.6.2", - "jest-worker": "^26.6.2", - "micromatch": "^4.0.2", - "sane": "^4.0.3", - "walker": "^1.0.7" - }, - "dependencies": { - "anymatch": { - "version": "3.1.2", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - } - } - }, - "jest-jasmine2": { - "version": "26.6.3", - "dev": true, - "requires": { - "@babel/traverse": "^7.1.0", - "@jest/environment": "^26.6.2", - "@jest/source-map": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "expect": "^26.6.2", - "is-generator-fn": "^2.0.0", - "jest-each": "^26.6.2", - "jest-matcher-utils": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-runtime": "^26.6.3", - "jest-snapshot": "^26.6.2", - "jest-util": "^26.6.2", - "pretty-format": "^26.6.2", - "throat": "^5.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-junit": { - "version": "8.0.0", - "dev": true, - "requires": { - "jest-validate": "^24.0.0", - "mkdirp": "^0.5.1", - "strip-ansi": "^4.0.0", - "xml": "^1.0.1" - }, - "dependencies": { - "@jest/types": { - "version": "24.9.0", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^1.1.1", - "@types/yargs": "^13.0.0" - } - }, - "@types/istanbul-reports": { - "version": "1.1.2", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "*", - "@types/istanbul-lib-report": "*" - } - }, - "@types/yargs": { - "version": "13.0.12", - "dev": true, - "requires": { - "@types/yargs-parser": "*" - } - }, - "ansi-regex": { - "version": "4.1.0", - "dev": true - }, - "jest-get-type": { - "version": "24.9.0", - "dev": true - }, - "jest-validate": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "camelcase": "^5.3.1", - "chalk": "^2.0.1", - "jest-get-type": "^24.9.0", - "leven": "^3.1.0", - "pretty-format": "^24.9.0" - } - }, - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "pretty-format": { - "version": "24.9.0", - "dev": true, - "requires": { - "@jest/types": "^24.9.0", - "ansi-regex": "^4.0.0", - "ansi-styles": "^3.2.0", - "react-is": "^16.8.4" - } - }, - "react-is": { - "version": "16.13.1", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "dev": true - } - } - } - } - }, - "jest-leak-detector": { - "version": "26.6.2", - "dev": true, - "requires": { - "jest-get-type": "^26.3.0", - "pretty-format": "^26.6.2" - } - }, - "jest-matcher-utils": { - "version": "26.6.2", - "dev": true, - "requires": { - "chalk": "^4.0.0", - "jest-diff": "^26.6.2", - "jest-get-type": "^26.3.0", - "pretty-format": "^26.6.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-message-util": { - "version": "26.6.2", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@jest/types": "^26.6.2", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "micromatch": "^4.0.2", - "pretty-format": "^26.6.2", - "slash": "^3.0.0", - "stack-utils": "^2.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-mock": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "@types/node": "*" - } - }, - "jest-pnp-resolver": { - "version": "1.2.2", - "dev": true, - "requires": {} - }, - "jest-regex-util": { - "version": "26.0.0", - "dev": true - }, - "jest-resolve": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^26.6.2", - "read-pkg-up": "^7.0.1", - "resolve": "^1.18.1", - "slash": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-resolve-dependencies": { - "version": "26.6.3", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-snapshot": "^26.6.2" - } - }, - "jest-runner": { - "version": "26.6.3", - "dev": true, - "requires": { - "@jest/console": "^26.6.2", - "@jest/environment": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.7.1", - "exit": "^0.1.2", - "graceful-fs": "^4.2.4", - "jest-config": "^26.6.3", - "jest-docblock": "^26.0.0", - "jest-haste-map": "^26.6.2", - "jest-leak-detector": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-resolve": "^26.6.2", - "jest-runtime": "^26.6.3", - "jest-util": "^26.6.2", - "jest-worker": "^26.6.2", - "source-map-support": "^0.5.6", - "throat": "^5.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-runtime": { - "version": "26.6.3", - "dev": true, - "requires": { - "@jest/console": "^26.6.2", - "@jest/environment": "^26.6.2", - "@jest/fake-timers": "^26.6.2", - "@jest/globals": "^26.6.2", - "@jest/source-map": "^26.6.2", - "@jest/test-result": "^26.6.2", - "@jest/transform": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/yargs": "^15.0.0", - "chalk": "^4.0.0", - "cjs-module-lexer": "^0.6.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.4", - "jest-config": "^26.6.3", - "jest-haste-map": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-mock": "^26.6.2", - "jest-regex-util": "^26.0.0", - "jest-resolve": "^26.6.2", - "jest-snapshot": "^26.6.2", - "jest-util": "^26.6.2", - "jest-validate": "^26.6.2", - "slash": "^3.0.0", - "strip-bom": "^4.0.0", - "yargs": "^15.4.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "cliui": { - "version": "6.0.0", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "get-caller-file": { - "version": "2.0.5", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "dev": true - }, - "wrap-ansi": { - "version": "6.2.0", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "yargs": { - "version": "15.4.1", - "dev": true, - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - } - }, - "yargs-parser": { - "version": "18.1.3", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "jest-serializer": { - "version": "26.6.2", - "dev": true, - "requires": { - "@types/node": "*", - "graceful-fs": "^4.2.4" - } - }, - "jest-snapshot": { - "version": "26.6.2", - "dev": true, - "requires": { - "@babel/types": "^7.0.0", - "@jest/types": "^26.6.2", - "@types/babel__traverse": "^7.0.4", - "@types/prettier": "^2.0.0", - "chalk": "^4.0.0", - "expect": "^26.6.2", - "graceful-fs": "^4.2.4", - "jest-diff": "^26.6.2", - "jest-get-type": "^26.3.0", - "jest-haste-map": "^26.6.2", - "jest-matcher-utils": "^26.6.2", - "jest-message-util": "^26.6.2", - "jest-resolve": "^26.6.2", - "natural-compare": "^1.4.0", - "pretty-format": "^26.6.2", - "semver": "^7.3.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "lru-cache": { - "version": "6.0.0", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.5", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "yallist": { - "version": "4.0.0", - "dev": true - } - } - }, - "jest-util": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "@types/node": "*", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.4", - "is-ci": "^2.0.0", - "micromatch": "^4.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-validate": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "camelcase": "^6.0.0", - "chalk": "^4.0.0", - "jest-get-type": "^26.3.0", - "leven": "^3.1.0", - "pretty-format": "^26.6.2" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "camelcase": { - "version": "6.3.0", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-watcher": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/test-result": "^26.6.2", - "@jest/types": "^26.6.2", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "jest-util": "^26.6.2", - "string-length": "^4.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jest-worker": { - "version": "26.6.2", - "dev": true, - "requires": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "merge-stream": { - "version": "2.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "jmespath": { - "version": "0.15.0" - }, - "js-base64": { - "version": "2.6.4", - "dev": true - }, - "js-tokens": { - "version": "4.0.0", - "dev": true - }, - "js-yaml": { - "version": "3.14.1", - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "js2xmlparser": { - "version": "3.0.0", - "requires": { - "xmlcreate": "^1.0.1" - } - }, - "jsbn": { - "version": "0.1.1" - }, - "jsdom": { - "version": "16.7.0", - "dev": true, - "requires": { - "abab": "^2.0.5", - "acorn": "^8.2.4", - "acorn-globals": "^6.0.0", - "cssom": "^0.4.4", - "cssstyle": "^2.3.0", - "data-urls": "^2.0.0", - "decimal.js": "^10.2.1", - "domexception": "^2.0.1", - "escodegen": "^2.0.0", - "form-data": "^3.0.0", - "html-encoding-sniffer": "^2.0.1", - "http-proxy-agent": "^4.0.1", - "https-proxy-agent": "^5.0.0", - "is-potential-custom-element-name": "^1.0.1", - "nwsapi": "^2.2.0", - "parse5": "6.0.1", - "saxes": "^5.0.1", - "symbol-tree": "^3.2.4", - "tough-cookie": "^4.0.0", - "w3c-hr-time": "^1.0.2", - "w3c-xmlserializer": "^2.0.0", - "webidl-conversions": "^6.1.0", - "whatwg-encoding": "^1.0.5", - "whatwg-mimetype": "^2.3.0", - "whatwg-url": "^8.5.0", - "ws": "^7.4.6", - "xml-name-validator": "^3.0.0" - }, - "dependencies": { - "acorn": { - "version": "8.7.0", - "dev": true - } - } - }, - "jsesc": { - "version": "2.5.2", - "dev": true - }, - "json-bigint": { - "version": "0.3.1", - "requires": { - "bignumber.js": "^9.0.0" - } - }, - "json-buffer": { - "version": "3.0.1" - }, - "json-loader": { - "version": "0.5.7", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "dev": true - }, - "json-parse-even-better-errors": { - "version": "2.3.1", - "dev": true - }, - "json-schema": { - "version": "0.4.0" - }, - "json-schema-traverse": { - "version": "0.4.1" - }, - "json-stable-stringify-without-jsonify": { - "version": "1.0.1", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1" - }, - "json3": { - "version": "3.3.3", - "dev": true - }, - "json5": { - "version": "2.2.0", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "jsonfile": { - "version": "4.0.0", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsonparse": { - "version": "1.3.1" - }, - "JSONStream": { - "version": "1.3.5", - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - } - }, - "jsprim": { - "version": "1.4.2", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - }, - "dependencies": { - "core-util-is": { - "version": "1.0.2" - }, - "verror": { - "version": "1.10.0", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - } - } - }, - "just-debounce": { - "version": "1.1.0", - "dev": true - }, - "jwa": { - "version": "1.4.1", - "requires": { - "buffer-equal-constant-time": "1.0.1", - "ecdsa-sig-formatter": "1.0.11", - "safe-buffer": "^5.0.1" - } - }, - "jws": { - "version": "3.2.2", - "requires": { - "jwa": "^1.4.1", - "safe-buffer": "^5.0.1" - } - }, - "keyv": { - "version": "4.0.5", - "requires": { - "json-buffer": "3.0.1" - } - }, - "killable": { - "version": "1.0.1", - "dev": true - }, - "kind-of": { - "version": "6.0.3", - "dev": true - }, - "kleur": { - "version": "3.0.3", - "dev": true - }, - "last-run": { - "version": "1.1.1", - "dev": true, - "requires": { - "default-resolution": "^2.0.0", - "es6-weak-map": "^2.0.1" - } - }, - "latest-version": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", - "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", - "dev": true, - "requires": { - "package-json": "^6.3.0" - } - }, - "lazystream": { - "version": "1.0.1", - "dev": true, - "requires": { - "readable-stream": "^2.0.5" - } - }, - "lcid": { - "version": "2.0.0", - "requires": { - "invert-kv": "^2.0.0" - } - }, - "ldap-filter": { - "version": "0.3.3", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "ldapjs": { - "version": "2.3.1", - "requires": { - "abstract-logging": "^2.0.0", - "asn1": "^0.2.4", - "assert-plus": "^1.0.0", - "backoff": "^2.5.0", - "ldap-filter": "^0.3.3", - "once": "^1.4.0", - "vasync": "^2.2.0", - "verror": "^1.8.1" - } - }, - "lead": { - "version": "1.0.0", - "dev": true, - "requires": { - "flush-write-stream": "^1.0.2" - } - }, - "leven": { - "version": "3.1.0", - "dev": true - }, - "levn": { - "version": "0.4.1", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1", - "type-check": "~0.4.0" - } - }, - "libbase64": { - "version": "1.2.1" - }, - "libmime": { - "version": "5.0.0", - "requires": { - "encoding-japanese": "1.0.30", - "iconv-lite": "0.6.2", - "libbase64": "1.2.1", - "libqp": "1.1.0" - }, - "dependencies": { - "iconv-lite": { - "version": "0.6.2", - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - } - } - } - }, - "liboneandone": { - "version": "1.2.0", - "requires": { - "mocha": "^2.5.3", - "request": "^2.74.0" - } - }, - "libqp": { - "version": "1.1.0" - }, - "liftoff": { - "version": "3.1.0", - "dev": true, - "requires": { - "extend": "^3.0.0", - "findup-sync": "^3.0.0", - "fined": "^1.0.1", - "flagged-respawn": "^1.0.0", - "is-plain-object": "^2.0.4", - "object.map": "^1.0.0", - "rechoir": "^0.6.2", - "resolve": "^1.1.7" - } - }, - "lines-and-columns": { - "version": "1.2.4", - "dev": true - }, - "linkify-it": { - "version": "3.0.2", - "requires": { - "uc.micro": "^1.0.1" - } - }, - "load-json-file": { - "version": "1.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" - }, - "dependencies": { - "parse-json": { - "version": "2.2.0", - "dev": true, - "requires": { - "error-ex": "^1.2.0" - } - }, - "strip-bom": { - "version": "2.0.0", - "dev": true, - "requires": { - "is-utf8": "^0.2.0" - } - } - } - }, - "loader-runner": { - "version": "2.4.0", - "dev": true - }, - "loader-utils": { - "version": "1.4.0", - "dev": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^1.0.1" - }, - "dependencies": { - "json5": { - "version": "1.0.1", - "dev": true, - "requires": { - "minimist": "^1.2.0" - } - } - } - }, - "locate-path": { - "version": "5.0.0", - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash": { - "version": "4.17.21" - }, - "lodash._basecopy": { - "version": "3.0.1", - "dev": true - }, - "lodash._basetostring": { - "version": "3.0.1", - "dev": true - }, - "lodash._basevalues": { - "version": "3.0.0", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "dev": true - }, - "lodash._reescape": { - "version": "3.0.0", - "dev": true - }, - "lodash._reevaluate": { - "version": "3.0.0", - "dev": true - }, - "lodash._reinterpolate": { - "version": "3.0.0", - "dev": true - }, - "lodash._root": { - "version": "3.0.1", - "dev": true - }, - "lodash.debounce": { - "version": "4.0.8", - "dev": true - }, - "lodash.escape": { - "version": "3.2.0", - "dev": true, - "requires": { - "lodash._root": "^3.0.0" - } - }, - "lodash.groupby": { - "version": "4.6.0", - "dev": true - }, - "lodash.isarguments": { - "version": "3.1.0", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "dev": true, - "requires": { - "lodash._getnative": "^3.0.0", - "lodash.isarguments": "^3.0.0", - "lodash.isarray": "^3.0.0" - } - }, - "lodash.merge": { - "version": "4.6.2", - "dev": true - }, - "lodash.mergewith": { - "version": "4.6.2", - "dev": true - }, - "lodash.restparam": { - "version": "3.6.1", - "dev": true - }, - "lodash.template": { - "version": "3.6.2", - "dev": true, - "requires": { - "lodash._basecopy": "^3.0.0", - "lodash._basetostring": "^3.0.0", - "lodash._basevalues": "^3.0.0", - "lodash._isiterateecall": "^3.0.0", - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0", - "lodash.keys": "^3.0.0", - "lodash.restparam": "^3.0.0", - "lodash.templatesettings": "^3.0.0" - } - }, - "lodash.templatesettings": { - "version": "3.1.1", - "dev": true, - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.escape": "^3.0.0" - } - }, - "lodash.truncate": { - "version": "4.4.2", - "dev": true - }, - "loglevel": { - "version": "1.8.0", - "dev": true - }, - "long": { - "version": "4.0.0", - "dev": true - }, - "loopback": { - "version": "3.28.0", - "requires": { - "async": "^2.0.1", - "bcryptjs": "^2.1.0", - "bluebird": "^3.1.1", - "body-parser": "^1.12.0", - "canonical-json": "0.0.4", - "debug": "^2.1.2", - "depd": "^1.0.0", - "ejs": "^2.3.1", - "express": "^4.14.0", - "inflection": "^1.6.0", - "isemail": "^3.2.0", - "loopback-connector-remote": "^3.0.0", - "loopback-datasource-juggler": "^3.28.0", - "loopback-filters": "^1.0.0", - "loopback-phase": "^3.0.0", - "nodemailer": "^6.4.16", - "nodemailer-direct-transport": "^3.3.2", - "nodemailer-stub-transport": "^1.1.0", - "serve-favicon": "^2.2.0", - "stable": "^0.1.5", - "strong-globalize": "^4.1.1", - "strong-remoting": "^3.11.0", - "uid2": "0.0.3", - "underscore.string": "^3.3.5" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "1.1.2" - }, - "ms": { - "version": "2.0.0" - } - } - }, - "loopback-boot": { - "version": "3.3.1", - "requires": { - "async": "^2.4.0", - "bluebird": "^3.5.3", - "commondir": "^1.0.1", - "debug": "^4.1.1", - "lodash": "^4.17.11", - "semver": "^5.1.0", - "strong-globalize": "^4.1.1", - "toposort": "^2.0.2" - }, - "dependencies": { - "semver": { - "version": "5.7.1" - } - } - }, - "loopback-component-explorer": { - "version": "6.5.1", - "requires": { - "debug": "^3.1.0", - "lodash": "^4.17.11", - "loopback-swagger": "^5.0.0", - "strong-globalize": "^4.1.1", - "swagger-ui": "^2.2.5" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "loopback-component-storage": { - "version": "3.6.1", - "requires": { - "async": "^2.6.1", - "debug": "^3.1.0", - "formidable": "^1.2.1", - "pkgcloud": "^2.0.0", - "strong-globalize": "^4.1.1", - "uuid": "^3.2.1" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "loopback-connector": { - "version": "4.11.1", - "requires": { - "async": "^3.2.0", - "bluebird": "^3.7.2", - "debug": "^4.1.1", - "msgpack5": "^4.2.0", - "strong-globalize": "^5.1.0", - "uuid": "^7.0.3" - }, - "dependencies": { - "async": { - "version": "3.2.3" - }, - "invert-kv": { - "version": "3.0.1" - }, - "lcid": { - "version": "3.1.1", - "requires": { - "invert-kv": "^3.0.0" - } - }, - "mem": { - "version": "5.1.1", - "requires": { - "map-age-cleaner": "^0.1.3", - "mimic-fn": "^2.1.0", - "p-is-promise": "^2.1.0" - } - }, - "mkdirp": { - "version": "0.5.5", - "requires": { - "minimist": "^1.2.5" - } - }, - "os-locale": { - "version": "5.0.0", - "requires": { - "execa": "^4.0.0", - "lcid": "^3.0.0", - "mem": "^5.0.0" - } - }, - "strong-globalize": { - "version": "5.1.0", - "requires": { - "accept-language": "^3.0.18", - "debug": "^4.1.1", - "globalize": "^1.5.0", - "lodash": "^4.17.15", - "md5": "^2.2.1", - "mkdirp": "^0.5.5", - "os-locale": "^5.0.0", - "yamljs": "^0.3.0" - } - }, - "uuid": { - "version": "7.0.3" - } - } - }, - "loopback-connector-mysql": { - "version": "5.4.4", - "requires": { - "async": "^2.6.1", - "debug": "^3.1.0", - "lodash": "^4.17.11", - "loopback-connector": "^4.0.0", - "mysql": "^2.11.1", - "strong-globalize": "^5.0.5" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - }, - "invert-kv": { - "version": "3.0.1" - }, - "lcid": { - "version": "3.1.1", - "requires": { - "invert-kv": "^3.0.0" - } - }, - "mem": { - "version": "5.1.1", - "requires": { - "map-age-cleaner": "^0.1.3", - "mimic-fn": "^2.1.0", - "p-is-promise": "^2.1.0" - } - }, - "mkdirp": { - "version": "0.5.5", - "requires": { - "minimist": "^1.2.5" - } - }, - "os-locale": { - "version": "5.0.0", - "requires": { - "execa": "^4.0.0", - "lcid": "^3.0.0", - "mem": "^5.0.0" - } - }, - "strong-globalize": { - "version": "5.1.0", - "requires": { - "accept-language": "^3.0.18", - "debug": "^4.1.1", - "globalize": "^1.5.0", - "lodash": "^4.17.15", - "md5": "^2.2.1", - "mkdirp": "^0.5.5", - "os-locale": "^5.0.0", - "yamljs": "^0.3.0" - }, - "dependencies": { - "debug": { - "version": "4.3.3", - "requires": { - "ms": "2.1.2" - } - } - } - } - } - }, - "loopback-connector-remote": { - "version": "3.4.1", - "requires": { - "loopback-datasource-juggler": "^3.0.0", - "strong-remoting": "^3.0.0" - } - }, - "loopback-context": { - "version": "3.5.2", - "requires": { - "cls-hooked": "^4.2.0" - } - }, - "loopback-datasource-juggler": { - "version": "3.36.1", - "requires": { - "async": "^2.6.0", - "bluebird": "^3.1.1", - "debug": "^3.1.0", - "depd": "^1.0.0", - "inflection": "^1.6.0", - "lodash": "^4.17.4", - "loopback-connector": "^4.4.0", - "minimatch": "^3.0.3", - "qs": "^6.5.0", - "shortid": "^2.2.6", - "strong-globalize": "^4.1.1", - "traverse": "^0.6.6", - "uuid": "^3.0.1" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - }, - "depd": { - "version": "1.1.2" - } - } - }, - "loopback-datatype-geopoint": { - "version": "1.0.0" - }, - "loopback-filters": { - "version": "1.1.1", - "requires": { - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "loopback-phase": { - "version": "3.4.0", - "requires": { - "async": "^2.6.1", - "debug": "^3.1.0", - "strong-globalize": "^4.1.1" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "loopback-swagger": { - "version": "5.9.0", - "requires": { - "async": "^2.1.4", - "debug": "^3.1.0", - "ejs": "^2.5.5", - "lodash": "^4.17.11", - "strong-globalize": "^4.1.1" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "loud-rejection": { - "version": "1.6.0", - "dev": true, - "requires": { - "currently-unhandled": "^0.4.1", - "signal-exit": "^3.0.0" - } - }, - "lower-case": { - "version": "1.1.4", - "dev": true - }, - "lowercase-keys": { - "version": "2.0.0" - }, - "lru-cache": { - "version": "5.1.1", - "requires": { - "yallist": "^3.0.2" - } - }, - "mailparser": { - "version": "2.8.1", - "requires": { - "encoding-japanese": "1.0.30", - "he": "1.2.0", - "html-to-text": "5.1.1", - "iconv-lite": "0.6.2", - "libmime": "5.0.0", - "linkify-it": "3.0.2", - "mailsplit": "5.0.0", - "nodemailer": "6.4.11", - "tlds": "1.208.0" - }, - "dependencies": { - "iconv-lite": { - "version": "0.6.2", - "requires": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - } - }, - "nodemailer": { - "version": "6.4.11" - } - } - }, - "mailsplit": { - "version": "5.0.0", - "requires": { - "libbase64": "1.2.1", - "libmime": "4.2.1", - "libqp": "1.1.0" - }, - "dependencies": { - "iconv-lite": { - "version": "0.5.0", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "libmime": { - "version": "4.2.1", - "requires": { - "encoding-japanese": "1.0.30", - "iconv-lite": "0.5.0", - "libbase64": "1.2.1", - "libqp": "1.1.0" - } - } - } - }, - "make-dir": { - "version": "2.1.0", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - }, - "dependencies": { - "pify": { - "version": "4.0.1", - "dev": true - }, - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "make-iterator": { - "version": "1.0.1", - "dev": true, - "requires": { - "kind-of": "^6.0.2" - } - }, - "make-plural": { - "version": "6.2.2" - }, - "makeerror": { - "version": "1.0.12", - "dev": true, - "requires": { - "tmpl": "1.0.5" - } - }, - "map-age-cleaner": { - "version": "0.1.3", - "requires": { - "p-defer": "^1.0.0" - } - }, - "map-cache": { - "version": "0.2.2", - "dev": true - }, - "map-obj": { - "version": "1.0.1", - "dev": true - }, - "map-stream": { - "version": "0.0.7", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "matchdep": { - "version": "2.0.0", - "dev": true, - "requires": { - "findup-sync": "^2.0.0", - "micromatch": "^3.0.4", - "resolve": "^1.4.0", - "stack-trace": "0.0.10" - }, - "dependencies": { - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "findup-sync": { - "version": "2.0.0", - "dev": true, - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^3.1.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "is-glob": { - "version": "3.1.0", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - }, - "micromatch": { - "version": "3.1.10", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "math-interval-parser": { - "version": "2.0.1" - }, - "md5": { - "version": "2.3.0", - "requires": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, - "md5.js": { - "version": "1.3.5", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "media-typer": { - "version": "0.3.0" - }, - "mem": { - "version": "4.3.0", - "requires": { - "map-age-cleaner": "^0.1.1", - "mimic-fn": "^2.0.0", - "p-is-promise": "^2.0.0" - } - }, - "memory-fs": { - "version": "0.4.1", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, - "meow": { - "version": "3.7.0", - "dev": true, - "requires": { - "camelcase-keys": "^2.0.0", - "decamelize": "^1.1.2", - "loud-rejection": "^1.0.0", - "map-obj": "^1.0.1", - "minimist": "^1.1.3", - "normalize-package-data": "^2.3.4", - "object-assign": "^4.0.1", - "read-pkg-up": "^1.0.1", - "redent": "^1.0.0", - "trim-newlines": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "path-exists": { - "version": "2.1.0", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "read-pkg": { - "version": "1.1.0", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - } - } - }, - "merge-descriptors": { - "version": "1.0.1" - }, - "merge-stream": { - "version": "1.0.1", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - } - }, - "messageformat": { - "version": "2.3.0", - "requires": { - "make-plural": "^4.3.0", - "messageformat-formatters": "^2.0.1", - "messageformat-parser": "^4.1.2" - }, - "dependencies": { - "make-plural": { - "version": "4.3.0", - "requires": { - "minimist": "^1.2.0" - } - } - } - }, - "messageformat-formatters": { - "version": "2.0.1" - }, - "messageformat-parser": { - "version": "4.1.3" - }, - "methods": { - "version": "1.1.2" - }, - "micromatch": { - "version": "4.0.4", - "dev": true, - "requires": { - "braces": "^3.0.1", - "picomatch": "^2.2.3" - }, - "dependencies": { - "braces": { - "version": "3.0.2", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "fill-range": { - "version": "7.0.1", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "is-number": { - "version": "7.0.0", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - } - } - }, - "miller-rabin": { - "version": "4.0.1", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "dev": true - } - } - }, - "mime": { - "version": "2.6.0" - }, - "mime-db": { - "version": "1.51.0" - }, - "mime-types": { - "version": "2.1.34", - "requires": { - "mime-db": "1.51.0" - } - }, - "mimic-fn": { - "version": "2.1.0" - }, - "mimic-response": { - "version": "2.1.0" - }, - "minimalistic-assert": { - "version": "1.0.1", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5" - }, - "mississippi": { - "version": "3.0.0", - "dev": true, - "requires": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^3.0.0", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - } - }, - "mixin-deep": { - "version": "1.3.2", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "1.0.4" - }, - "mkdirp-classic": { - "version": "0.5.3" - }, - "mktmpdir": { - "version": "0.1.1", - "requires": { - "rimraf": "~2.2.8" - }, - "dependencies": { - "rimraf": { - "version": "2.2.8" - } - } - }, - "mocha": { - "version": "2.5.3", - "requires": { - "commander": "2.3.0", - "debug": "2.2.0", - "diff": "1.4.0", - "escape-string-regexp": "1.0.2", - "glob": "3.2.11", - "growl": "1.9.2", - "jade": "0.26.3", - "mkdirp": "0.5.1", - "supports-color": "1.2.0", - "to-iso-string": "0.0.2" - }, - "dependencies": { - "commander": { - "version": "2.3.0" - }, - "debug": { - "version": "2.2.0", - "requires": { - "ms": "0.7.1" - } - }, - "escape-string-regexp": { - "version": "1.0.2" - }, - "glob": { - "version": "3.2.11", - "requires": { - "inherits": "2", - "minimatch": "0.3" - } - }, - "lru-cache": { - "version": "2.7.3" - }, - "minimatch": { - "version": "0.3.0", - "requires": { - "lru-cache": "2", - "sigmund": "~1.0.0" - } - }, - "minimist": { - "version": "0.0.8" - }, - "mkdirp": { - "version": "0.5.1", - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "0.7.1" - }, - "supports-color": { - "version": "1.2.0" - } - } - }, - "move-concurrently": { - "version": "1.0.1", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - } - } - }, - "ms": { - "version": "2.1.2" - }, - "msgpack-js": { - "version": "0.3.0", - "requires": { - "bops": "~0.0.6" - }, - "dependencies": { - "base64-js": { - "version": "0.0.2" - }, - "bops": { - "version": "0.0.7", - "requires": { - "base64-js": "0.0.2", - "to-utf8": "0.0.1" - } - } - } - }, - "msgpack-stream": { - "version": "0.0.13", - "requires": { - "bops": "1.0.0", - "msgpack-js": "0.3.0", - "through": "2.3.4" - }, - "dependencies": { - "through": { - "version": "2.3.4" - } - } - }, - "msgpack5": { - "version": "4.5.1", - "requires": { - "bl": "^2.0.1", - "inherits": "^2.0.3", - "readable-stream": "^2.3.6", - "safe-buffer": "^5.1.2" - } - }, - "multicast-dns": { - "version": "6.2.3", - "dev": true, - "requires": { - "dns-packet": "^1.3.1", - "thunky": "^1.0.2" - } - }, - "multicast-dns-service-types": { - "version": "1.1.0", - "dev": true - }, - "multipipe": { - "version": "0.1.2", - "dev": true, - "requires": { - "duplexer2": "0.0.2" - } - }, - "mustache": { - "version": "4.2.0" - }, - "mute-stdout": { - "version": "1.0.1", - "dev": true - }, - "mux-demux": { - "version": "3.7.9", - "requires": { - "duplex": "~1.0.0", - "json-buffer": "~2.0.4", - "msgpack-stream": "~0.0.10", - "stream-combiner": "0.0.2", - "stream-serializer": "~1.1.1", - "through": "~2.3.1", - "xtend": "~1.0.3" - }, - "dependencies": { - "json-buffer": { - "version": "2.0.11" - }, - "xtend": { - "version": "1.0.3" - } - } - }, - "mysql": { - "version": "2.18.1", - "requires": { - "bignumber.js": "9.0.0", - "readable-stream": "2.3.7", - "safe-buffer": "5.1.2", - "sqlstring": "2.3.1" - } - }, - "mysql2": { - "version": "1.7.0", - "dev": true, - "requires": { - "denque": "^1.4.1", - "generate-function": "^2.3.1", - "iconv-lite": "^0.5.0", - "long": "^4.0.0", - "lru-cache": "^5.1.1", - "named-placeholders": "^1.1.2", - "seq-queue": "^0.0.5", - "sqlstring": "^2.3.1" - }, - "dependencies": { - "iconv-lite": { - "version": "0.5.2", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - } - } - }, - "named-placeholders": { - "version": "1.1.2", - "dev": true, - "requires": { - "lru-cache": "^4.1.3" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.5", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "yallist": { - "version": "2.1.2", - "dev": true - } - } - }, - "nan": { - "version": "2.15.0", - "dev": true - }, - "nanoid": { - "version": "2.1.11" - }, - "nanomatch": { - "version": "1.2.13", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "napi-build-utils": { - "version": "1.0.2" - }, - "natural-compare": { - "version": "1.4.0", - "dev": true - }, - "negotiator": { - "version": "0.6.2" - }, - "neo-async": { - "version": "2.6.2", - "dev": true - }, - "next-tick": { - "version": "1.0.0", - "dev": true - }, - "nice-try": { - "version": "1.0.5" - }, - "no-case": { - "version": "2.3.2", - "dev": true, - "requires": { - "lower-case": "^1.1.1" - } - }, - "nocache": { - "version": "2.1.0" - }, - "node-abi": { - "version": "2.30.1", - "requires": { - "semver": "^5.4.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1" - } - } - }, - "node-addon-api": { - "version": "3.2.1" - }, - "node-domexception": { - "version": "1.0.0" - }, - "node-fetch": { - "version": "2.6.6", - "requires": { - "whatwg-url": "^5.0.0" - }, - "dependencies": { - "tr46": { - "version": "0.0.3" - }, - "webidl-conversions": { - "version": "3.0.1" - }, - "whatwg-url": { - "version": "5.0.0", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - } - } - }, - "node-forge": { - "version": "0.10.0" - }, - "node-gyp": { - "version": "3.8.0", - "dev": true, - "requires": { - "fstream": "^1.0.0", - "glob": "^7.0.3", - "graceful-fs": "^4.1.2", - "mkdirp": "^0.5.0", - "nopt": "2 || 3", - "npmlog": "0 || 1 || 2 || 3 || 4", - "osenv": "0", - "request": "^2.87.0", - "rimraf": "2", - "semver": "~5.3.0", - "tar": "^2.0.0", - "which": "1" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "semver": { - "version": "5.3.0", - "dev": true - }, - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "node-int64": { - "version": "0.4.0", - "dev": true - }, - "node-libs-browser": { - "version": "2.2.1", - "dev": true, - "requires": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^3.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "0.0.1", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.11.0", - "vm-browserify": "^1.0.1" - }, - "dependencies": { - "events": { - "version": "3.3.0", - "dev": true - }, - "punycode": { - "version": "1.4.1", - "dev": true - }, - "url": { - "version": "0.11.0", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "dev": true - } - } - } - } - }, - "node-notifier": { - "version": "8.0.2", - "dev": true, - "optional": true, - "requires": { - "growly": "^1.3.0", - "is-wsl": "^2.2.0", - "semver": "^7.3.2", - "shellwords": "^0.1.1", - "uuid": "^8.3.0", - "which": "^2.0.2" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "dev": true, - "optional": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.5", - "dev": true, - "optional": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "uuid": { - "version": "8.3.2", - "dev": true, - "optional": true - }, - "yallist": { - "version": "4.0.0", - "dev": true, - "optional": true - } - } - }, - "node-releases": { - "version": "2.0.1", - "dev": true - }, - "node-sass": { - "version": "4.14.1", - "dev": true, - "requires": { - "async-foreach": "^0.1.3", - "chalk": "^1.1.1", - "cross-spawn": "^3.0.0", - "gaze": "^1.0.0", - "get-stdin": "^4.0.1", - "glob": "^7.0.3", - "in-publish": "^2.0.0", - "lodash": "^4.17.15", - "meow": "^3.7.0", - "mkdirp": "^0.5.1", - "nan": "^2.13.2", - "node-gyp": "^3.8.0", - "npmlog": "^4.0.0", - "request": "^2.88.0", - "sass-graph": "2.2.5", - "stdout-stream": "^1.4.0", - "true-case-path": "^1.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "cross-spawn": { - "version": "3.0.1", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "which": "^1.2.9" - } - }, - "lru-cache": { - "version": "4.1.5", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "dev": true - }, - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "yallist": { - "version": "2.1.2", - "dev": true - } - } - }, - "node-ssh": { - "version": "11.1.1", - "requires": { - "make-dir": "^3.1.0", - "sb-promise-queue": "^2.1.0", - "sb-scandir": "^3.1.0", - "shell-escape": "^0.2.0", - "ssh2": "^0.8.9" - }, - "dependencies": { - "make-dir": { - "version": "3.1.0", - "requires": { - "semver": "^6.0.0" - } - } - } - }, - "node.extend": { - "version": "2.0.2", - "dev": true, - "requires": { - "has": "^1.0.3", - "is": "^3.2.1" - } - }, - "nodemailer": { - "version": "6.7.2" - }, - "nodemailer-direct-transport": { - "version": "3.3.2", - "requires": { - "nodemailer-shared": "1.1.0", - "smtp-connection": "2.12.0" - } - }, - "nodemailer-fetch": { - "version": "1.6.0" - }, - "nodemailer-shared": { - "version": "1.1.0", - "requires": { - "nodemailer-fetch": "1.6.0" - } - }, - "nodemailer-stub-transport": { - "version": "1.1.0" - }, - "nodemon": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.16.tgz", - "integrity": "sha512-zsrcaOfTWRuUzBn3P44RDliLlp263Z/76FPoHFr3cFFkOz0lTPAcIw8dCzfdVIx/t3AtDYCZRCDkoCojJqaG3w==", - "dev": true, - "requires": { - "chokidar": "^3.5.2", - "debug": "^3.2.7", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.0.4", - "pstree.remy": "^1.1.8", - "semver": "^5.7.1", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5", - "update-notifier": "^5.1.0" - }, - "dependencies": { - "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "debug": { - "version": "3.2.7", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "semver": { - "version": "5.7.1", - "dev": true - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - } - } - }, - "nopt": { - "version": "3.0.6", - "dev": true, - "requires": { - "abbrev": "1" - } - }, - "normalize-package-data": { - "version": "2.5.0", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "dev": true - } - } - }, - "normalize-path": { - "version": "3.0.0", - "dev": true - }, - "normalize-url": { - "version": "6.1.0" - }, - "now-and-later": { - "version": "2.0.1", - "dev": true, - "requires": { - "once": "^1.3.2" - } - }, - "npm-run-path": { - "version": "4.0.1", - "requires": { - "path-key": "^3.0.0" - } - }, - "npmlog": { - "version": "4.1.2", - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "nth-check": { - "version": "2.0.1", - "dev": true, - "requires": { - "boolbase": "^1.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1" - }, - "nwsapi": { - "version": "2.2.0", - "dev": true - }, - "oauth-sign": { - "version": "0.9.0" - }, - "object-assign": { - "version": "4.1.1" - }, - "object-copy": { - "version": "0.1.0", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "object-diff": { - "version": "0.0.4" - }, - "object-inspect": { - "version": "1.12.0" - }, - "object-is": { - "version": "1.1.5", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "object-keys": { - "version": "1.1.1", - "dev": true - }, - "object-visit": { - "version": "1.0.1", - "dev": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.assign": { - "version": "4.1.2", - "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" - } - }, - "object.defaults": { - "version": "1.1.0", - "dev": true, - "requires": { - "array-each": "^1.0.1", - "array-slice": "^1.0.0", - "for-own": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "object.getownpropertydescriptors": { - "version": "2.1.3", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.1" - } - }, - "object.map": { - "version": "1.0.1", - "dev": true, - "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "object.pick": { - "version": "1.3.0", - "requires": { - "isobject": "^3.0.1" - } - }, - "object.reduce": { - "version": "1.0.1", - "dev": true, - "requires": { - "for-own": "^1.0.0", - "make-iterator": "^1.0.0" - } - }, - "obuf": { - "version": "1.1.2", - "dev": true - }, - "on-finished": { - "version": "2.3.0", - "requires": { - "ee-first": "1.1.1" - } - }, - "on-headers": { - "version": "1.0.2" - }, - "once": { - "version": "1.4.0", - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "5.1.2", - "requires": { - "mimic-fn": "^2.1.0" - } - }, - "opn": { - "version": "5.5.0", - "dev": true, - "requires": { - "is-wsl": "^1.1.0" - }, - "dependencies": { - "is-wsl": { - "version": "1.1.0", - "dev": true - } - } - }, - "optional": { - "version": "0.1.4" - }, - "optionator": { - "version": "0.9.1", - "dev": true, - "requires": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.3" - } - }, - "options": { - "version": "0.0.6" - }, - "ordered-read-streams": { - "version": "1.0.1", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - } - }, - "original": { - "version": "1.0.2", - "dev": true, - "requires": { - "url-parse": "^1.4.3" - } - }, - "os-browserify": { - "version": "0.3.0", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "dev": true - }, - "os-locale": { - "version": "3.1.0", - "requires": { - "execa": "^1.0.0", - "lcid": "^2.0.0", - "mem": "^4.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "requires": { - "pump": "^3.0.0" - } - }, - "is-stream": { - "version": "1.1.0" - }, - "npm-run-path": { - "version": "2.0.2", - "requires": { - "path-key": "^2.0.0" - } - }, - "path-key": { - "version": "2.0.1" - }, - "semver": { - "version": "5.7.1" - }, - "shebang-command": { - "version": "1.2.0", - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0" - }, - "which": { - "version": "1.3.1", - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "os-tmpdir": { - "version": "1.0.2", - "dev": true - }, - "osenv": { - "version": "0.1.5", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "p-cancelable": { - "version": "2.1.1" - }, - "p-defer": { - "version": "1.0.0" - }, - "p-each-series": { - "version": "2.2.0", - "dev": true - }, - "p-event": { - "version": "4.2.0", - "requires": { - "p-timeout": "^3.1.0" - } - }, - "p-finally": { - "version": "1.0.0" - }, - "p-is-promise": { - "version": "2.1.0" - }, - "p-limit": { - "version": "2.3.0", - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-map": { - "version": "2.1.0", - "dev": true - }, - "p-queue": { - "version": "1.2.0", - "dev": true - }, - "p-retry": { - "version": "3.0.1", - "dev": true, - "requires": { - "retry": "^0.12.0" - } - }, - "p-timeout": { - "version": "3.2.0", - "requires": { - "p-finally": "^1.0.0" - } - }, - "p-try": { - "version": "2.2.0" - }, - "package-json": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", - "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", - "dev": true, - "requires": { - "got": "^9.6.0", - "registry-auth-token": "^4.0.0", - "registry-url": "^5.0.0", - "semver": "^6.2.0" - }, - "dependencies": { - "@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", - "dev": true - }, - "@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", - "dev": true, - "requires": { - "defer-to-connect": "^1.0.1" - } - }, - "cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "dev": true, - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - } - }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", - "dev": true, - "requires": { - "mimic-response": "^1.0.0" - } - }, - "defer-to-connect": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", - "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", - "dev": true - }, - "got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "dev": true, - "requires": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - }, - "dependencies": { - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true - } - } - }, - "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", - "dev": true - }, - "keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", - "dev": true, - "requires": { - "json-buffer": "3.0.0" - } - }, - "mimic-response": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", - "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true - }, - "normalize-url": { - "version": "4.5.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz", - "integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==", - "dev": true - }, - "p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", - "dev": true - }, - "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "dev": true, - "requires": { - "lowercase-keys": "^1.0.0" - }, - "dependencies": { - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true - } - } - }, - "to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", - "dev": true - } - } - }, - "pako": { - "version": "1.0.11", - "dev": true - }, - "parallel-transform": { - "version": "1.2.0", - "dev": true, - "requires": { - "cyclist": "^1.0.1", - "inherits": "^2.0.3", - "readable-stream": "^2.1.5" - } - }, - "param-case": { - "version": "2.1.1", - "dev": true, - "requires": { - "no-case": "^2.2.0" - } - }, - "parent-module": { - "version": "1.0.1", - "dev": true, - "requires": { - "callsites": "^3.0.0" - } - }, - "parse-asn1": { - "version": "5.1.6", - "dev": true, - "requires": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, - "parse-filepath": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "map-cache": "^0.2.0", - "path-root": "^0.1.1" - } - }, - "parse-json": { - "version": "5.2.0", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - } - }, - "parse-node-version": { - "version": "1.0.1", - "dev": true - }, - "parse-passwd": { - "version": "1.0.0", - "dev": true - }, - "parse5": { - "version": "6.0.1", - "dev": true - }, - "parseurl": { - "version": "1.3.3" - }, - "pascal-case": { - "version": "3.1.2", - "dev": true, - "requires": { - "no-case": "^3.0.4", - "tslib": "^2.0.3" - }, - "dependencies": { - "lower-case": { - "version": "2.0.2", - "dev": true, - "requires": { - "tslib": "^2.0.3" - } - }, - "no-case": { - "version": "3.0.4", - "dev": true, - "requires": { - "lower-case": "^2.0.2", - "tslib": "^2.0.3" - } - } - } - }, - "pascalcase": { - "version": "0.1.1", - "dev": true - }, - "path-browserify": { - "version": "0.0.1", - "dev": true - }, - "path-dirname": { - "version": "1.0.2", - "dev": true - }, - "path-exists": { - "version": "4.0.0" - }, - "path-is-absolute": { - "version": "1.0.1" - }, - "path-is-inside": { - "version": "1.0.2", - "dev": true - }, - "path-key": { - "version": "3.1.1" - }, - "path-parse": { - "version": "1.0.7", - "dev": true - }, - "path-root": { - "version": "0.1.1", - "dev": true, - "requires": { - "path-root-regex": "^0.1.0" - } - }, - "path-root-regex": { - "version": "0.1.2", - "dev": true - }, - "path-to-regexp": { - "version": "0.1.7" - }, - "path-type": { - "version": "1.1.0", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "pbkdf2": { - "version": "3.1.2", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "pend": { - "version": "1.2.0" - }, - "performance-now": { - "version": "2.1.0" - }, - "picocolors": { - "version": "1.0.0", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "dev": true - }, - "pify": { - "version": "2.3.0", - "dev": true - }, - "pinkie": { - "version": "2.0.4", - "dev": true - }, - "pinkie-promise": { - "version": "2.0.1", - "dev": true, - "requires": { - "pinkie": "^2.0.0" - } - }, - "pirates": { - "version": "4.0.4", - "dev": true - }, - "pkg-dir": { - "version": "3.0.0", - "dev": true, - "requires": { - "find-up": "^3.0.0" - }, - "dependencies": { - "find-up": { - "version": "3.0.0", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "locate-path": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "dev": true - } - } - }, - "pkgcloud": { - "version": "2.2.0", - "requires": { - "@google-cloud/storage": "^2.4.3", - "async": "^2.6.1", - "aws-sdk": "^2.382.0", - "errs": "^0.3.2", - "eventemitter2": "^5.0.1", - "fast-json-patch": "^2.1.0", - "filed-mimefix": "^0.1.3", - "ip": "^1.1.5", - "liboneandone": "^1.2.0", - "lodash": "^4.17.10", - "mime": "^2.4.1", - "qs": "^6.5.2", - "request": "^2.88.0", - "through2": "^3.0.1", - "url-join": "^4.0.0", - "xml2js": "^0.4.19" - }, - "dependencies": { - "through2": { - "version": "3.0.2", - "requires": { - "inherits": "^2.0.4", - "readable-stream": "2 || 3" - } - } - } - }, - "plugin-error": { - "version": "1.0.1", - "dev": true, - "requires": { - "ansi-colors": "^1.0.1", - "arr-diff": "^4.0.0", - "arr-union": "^3.1.0", - "extend-shallow": "^3.0.2" - }, - "dependencies": { - "ansi-colors": { - "version": "1.1.0", - "dev": true, - "requires": { - "ansi-wrap": "^0.1.0" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "portfinder": { - "version": "1.0.28", - "dev": true, - "requires": { - "async": "^2.6.2", - "debug": "^3.1.1", - "mkdirp": "^0.5.5" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - } - } - }, - "posix-character-classes": { - "version": "0.1.1", - "dev": true - }, - "posix-getopt": { - "version": "1.2.1" - }, - "postcss": { - "version": "7.0.39", - "dev": true, - "requires": { - "picocolors": "^0.2.1", - "source-map": "^0.6.1" - }, - "dependencies": { - "picocolors": { - "version": "0.2.1", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "postcss-modules-extract-imports": { - "version": "2.0.0", - "dev": true, - "requires": { - "postcss": "^7.0.5" - } - }, - "postcss-modules-local-by-default": { - "version": "2.0.6", - "dev": true, - "requires": { - "postcss": "^7.0.6", - "postcss-selector-parser": "^6.0.0", - "postcss-value-parser": "^3.3.1" - } - }, - "postcss-modules-scope": { - "version": "2.2.0", - "dev": true, - "requires": { - "postcss": "^7.0.6", - "postcss-selector-parser": "^6.0.0" - } - }, - "postcss-modules-values": { - "version": "2.0.0", - "dev": true, - "requires": { - "icss-replace-symbols": "^1.1.0", - "postcss": "^7.0.6" - } - }, - "postcss-selector-parser": { - "version": "6.0.8", - "dev": true, - "requires": { - "cssesc": "^3.0.0", - "util-deprecate": "^1.0.2" - } - }, - "postcss-value-parser": { - "version": "3.3.1", - "dev": true - }, - "prebuild-install": { - "version": "6.1.4", - "requires": { - "detect-libc": "^1.0.3", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^2.21.0", - "npmlog": "^4.0.1", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^3.0.3", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "dependencies": { - "decompress-response": { - "version": "4.2.1", - "requires": { - "mimic-response": "^2.0.0" - } - }, - "simple-get": { - "version": "3.1.0", - "requires": { - "decompress-response": "^4.2.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - } - } - }, - "precond": { - "version": "0.2.3" - }, - "prelude-ls": { - "version": "1.2.1", - "dev": true - }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true - }, - "pretty-error": { - "version": "2.1.2", - "dev": true, - "requires": { - "lodash": "^4.17.20", - "renderkid": "^2.0.4" - } - }, - "pretty-format": { - "version": "26.6.2", - "dev": true, - "requires": { - "@jest/types": "^26.6.2", - "ansi-regex": "^5.0.0", - "ansi-styles": "^4.0.0", - "react-is": "^17.0.1" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - } - } - }, - "pretty-hrtime": { - "version": "1.0.3", - "dev": true - }, - "private": { - "version": "0.1.8", - "dev": true - }, - "process": { - "version": "0.11.10", - "dev": true - }, - "process-nextick-args": { - "version": "2.0.1" - }, - "progress": { - "version": "2.0.3" - }, - "promise-inflight": { - "version": "1.0.1", - "dev": true - }, - "prompts": { - "version": "2.4.2", - "dev": true, - "requires": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - } - }, - "proxy-addr": { - "version": "2.0.7", - "requires": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - } - }, - "proxy-from-env": { - "version": "1.1.0" - }, - "prr": { - "version": "1.0.1", - "dev": true - }, - "pseudomap": { - "version": "1.0.2" - }, - "psl": { - "version": "1.8.0" - }, - "pstree.remy": { - "version": "1.1.8", - "dev": true - }, - "public-encrypt": { - "version": "4.0.3", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "dev": true - } - } - }, - "pump": { - "version": "3.0.0", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.1", - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - }, - "dependencies": { - "pump": { - "version": "2.0.1", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - } - } - }, - "punycode": { - "version": "2.1.1" - }, - "pupa": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", - "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", - "dev": true, - "requires": { - "escape-goat": "^2.0.0" - } - }, - "puppeteer": { - "version": "7.1.0", - "requires": { - "debug": "^4.1.0", - "devtools-protocol": "0.0.847576", - "extract-zip": "^2.0.0", - "https-proxy-agent": "^5.0.0", - "node-fetch": "^2.6.1", - "pkg-dir": "^4.2.0", - "progress": "^2.0.1", - "proxy-from-env": "^1.1.0", - "rimraf": "^3.0.2", - "tar-fs": "^2.0.0", - "unbzip2-stream": "^1.3.3", - "ws": "^7.2.3" - }, - "dependencies": { - "pkg-dir": { - "version": "4.2.0", - "requires": { - "find-up": "^4.0.0" - } - }, - "rimraf": { - "version": "3.0.2", - "requires": { - "glob": "^7.1.3" - } - } - } - }, - "qs": { - "version": "6.9.6" - }, - "querystring": { - "version": "0.2.0" - }, - "querystring-es3": { - "version": "0.2.1", - "dev": true - }, - "querystringify": { - "version": "2.2.0", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "dev": true, - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "range-parser": { - "version": "1.2.1" - }, - "raw-body": { - "version": "2.4.2", - "requires": { - "bytes": "3.1.1", - "http-errors": "1.8.1", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "dependencies": { - "bytes": { - "version": "3.1.1" - } - } - }, - "raw-loader": { - "version": "1.0.0", - "dev": true, - "requires": { - "loader-utils": "^1.1.0", - "schema-utils": "^1.0.0" - }, - "dependencies": { - "schema-utils": { - "version": "1.0.0", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "rc": { - "version": "1.2.8", - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "strip-json-comments": { - "version": "2.0.1" - } - } - }, - "react-is": { - "version": "17.0.2", - "dev": true - }, - "read-chunk": { - "version": "3.2.0", - "requires": { - "pify": "^4.0.1", - "with-open-file": "^0.1.6" - }, - "dependencies": { - "pify": { - "version": "4.0.1" - } - } - }, - "read-pkg": { - "version": "5.2.0", - "dev": true, - "requires": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^2.5.0", - "parse-json": "^5.0.0", - "type-fest": "^0.6.0" - }, - "dependencies": { - "type-fest": { - "version": "0.6.0", - "dev": true - } - } - }, - "read-pkg-up": { - "version": "7.0.1", - "dev": true, - "requires": { - "find-up": "^4.1.0", - "read-pkg": "^5.2.0", - "type-fest": "^0.8.1" - }, - "dependencies": { - "type-fest": { - "version": "0.8.1", - "dev": true - } - } - }, - "readable-stream": { - "version": "2.3.7", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "2.2.1", - "dev": true, - "requires": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" - }, - "dependencies": { - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "micromatch": { - "version": "3.1.10", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "recast": { - "version": "0.11.23", - "dev": true, - "requires": { - "ast-types": "0.9.6", - "esprima": "~3.1.0", - "private": "~0.1.5", - "source-map": "~0.5.0" - }, - "dependencies": { - "esprima": { - "version": "3.1.3", - "dev": true - } - } - }, - "rechoir": { - "version": "0.6.2", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "redent": { - "version": "1.0.0", - "dev": true, - "requires": { - "indent-string": "^2.1.0", - "strip-indent": "^1.0.1" - } - }, - "referrer-policy": { - "version": "1.2.0" - }, - "regenerate": { - "version": "1.4.2", - "dev": true - }, - "regenerate-unicode-properties": { - "version": "9.0.0", - "dev": true, - "requires": { - "regenerate": "^1.4.2" - } - }, - "regenerator-runtime": { - "version": "0.13.9" - }, - "regenerator-transform": { - "version": "0.14.5", - "dev": true, - "requires": { - "@babel/runtime": "^7.8.4" - } - }, - "regex-not": { - "version": "1.0.2", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "regexp.prototype.flags": { - "version": "1.4.1", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "regexpp": { - "version": "3.2.0", - "dev": true - }, - "regexpu-core": { - "version": "4.8.0", - "dev": true, - "requires": { - "regenerate": "^1.4.2", - "regenerate-unicode-properties": "^9.0.0", - "regjsgen": "^0.5.2", - "regjsparser": "^0.7.0", - "unicode-match-property-ecmascript": "^2.0.0", - "unicode-match-property-value-ecmascript": "^2.0.0" - } - }, - "registry-auth-token": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", - "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", - "dev": true, - "requires": { - "rc": "^1.2.8" - } - }, - "registry-url": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", - "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", - "dev": true, - "requires": { - "rc": "^1.2.8" - } - }, - "regjsgen": { - "version": "0.5.2", - "dev": true - }, - "regjsparser": { - "version": "0.7.0", - "dev": true, - "requires": { - "jsesc": "~0.5.0" - }, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "dev": true - } - } - }, - "relateurl": { - "version": "0.2.7", - "dev": true - }, - "remove-bom-buffer": { - "version": "3.0.0", - "dev": true, - "requires": { - "is-buffer": "^1.1.5", - "is-utf8": "^0.2.1" - } - }, - "remove-bom-stream": { - "version": "1.2.0", - "dev": true, - "requires": { - "remove-bom-buffer": "^3.0.0", - "safe-buffer": "^5.1.0", - "through2": "^2.0.3" - } - }, - "remove-trailing-separator": { - "version": "1.1.0", - "dev": true - }, - "renderkid": { - "version": "2.0.7", - "dev": true, - "requires": { - "css-select": "^4.1.3", - "dom-converter": "^0.2.0", - "htmlparser2": "^6.1.0", - "lodash": "^4.17.21", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "dom-serializer": { - "version": "1.3.2", - "dev": true, - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - } - }, - "domelementtype": { - "version": "2.2.0", - "dev": true - }, - "domhandler": { - "version": "4.3.0", - "dev": true, - "requires": { - "domelementtype": "^2.2.0" - } - }, - "domutils": { - "version": "2.8.0", - "dev": true, - "requires": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - } - }, - "entities": { - "version": "2.2.0", - "dev": true - }, - "htmlparser2": { - "version": "6.1.0", - "dev": true, - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", - "domutils": "^2.5.2", - "entities": "^2.0.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "repeat-element": { - "version": "1.1.4", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "dev": true - }, - "repeating": { - "version": "2.0.1", - "dev": true, - "requires": { - "is-finite": "^1.0.0" - } - }, - "replace-ext": { - "version": "0.0.1", - "dev": true - }, - "replace-homedir": { - "version": "1.0.0", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1", - "is-absolute": "^1.0.0", - "remove-trailing-separator": "^1.1.0" - } - }, - "request": { - "version": "2.88.2", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "form-data": { - "version": "2.3.3", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "qs": { - "version": "6.5.3" - }, - "tough-cookie": { - "version": "2.5.0", - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - } - } - }, - "require-directory": { - "version": "2.1.1", - "dev": true - }, - "require-from-string": { - "version": "2.0.2", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "dev": true - }, - "require-yaml": { - "version": "0.0.1", - "requires": { - "js-yaml": "" - } - }, - "requires-port": { - "version": "1.0.0", - "dev": true - }, - "resolve": { - "version": "1.21.0", - "dev": true, - "requires": { - "is-core-module": "^2.8.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "resolve-cwd": { - "version": "3.0.0", - "dev": true, - "requires": { - "resolve-from": "^5.0.0" - } - }, - "resolve-dir": { - "version": "1.0.1", - "dev": true, - "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - } - }, - "resolve-from": { - "version": "5.0.0", - "dev": true - }, - "resolve-options": { - "version": "1.1.0", - "dev": true, - "requires": { - "value-or-function": "^3.0.0" - } - }, - "resolve-url": { - "version": "0.2.1", - "dev": true - }, - "responselike": { - "version": "2.0.0", - "requires": { - "lowercase-keys": "^2.0.0" - } - }, - "ret": { - "version": "0.1.15", - "dev": true - }, - "retry": { - "version": "0.12.0", - "dev": true - }, - "retry-request": { - "version": "4.2.2", - "requires": { - "debug": "^4.1.1", - "extend": "^3.0.2" - } - }, - "rimraf": { - "version": "2.7.1", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "ripemd160": { - "version": "2.0.2", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "rsvp": { - "version": "4.8.5", - "dev": true - }, - "run-queue": { - "version": "1.0.3", - "dev": true, - "requires": { - "aproba": "^1.1.1" - } - }, - "safe-buffer": { - "version": "5.1.2" - }, - "safe-regex": { - "version": "1.1.0", - "dev": true, - "requires": { - "ret": "~0.1.10" - } - }, - "safer-buffer": { - "version": "2.1.2" - }, - "sane": { - "version": "4.1.0", - "dev": true, - "requires": { - "@cnakazawa/watch": "^1.0.3", - "anymatch": "^2.0.0", - "capture-exit": "^2.0.0", - "exec-sh": "^0.3.2", - "execa": "^1.0.0", - "fb-watchman": "^2.0.0", - "micromatch": "^3.1.4", - "minimist": "^1.1.1", - "walker": "~1.0.5" - }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "execa": { - "version": "1.0.0", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "get-stream": { - "version": "4.1.0", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "is-stream": { - "version": "1.1.0", - "dev": true - }, - "micromatch": { - "version": "3.1.10", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "npm-run-path": { - "version": "2.0.2", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "path-key": { - "version": "2.0.1", - "dev": true - }, - "semver": { - "version": "5.7.1", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "dev": true - }, - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } - } - }, - "sass-graph": { - "version": "2.2.5", - "dev": true, - "requires": { - "glob": "^7.0.0", - "lodash": "^4.0.0", - "scss-tokenizer": "^0.2.3", - "yargs": "^13.3.2" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "dev": true - }, - "cliui": { - "version": "5.0.0", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "emoji-regex": { - "version": "7.0.3", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "get-caller-file": { - "version": "2.0.5", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "locate-path": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "which-module": { - "version": "2.0.0", - "dev": true - }, - "wrap-ansi": { - "version": "5.1.0", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, - "yargs": { - "version": "13.3.2", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "yargs-parser": { - "version": "13.1.2", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "sass-loader": { - "version": "7.3.1", - "dev": true, - "requires": { - "clone-deep": "^4.0.1", - "loader-utils": "^1.0.1", - "neo-async": "^2.5.0", - "pify": "^4.0.1", - "semver": "^6.3.0" - }, - "dependencies": { - "pify": { - "version": "4.0.1", - "dev": true - } - } - }, - "sax": { - "version": "1.2.1" - }, - "saxes": { - "version": "5.0.1", - "dev": true, - "requires": { - "xmlchars": "^2.2.0" - } - }, - "sb-promise-queue": { - "version": "2.1.0" - }, - "sb-scandir": { - "version": "3.1.0", - "requires": { - "sb-promise-queue": "^2.1.0" - } - }, - "schema-utils": { - "version": "2.7.1", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.5", - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2" - } - }, - "scss-tokenizer": { - "version": "0.2.3", - "dev": true, - "requires": { - "js-base64": "^2.1.8", - "source-map": "^0.4.2" - }, - "dependencies": { - "source-map": { - "version": "0.4.4", - "dev": true, - "requires": { - "amdefine": ">=0.0.4" - } - } - } - }, - "select-hose": { - "version": "2.0.0", - "dev": true - }, - "selfsigned": { - "version": "1.10.14", - "dev": true, - "requires": { - "node-forge": "^0.10.0" - } - }, - "semver": { - "version": "6.3.0" - }, - "semver-diff": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", - "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", - "dev": true, - "requires": { - "semver": "^6.3.0" - } - }, - "semver-greatest-satisfied-range": { - "version": "1.1.0", - "dev": true, - "requires": { - "sver-compat": "^1.5.0" - } - }, - "send": { - "version": "0.17.2", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "1.8.1", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - }, - "dependencies": { - "ms": { - "version": "2.0.0" - } - } - }, - "depd": { - "version": "1.1.2" - }, - "mime": { - "version": "1.6.0" - }, - "ms": { - "version": "2.1.3" - } - } - }, - "seq-queue": { - "version": "0.0.5", - "dev": true - }, - "serialize-javascript": { - "version": "4.0.0", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "serve-favicon": { - "version": "2.5.0", - "requires": { - "etag": "~1.8.1", - "fresh": "0.5.2", - "ms": "2.1.1", - "parseurl": "~1.3.2", - "safe-buffer": "5.1.1" - }, - "dependencies": { - "ms": { - "version": "2.1.1" - }, - "safe-buffer": { - "version": "5.1.1" - } - } - }, - "serve-index": { - "version": "1.9.1", - "dev": true, - "requires": { - "accepts": "~1.3.4", - "batch": "0.6.1", - "debug": "2.6.9", - "escape-html": "~1.0.3", - "http-errors": "~1.6.2", - "mime-types": "~2.1.17", - "parseurl": "~1.3.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "depd": { - "version": "1.1.2", - "dev": true - }, - "http-errors": { - "version": "1.6.3", - "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "inherits": { - "version": "2.0.3", - "dev": true - }, - "ms": { - "version": "2.0.0", - "dev": true - }, - "setprototypeof": { - "version": "1.1.0", - "dev": true - } - } - }, - "serve-static": { - "version": "1.14.2", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.2" - } - }, - "set-blocking": { - "version": "2.0.0" - }, - "set-value": { - "version": "2.0.1", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - } - }, - "setimmediate": { - "version": "1.0.5", - "dev": true - }, - "setprototypeof": { - "version": "1.2.0" - }, - "sha.js": { - "version": "2.4.11", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shallow-clone": { - "version": "3.0.1", - "dev": true, - "requires": { - "kind-of": "^6.0.2" - } - }, - "sharp": { - "version": "0.27.2", - "requires": { - "array-flatten": "^3.0.0", - "color": "^3.1.3", - "detect-libc": "^1.0.3", - "node-addon-api": "^3.1.0", - "npmlog": "^4.1.2", - "prebuild-install": "^6.0.1", - "semver": "^7.3.4", - "simple-get": "^4.0.0", - "tar-fs": "^2.1.1", - "tunnel-agent": "^0.6.0" - }, - "dependencies": { - "array-flatten": { - "version": "3.0.0" - }, - "lru-cache": { - "version": "6.0.0", - "requires": { - "yallist": "^4.0.0" - } - }, - "semver": { - "version": "7.3.5", - "requires": { - "lru-cache": "^6.0.0" - } - }, - "yallist": { - "version": "4.0.0" - } - } - }, - "shebang-command": { - "version": "2.0.0", - "requires": { - "shebang-regex": "^3.0.0" - } - }, - "shebang-regex": { - "version": "3.0.0" - }, - "shell-escape": { - "version": "0.2.0" - }, - "shellwords": { - "version": "0.1.1", - "dev": true, - "optional": true - }, - "shimmer": { - "version": "1.2.1" - }, - "shortid": { - "version": "2.2.16", - "requires": { - "nanoid": "^2.1.0" - } - }, - "side-channel": { - "version": "1.0.4", - "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" - } - }, - "sigmund": { - "version": "1.0.1" - }, - "signal-exit": { - "version": "3.0.6" - }, - "simple-concat": { - "version": "1.0.1" - }, - "simple-get": { - "version": "4.0.0", - "requires": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - }, - "dependencies": { - "decompress-response": { - "version": "6.0.0", - "requires": { - "mimic-response": "^3.1.0" - } - }, - "mimic-response": { - "version": "3.1.0" - } - } - }, - "simple-swizzle": { - "version": "0.2.2", - "requires": { - "is-arrayish": "^0.3.1" - }, - "dependencies": { - "is-arrayish": { - "version": "0.3.2" - } - } - }, - "sisteransi": { - "version": "1.0.5", - "dev": true - }, - "slash": { - "version": "3.0.0", - "dev": true - }, - "slice-ansi": { - "version": "4.0.0", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "astral-regex": "^2.0.0", - "is-fullwidth-code-point": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true - } - } - }, - "smbhash": { - "version": "0.0.1", - "requires": { - "bigdecimal": ">= 0.6.0" - } - }, - "smtp-connection": { - "version": "2.12.0", - "requires": { - "httpntlm": "1.6.1", - "nodemailer-shared": "1.1.0" - } - }, - "snakeize": { - "version": "0.1.0" - }, - "snapdragon": { - "version": "0.8.2", - "dev": true, - "requires": { - "base": "^0.11.1", - "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.0", - "use": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "dev": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "dev": true, - "requires": { - "kind-of": "^3.2.0" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "sockjs": { - "version": "0.3.24", - "dev": true, - "requires": { - "faye-websocket": "^0.11.3", - "uuid": "^8.3.2", - "websocket-driver": "^0.7.4" - }, - "dependencies": { - "uuid": { - "version": "8.3.2", - "dev": true - } - } - }, - "sockjs-client": { - "version": "1.5.2", - "dev": true, - "requires": { - "debug": "^3.2.6", - "eventsource": "^1.0.7", - "faye-websocket": "^0.11.3", - "inherits": "^2.0.4", - "json3": "^3.3.3", - "url-parse": "^1.5.3" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } - }, - "source-list-map": { - "version": "2.0.1", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.3", - "dev": true, - "requires": { - "atob": "^2.1.2", - "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.5.21", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "source-map-url": { - "version": "0.4.1", - "dev": true - }, - "sparkles": { - "version": "1.0.1", - "dev": true - }, - "spdx-correct": { - "version": "3.1.1", - "dev": true, - "requires": { - "spdx-expression-parse": "^3.0.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-exceptions": { - "version": "2.3.0", - "dev": true - }, - "spdx-expression-parse": { - "version": "3.0.1", - "dev": true, - "requires": { - "spdx-exceptions": "^2.1.0", - "spdx-license-ids": "^3.0.0" - } - }, - "spdx-license-ids": { - "version": "3.0.11", - "dev": true - }, - "spdy": { - "version": "4.0.2", - "dev": true, - "requires": { - "debug": "^4.1.0", - "handle-thing": "^2.0.0", - "http-deceiver": "^1.2.7", - "select-hose": "^2.0.0", - "spdy-transport": "^3.0.0" - } - }, - "spdy-transport": { - "version": "3.0.0", - "dev": true, - "requires": { - "debug": "^4.1.0", - "detect-node": "^2.0.4", - "hpack.js": "^2.1.6", - "obuf": "^1.1.2", - "readable-stream": "^3.0.6", - "wbuf": "^1.7.3" - }, - "dependencies": { - "readable-stream": { - "version": "3.6.0", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "split-array-stream": { - "version": "2.0.0", - "requires": { - "is-stream-ended": "^0.1.4" - } - }, - "split-string": { - "version": "3.1.0", - "dev": true, - "requires": { - "extend-shallow": "^3.0.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "sprintf-js": { - "version": "1.1.2" - }, - "sqlstring": { - "version": "2.3.1" - }, - "sse": { - "version": "0.0.8", - "requires": { - "options": "0.0.6" - } - }, - "ssh2": { - "version": "0.8.9", - "requires": { - "ssh2-streams": "~0.4.10" - } - }, - "ssh2-streams": { - "version": "0.4.10", - "requires": { - "asn1": "~0.2.0", - "bcrypt-pbkdf": "^1.0.2", - "streamsearch": "~0.1.2" - } - }, - "sshpk": { - "version": "1.17.0", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "ssri": { - "version": "6.0.2", - "dev": true, - "requires": { - "figgy-pudding": "^3.5.1" - } - }, - "stable": { - "version": "0.1.8" - }, - "stack-chain": { - "version": "1.3.7" - }, - "stack-trace": { - "version": "0.0.10", - "dev": true - }, - "stack-utils": { - "version": "2.0.5", - "dev": true, - "requires": { - "escape-string-regexp": "^2.0.0" - }, - "dependencies": { - "escape-string-regexp": { - "version": "2.0.0", - "dev": true - } - } - }, - "static-extend": { - "version": "0.1.2", - "dev": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - } - }, - "statuses": { - "version": "1.5.0" - }, - "stdout-stream": { - "version": "1.4.1", - "dev": true, - "requires": { - "readable-stream": "^2.0.1" - } - }, - "stream-browserify": { - "version": "2.0.2", - "dev": true, - "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" - } - }, - "stream-combiner": { - "version": "0.0.2", - "requires": { - "duplexer": "~0.0.3" - } - }, - "stream-each": { - "version": "1.2.3", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "stream-shift": "^1.0.0" - } - }, - "stream-events": { - "version": "1.0.5", - "requires": { - "stubs": "^3.0.0" - } - }, - "stream-exhaust": { - "version": "1.0.2", - "dev": true - }, - "stream-http": { - "version": "2.8.3", - "dev": true, - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" - } - }, - "stream-serializer": { - "version": "1.1.2" - }, - "stream-shift": { - "version": "1.0.1" - }, - "streamsearch": { - "version": "0.1.2" - }, - "string_decoder": { - "version": "1.1.1", - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "string-length": { - "version": "4.0.2", - "dev": true, - "requires": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - } - }, - "string-width": { - "version": "1.0.2", - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1" - }, - "strip-ansi": { - "version": "3.0.1", - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "string.prototype.trimend": { - "version": "1.0.4", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "string.prototype.trimstart": { - "version": "1.0.4", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - } - }, - "strip-ansi": { - "version": "6.0.1", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-bom": { - "version": "4.0.0", - "dev": true - }, - "strip-eof": { - "version": "1.0.0" - }, - "strip-final-newline": { - "version": "2.0.0" - }, - "strip-indent": { - "version": "1.0.1", - "dev": true, - "requires": { - "get-stdin": "^4.0.1" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "dev": true - }, - "strong-error-handler": { - "version": "2.3.2", - "requires": { - "accepts": "^1.3.3", - "debug": "^2.2.0", - "ejs": "^2.5.7", - "http-status": "^1.0.0", - "js2xmlparser": "^3.0.0", - "strong-globalize": "^3.1.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "execa": { - "version": "0.7.0", - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "3.0.0" - }, - "invert-kv": { - "version": "1.0.0" - }, - "is-stream": { - "version": "1.1.0" - }, - "lcid": { - "version": "1.0.0", - "requires": { - "invert-kv": "^1.0.0" - } - }, - "lru-cache": { - "version": "4.1.5", - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "mem": { - "version": "1.1.0", - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "mimic-fn": { - "version": "1.2.0" - }, - "mkdirp": { - "version": "0.5.5", - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.0.0" - }, - "npm-run-path": { - "version": "2.0.2", - "requires": { - "path-key": "^2.0.0" - } - }, - "os-locale": { - "version": "2.1.0", - "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - } - }, - "path-key": { - "version": "2.0.1" - }, - "shebang-command": { - "version": "1.2.0", - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0" - }, - "strong-globalize": { - "version": "3.3.0", - "requires": { - "accept-language": "^3.0.18", - "async": "^2.4.1", - "debug": "^3.1.0", - "esprima": "^4.0.0", - "estraverse": "^4.2.0", - "g11n-pipeline": "^2.0.1", - "globalize": "^1.3.0", - "htmlparser2": "^3.9.2", - "lodash": "^4.17.4", - "md5": "^2.2.1", - "mkdirp": "^0.5.1", - "mktmpdir": "^0.1.1", - "optional": "^0.1.3", - "os-locale": "^2.0.0", - "posix-getopt": "^1.2.0", - "word-count": "^0.2.2", - "xtend": "^4.0.1", - "yamljs": "^0.3.0" - }, - "dependencies": { - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.3" - } - } - }, - "which": { - "version": "1.3.1", - "requires": { - "isexe": "^2.0.0" - } - }, - "yallist": { - "version": "2.1.2" - } - } - }, - "strong-globalize": { - "version": "4.1.3", - "requires": { - "accept-language": "^3.0.18", - "debug": "^4.1.1", - "globalize": "^1.4.2", - "lodash": "^4.17.4", - "md5": "^2.2.1", - "mkdirp": "^0.5.1", - "os-locale": "^3.1.0", - "yamljs": "^0.3.0" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "requires": { - "minimist": "^1.2.5" - } - } - } - }, - "strong-remoting": { - "version": "3.17.0", - "requires": { - "async": "^3.1.0", - "body-parser": "^1.12.4", - "debug": "^4.1.1", - "depd": "^2.0.0", - "escape-string-regexp": "^2.0.0", - "eventemitter2": "^5.0.1", - "express": "4.x", - "inflection": "^1.7.1", - "jayson": "^2.0.5", - "js2xmlparser": "^3.0.0", - "loopback-datatype-geopoint": "^1.0.0", - "loopback-phase": "^3.1.0", - "mux-demux": "^3.7.9", - "qs": "^6.2.1", - "request": "^2.83.0", - "sse": "0.0.8", - "strong-error-handler": "^3.0.0", - "strong-globalize": "^5.0.2", - "traverse": "^0.6.6", - "xml2js": "^0.4.8" - }, - "dependencies": { - "async": { - "version": "3.2.3" - }, - "ejs": { - "version": "3.1.6", - "requires": { - "jake": "^10.6.1" - } - }, - "escape-string-regexp": { - "version": "2.0.0" - }, - "invert-kv": { - "version": "3.0.1" - }, - "lcid": { - "version": "3.1.1", - "requires": { - "invert-kv": "^3.0.0" - } - }, - "mem": { - "version": "5.1.1", - "requires": { - "map-age-cleaner": "^0.1.3", - "mimic-fn": "^2.1.0", - "p-is-promise": "^2.1.0" - } - }, - "os-locale": { - "version": "5.0.0", - "requires": { - "execa": "^4.0.0", - "lcid": "^3.0.0", - "mem": "^5.0.0" - } - }, - "strong-error-handler": { - "version": "3.5.0", - "requires": { - "@types/express": "^4.16.0", - "accepts": "^1.3.3", - "debug": "^4.1.1", - "ejs": "^3.1.3", - "fast-safe-stringify": "^2.0.6", - "http-status": "^1.1.2", - "js2xmlparser": "^4.0.0", - "strong-globalize": "^6.0.1" - }, - "dependencies": { - "js2xmlparser": { - "version": "4.0.2", - "requires": { - "xmlcreate": "^2.0.4" - } - }, - "strong-globalize": { - "version": "6.0.5", - "requires": { - "accept-language": "^3.0.18", - "debug": "^4.2.0", - "globalize": "^1.6.0", - "lodash": "^4.17.20", - "md5": "^2.3.0", - "mkdirp": "^1.0.4", - "os-locale": "^5.0.0", - "yamljs": "^0.3.0" - } - } - } - }, - "strong-globalize": { - "version": "5.1.0", - "requires": { - "accept-language": "^3.0.18", - "debug": "^4.1.1", - "globalize": "^1.5.0", - "lodash": "^4.17.15", - "md5": "^2.2.1", - "mkdirp": "^0.5.5", - "os-locale": "^5.0.0", - "yamljs": "^0.3.0" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "requires": { - "minimist": "^1.2.5" - } - } - } - }, - "xmlcreate": { - "version": "2.0.4" - } - } - }, - "stubs": { - "version": "3.0.0" - }, - "style-loader": { - "version": "0.23.1", - "dev": true, - "requires": { - "loader-utils": "^1.1.0", - "schema-utils": "^1.0.0" - }, - "dependencies": { - "schema-utils": { - "version": "1.0.0", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "supports-color": { - "version": "5.5.0", - "requires": { - "has-flag": "^3.0.0" - } - }, - "supports-hyperlinks": { - "version": "2.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0", - "supports-color": "^7.0.0" - }, - "dependencies": { - "has-flag": { - "version": "4.0.0", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0", - "dev": true - }, - "sver-compat": { - "version": "1.5.0", - "dev": true, - "requires": { - "es6-iterator": "^2.0.1", - "es6-symbol": "^3.1.1" - } - }, - "swagger-client": { - "version": "3.18.1", - "requires": { - "@babel/runtime-corejs3": "^7.11.2", - "btoa": "^1.2.1", - "cookie": "~0.4.1", - "cross-fetch": "^3.1.4", - "deepmerge": "~4.2.2", - "fast-json-patch": "^3.0.0-1", - "form-data-encoder": "^1.4.3", - "formdata-node": "^4.0.0", - "is-plain-object": "^5.0.0", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21", - "qs": "^6.10.2", - "traverse": "~0.6.6", - "url": "~0.11.0" - }, - "dependencies": { - "argparse": { - "version": "2.0.1" - }, - "fast-json-patch": { - "version": "3.1.0" - }, - "is-plain-object": { - "version": "5.0.0" - }, - "js-yaml": { - "version": "4.1.0", - "requires": { - "argparse": "^2.0.1" - } - }, - "punycode": { - "version": "1.3.2" - }, - "qs": { - "version": "6.10.3", - "requires": { - "side-channel": "^1.0.4" - } - }, - "url": { - "version": "0.11.0", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - } - } - }, - "swagger-ui": { - "version": "2.2.10" - }, - "symbol-tree": { - "version": "3.2.4", - "dev": true - }, - "table": { - "version": "6.8.0", - "dev": true, - "requires": { - "ajv": "^8.0.1", - "lodash.truncate": "^4.4.2", - "slice-ansi": "^4.0.0", - "string-width": "^4.2.3", - "strip-ansi": "^6.0.1" - }, - "dependencies": { - "ajv": { - "version": "8.8.2", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" - } - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "dev": true - }, - "json-schema-traverse": { - "version": "1.0.0", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - } - } - }, - "tapable": { - "version": "1.1.3", - "dev": true - }, - "tar": { - "version": "2.2.2", - "dev": true, - "requires": { - "block-stream": "*", - "fstream": "^1.0.12", - "inherits": "2" - } - }, - "tar-fs": { - "version": "2.1.1", - "requires": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "tar-stream": { - "version": "2.2.0", - "requires": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "dependencies": { - "bl": { - "version": "4.1.0", - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "buffer": { - "version": "5.7.1", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "readable-stream": { - "version": "3.6.0", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "teeny-request": { - "version": "3.11.3", - "requires": { - "https-proxy-agent": "^2.2.1", - "node-fetch": "^2.2.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "agent-base": { - "version": "4.3.0", - "requires": { - "es6-promisify": "^5.0.0" - } - }, - "debug": { - "version": "3.2.7", - "requires": { - "ms": "^2.1.1" - } - }, - "https-proxy-agent": { - "version": "2.2.4", - "requires": { - "agent-base": "^4.3.0", - "debug": "^3.1.0" - } - } - } - }, - "terminal-link": { - "version": "2.1.1", - "dev": true, - "requires": { - "ansi-escapes": "^4.2.1", - "supports-hyperlinks": "^2.0.0" - } - }, - "terser": { - "version": "4.8.0", - "dev": true, - "requires": { - "commander": "^2.20.0", - "source-map": "~0.6.1", - "source-map-support": "~0.5.12" - }, - "dependencies": { - "commander": { - "version": "2.20.3", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "terser-webpack-plugin": { - "version": "1.4.5", - "dev": true, - "requires": { - "cacache": "^12.0.2", - "find-cache-dir": "^2.1.0", - "is-wsl": "^1.1.0", - "schema-utils": "^1.0.0", - "serialize-javascript": "^4.0.0", - "source-map": "^0.6.1", - "terser": "^4.1.2", - "webpack-sources": "^1.4.0", - "worker-farm": "^1.7.0" - }, - "dependencies": { - "is-wsl": { - "version": "1.1.0", - "dev": true - }, - "schema-utils": { - "version": "1.0.0", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - }, - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "test-exclude": { - "version": "6.0.0", - "dev": true, - "requires": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - } - }, - "text-table": { - "version": "0.2.0", - "dev": true - }, - "throat": { - "version": "5.0.0", - "dev": true - }, - "through": { - "version": "2.3.8" - }, - "through2": { - "version": "2.0.5", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "through2-filter": { - "version": "3.0.0", - "dev": true, - "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" - } - }, - "thunky": { - "version": "1.1.0", - "dev": true - }, - "time-stamp": { - "version": "1.1.0", - "dev": true - }, - "timers-browserify": { - "version": "2.0.12", - "dev": true, - "requires": { - "setimmediate": "^1.0.4" - } - }, - "tlds": { - "version": "1.208.0" - }, - "tmpl": { - "version": "1.0.5", - "dev": true - }, - "to-absolute-glob": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-absolute": "^1.0.0", - "is-negated-glob": "^1.0.0" - } - }, - "to-arraybuffer": { - "version": "1.0.1", - "dev": true - }, - "to-fast-properties": { - "version": "2.0.0", - "dev": true - }, - "to-iso-string": { - "version": "0.0.2" - }, - "to-object-path": { - "version": "0.3.0", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "to-readable-stream": { - "version": "2.1.0" - }, - "to-regex": { - "version": "3.0.2", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - }, - "dependencies": { - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "to-regex-range": { - "version": "2.1.1", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - }, - "to-through": { - "version": "2.0.0", - "dev": true, - "requires": { - "through2": "^2.0.3" - } - }, - "to-utf8": { - "version": "0.0.1" - }, - "toidentifier": { - "version": "1.0.1" - }, - "toposort": { - "version": "2.0.2" - }, - "touch": { - "version": "3.1.0", - "dev": true, - "requires": { - "nopt": "~1.0.10" - }, - "dependencies": { - "nopt": { - "version": "1.0.10", - "dev": true, - "requires": { - "abbrev": "1" - } - } - } - }, - "tough-cookie": { - "version": "4.0.0", - "dev": true, - "requires": { - "psl": "^1.1.33", - "punycode": "^2.1.1", - "universalify": "^0.1.2" - } - }, - "tr46": { - "version": "2.1.0", - "dev": true, - "requires": { - "punycode": "^2.1.1" - } - }, - "traverse": { - "version": "0.6.6" - }, - "trim-newlines": { - "version": "1.0.0", - "dev": true - }, - "true-case-path": { - "version": "1.0.3", - "dev": true, - "requires": { - "glob": "^7.1.2" - } - }, - "tryit": { - "version": "1.0.3", - "dev": true - }, - "tslib": { - "version": "2.3.1", - "dev": true - }, - "tty-browserify": { - "version": "0.0.0", - "dev": true - }, - "tunnel-agent": { - "version": "0.6.0", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5" - }, - "type": { - "version": "1.2.0", - "dev": true - }, - "type-check": { - "version": "0.4.0", - "dev": true, - "requires": { - "prelude-ls": "^1.2.1" - } - }, - "type-detect": { - "version": "4.0.8", - "dev": true - }, - "type-fest": { - "version": "0.10.0" - }, - "type-is": { - "version": "1.6.18", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } - }, - "typedarray": { - "version": "0.0.6" - }, - "typedarray-to-buffer": { - "version": "3.1.5", - "dev": true, - "requires": { - "is-typedarray": "^1.0.0" - } - }, - "uc.micro": { - "version": "1.0.6" - }, - "uglify-js": { - "version": "3.4.10", - "dev": true, - "requires": { - "commander": "~2.19.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "commander": { - "version": "2.19.0", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "uid2": { - "version": "0.0.3" - }, - "unbox-primitive": { - "version": "1.0.1", - "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.1", - "has-symbols": "^1.0.2", - "which-boxed-primitive": "^1.0.2" - } - }, - "unbzip2-stream": { - "version": "1.4.3", - "requires": { - "buffer": "^5.2.1", - "through": "^2.3.8" - }, - "dependencies": { - "buffer": { - "version": "5.7.1", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - } - } - }, - "unc-path-regex": { - "version": "0.1.2", - "dev": true - }, - "undefsafe": { - "version": "2.0.5", - "dev": true - }, - "underscore": { - "version": "1.7.0" - }, - "underscore.string": { - "version": "3.3.5", - "requires": { - "sprintf-js": "^1.0.3", - "util-deprecate": "^1.0.2" - } - }, - "undertaker": { - "version": "1.3.0", - "dev": true, - "requires": { - "arr-flatten": "^1.0.1", - "arr-map": "^2.0.0", - "bach": "^1.0.0", - "collection-map": "^1.0.0", - "es6-weak-map": "^2.0.1", - "fast-levenshtein": "^1.0.0", - "last-run": "^1.1.0", - "object.defaults": "^1.0.0", - "object.reduce": "^1.0.0", - "undertaker-registry": "^1.0.0" - }, - "dependencies": { - "fast-levenshtein": { - "version": "1.1.4", - "dev": true - } - } - }, - "undertaker-registry": { - "version": "1.0.1", - "dev": true - }, - "unicode-canonical-property-names-ecmascript": { - "version": "2.0.0", - "dev": true - }, - "unicode-match-property-ecmascript": { - "version": "2.0.0", - "dev": true, - "requires": { - "unicode-canonical-property-names-ecmascript": "^2.0.0", - "unicode-property-aliases-ecmascript": "^2.0.0" - } - }, - "unicode-match-property-value-ecmascript": { - "version": "2.0.0", - "dev": true - }, - "unicode-property-aliases-ecmascript": { - "version": "2.0.0", - "dev": true - }, - "union-value": { - "version": "1.0.1", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - } - }, - "unique-filename": { - "version": "1.1.1", - "dev": true, - "requires": { - "unique-slug": "^2.0.0" - } - }, - "unique-slug": { - "version": "2.0.2", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4" - } - }, - "unique-stream": { - "version": "2.3.1", - "dev": true, - "requires": { - "json-stable-stringify-without-jsonify": "^1.0.1", - "through2-filter": "^3.0.0" - } - }, - "unique-string": { - "version": "1.0.0", - "requires": { - "crypto-random-string": "^1.0.0" - } - }, - "universalify": { - "version": "0.1.2" - }, - "unpipe": { - "version": "1.0.0" - }, - "unset-value": { - "version": "1.0.0", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "dev": true - } - } - }, - "upath": { - "version": "1.2.0", - "dev": true - }, - "update-notifier": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", - "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", - "dev": true, - "requires": { - "boxen": "^5.0.0", - "chalk": "^4.1.0", - "configstore": "^5.0.1", - "has-yarn": "^2.1.0", - "import-lazy": "^2.1.0", - "is-ci": "^2.0.0", - "is-installed-globally": "^0.4.0", - "is-npm": "^5.0.0", - "is-yarn-global": "^0.3.0", - "latest-version": "^5.1.0", - "pupa": "^2.1.1", - "semver": "^7.3.4", - "semver-diff": "^3.1.1", - "xdg-basedir": "^4.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "configstore": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", - "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", - "dev": true, - "requires": { - "dot-prop": "^5.2.0", - "graceful-fs": "^4.1.2", - "make-dir": "^3.0.0", - "unique-string": "^2.0.0", - "write-file-atomic": "^3.0.0", - "xdg-basedir": "^4.0.0" - } - }, - "crypto-random-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", - "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", - "dev": true - }, - "dot-prop": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", - "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", - "dev": true, - "requires": { - "is-obj": "^2.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "is-obj": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", - "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", - "dev": true - }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - }, - "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", - "dev": true, - "requires": { - "semver": "^6.0.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true - } - } - }, - "semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "unique-string": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", - "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", - "dev": true, - "requires": { - "crypto-random-string": "^2.0.0" - } - }, - "xdg-basedir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", - "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", - "dev": true - }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } - }, - "upper-case": { - "version": "1.1.3", - "dev": true - }, - "uri-js": { - "version": "4.4.1", - "requires": { - "punycode": "^2.1.0" - } - }, - "urix": { - "version": "0.1.0", - "dev": true - }, - "url": { - "version": "0.10.3", - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2" - } - } - }, - "url-join": { - "version": "4.0.1" - }, - "url-parse": { - "version": "1.5.4", - "dev": true, - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, - "url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "dev": true, - "requires": { - "prepend-http": "^2.0.0" - } - }, - "use": { - "version": "3.1.1", - "dev": true - }, - "utf7": { - "version": "1.0.2", - "requires": { - "semver": "~5.3.0" - }, - "dependencies": { - "semver": { - "version": "5.3.0" - } - } - }, - "util": { - "version": "0.11.1", - "dev": true, - "requires": { - "inherits": "2.0.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "dev": true - } - } - }, - "util-deprecate": { - "version": "1.0.2" - }, - "util.promisify": { - "version": "1.0.0", - "dev": true, - "requires": { - "define-properties": "^1.1.2", - "object.getownpropertydescriptors": "^2.0.3" - } - }, - "utila": { - "version": "0.4.0", - "dev": true - }, - "utils-merge": { - "version": "1.0.1" - }, - "uuid": { - "version": "3.4.0" - }, - "v8-compile-cache": { - "version": "2.3.0", - "dev": true - }, - "v8-to-istanbul": { - "version": "7.1.2", - "dev": true, - "requires": { - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^1.6.0", - "source-map": "^0.7.3" - }, - "dependencies": { - "source-map": { - "version": "0.7.3", - "dev": true - } - } - }, - "v8flags": { - "version": "3.2.0", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, - "validate-npm-package-license": { - "version": "3.0.4", - "dev": true, - "requires": { - "spdx-correct": "^3.0.0", - "spdx-expression-parse": "^3.0.0" - } - }, - "value-or-function": { - "version": "3.0.0", - "dev": true - }, - "vary": { - "version": "1.1.2" - }, - "vasync": { - "version": "2.2.1", - "requires": { - "verror": "1.10.0" - }, - "dependencies": { - "core-util-is": { - "version": "1.0.2" - }, - "verror": { - "version": "1.10.0", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - } - } - }, - "verror": { - "version": "1.10.1", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - }, - "dependencies": { - "core-util-is": { - "version": "1.0.2" - } - } - }, - "vinyl": { - "version": "2.2.1", - "dev": true, - "requires": { - "clone": "^2.1.1", - "clone-buffer": "^1.0.0", - "clone-stats": "^1.0.0", - "cloneable-readable": "^1.0.0", - "remove-trailing-separator": "^1.0.1", - "replace-ext": "^1.0.0" - }, - "dependencies": { - "replace-ext": { - "version": "1.0.1", - "dev": true - } - } - }, - "vinyl-bufferstream": { - "version": "1.0.1", - "dev": true, - "requires": { - "bufferstreams": "1.0.1" - }, - "dependencies": { - "bufferstreams": { - "version": "1.0.1", - "dev": true, - "requires": { - "readable-stream": "^1.0.33" - } - }, - "isarray": { - "version": "0.0.1", - "dev": true - }, - "readable-stream": { - "version": "1.1.14", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" - } - }, - "string_decoder": { - "version": "0.10.31", - "dev": true - } - } - }, - "vinyl-fs": { - "version": "3.0.3", - "dev": true, - "requires": { - "fs-mkdirp-stream": "^1.0.0", - "glob-stream": "^6.1.0", - "graceful-fs": "^4.0.0", - "is-valid-glob": "^1.0.0", - "lazystream": "^1.0.0", - "lead": "^1.0.0", - "object.assign": "^4.0.4", - "pumpify": "^1.3.5", - "readable-stream": "^2.3.3", - "remove-bom-buffer": "^3.0.0", - "remove-bom-stream": "^1.2.0", - "resolve-options": "^1.1.0", - "through2": "^2.0.0", - "to-through": "^2.0.0", - "value-or-function": "^3.0.0", - "vinyl": "^2.0.0", - "vinyl-sourcemap": "^1.1.0" - } - }, - "vinyl-sourcemap": { - "version": "1.1.0", - "dev": true, - "requires": { - "append-buffer": "^1.0.2", - "convert-source-map": "^1.5.0", - "graceful-fs": "^4.1.6", - "normalize-path": "^2.1.1", - "now-and-later": "^2.0.0", - "remove-bom-buffer": "^3.0.0", - "vinyl": "^2.0.0" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } - } - }, - "vm-browserify": { - "version": "1.1.2", - "dev": true - }, - "vn-loopback": { - "version": "file:loopback" - }, - "vn-print": { - "version": "file:print", - "requires": { - "fs-extra": "^7.0.1", - "intl": "^1.2.5", - "js-yaml": "^3.13.1", - "jsonexport": "^3.2.0", - "juice": "^5.2.0", - "mysql2": "^1.7.0", - "nodemailer": "^4.7.0", - "puppeteer": "^2.0.0", - "qrcode": "^1.4.2", - "strftime": "^0.10.0", - "vue": "^2.6.10", - "vue-i18n": "^8.15.0", - "vue-server-renderer": "^2.6.10" - }, - "dependencies": { - "@types/mime-types": { - "version": "2.1.1" - }, - "agent-base": { - "version": "5.1.1" - }, - "ajv": { - "version": "6.12.6", - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "ansi-regex": { - "version": "2.1.1" - }, - "ansi-styles": { - "version": "2.2.1" - }, - "argparse": { - "version": "1.0.10", - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "asn1": { - "version": "0.2.6", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "assert-plus": { - "version": "1.0.0" - }, - "async": { - "version": "3.2.3" - }, - "async-limiter": { - "version": "1.0.1" - }, - "asynckit": { - "version": "0.4.0" - }, - "aws-sign2": { - "version": "0.7.0" - }, - "aws4": { - "version": "1.11.0" - }, - "balanced-match": { - "version": "1.0.2" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "boolbase": { - "version": "1.0.0" - }, - "brace-expansion": { - "version": "1.1.11", - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "buffer-crc32": { - "version": "0.2.13" - }, - "buffer-from": { - "version": "1.1.2" - }, - "camelcase": { - "version": "5.3.1" - }, - "caseless": { - "version": "0.12.0" - }, - "chalk": { - "version": "1.1.3", - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "cheerio": { - "version": "0.22.0", - "requires": { - "css-select": "~1.2.0", - "dom-serializer": "~0.1.0", - "entities": "~1.1.1", - "htmlparser2": "^3.9.1", - "lodash.assignin": "^4.0.9", - "lodash.bind": "^4.1.4", - "lodash.defaults": "^4.0.1", - "lodash.filter": "^4.4.0", - "lodash.flatten": "^4.2.0", - "lodash.foreach": "^4.3.0", - "lodash.map": "^4.4.0", - "lodash.merge": "^4.4.0", - "lodash.pick": "^4.2.1", - "lodash.reduce": "^4.4.0", - "lodash.reject": "^4.4.0", - "lodash.some": "^4.4.0" - } - }, - "cliui": { - "version": "6.0.0", - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1" - }, - "strip-ansi": { - "version": "6.0.1", - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "color-convert": { - "version": "1.9.3", - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3" - }, - "combined-stream": { - "version": "1.0.8", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.20.3" - }, - "concat-map": { - "version": "0.0.1" - }, - "concat-stream": { - "version": "1.6.2", - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "safe-buffer": { - "version": "5.1.2" - }, - "string_decoder": { - "version": "1.1.1", - "requires": { - "safe-buffer": "~5.1.0" - } - } - } - }, - "core-util-is": { - "version": "1.0.2" - }, - "cross-spawn": { - "version": "6.0.5", - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "css-select": { - "version": "1.2.0", - "requires": { - "boolbase": "~1.0.0", - "css-what": "2.1", - "domutils": "1.5.1", - "nth-check": "~1.0.1" - } - }, - "css-what": { - "version": "2.1.3" - }, - "dashdash": { - "version": "1.14.1", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "datauri": { - "version": "2.0.0", - "requires": { - "image-size": "^0.7.3", - "mimer": "^1.0.0" - } - }, - "debug": { - "version": "4.3.3", - "requires": { - "ms": "2.1.2" - } - }, - "decamelize": { - "version": "1.2.0" - }, - "deep-extend": { - "version": "0.6.0" - }, - "delayed-stream": { - "version": "1.0.0" - }, - "denque": { - "version": "1.5.1" - }, - "dijkstrajs": { - "version": "1.0.2" - }, - "dom-serializer": { - "version": "0.1.1", - "requires": { - "domelementtype": "^1.3.0", - "entities": "^1.1.1" - } - }, - "domelementtype": { - "version": "1.3.1" - }, - "domhandler": { - "version": "2.4.2", - "requires": { - "domelementtype": "1" - } - }, - "domutils": { - "version": "1.5.1", - "requires": { - "dom-serializer": "0", - "domelementtype": "1" - } - }, - "ecc-jsbn": { - "version": "0.1.2", - "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } - }, - "emoji-regex": { - "version": "8.0.0" - }, - "encode-utf8": { - "version": "1.0.3" - }, - "entities": { - "version": "1.1.2" - }, - "escape-string-regexp": { - "version": "1.0.5" - }, - "esprima": { - "version": "4.0.1" - }, - "extend": { - "version": "3.0.2" - }, - "extract-zip": { - "version": "1.7.0", - "requires": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", - "yauzl": "^2.10.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0" - } - } - }, - "extsprintf": { - "version": "1.3.0" - }, - "fast-deep-equal": { - "version": "3.1.3" - }, - "fast-json-stable-stringify": { - "version": "2.1.0" - }, - "fd-slicer": { - "version": "1.1.0", - "requires": { - "pend": "~1.2.0" - } - }, - "find-up": { - "version": "4.1.0", - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, - "forever-agent": { - "version": "0.6.1" - }, - "form-data": { - "version": "2.3.3", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "fs-extra": { - "version": "7.0.1", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs.realpath": { - "version": "1.0.0" - }, - "function-bind": { - "version": "1.1.1" - }, - "generate-function": { - "version": "2.3.1", - "requires": { - "is-property": "^1.0.2" - } - }, - "get-caller-file": { - "version": "2.0.5" - }, - "getpass": { - "version": "0.1.7", - "requires": { - "assert-plus": "^1.0.0" - } - }, - "glob": { - "version": "7.2.0", - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "graceful-fs": { - "version": "4.2.9" - }, - "har-schema": { - "version": "2.0.0" - }, - "har-validator": { - "version": "5.1.5", - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, - "has": { - "version": "1.0.3", - "requires": { - "function-bind": "^1.1.1" - } - }, - "has-ansi": { - "version": "2.0.0", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-flag": { - "version": "3.0.0" - }, - "hash-sum": { - "version": "1.0.2" - }, - "he": { - "version": "1.2.0" - }, - "htmlparser2": { - "version": "3.10.1", - "requires": { - "domelementtype": "^1.3.1", - "domhandler": "^2.3.0", - "domutils": "^1.5.1", - "entities": "^1.1.1", - "inherits": "^2.0.1", - "readable-stream": "^3.1.1" - } - }, - "http-signature": { - "version": "1.2.0", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "https-proxy-agent": { - "version": "4.0.0", - "requires": { - "agent-base": "5", - "debug": "4" - } - }, - "iconv-lite": { - "version": "0.5.2", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "image-size": { - "version": "0.7.5" - }, - "inflight": { - "version": "1.0.6", - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4" - }, - "intl": { - "version": "1.2.5" - }, - "is-core-module": { - "version": "2.8.1", - "requires": { - "has": "^1.0.3" - } - }, - "is-fullwidth-code-point": { - "version": "3.0.0" - }, - "is-property": { - "version": "1.0.2" - }, - "is-typedarray": { - "version": "1.0.0" - }, - "isarray": { - "version": "1.0.0" - }, - "isexe": { - "version": "2.0.0" - }, - "isstream": { - "version": "0.1.2" - }, - "js-yaml": { - "version": "3.14.1", - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "jsbn": { - "version": "0.1.1" - }, - "json-schema": { - "version": "0.4.0" - }, - "json-schema-traverse": { - "version": "0.4.1" - }, - "json-stringify-safe": { - "version": "5.0.1" - }, - "jsonexport": { - "version": "3.2.0" - }, - "jsonfile": { - "version": "4.0.0", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsprim": { - "version": "1.4.2", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" - } - }, - "juice": { - "version": "5.2.0", - "requires": { - "cheerio": "^0.22.0", - "commander": "^2.15.1", - "cross-spawn": "^6.0.5", - "deep-extend": "^0.6.0", - "mensch": "^0.3.3", - "slick": "^1.12.2", - "web-resource-inliner": "^4.3.1" - } - }, - "locate-path": { - "version": "5.0.0", - "requires": { - "p-locate": "^4.1.0" - } - }, - "lodash._reinterpolate": { - "version": "3.0.0" - }, - "lodash.assignin": { - "version": "4.2.0" - }, - "lodash.bind": { - "version": "4.2.1" - }, - "lodash.defaults": { - "version": "4.2.0" - }, - "lodash.filter": { - "version": "4.6.0" - }, - "lodash.flatten": { - "version": "4.4.0" - }, - "lodash.foreach": { - "version": "4.5.0" - }, - "lodash.map": { - "version": "4.6.0" - }, - "lodash.merge": { - "version": "4.6.2" - }, - "lodash.pick": { - "version": "4.4.0" - }, - "lodash.reduce": { - "version": "4.6.0" - }, - "lodash.reject": { - "version": "4.6.0" - }, - "lodash.some": { - "version": "4.6.0" - }, - "lodash.template": { - "version": "4.5.0", - "requires": { - "lodash._reinterpolate": "^3.0.0", - "lodash.templatesettings": "^4.0.0" - } - }, - "lodash.templatesettings": { - "version": "4.2.0", - "requires": { - "lodash._reinterpolate": "^3.0.0" - } - }, - "lodash.unescape": { - "version": "4.0.1" - }, - "lodash.uniq": { - "version": "4.5.0" - }, - "long": { - "version": "4.0.0" - }, - "lru-cache": { - "version": "5.1.1", - "requires": { - "yallist": "^3.0.2" - } - }, - "mensch": { - "version": "0.3.4" - }, - "mime": { - "version": "2.6.0" - }, - "mime-db": { - "version": "1.51.0" - }, - "mime-types": { - "version": "2.1.34", - "requires": { - "mime-db": "1.51.0" - } - }, - "mimer": { - "version": "1.1.1" - }, - "minimatch": { - "version": "3.0.4", - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "1.2.5" - }, - "mkdirp": { - "version": "0.5.5", - "requires": { - "minimist": "^1.2.5" - } - }, - "ms": { - "version": "2.1.2" - }, - "mysql2": { - "version": "1.7.0", - "requires": { - "denque": "^1.4.1", - "generate-function": "^2.3.1", - "iconv-lite": "^0.5.0", - "long": "^4.0.0", - "lru-cache": "^5.1.1", - "named-placeholders": "^1.1.2", - "seq-queue": "^0.0.5", - "sqlstring": "^2.3.1" - } - }, - "named-placeholders": { - "version": "1.1.2", - "requires": { - "lru-cache": "^4.1.3" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.5", - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "yallist": { - "version": "2.1.2" - } - } - }, - "nice-try": { - "version": "1.0.5" - }, - "nodemailer": { - "version": "4.7.0" - }, - "nth-check": { - "version": "1.0.2", - "requires": { - "boolbase": "~1.0.0" - } - }, - "oauth-sign": { - "version": "0.9.0" - }, - "once": { - "version": "1.4.0", - "requires": { - "wrappy": "1" - } - }, - "p-limit": { - "version": "2.3.0", - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0" - }, - "path-exists": { - "version": "4.0.0" - }, - "path-is-absolute": { - "version": "1.0.1" - }, - "path-key": { - "version": "2.0.1" - }, - "path-parse": { - "version": "1.0.7" - }, - "pend": { - "version": "1.2.0" - }, - "performance-now": { - "version": "2.1.0" - }, - "pngjs": { - "version": "5.0.0" - }, - "process-nextick-args": { - "version": "2.0.1" - }, - "progress": { - "version": "2.0.3" - }, - "proxy-from-env": { - "version": "1.1.0" - }, - "pseudomap": { - "version": "1.0.2" - }, - "psl": { - "version": "1.8.0" - }, - "punycode": { - "version": "2.1.1" - }, - "puppeteer": { - "version": "2.1.1", - "requires": { - "@types/mime-types": "^2.1.0", - "debug": "^4.1.0", - "extract-zip": "^1.6.6", - "https-proxy-agent": "^4.0.0", - "mime": "^2.0.3", - "mime-types": "^2.1.25", - "progress": "^2.0.1", - "proxy-from-env": "^1.0.0", - "rimraf": "^2.6.1", - "ws": "^6.1.0" - } - }, - "qrcode": { - "version": "1.5.0", - "requires": { - "dijkstrajs": "^1.0.1", - "encode-utf8": "^1.0.3", - "pngjs": "^5.0.0", - "yargs": "^15.3.1" - } - }, - "qs": { - "version": "6.5.3" - }, - "randombytes": { - "version": "2.1.0", - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readable-stream": { - "version": "3.6.0", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "request": { - "version": "2.88.2", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - } - }, - "require-directory": { - "version": "2.1.1" - }, - "require-main-filename": { - "version": "2.0.0" - }, - "resolve": { - "version": "1.21.0", - "requires": { - "is-core-module": "^2.8.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - } - }, - "rimraf": { - "version": "2.7.1", - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.2.1" - }, - "safer-buffer": { - "version": "2.1.2" - }, - "semver": { - "version": "5.7.1" - }, - "seq-queue": { - "version": "0.0.5" - }, - "serialize-javascript": { - "version": "3.1.0", - "requires": { - "randombytes": "^2.1.0" - } - }, - "set-blocking": { - "version": "2.0.0" - }, - "shebang-command": { - "version": "1.2.0", - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0" - }, - "slick": { - "version": "1.12.2" - }, - "source-map": { - "version": "0.5.6" - }, - "sprintf-js": { - "version": "1.0.3" - }, - "sqlstring": { - "version": "2.3.2" - }, - "sshpk": { - "version": "1.17.0", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "strftime": { - "version": "0.10.1" - }, - "string_decoder": { - "version": "1.3.0", - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "string-width": { - "version": "4.2.3", - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1" - }, - "strip-ansi": { - "version": "6.0.1", - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "strip-ansi": { - "version": "3.0.1", - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0" - }, - "supports-preserve-symlinks-flag": { - "version": "1.0.0" - }, - "tough-cookie": { - "version": "2.5.0", - "requires": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - } - }, - "tunnel-agent": { - "version": "0.6.0", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5" - }, - "typedarray": { - "version": "0.0.6" - }, - "universalify": { - "version": "0.1.2" - }, - "uri-js": { - "version": "4.4.1", - "requires": { - "punycode": "^2.1.0" - } - }, - "util-deprecate": { - "version": "1.0.2" - }, - "uuid": { - "version": "3.4.0" - }, - "valid-data-url": { - "version": "2.0.0" - }, - "verror": { - "version": "1.10.0", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } - }, - "vue": { - "version": "2.6.14" - }, - "vue-i18n": { - "version": "8.26.8" - }, - "vue-server-renderer": { - "version": "2.6.14", - "requires": { - "chalk": "^1.1.3", - "hash-sum": "^1.0.2", - "he": "^1.1.0", - "lodash.template": "^4.5.0", - "lodash.uniq": "^4.5.0", - "resolve": "^1.2.0", - "serialize-javascript": "^3.1.0", - "source-map": "0.5.6" - } - }, - "web-resource-inliner": { - "version": "4.3.4", - "requires": { - "async": "^3.1.0", - "chalk": "^2.4.2", - "datauri": "^2.0.0", - "htmlparser2": "^4.0.0", - "lodash.unescape": "^4.0.1", - "request": "^2.88.0", - "safer-buffer": "^2.1.2", - "valid-data-url": "^2.0.0", - "xtend": "^4.0.2" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "dom-serializer": { - "version": "1.3.2", - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.0", - "entities": "^2.0.0" - }, - "dependencies": { - "domhandler": { - "version": "4.3.0", - "requires": { - "domelementtype": "^2.2.0" - } - } - } - }, - "domelementtype": { - "version": "2.2.0" - }, - "domhandler": { - "version": "3.3.0", - "requires": { - "domelementtype": "^2.0.1" - } - }, - "domutils": { - "version": "2.8.0", - "requires": { - "dom-serializer": "^1.0.1", - "domelementtype": "^2.2.0", - "domhandler": "^4.2.0" - }, - "dependencies": { - "domhandler": { - "version": "4.3.0", - "requires": { - "domelementtype": "^2.2.0" - } - } - } - }, - "entities": { - "version": "2.2.0" - }, - "htmlparser2": { - "version": "4.1.0", - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^3.0.0", - "domutils": "^2.0.0", - "entities": "^2.0.0" - } - }, - "supports-color": { - "version": "5.5.0", - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "which": { - "version": "1.3.1", - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0" - }, - "wrap-ansi": { - "version": "6.2.0", - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "5.0.1" - }, - "ansi-styles": { - "version": "4.3.0", - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4" - }, - "strip-ansi": { - "version": "6.0.1", - "requires": { - "ansi-regex": "^5.0.1" - } - } - } - }, - "wrappy": { - "version": "1.0.2" - }, - "ws": { - "version": "6.2.2", - "requires": { - "async-limiter": "~1.0.0" - } - }, - "xtend": { - "version": "4.0.2" - }, - "y18n": { - "version": "4.0.3" - }, - "yallist": { - "version": "3.1.1" - }, - "yargs": { - "version": "15.4.1", - "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - } - }, - "yargs-parser": { - "version": "18.1.3", - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - }, - "yauzl": { - "version": "2.10.0", - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - } - } - }, - "w3c-hr-time": { - "version": "1.0.2", - "dev": true, - "requires": { - "browser-process-hrtime": "^1.0.0" - } - }, - "w3c-xmlserializer": { - "version": "2.0.0", - "dev": true, - "requires": { - "xml-name-validator": "^3.0.0" - } - }, - "walker": { - "version": "1.0.8", - "dev": true, - "requires": { - "makeerror": "1.0.12" - } - }, - "watchpack": { - "version": "1.7.5", - "dev": true, - "requires": { - "chokidar": "^3.4.1", - "graceful-fs": "^4.1.2", - "neo-async": "^2.5.0", - "watchpack-chokidar2": "^2.0.1" - }, - "dependencies": { - "anymatch": { - "version": "3.1.2", - "dev": true, - "optional": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "binary-extensions": { - "version": "2.2.0", - "dev": true, - "optional": true - }, - "braces": { - "version": "3.0.2", - "dev": true, - "optional": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "chokidar": { - "version": "3.5.2", - "dev": true, - "optional": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "fill-range": { - "version": "7.0.1", - "dev": true, - "optional": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "is-binary-path": { - "version": "2.1.0", - "dev": true, - "optional": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-number": { - "version": "7.0.0", - "dev": true, - "optional": true - }, - "readdirp": { - "version": "3.6.0", - "dev": true, - "optional": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "to-regex-range": { - "version": "5.0.1", - "dev": true, - "optional": true, - "requires": { - "is-number": "^7.0.0" - } - } - } - }, - "watchpack-chokidar2": { - "version": "2.0.1", - "dev": true, - "optional": true, - "requires": { - "chokidar": "^2.1.8" - } - }, - "wbuf": { - "version": "1.7.3", - "dev": true, - "requires": { - "minimalistic-assert": "^1.0.0" - } - }, - "web-streams-polyfill": { - "version": "4.0.0-beta.1" - }, - "webidl-conversions": { - "version": "6.1.0", - "dev": true - }, - "webpack": { - "version": "4.46.0", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.9.0", - "@webassemblyjs/helper-module-context": "1.9.0", - "@webassemblyjs/wasm-edit": "1.9.0", - "@webassemblyjs/wasm-parser": "1.9.0", - "acorn": "^6.4.1", - "ajv": "^6.10.2", - "ajv-keywords": "^3.4.1", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^4.5.0", - "eslint-scope": "^4.0.3", - "json-parse-better-errors": "^1.0.2", - "loader-runner": "^2.4.0", - "loader-utils": "^1.2.3", - "memory-fs": "^0.4.1", - "micromatch": "^3.1.10", - "mkdirp": "^0.5.3", - "neo-async": "^2.6.1", - "node-libs-browser": "^2.2.1", - "schema-utils": "^1.0.0", - "tapable": "^1.1.3", - "terser-webpack-plugin": "^1.4.3", - "watchpack": "^1.7.4", - "webpack-sources": "^1.4.1" - }, - "dependencies": { - "acorn": { - "version": "6.4.2", - "dev": true - }, - "define-property": { - "version": "2.0.2", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - } - }, - "eslint-scope": { - "version": "4.0.3", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "extend-shallow": { - "version": "3.0.2", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-extendable": { - "version": "1.0.1", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "micromatch": { - "version": "3.1.10", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - }, - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "schema-utils": { - "version": "1.0.0", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - } - } - }, - "webpack-cli": { - "version": "3.3.12", - "dev": true, - "requires": { - "chalk": "^2.4.2", - "cross-spawn": "^6.0.5", - "enhanced-resolve": "^4.1.1", - "findup-sync": "^3.0.0", - "global-modules": "^2.0.0", - "import-local": "^2.0.0", - "interpret": "^1.4.0", - "loader-utils": "^1.4.0", - "supports-color": "^6.1.0", - "v8-compile-cache": "^2.1.1", - "yargs": "^13.3.2" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "dev": true - }, - "cliui": { - "version": "5.0.0", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "cross-spawn": { - "version": "6.0.5", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "emoji-regex": { - "version": "7.0.3", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "get-caller-file": { - "version": "2.0.5", - "dev": true - }, - "global-modules": { - "version": "2.0.0", - "dev": true, - "requires": { - "global-prefix": "^3.0.0" - } - }, - "global-prefix": { - "version": "3.0.0", - "dev": true, - "requires": { - "ini": "^1.3.5", - "kind-of": "^6.0.2", - "which": "^1.3.1" - } - }, - "import-local": { - "version": "2.0.0", - "dev": true, - "requires": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "locate-path": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "dev": true - }, - "resolve-cwd": { - "version": "2.0.0", - "dev": true, - "requires": { - "resolve-from": "^3.0.0" - } - }, - "resolve-from": { - "version": "3.0.0", - "dev": true - }, - "semver": { - "version": "5.7.1", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "supports-color": { - "version": "6.1.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "which": { - "version": "1.3.1", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "dev": true - }, - "wrap-ansi": { - "version": "5.1.0", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, - "yargs": { - "version": "13.3.2", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "yargs-parser": { - "version": "13.1.2", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "webpack-dev-middleware": { - "version": "3.7.3", - "dev": true, - "requires": { - "memory-fs": "^0.4.1", - "mime": "^2.4.4", - "mkdirp": "^0.5.1", - "range-parser": "^1.2.1", - "webpack-log": "^2.0.0" - }, - "dependencies": { - "mkdirp": { - "version": "0.5.5", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - } - } - }, - "webpack-dev-server": { - "version": "3.11.3", - "dev": true, - "requires": { - "ansi-html-community": "0.0.8", - "bonjour": "^3.5.0", - "chokidar": "^2.1.8", - "compression": "^1.7.4", - "connect-history-api-fallback": "^1.6.0", - "debug": "^4.1.1", - "del": "^4.1.1", - "express": "^4.17.1", - "html-entities": "^1.3.1", - "http-proxy-middleware": "0.19.1", - "import-local": "^2.0.0", - "internal-ip": "^4.3.0", - "ip": "^1.1.5", - "is-absolute-url": "^3.0.3", - "killable": "^1.0.1", - "loglevel": "^1.6.8", - "opn": "^5.5.0", - "p-retry": "^3.0.1", - "portfinder": "^1.0.26", - "schema-utils": "^1.0.0", - "selfsigned": "^1.10.8", - "semver": "^6.3.0", - "serve-index": "^1.9.1", - "sockjs": "^0.3.21", - "sockjs-client": "^1.5.0", - "spdy": "^4.0.2", - "strip-ansi": "^3.0.1", - "supports-color": "^6.1.0", - "url": "^0.11.0", - "webpack-dev-middleware": "^3.7.2", - "webpack-log": "^2.0.0", - "ws": "^6.2.1", - "yargs": "^13.3.2" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "cliui": { - "version": "5.0.0", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "del": { - "version": "4.1.1", - "dev": true, - "requires": { - "@types/glob": "^7.1.1", - "globby": "^6.1.0", - "is-path-cwd": "^2.0.0", - "is-path-in-cwd": "^2.0.0", - "p-map": "^2.0.0", - "pify": "^4.0.1", - "rimraf": "^2.6.3" - }, - "dependencies": { - "pify": { - "version": "4.0.1", - "dev": true - } - } - }, - "emoji-regex": { - "version": "7.0.3", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "get-caller-file": { - "version": "2.0.5", - "dev": true - }, - "globby": { - "version": "6.1.0", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "glob": "^7.0.3", - "object-assign": "^4.0.1", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "import-local": { - "version": "2.0.0", - "dev": true, - "requires": { - "pkg-dir": "^3.0.0", - "resolve-cwd": "^2.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "dev": true - }, - "is-path-cwd": { - "version": "2.2.0", - "dev": true - }, - "is-path-in-cwd": { - "version": "2.1.0", - "dev": true, - "requires": { - "is-path-inside": "^2.1.0" - } - }, - "is-path-inside": { - "version": "2.1.0", - "dev": true, - "requires": { - "path-is-inside": "^1.0.2" - } - }, - "locate-path": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "path-exists": { - "version": "3.0.0", - "dev": true - }, - "punycode": { - "version": "1.3.2", - "dev": true - }, - "require-main-filename": { - "version": "2.0.0", - "dev": true - }, - "resolve-cwd": { - "version": "2.0.0", - "dev": true, - "requires": { - "resolve-from": "^3.0.0" - } - }, - "resolve-from": { - "version": "3.0.0", - "dev": true - }, - "schema-utils": { - "version": "1.0.0", - "dev": true, - "requires": { - "ajv": "^6.1.0", - "ajv-errors": "^1.0.0", - "ajv-keywords": "^3.1.0" - } - }, - "string-width": { - "version": "3.1.0", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "6.1.0", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - }, - "url": { - "version": "0.11.0", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, - "which-module": { - "version": "2.0.0", - "dev": true - }, - "wrap-ansi": { - "version": "5.1.0", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } - } - }, - "ws": { - "version": "6.2.2", - "dev": true, - "requires": { - "async-limiter": "~1.0.0" - } - }, - "yargs": { - "version": "13.3.2", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "yargs-parser": { - "version": "13.1.2", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } - } - } - }, - "webpack-log": { - "version": "2.0.0", - "dev": true, - "requires": { - "ansi-colors": "^3.0.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "ansi-colors": { - "version": "3.2.4", - "dev": true - } - } - }, - "webpack-merge": { - "version": "4.2.2", - "dev": true, - "requires": { - "lodash": "^4.17.15" - } - }, - "webpack-sources": { - "version": "1.4.3", - "dev": true, - "requires": { - "source-list-map": "^2.0.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "dev": true - } - } - }, - "websocket-driver": { - "version": "0.7.4", - "dev": true, - "requires": { - "http-parser-js": ">=0.5.1", - "safe-buffer": ">=5.1.0", - "websocket-extensions": ">=0.1.1" - } - }, - "websocket-extensions": { - "version": "0.1.4", - "dev": true - }, - "whatwg-encoding": { - "version": "1.0.5", - "dev": true, - "requires": { - "iconv-lite": "0.4.24" - } - }, - "whatwg-mimetype": { - "version": "2.3.0", - "dev": true - }, - "whatwg-url": { - "version": "8.7.0", - "dev": true, - "requires": { - "lodash": "^4.7.0", - "tr46": "^2.1.0", - "webidl-conversions": "^6.1.0" - } - }, - "which": { - "version": "2.0.2", - "requires": { - "isexe": "^2.0.0" - } - }, - "which-boxed-primitive": { - "version": "1.0.2", - "dev": true, - "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" - } - }, - "which-module": { - "version": "1.0.0", - "dev": true - }, - "wide-align": { - "version": "1.1.5", - "requires": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, - "widest-line": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", - "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", - "dev": true, - "requires": { - "string-width": "^4.0.0" - }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - } - } - }, - "with-open-file": { - "version": "0.1.7", - "requires": { - "p-finally": "^1.0.0", - "p-try": "^2.1.0", - "pify": "^4.0.1" - }, - "dependencies": { - "pify": { - "version": "4.0.1" - } - } - }, - "word-count": { - "version": "0.2.2" - }, - "word-wrap": { - "version": "1.2.3", - "dev": true - }, - "worker-farm": { - "version": "1.7.0", - "dev": true, - "requires": { - "errno": "~0.1.7" - } - }, - "wrap-ansi": { - "version": "2.1.0", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - } - } - }, - "wrappy": { - "version": "1.0.2" - }, - "write-file-atomic": { - "version": "3.0.3", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4", - "is-typedarray": "^1.0.0", - "signal-exit": "^3.0.2", - "typedarray-to-buffer": "^3.1.5" - } - }, - "ws": { - "version": "7.5.6", - "requires": {} - }, - "x-xss-protection": { - "version": "1.3.0" - }, - "xdg-basedir": { - "version": "3.0.0" - }, - "xml": { - "version": "1.0.1", - "dev": true - }, - "xml-name-validator": { - "version": "3.0.0", - "dev": true - }, - "xml2js": { - "version": "0.4.23", - "requires": { - "sax": ">=0.6.0", - "xmlbuilder": "~11.0.0" - } - }, - "xmlbuilder": { - "version": "11.0.1" - }, - "xmlchars": { - "version": "2.2.0", - "dev": true - }, - "xmlcreate": { - "version": "1.0.2" - }, - "xtend": { - "version": "4.0.2" - }, - "y18n": { - "version": "4.0.3", - "dev": true - }, - "yallist": { - "version": "3.1.1" - }, - "yaml-loader": { - "version": "0.5.0", - "dev": true, - "requires": { - "js-yaml": "^3.5.2" - } - }, - "yamljs": { - "version": "0.3.0", - "requires": { - "argparse": "^1.0.7", - "glob": "^7.0.5" - } - }, - "yargs": { - "version": "7.1.2", - "dev": true, - "requires": { - "camelcase": "^3.0.0", - "cliui": "^3.2.0", - "decamelize": "^1.1.1", - "get-caller-file": "^1.0.1", - "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.1" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "dev": true - }, - "find-up": { - "version": "1.1.2", - "dev": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - }, - "invert-kv": { - "version": "1.0.0", - "dev": true - }, - "lcid": { - "version": "1.0.0", - "dev": true, - "requires": { - "invert-kv": "^1.0.0" - } - }, - "os-locale": { - "version": "1.4.0", - "dev": true, - "requires": { - "lcid": "^1.0.0" - } - }, - "path-exists": { - "version": "2.1.0", - "dev": true, - "requires": { - "pinkie-promise": "^2.0.0" - } - }, - "read-pkg": { - "version": "1.1.0", - "dev": true, - "requires": { - "load-json-file": "^1.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" - } - }, - "read-pkg-up": { - "version": "1.0.1", - "dev": true, - "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - } - }, - "y18n": { - "version": "3.2.2", - "dev": true - } - } - }, - "yargs-parser": { - "version": "5.0.1", - "dev": true, - "requires": { - "camelcase": "^3.0.0", - "object.assign": "^4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "3.0.0", - "dev": true - } - } - }, - "yauzl": { - "version": "2.10.0", - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } - } - } -} From 558585fd154288322f6716e555e8363677a84961 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 12 May 2022 12:08:12 +0200 Subject: [PATCH 091/141] Updated redmine link --- print/templates/email/osticket-report/osticket-report.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/print/templates/email/osticket-report/osticket-report.html b/print/templates/email/osticket-report/osticket-report.html index 76973c8e1..a9cf9a24a 100644 --- a/print/templates/email/osticket-report/osticket-report.html +++ b/print/templates/email/osticket-report/osticket-report.html @@ -35,8 +35,8 @@

From eb0314e32ffe1c3c9b22e7278ab9bc416a026ec7 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 12 May 2022 12:20:55 +0200 Subject: [PATCH 092/141] disabled --prefer-offline --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e7f9d3630..242d793f7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,7 +41,7 @@ pipeline { } steps { nodejs('node-v14') { - sh 'npm install --no-audit --prefer-offline' + sh 'npm install --no-audit' sh 'gulp install --ci' } } From eee2d26f5ec99019f0bb1c5e3f44f126ab563f41 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 12 May 2022 12:37:56 +0200 Subject: [PATCH 093/141] nodemon removed from CI test run --- Jenkinsfile | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e7f9d3630..4a1f9ba54 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -65,7 +65,7 @@ pipeline { stage('Backend') { steps { nodejs('node-v14') { - sh 'npm run test:back ci' + sh 'npm run test:back:ci' } } } diff --git a/package.json b/package.json index b0d6c9bd5..52741641a 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "scripts": { "dbtest": "nodemon -q db/tests.js -w db/tests", "test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json", + "test:back:ci": "node back/tests.js ci", "test:e2e": "node e2e/helpers/tests.js", "test:front": "jest --watch", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", From 9a47bdafbe7150af94c77ec193f49eedd8b91065 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 12 May 2022 13:24:19 +0200 Subject: [PATCH 094/141] debuging conection errors on CI db --- db/docker.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db/docker.js b/db/docker.js index ea9fe8ed1..13fa79130 100644 --- a/db/docker.js +++ b/db/docker.js @@ -1,5 +1,6 @@ const exec = require('child_process').exec; const log = require('fancy-log'); +const {ConstraintViolationError} = require('ldapjs'); const dataSources = require('../loopback/server/datasources.json'); module.exports = class Docker { @@ -158,8 +159,12 @@ module.exports = class Docker { return reject(new Error('Docker exited, please see the docker logs for more info')); let conn = mysql.createConnection(myConf); + console.log('myConf', myConf); + conn.on('error', () => {}); conn.connect(err => { + console.log('err', err); + conn.destroy(); if (!err) { log('MySQL process ready.'); From 526bc99c4f7556903909eb611ce6d9eac3acb006 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 12 May 2022 13:51:31 +0200 Subject: [PATCH 095/141] docker container.run now receives boolean flag isCI --- back/tests.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/back/tests.js b/back/tests.js index a51b95698..88640c83d 100644 --- a/back/tests.js +++ b/back/tests.js @@ -8,14 +8,14 @@ process.on('warning', warning => { }); async function test() { - let verbose = false; + let isCI = false; if (process.argv[2] === 'ci') - verbose = true; + isCI = true; const container = new Docker(); - await container.run(process.argv.ci); + await container.run(isCI); dataSources = JSON.parse(JSON.stringify(dataSources)); Object.assign(dataSources.vn, { @@ -45,8 +45,8 @@ async function test() { jasmine.addReporter(new SpecReporter({ spec: { - displaySuccessful: verbose, - displayPending: verbose + displaySuccessful: isCI, + displayPending: isCI }, summary: { displayPending: false, From 9778783dfa033fe2ec2beac14e6363b1c447c0e2 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Thu, 12 May 2022 14:02:50 +0200 Subject: [PATCH 096/141] removed unused console logs --- db/docker.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/db/docker.js b/db/docker.js index 13fa79130..daf1b0c5b 100644 --- a/db/docker.js +++ b/db/docker.js @@ -159,12 +159,9 @@ module.exports = class Docker { return reject(new Error('Docker exited, please see the docker logs for more info')); let conn = mysql.createConnection(myConf); - console.log('myConf', myConf); conn.on('error', () => {}); conn.connect(err => { - console.log('err', err); - conn.destroy(); if (!err) { log('MySQL process ready.'); From fd7bed9933f5730b4502b5aa0e8a3df3544046bd Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 12 May 2022 15:28:52 +0200 Subject: [PATCH 097/141] CI launch back tests only --- Jenkinsfile | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 903692ad9..2e97b66c5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -54,20 +54,9 @@ pipeline { environment { NODE_ENV = "" } - parallel { - stage('Frontend') { - steps { - nodejs('node-v14') { - sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' - } - } - } - stage('Backend') { - steps { - nodejs('node-v14') { - sh 'npm run test:back:ci' - } - } + steps { + nodejs('node-v14') { + sh 'npm run test:back:ci' } } } From 17957c0987abe1cd41837524a2f268911a2315ad Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 12 May 2022 15:35:25 +0200 Subject: [PATCH 098/141] Run with parallel --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2e97b66c5..7a21cfa2f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,7 +46,7 @@ pipeline { } } } - stage('Test') { + stage('Test/Back') { when { not { anyOf { branch 'test' branch 'master' From ad4bee7a161e4d257aa14e737d761f847624c17a Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 12 May 2022 15:44:11 +0200 Subject: [PATCH 099/141] Show build status --- db/docker.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/docker.js b/db/docker.js index daf1b0c5b..86659a37c 100644 --- a/db/docker.js +++ b/db/docker.js @@ -25,6 +25,8 @@ module.exports = class Docker { let d = new Date(); let pad = v => v < 10 ? '0' + v : v; let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`; + + log('Building container image...'); await this.execP(`docker build --build-arg STAMP=${stamp} -t salix-db ./db`); let dockerArgs; @@ -40,6 +42,7 @@ module.exports = class Docker { let runChown = process.platform != 'linux'; + log('Starting container...'); const container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`); this.id = container.stdout.trim(); From f7077aaa3fa21cc81907502a53e84fc51cbef105 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 12 May 2022 15:56:34 +0200 Subject: [PATCH 100/141] Show build status --- db/docker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/docker.js b/db/docker.js index 86659a37c..34026f85f 100644 --- a/db/docker.js +++ b/db/docker.js @@ -1,6 +1,5 @@ const exec = require('child_process').exec; const log = require('fancy-log'); -const {ConstraintViolationError} = require('ldapjs'); const dataSources = require('../loopback/server/datasources.json'); module.exports = class Docker { @@ -28,6 +27,7 @@ module.exports = class Docker { log('Building container image...'); await this.execP(`docker build --build-arg STAMP=${stamp} -t salix-db ./db`); + log('Image built.'); let dockerArgs; From 9c543070595584eda3c08c09a25d7b7c15522c0d Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 12 May 2022 16:18:08 +0200 Subject: [PATCH 101/141] run parallel --- Jenkinsfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7a21cfa2f..903692ad9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -46,7 +46,7 @@ pipeline { } } } - stage('Test/Back') { + stage('Test') { when { not { anyOf { branch 'test' branch 'master' @@ -54,9 +54,20 @@ pipeline { environment { NODE_ENV = "" } - steps { - nodejs('node-v14') { - sh 'npm run test:back:ci' + parallel { + stage('Frontend') { + steps { + nodejs('node-v14') { + sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' + } + } + } + stage('Backend') { + steps { + nodejs('node-v14') { + sh 'npm run test:back:ci' + } + } } } } From 2031639d71f9f0bc6c0999683379ec7c08dcdd20 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 12 May 2022 16:36:38 +0200 Subject: [PATCH 102/141] Back only --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 903692ad9..5f77ade3a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,13 +55,13 @@ pipeline { NODE_ENV = "" } parallel { - stage('Frontend') { + /* stage('Frontend') { steps { nodejs('node-v14') { sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' } } - } + } */ stage('Backend') { steps { nodejs('node-v14') { From 04d86da48f0c425cea2cfb05b0f0699803cacf8a Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 08:47:53 +0200 Subject: [PATCH 103/141] Run changePassword() --- back/methods/account/specs/change-password.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index 9f1130df5..0cc550e9e 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -describe('account changePassword()', () => { +fdescribe('account changePassword()', () => { it('should throw an error when old password is wrong', async() => { let req = app.models.Account.changePassword(null, 1, 'wrongOldPass', 'newPass'); From a697438019089ce23abd0229b7dcec9a40ddf913 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 09:02:33 +0200 Subject: [PATCH 104/141] Jest junit --- jest.front.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.front.config.js b/jest.front.config.js index dbea13950..a03c61d11 100644 --- a/jest.front.config.js +++ b/jest.front.config.js @@ -47,5 +47,6 @@ module.exports = { '^.+\\.js?$': 'babel-jest', '^.+\\.html$': 'html-loader-jest' }, + reporters: ['default', 'jest-junit'] }; From 59b6a3bc0c4b98415aeeba315dcc95c56f8ebe26 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 09:06:26 +0200 Subject: [PATCH 105/141] Jest CI --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5f77ade3a..43afa1e06 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,20 +55,20 @@ pipeline { NODE_ENV = "" } parallel { - /* stage('Frontend') { + stage('Frontend') { steps { nodejs('node-v14') { sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' } } - } */ - stage('Backend') { + } + /* stage('Backend') { steps { nodejs('node-v14') { sh 'npm run test:back:ci' } } - } + } */ } } stage('Build') { From c47f8dcd35eed404029605f124fc99e95a7d7032 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 09:49:52 +0200 Subject: [PATCH 106/141] Disabled junitresults --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 43afa1e06..342b8c3d0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -121,7 +121,7 @@ pipeline { script { if (!['master', 'test'].contains(env.BRANCH_NAME)) { try { - junit 'junitresults.xml' + // junit 'junitresults.xml' junit 'junit.xml' } catch (e) { echo e.toString() From 6b18432f879261fadbf50819277a66aaf4fcef03 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 09:53:47 +0200 Subject: [PATCH 107/141] Force test to fail --- modules/ticket/front/sale/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index a8ac2f3de..fcc1fc150 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -90,7 +90,7 @@ describe('Ticket', () => { const result = controller.isClaimable; - expect(result).toEqual(false); + expect(result).toEqual(true); }); }); From f8db3c31dfc9ca90776c99a87e52eca7b9d87583 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 10:02:34 +0200 Subject: [PATCH 108/141] Proper test result --- modules/ticket/front/sale/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index fcc1fc150..a8ac2f3de 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -90,7 +90,7 @@ describe('Ticket', () => { const result = controller.isClaimable; - expect(result).toEqual(true); + expect(result).toEqual(false); }); }); From c935655835a8f44b5b2d6f2fc0165bfebc40ac88 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 10:03:18 +0200 Subject: [PATCH 109/141] Enabled back tests --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 342b8c3d0..59806f497 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,20 +55,20 @@ pipeline { NODE_ENV = "" } parallel { - stage('Frontend') { + /* stage('Frontend') { steps { nodejs('node-v14') { sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' } } - } - /* stage('Backend') { + } */ + stage('Backend') { steps { nodejs('node-v14') { sh 'npm run test:back:ci' } } - } */ + } } } stage('Build') { From 75da4cfc3f92bfa6e19eba2baa418ab12b10c87e Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 10:22:05 +0200 Subject: [PATCH 110/141] Disabled ldap sync --- back/methods/account/change-password.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/account/change-password.js b/back/methods/account/change-password.js index 25b63b9a8..8dbc88e3e 100644 --- a/back/methods/account/change-password.js +++ b/back/methods/account/change-password.js @@ -29,6 +29,6 @@ module.exports = Self => { Self.changePassword = async function(id, oldPassword, newPassword) { await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`, [id, oldPassword, newPassword]); - await Self.app.models.UserAccount.syncById(id, newPassword); + // await Self.app.models.UserAccount.syncById(id, newPassword); }; }; From 649be482b500d4d4175d8ec342337b8b781484b0 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 10:52:05 +0200 Subject: [PATCH 111/141] Updated changePassword() --- Jenkinsfile | 2 +- back/methods/account/change-password.js | 2 +- back/methods/account/specs/change-password.spec.js | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 59806f497..97fec5b48 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -41,7 +41,7 @@ pipeline { } steps { nodejs('node-v14') { - sh 'npm install --no-audit' + sh 'npm install --no-audit --prefer-offline' sh 'gulp install --ci' } } diff --git a/back/methods/account/change-password.js b/back/methods/account/change-password.js index 8dbc88e3e..25b63b9a8 100644 --- a/back/methods/account/change-password.js +++ b/back/methods/account/change-password.js @@ -29,6 +29,6 @@ module.exports = Self => { Self.changePassword = async function(id, oldPassword, newPassword) { await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`, [id, oldPassword, newPassword]); - // await Self.app.models.UserAccount.syncById(id, newPassword); + await Self.app.models.UserAccount.syncById(id, newPassword); }; }; diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index 0cc550e9e..2dbd426ee 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -1,9 +1,10 @@ -const app = require('vn-loopback/server/server'); +const {models} = require('vn-loopback/server/server'); fdescribe('account changePassword()', () => { it('should throw an error when old password is wrong', async() => { - let req = app.models.Account.changePassword(null, 1, 'wrongOldPass', 'newPass'); + const response = models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999'); - await expectAsync(req).toBeRejected(); + const error = new Error('ER_SIGNAL_EXCEPTION: Invalid password'); + await expectAsync(response).toBeRejectedWith(error); }); }); From 4479337731c67485d0bc72c43960b9238316b905 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 10:59:13 +0200 Subject: [PATCH 112/141] Updated test --- Jenkinsfile | 2 +- back/methods/account/specs/change-password.spec.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 97fec5b48..f1ab01af9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -122,7 +122,7 @@ pipeline { if (!['master', 'test'].contains(env.BRANCH_NAME)) { try { // junit 'junitresults.xml' - junit 'junit.xml' + // junit 'junit.xml' } catch (e) { echo e.toString() } diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index 2dbd426ee..9fb3200a7 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -2,9 +2,11 @@ const {models} = require('vn-loopback/server/server'); fdescribe('account changePassword()', () => { it('should throw an error when old password is wrong', async() => { - const response = models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999'); + let err; + await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999') + .catch(error => err = error.sqlMessage); - const error = new Error('ER_SIGNAL_EXCEPTION: Invalid password'); - await expectAsync(response).toBeRejectedWith(error); + expect(err).toBeDefined(); + expect(err).toEqual('Invalid password'); }); }); From 5cbe5b63595fe845b5007419770adf3b89405b47 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:17:11 +0200 Subject: [PATCH 113/141] Updated unit test --- back/methods/account/change-password.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/back/methods/account/change-password.js b/back/methods/account/change-password.js index 25b63b9a8..abe97a57e 100644 --- a/back/methods/account/change-password.js +++ b/back/methods/account/change-password.js @@ -29,6 +29,8 @@ module.exports = Self => { Self.changePassword = async function(id, oldPassword, newPassword) { await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`, [id, oldPassword, newPassword]); - await Self.app.models.UserAccount.syncById(id, newPassword); + // await Self.app.models.UserAccount.syncById(id, newPassword); + + return true; }; }; From 2ed9b36b0d85e1b1e4f61f7a2da86c9260707ad4 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:23:09 +0200 Subject: [PATCH 114/141] Updated unit test --- back/methods/account/change-password.js | 4 ++-- back/methods/account/specs/change-password.spec.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/back/methods/account/change-password.js b/back/methods/account/change-password.js index abe97a57e..d70fb4255 100644 --- a/back/methods/account/change-password.js +++ b/back/methods/account/change-password.js @@ -27,8 +27,8 @@ module.exports = Self => { }); Self.changePassword = async function(id, oldPassword, newPassword) { - await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`, - [id, oldPassword, newPassword]); + // await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`, + // [id, oldPassword, newPassword]); // await Self.app.models.UserAccount.syncById(id, newPassword); return true; diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index 9fb3200a7..bf703f261 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -2,11 +2,11 @@ const {models} = require('vn-loopback/server/server'); fdescribe('account changePassword()', () => { it('should throw an error when old password is wrong', async() => { - let err; - await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999') + // let err; + const result = await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999') .catch(error => err = error.sqlMessage); - expect(err).toBeDefined(); - expect(err).toEqual('Invalid password'); + expect(result).toBe(true); + // expect(err).toEqual('Invalid password'); }); }); From d8ebc69612c6bd42407de3d5fbc12f6c0a5f4720 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:31:18 +0200 Subject: [PATCH 115/141] Excluded back unit test --- back/methods/account/change-password.js | 8 +++----- back/methods/account/specs/change-password.spec.js | 12 +++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/back/methods/account/change-password.js b/back/methods/account/change-password.js index d70fb4255..25b63b9a8 100644 --- a/back/methods/account/change-password.js +++ b/back/methods/account/change-password.js @@ -27,10 +27,8 @@ module.exports = Self => { }); Self.changePassword = async function(id, oldPassword, newPassword) { - // await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`, - // [id, oldPassword, newPassword]); - // await Self.app.models.UserAccount.syncById(id, newPassword); - - return true; + await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`, + [id, oldPassword, newPassword]); + await Self.app.models.UserAccount.syncById(id, newPassword); }; }; diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index bf703f261..54526a5ba 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -1,12 +1,14 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('account changePassword()', () => { +describe('account changePassword()', () => { it('should throw an error when old password is wrong', async() => { - // let err; - const result = await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999') + pending('#4038 - Throws a timeout error on CI but not locally'); + + let err; + await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999') .catch(error => err = error.sqlMessage); - expect(result).toBe(true); - // expect(err).toEqual('Invalid password'); + expect(err).toBeDefined(); + expect(err).toEqual('Invalid password'); }); }); From 057d825be9928efca13f633e056ba152e06107c5 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:37:31 +0200 Subject: [PATCH 116/141] Log on boot --- back/tests.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/back/tests.js b/back/tests.js index 88640c83d..167f7ae98 100644 --- a/back/tests.js +++ b/back/tests.js @@ -25,7 +25,9 @@ async function test() { const bootOptions = {dataSources}; const app = require('vn-loopback/server/server'); - app.boot(bootOptions); + app.boot(bootOptions, () => { + console.log('------------------------------ BOOTED ----------------------------------------------'); + }); const Jasmine = require('jasmine'); const jasmine = new Jasmine(); From 35a579f06b377304370005102b8457ede8d42704 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:41:22 +0200 Subject: [PATCH 117/141] Launch on boot --- back/tests.js | 66 +++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/back/tests.js b/back/tests.js index 167f7ae98..6e8c7b405 100644 --- a/back/tests.js +++ b/back/tests.js @@ -25,41 +25,39 @@ async function test() { const bootOptions = {dataSources}; const app = require('vn-loopback/server/server'); - app.boot(bootOptions, () => { - console.log('------------------------------ BOOTED ----------------------------------------------'); + app.boot(bootOptions, async() => { + const Jasmine = require('jasmine'); + const jasmine = new Jasmine(); + const SpecReporter = require('jasmine-spec-reporter').SpecReporter; + + const backSpecs = [ + './back/**/*[sS]pec.js', + './loopback/**/*[sS]pec.js', + './modules/*/back/**/*.[sS]pec.js' + ]; + + jasmine.loadConfig({ + spec_dir: '.', + spec_files: backSpecs, + helpers: [] + }); + + jasmine.addReporter(new SpecReporter({ + spec: { + displaySuccessful: isCI, + displayPending: isCI + }, + summary: { + displayPending: false, + } + })); + + jasmine.exitOnCompletion = false; + await jasmine.execute(); + if (app) await app.disconnect(); + if (container) await container.rm(); + console.log('app disconnected & container removed'); }); - - const Jasmine = require('jasmine'); - const jasmine = new Jasmine(); - const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - - const backSpecs = [ - './back/**/*[sS]pec.js', - './loopback/**/*[sS]pec.js', - './modules/*/back/**/*.[sS]pec.js' - ]; - - jasmine.loadConfig({ - spec_dir: '.', - spec_files: backSpecs, - helpers: [] - }); - - jasmine.addReporter(new SpecReporter({ - spec: { - displaySuccessful: isCI, - displayPending: isCI - }, - summary: { - displayPending: false, - } - })); - - jasmine.exitOnCompletion = false; - await jasmine.execute(); - if (app) await app.disconnect(); - if (container) await container.rm(); - console.log('app disconnected & container removed'); } test(); From 490b5fc6dfbe35cfb5aca0f64200b3d0d948a200 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:44:04 +0200 Subject: [PATCH 118/141] Sleep --- back/tests.js | 58 ++++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/back/tests.js b/back/tests.js index 6e8c7b405..c6c587255 100644 --- a/back/tests.js +++ b/back/tests.js @@ -25,39 +25,41 @@ async function test() { const bootOptions = {dataSources}; const app = require('vn-loopback/server/server'); - app.boot(bootOptions, async() => { - const Jasmine = require('jasmine'); - const jasmine = new Jasmine(); - const SpecReporter = require('jasmine-spec-reporter').SpecReporter; + app.boot(bootOptions); - const backSpecs = [ - './back/**/*[sS]pec.js', - './loopback/**/*[sS]pec.js', - './modules/*/back/**/*.[sS]pec.js' - ]; + await new Promise(resolve => setTimeout(resolve, 5000)); - jasmine.loadConfig({ - spec_dir: '.', - spec_files: backSpecs, - helpers: [] - }); + const Jasmine = require('jasmine'); + const jasmine = new Jasmine(); + const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - jasmine.addReporter(new SpecReporter({ - spec: { - displaySuccessful: isCI, - displayPending: isCI - }, - summary: { - displayPending: false, - } - })); + const backSpecs = [ + './back/**/*[sS]pec.js', + './loopback/**/*[sS]pec.js', + './modules/*/back/**/*.[sS]pec.js' + ]; - jasmine.exitOnCompletion = false; - await jasmine.execute(); - if (app) await app.disconnect(); - if (container) await container.rm(); - console.log('app disconnected & container removed'); + jasmine.loadConfig({ + spec_dir: '.', + spec_files: backSpecs, + helpers: [] }); + + jasmine.addReporter(new SpecReporter({ + spec: { + displaySuccessful: isCI, + displayPending: isCI + }, + summary: { + displayPending: false, + } + })); + + jasmine.exitOnCompletion = false; + await jasmine.execute(); + if (app) await app.disconnect(); + if (container) await container.rm(); + console.log('app disconnected & container removed'); } test(); From 330763a745f2d35ddbfcc1e1a7f4e5a91757b3f4 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:46:44 +0200 Subject: [PATCH 119/141] Sleep --- back/tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/tests.js b/back/tests.js index c6c587255..8f612c220 100644 --- a/back/tests.js +++ b/back/tests.js @@ -27,7 +27,7 @@ async function test() { const app = require('vn-loopback/server/server'); app.boot(bootOptions); - await new Promise(resolve => setTimeout(resolve, 5000)); + await new Promise(resolve => setTimeout(resolve, 15000)); const Jasmine = require('jasmine'); const jasmine = new Jasmine(); From 65e68cf4dd404584cf3f1eb8972417ebff629461 Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:51:45 +0200 Subject: [PATCH 120/141] Increased timeout --- back/tests.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/back/tests.js b/back/tests.js index 8f612c220..57e800772 100644 --- a/back/tests.js +++ b/back/tests.js @@ -27,8 +27,6 @@ async function test() { const app = require('vn-loopback/server/server'); app.boot(bootOptions); - await new Promise(resolve => setTimeout(resolve, 15000)); - const Jasmine = require('jasmine'); const jasmine = new Jasmine(); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; @@ -42,7 +40,7 @@ async function test() { jasmine.loadConfig({ spec_dir: '.', spec_files: backSpecs, - helpers: [] + helpers: [], }); jasmine.addReporter(new SpecReporter({ @@ -56,6 +54,7 @@ async function test() { })); jasmine.exitOnCompletion = false; + jasmine.defaultTimeoutInterval = 40000; await jasmine.execute(); if (app) await app.disconnect(); if (container) await container.rm(); From 0c6852f35ae72ad26d5631a57e931314ac2d919c Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:52:49 +0200 Subject: [PATCH 121/141] Included test --- back/methods/account/specs/change-password.spec.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index 54526a5ba..9fb3200a7 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -1,9 +1,7 @@ const {models} = require('vn-loopback/server/server'); -describe('account changePassword()', () => { +fdescribe('account changePassword()', () => { it('should throw an error when old password is wrong', async() => { - pending('#4038 - Throws a timeout error on CI but not locally'); - let err; await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999') .catch(error => err = error.sqlMessage); From ccf3366e1a8c7e3bef746067d8ac5401d4f4172a Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 13 May 2022 11:55:04 +0200 Subject: [PATCH 122/141] Timeout --- back/tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/tests.js b/back/tests.js index 57e800772..7bd4392af 100644 --- a/back/tests.js +++ b/back/tests.js @@ -54,7 +54,7 @@ async function test() { })); jasmine.exitOnCompletion = false; - jasmine.defaultTimeoutInterval = 40000; + jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000; await jasmine.execute(); if (app) await app.disconnect(); if (container) await container.rm(); From 9be7d46fb212c7406c7d0243ea66f3beb0941f0b Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 11:57:36 +0200 Subject: [PATCH 123/141] added timeout to failing test --- back/methods/account/specs/change-password.spec.js | 2 +- back/tests.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index 9fb3200a7..0366a926d 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -8,5 +8,5 @@ fdescribe('account changePassword()', () => { expect(err).toBeDefined(); expect(err).toEqual('Invalid password'); - }); + }, 40000); }); diff --git a/back/tests.js b/back/tests.js index 7bd4392af..1873c914c 100644 --- a/back/tests.js +++ b/back/tests.js @@ -54,7 +54,6 @@ async function test() { })); jasmine.exitOnCompletion = false; - jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000; await jasmine.execute(); if (app) await app.disconnect(); if (container) await container.rm(); From 09a1dc62df0d54d9b30fc5fc44052acbc1297edb Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 12:05:41 +0200 Subject: [PATCH 124/141] jasmine default timeout 30 secs on CI --- back/methods/account/specs/change-password.spec.js | 4 ++-- back/tests.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/back/methods/account/specs/change-password.spec.js b/back/methods/account/specs/change-password.spec.js index 0366a926d..17fadb3c6 100644 --- a/back/methods/account/specs/change-password.spec.js +++ b/back/methods/account/specs/change-password.spec.js @@ -1,6 +1,6 @@ const {models} = require('vn-loopback/server/server'); -fdescribe('account changePassword()', () => { +describe('account changePassword()', () => { it('should throw an error when old password is wrong', async() => { let err; await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999') @@ -8,5 +8,5 @@ fdescribe('account changePassword()', () => { expect(err).toBeDefined(); expect(err).toEqual('Invalid password'); - }, 40000); + }); }); diff --git a/back/tests.js b/back/tests.js index 1873c914c..9b40ea728 100644 --- a/back/tests.js +++ b/back/tests.js @@ -53,6 +53,8 @@ async function test() { } })); + if (isCI) jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + jasmine.exitOnCompletion = false; await jasmine.execute(); if (app) await app.disconnect(); From 35209d77ccaeb24b382d6933f5c1b0c954496ebe Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 13 May 2022 12:14:37 +0200 Subject: [PATCH 125/141] fix(multi-check) --- .../components/multi-check/multi-check.html | 6 ++-- .../components/multi-check/multi-check.js | 4 +++ .../multi-check/multi-check.spec.js | 34 +++++++++++++++++++ front/core/components/multi-check/style.scss | 9 +---- 4 files changed, 43 insertions(+), 10 deletions(-) diff --git a/front/core/components/multi-check/multi-check.html b/front/core/components/multi-check/multi-check.html index eaa4577f0..fe485e19b 100644 --- a/front/core/components/multi-check/multi-check.html +++ b/front/core/components/multi-check/multi-check.html @@ -5,12 +5,14 @@ - + All diff --git a/front/core/components/multi-check/multi-check.js b/front/core/components/multi-check/multi-check.js index e60d16519..077c93360 100644 --- a/front/core/components/multi-check/multi-check.js +++ b/front/core/components/multi-check/multi-check.js @@ -172,6 +172,10 @@ export default class MultiCheck extends FormInput { this.checkedDummyCount = this.allRowsCount; } + isCheckedDummy() { + return this.checked && this.checkDummyEnabled; + } + /** * Toggles checked property on * all instances diff --git a/front/core/components/multi-check/multi-check.spec.js b/front/core/components/multi-check/multi-check.spec.js index 1c0adb9d8..bda022d6b 100644 --- a/front/core/components/multi-check/multi-check.spec.js +++ b/front/core/components/multi-check/multi-check.spec.js @@ -190,4 +190,38 @@ describe('Component vnMultiCheck', () => { expect(controller.checkedDummyCount).toBeNull(); }); }); + + describe('isCheckedDummy()', () => { + it(`should return true only if is checked and checked dummy is enabled`, () => { + controller.checked = true; + controller.checkDummyEnabled = true; + const isCheckedDummy = controller.isCheckedDummy(); + + expect(isCheckedDummy).toEqual(true); + }); + + it(`should return true only if is checked and checked dummy is enabled`, () => { + controller.checked = true; + controller.checkDummyEnabled = true; + const isCheckedDummy = controller.isCheckedDummy(); + + expect(isCheckedDummy).toEqual(true); + }); + + it(`should return false if not checked`, () => { + controller.checked = false; + controller.checkDummyEnabled = true; + const isCheckedDummy = controller.isCheckedDummy(); + + expect(isCheckedDummy).toEqual(false); + }); + + it(`should return false if checked dummy is disabled`, () => { + controller.checked = true; + controller.checkDummyEnabled = false; + const isCheckedDummy = controller.isCheckedDummy(); + + expect(isCheckedDummy).toEqual(false); + }); + }); }); diff --git a/front/core/components/multi-check/style.scss b/front/core/components/multi-check/style.scss index 7a4d10675..15f462e8f 100644 --- a/front/core/components/multi-check/style.scss +++ b/front/core/components/multi-check/style.scss @@ -3,15 +3,8 @@ vn-multi-check { .vn-check { margin-bottom: 12px } - - vn-list{ - padding: 50px; - } - vn-menu{ - padding: 50px; - } - } + .bold{ font-weight: bold; } \ No newline at end of file From d4fab0225218e90a9c69ac733bee4c23c1f80883 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 12:25:35 +0200 Subject: [PATCH 126/141] junit reporter added for CI --- Jenkinsfile | 8 ++++---- back/tests.js | 37 +++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f1ab01af9..4a1f9ba54 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,13 +55,13 @@ pipeline { NODE_ENV = "" } parallel { - /* stage('Frontend') { + stage('Frontend') { steps { nodejs('node-v14') { sh 'jest --ci --reporters=default --reporters=jest-junit --maxWorkers=2' } } - } */ + } stage('Backend') { steps { nodejs('node-v14') { @@ -121,8 +121,8 @@ pipeline { script { if (!['master', 'test'].contains(env.BRANCH_NAME)) { try { - // junit 'junitresults.xml' - // junit 'junit.xml' + junit 'junitresults.xml' + junit 'junit.xml' } catch (e) { echo e.toString() } diff --git a/back/tests.js b/back/tests.js index 9b40ea728..d2a721c97 100644 --- a/back/tests.js +++ b/back/tests.js @@ -27,9 +27,30 @@ async function test() { const app = require('vn-loopback/server/server'); app.boot(bootOptions); - const Jasmine = require('jasmine'); - const jasmine = new Jasmine(); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; + let reporter = new SpecReporter({ + spec: { + displaySuccessful: isCI, + displayPending: isCI + }, + summary: { + displayPending: false, + } + }); + + if (isCI) { + const reporters = require('jasmine-reporters'); + reporter = new reporters.JUnitXmlReporter(); + } + + const Jasmine = require('jasmine'); + const jasmine = new Jasmine({ + reporter: [ + reporter + ] + }); + + if (isCI) jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; const backSpecs = [ './back/**/*[sS]pec.js', @@ -43,18 +64,6 @@ async function test() { helpers: [], }); - jasmine.addReporter(new SpecReporter({ - spec: { - displaySuccessful: isCI, - displayPending: isCI - }, - summary: { - displayPending: false, - } - })); - - if (isCI) jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; - jasmine.exitOnCompletion = false; await jasmine.execute(); if (app) await app.disconnect(); From 42270bf61b0080c62202c205362c824e74a7334a Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 12:33:08 +0200 Subject: [PATCH 127/141] allowed both spec reporters for CI --- back/tests.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/back/tests.js b/back/tests.js index d2a721c97..fc545713c 100644 --- a/back/tests.js +++ b/back/tests.js @@ -28,7 +28,10 @@ async function test() { app.boot(bootOptions); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - let reporter = new SpecReporter({ + + const reporters = []; + + reporters.push(new SpecReporter({ spec: { displaySuccessful: isCI, displayPending: isCI @@ -36,18 +39,16 @@ async function test() { summary: { displayPending: false, } - }); + })); if (isCI) { const reporters = require('jasmine-reporters'); - reporter = new reporters.JUnitXmlReporter(); + reporters.push(new reporters.JUnitXmlReporter()); } const Jasmine = require('jasmine'); const jasmine = new Jasmine({ - reporter: [ - reporter - ] + reporter: reporters }); if (isCI) jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; From fa552635160429bb054866052df48ad3c34d6abc Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 12:35:39 +0200 Subject: [PATCH 128/141] renamed junit reporters constant --- back/tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/back/tests.js b/back/tests.js index fc545713c..71b98ce3d 100644 --- a/back/tests.js +++ b/back/tests.js @@ -42,8 +42,8 @@ async function test() { })); if (isCI) { - const reporters = require('jasmine-reporters'); - reporters.push(new reporters.JUnitXmlReporter()); + const junitReporter = require('jasmine-reporters'); + reporters.push(new junitReporter.JUnitXmlReporter()); } const Jasmine = require('jasmine'); From 8b951504373a7b8a40002e669d264dc9d072fac1 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 12:44:21 +0200 Subject: [PATCH 129/141] minor refactor on reporters definition --- back/tests.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/back/tests.js b/back/tests.js index 71b98ce3d..335688778 100644 --- a/back/tests.js +++ b/back/tests.js @@ -28,10 +28,7 @@ async function test() { app.boot(bootOptions); const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - - const reporters = []; - - reporters.push(new SpecReporter({ + const specReporter = new SpecReporter({ spec: { displaySuccessful: isCI, displayPending: isCI @@ -39,11 +36,14 @@ async function test() { summary: { displayPending: false, } - })); + }); + + const reporters = [specReporter]; if (isCI) { - const junitReporter = require('jasmine-reporters'); - reporters.push(new junitReporter.JUnitXmlReporter()); + const JunitReporter = require('jasmine-reporters'); + const junitReporter = new JunitReporter.JUnitXmlReporter(); + reporters.push(junitReporter); } const Jasmine = require('jasmine'); From ddc3b552d7cab4e0cdd79333a016989081651b13 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 12:51:02 +0200 Subject: [PATCH 130/141] jasmine reporters are now added using addReporter --- back/tests.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/back/tests.js b/back/tests.js index 335688778..809906177 100644 --- a/back/tests.js +++ b/back/tests.js @@ -27,8 +27,11 @@ async function test() { const app = require('vn-loopback/server/server'); app.boot(bootOptions); + const Jasmine = require('jasmine'); + const jasmine = new Jasmine(); + const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - const specReporter = new SpecReporter({ + jasmine.addReporter(new SpecReporter({ spec: { displaySuccessful: isCI, displayPending: isCI @@ -36,23 +39,15 @@ async function test() { summary: { displayPending: false, } - }); - - const reporters = [specReporter]; + })); if (isCI) { const JunitReporter = require('jasmine-reporters'); - const junitReporter = new JunitReporter.JUnitXmlReporter(); - reporters.push(junitReporter); + jasmine.addReporter(new JunitReporter.JUnitXmlReporter()); + + jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; } - const Jasmine = require('jasmine'); - const jasmine = new Jasmine({ - reporter: reporters - }); - - if (isCI) jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; - const backSpecs = [ './back/**/*[sS]pec.js', './loopback/**/*[sS]pec.js', From dc62ec21b49b176c2183f7e7173c8585e56a709e Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 12:57:11 +0200 Subject: [PATCH 131/141] forced test failure to test CI junit check --- back/methods/account/specs/set-password.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/account/specs/set-password.spec.js b/back/methods/account/specs/set-password.spec.js index c76fd52b8..c5b781348 100644 --- a/back/methods/account/specs/set-password.spec.js +++ b/back/methods/account/specs/set-password.spec.js @@ -10,6 +10,6 @@ describe('account changePassword()', () => { it('should update password when it passes requirements', async() => { let req = app.models.Account.setPassword(1, 'Very$ecurePa22.'); - await expectAsync(req).toBeResolved(); + await expectAsync(req).toBeRejected(); }); }); From dcdbafe25fcd53540bead9c0cc7bb50d64a94ef8 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 12:58:06 +0200 Subject: [PATCH 132/141] removed test failure --- back/methods/account/specs/set-password.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/account/specs/set-password.spec.js b/back/methods/account/specs/set-password.spec.js index c5b781348..c76fd52b8 100644 --- a/back/methods/account/specs/set-password.spec.js +++ b/back/methods/account/specs/set-password.spec.js @@ -10,6 +10,6 @@ describe('account changePassword()', () => { it('should update password when it passes requirements', async() => { let req = app.models.Account.setPassword(1, 'Very$ecurePa22.'); - await expectAsync(req).toBeRejected(); + await expectAsync(req).toBeResolved(); }); }); From 39413c145d169c93c407122e6489a92e1cfe608b Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 17:09:41 +0200 Subject: [PATCH 133/141] e2e test battery moved out of gulp to npm script --- e2e/helpers/tests.js | 108 ++++++++++++++++++++++++++++++++++++++++++ gulpfile.js | 110 +------------------------------------------ 2 files changed, 109 insertions(+), 109 deletions(-) create mode 100644 e2e/helpers/tests.js diff --git a/e2e/helpers/tests.js b/e2e/helpers/tests.js new file mode 100644 index 000000000..d1429c94d --- /dev/null +++ b/e2e/helpers/tests.js @@ -0,0 +1,108 @@ +require('@babel/register')({presets: ['@babel/env']}); +require('core-js/stable'); +require('regenerator-runtime/runtime'); + +const axios = require('axios'); +const Docker = require('../../db/docker.js'); +const e2eConfig = require('./config.js'); +const log = require('fancy-log'); + +process.on('warning', warning => { + console.log(warning.name); + console.log(warning.message); + console.log(warning.stack); +}); + +async function test() { + let isCI = false; + + if (process.argv[2] === 'show') + process.env.E2E_SHOW = true; + + if (process.argv[2] === 'ci') + isCI = true; + + const container = new Docker('salix-db'); + + await container.run(); + + const Jasmine = require('jasmine'); + const jasmine = new Jasmine(); + + const SpecReporter = require('jasmine-spec-reporter').SpecReporter; + jasmine.addReporter(new SpecReporter({ + spec: { + displaySuccessful: isCI, + displayPending: isCI + }, + summary: { + displayPending: false, + } + })); + + if (isCI) { + const JunitReporter = require('jasmine-reporters'); + jasmine.addReporter(new JunitReporter.JUnitXmlReporter()); + } + + const specFiles = [ + `./e2e/paths/01*/*[sS]pec.js`, + `./e2e/paths/02*/*[sS]pec.js`, + `./e2e/paths/03*/*[sS]pec.js`, + `./e2e/paths/04*/*[sS]pec.js`, + `./e2e/paths/05*/*[sS]pec.js`, + `./e2e/paths/06*/*[sS]pec.js`, + `./e2e/paths/07*/*[sS]pec.js`, + `./e2e/paths/08*/*[sS]pec.js`, + `./e2e/paths/09*/*[sS]pec.js`, + `./e2e/paths/10*/*[sS]pec.js`, + `./e2e/paths/11*/*[sS]pec.js`, + `./e2e/paths/12*/*[sS]pec.js`, + `./e2e/paths/13*/*[sS]pec.js`, + `./e2e/paths/**/*[sS]pec.js` + ]; + + jasmine.loadConfig({ + spec_dir: '.', + spec_files: specFiles, + helpers: [], + random: false, + }); + + await backendStatus(); + + jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + await jasmine.execute(); +} + +async function backendStatus() { + log('Awaiting backend connection...'); + + const milliseconds = 1000; + const maxAttempts = 10; + + return new Promise(resolve => { + let timer; + let attempts = 1; + timer = setInterval(async() => { + try { + attempts++; + const url = `${e2eConfig.url}/api/Applications/status`; + const {data} = await axios.get(url); + + if (data == true) { + clearInterval(timer); + log('Backend connection stablished!'); + resolve(attempts); + } + } catch (error) { + if (error && attempts >= maxAttempts) { + log('Could not connect to backend'); + process.exit(); + } + } + }, milliseconds); + }); +} + +test(); diff --git a/gulpfile.js b/gulpfile.js index cc946091f..d7e7d8e86 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,8 +3,6 @@ const gulp = require('gulp'); const PluginError = require('plugin-error'); const argv = require('minimist')(process.argv.slice(2)); const log = require('fancy-log'); -const got = require('got'); -const e2eConfig = require('./e2e/helpers/config.js'); const Docker = require('./db/docker.js'); // Configuration @@ -67,110 +65,6 @@ back.description = `Starts backend and database service`; const defaultTask = gulp.parallel(front, back); defaultTask.description = `Starts all application services`; - -// End to end tests -function e2eSingleRun() { - require('@babel/register')({presets: ['@babel/env']}); - require('core-js/stable'); - require('regenerator-runtime/runtime'); - - const jasmine = require('gulp-jasmine'); - const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - - if (argv.show || argv.s) - process.env.E2E_SHOW = true; - - const specFiles = [ - `${__dirname}/e2e/paths/01*/*[sS]pec.js`, - `${__dirname}/e2e/paths/02*/*[sS]pec.js`, - `${__dirname}/e2e/paths/03*/*[sS]pec.js`, - `${__dirname}/e2e/paths/04*/*[sS]pec.js`, - `${__dirname}/e2e/paths/05*/*[sS]pec.js`, - `${__dirname}/e2e/paths/06*/*[sS]pec.js`, - `${__dirname}/e2e/paths/07*/*[sS]pec.js`, - `${__dirname}/e2e/paths/08*/*[sS]pec.js`, - `${__dirname}/e2e/paths/09*/*[sS]pec.js`, - `${__dirname}/e2e/paths/10*/*[sS]pec.js`, - `${__dirname}/e2e/paths/11*/*[sS]pec.js`, - `${__dirname}/e2e/paths/12*/*[sS]pec.js`, - `${__dirname}/e2e/paths/13*/*[sS]pec.js`, - `${__dirname}/e2e/paths/**/*[sS]pec.js` - ]; - - return gulp.src(specFiles).pipe(jasmine({ - errorOnFail: false, - timeout: 30000, - config: { - random: false, - // TODO: Waiting for this option to be implemented - // https://github.com/jasmine/jasmine/issues/1533 - stopSpecOnExpectationFailure: false - }, - reporter: [ - new SpecReporter({ - spec: { - displayStacktrace: 'none', - displaySuccessful: true, - displayFailedSpec: true, - displaySpecDuration: true, - }, - summary: { - displayStacktrace: 'raw', - displayPending: false - }, - colors: { - enabled: true, - successful: 'brightGreen', - failed: 'brightRed' - }, - // stacktrace: { - // filter: stacktrace => { - // const lines = stacktrace.split('\n'); - // const filtered = []; - // for (let i = 1; i < lines.length; i++) { - // if (/e2e\/paths/.test(lines[i])) - // filtered.push(lines[i]); - // } - // return filtered.join('\n'); - // } - // } - }) - ] - })); -} - -e2e = gulp.series(docker, async function isBackendReady() { - const attempts = await backendStatus(); - log(`Backend ready after ${attempts} attempt(s)`); - - return attempts; -}, e2eSingleRun); -e2e.description = `Restarts database and runs the e2e tests`; - -async function backendStatus() { - const milliseconds = 250; - return new Promise(resolve => { - let timer; - let attempts = 1; - timer = setInterval(async() => { - try { - const url = `${e2eConfig.url}/api/Applications/status`; - const {body} = await got.get(url); - - if (body == 'true') { - clearInterval(timer); - resolve(attempts); - } else - attempts++; - } catch (error) { - if (error || attempts > 100) // 250ms * 100 => 25s timeout - throw new Error('Could not connect to backend'); - } - }, milliseconds); - }); -} -backendStatus.description = `Performs a simple requests to check the backend status`; - function install() { const install = require('gulp-install'); const print = require('gulp-print'); @@ -354,7 +248,6 @@ module.exports = { back, backOnly, backWatch, - e2e, i, install, build, @@ -365,6 +258,5 @@ module.exports = { locales, localesRoutes, watch, - docker, - backendStatus, + docker }; From 7bafc48d681098fcd1adaecb5186eb57442a3340 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 18:29:20 +0200 Subject: [PATCH 134/141] removed CI references for e2e --- e2e/helpers/tests.js | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/e2e/helpers/tests.js b/e2e/helpers/tests.js index d1429c94d..aac9963dd 100644 --- a/e2e/helpers/tests.js +++ b/e2e/helpers/tests.js @@ -14,14 +14,9 @@ process.on('warning', warning => { }); async function test() { - let isCI = false; - if (process.argv[2] === 'show') process.env.E2E_SHOW = true; - if (process.argv[2] === 'ci') - isCI = true; - const container = new Docker('salix-db'); await container.run(); @@ -29,22 +24,6 @@ async function test() { const Jasmine = require('jasmine'); const jasmine = new Jasmine(); - const SpecReporter = require('jasmine-spec-reporter').SpecReporter; - jasmine.addReporter(new SpecReporter({ - spec: { - displaySuccessful: isCI, - displayPending: isCI - }, - summary: { - displayPending: false, - } - })); - - if (isCI) { - const JunitReporter = require('jasmine-reporters'); - jasmine.addReporter(new JunitReporter.JUnitXmlReporter()); - } - const specFiles = [ `./e2e/paths/01*/*[sS]pec.js`, `./e2e/paths/02*/*[sS]pec.js`, From 6e9fedf2b5a671758de06a8b81970d7a3c8b1779 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Fri, 13 May 2022 18:41:53 +0200 Subject: [PATCH 135/141] tests batteries command updated on readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1e3ad5e9e..f73a8551b 100644 --- a/README.md +++ b/README.md @@ -54,17 +54,17 @@ $ gulp docker For client-side unit tests run from project's root. ``` -$ jest +$ npm run test:front ``` For server-side unit tests run from project's root. ``` -$ gulp backTest +$ npm run test:back ``` For end-to-end tests run from project's root. ``` -$ gulp e2e +$ npm run test:e2e ``` ## Visual Studio Code extensions From 40bcc567584d8b6ee4324dd7e85d1c4bc80a8296 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 16 May 2022 07:22:01 +0200 Subject: [PATCH 136/141] refactor: change acl --- db/changes/10451-april/00-aclSupplierActivity.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/db/changes/10451-april/00-aclSupplierActivity.sql b/db/changes/10451-april/00-aclSupplierActivity.sql index 1892704ab..bf73a1506 100644 --- a/db/changes/10451-april/00-aclSupplierActivity.sql +++ b/db/changes/10451-april/00-aclSupplierActivity.sql @@ -1,2 +1,5 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) -VALUES('SupplierActivity', '*', '*', 'ALLOW', 'ROLE', 'employee'); +VALUES('SupplierActivity', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); + +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) +VALUES('SupplierActivity', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative'); From c88fe629cd1cc7cf79bcac393f4b51aaaf1b3abf Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 16 May 2022 08:21:12 +0200 Subject: [PATCH 137/141] Removed duplicated version --- db/changes/10460-mothersDay/delete.keep | 1 - 1 file changed, 1 deletion(-) delete mode 100644 db/changes/10460-mothersDay/delete.keep diff --git a/db/changes/10460-mothersDay/delete.keep b/db/changes/10460-mothersDay/delete.keep deleted file mode 100644 index 0e7498f40..000000000 --- a/db/changes/10460-mothersDay/delete.keep +++ /dev/null @@ -1 +0,0 @@ -Delete file \ No newline at end of file From d31f7f1b6b936d975e1f591b902e179288b70d23 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 16 May 2022 10:19:43 +0200 Subject: [PATCH 138/141] all type Dates replaced to date as per convention --- back/models/delivery.json | 2 +- back/models/dms.json | 2 +- back/models/user-log.json | 2 +- modules/claim/back/models/claim-log.json | 2 +- modules/client/back/models/client-log.json | 2 +- modules/client/back/models/client.json | 2 +- modules/client/back/models/defaulter.json | 2 +- modules/client/back/models/sms.json | 2 +- modules/client/back/models/tpv-transaction.json | 2 +- modules/entry/back/models/entry-log.json | 2 +- modules/item/back/models/item-log.json | 2 +- modules/item/back/models/item-shelving-sale.json | 2 +- modules/item/back/models/item-shelving.json | 2 +- modules/order/back/models/order.json | 8 ++++---- modules/route/back/models/route-log.json | 2 +- modules/ticket/back/models/expedition.json | 2 +- modules/ticket/back/models/sale-tracking.json | 2 +- modules/ticket/back/models/stowaway.json | 2 +- modules/ticket/back/models/ticket-log.json | 2 +- modules/ticket/back/models/ticket-packaging.json | 2 +- modules/ticket/back/models/ticket-request.json | 2 +- modules/ticket/back/models/ticket-tracking.json | 2 +- modules/travel/back/models/travel-log.json | 2 +- modules/worker/back/models/calendar-holiday.json | 2 +- modules/worker/back/models/calendar.json | 2 +- modules/worker/back/models/worker-log.json | 2 +- modules/worker/back/models/worker-time-control-mail.json | 2 +- modules/zone/back/models/zone-closure.json | 2 +- modules/zone/back/models/zone-estimated-delivery.json | 6 +++--- modules/zone/back/models/zone-event.json | 8 ++++---- modules/zone/back/models/zone-exclusion.json | 2 +- modules/zone/back/models/zone-log.json | 2 +- 32 files changed, 40 insertions(+), 40 deletions(-) diff --git a/back/models/delivery.json b/back/models/delivery.json index d25cc8f19..65a0eef1b 100644 --- a/back/models/delivery.json +++ b/back/models/delivery.json @@ -13,7 +13,7 @@ "forceId": false }, "date": { - "type": "Date" + "type": "date" }, "m3":{ "type": "number" diff --git a/back/models/dms.json b/back/models/dms.json index 650d80f49..0259e5487 100644 --- a/back/models/dms.json +++ b/back/models/dms.json @@ -36,7 +36,7 @@ "type": "boolean" }, "created": { - "type": "Date" + "type": "date" } }, "relations": { diff --git a/back/models/user-log.json b/back/models/user-log.json index 2b9ff1732..43ccbfa43 100644 --- a/back/models/user-log.json +++ b/back/models/user-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "number" diff --git a/modules/claim/back/models/claim-log.json b/modules/claim/back/models/claim-log.json index 29f22d835..519cfe1ea 100644 --- a/modules/claim/back/models/claim-log.json +++ b/modules/claim/back/models/claim-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "number" diff --git a/modules/client/back/models/client-log.json b/modules/client/back/models/client-log.json index 2cebccf72..9c0933c0c 100644 --- a/modules/client/back/models/client-log.json +++ b/modules/client/back/models/client-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "number" diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index b21f23d9c..b9951e8bb 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -117,7 +117,7 @@ "type": "string" }, "created": { - "type": "Date" + "type": "date" }, "sageTaxTypeFk": { "type": "number", diff --git a/modules/client/back/models/defaulter.json b/modules/client/back/models/defaulter.json index ca48e12ab..ddff1d214 100644 --- a/modules/client/back/models/defaulter.json +++ b/modules/client/back/models/defaulter.json @@ -12,7 +12,7 @@ "type": "number" }, "created": { - "type": "Date" + "type": "date" }, "amount": { "type": "number" diff --git a/modules/client/back/models/sms.json b/modules/client/back/models/sms.json index b24f1f3d7..29438fc67 100644 --- a/modules/client/back/models/sms.json +++ b/modules/client/back/models/sms.json @@ -32,7 +32,7 @@ "type": "string" }, "created": { - "type": "Date" + "type": "date" } }, "relations": { diff --git a/modules/client/back/models/tpv-transaction.json b/modules/client/back/models/tpv-transaction.json index 891393e6f..2d926cc40 100644 --- a/modules/client/back/models/tpv-transaction.json +++ b/modules/client/back/models/tpv-transaction.json @@ -34,7 +34,7 @@ "type": "string" }, "created": { - "type": "Date" + "type": "date" } }, "relations": { diff --git a/modules/entry/back/models/entry-log.json b/modules/entry/back/models/entry-log.json index 0801734fa..6f8edaf25 100644 --- a/modules/entry/back/models/entry-log.json +++ b/modules/entry/back/models/entry-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "string" diff --git a/modules/item/back/models/item-log.json b/modules/item/back/models/item-log.json index bf06f0073..633a8f86b 100644 --- a/modules/item/back/models/item-log.json +++ b/modules/item/back/models/item-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "number" diff --git a/modules/item/back/models/item-shelving-sale.json b/modules/item/back/models/item-shelving-sale.json index a2e53f4f2..8b89a7597 100644 --- a/modules/item/back/models/item-shelving-sale.json +++ b/modules/item/back/models/item-shelving-sale.json @@ -16,7 +16,7 @@ "type": "number" }, "created": { - "type": "Date" + "type": "date" } }, "relations": { diff --git a/modules/item/back/models/item-shelving.json b/modules/item/back/models/item-shelving.json index b365842d1..951a4553a 100644 --- a/modules/item/back/models/item-shelving.json +++ b/modules/item/back/models/item-shelving.json @@ -28,7 +28,7 @@ "type": "number" }, "created": { - "type": "Date" + "type": "date" } }, "relations": { diff --git a/modules/order/back/models/order.json b/modules/order/back/models/order.json index 8c49f614a..169c0c550 100644 --- a/modules/order/back/models/order.json +++ b/modules/order/back/models/order.json @@ -13,7 +13,7 @@ "description": "Identifier" }, "landed": { - "type": "Date", + "type": "date", "required": true, "mysql": { "columnName": "date_send" @@ -63,19 +63,19 @@ } }, "created": { - "type": "Date", + "type": "date", "mysql": { "columnName": "date_make" } }, "firstRowStamp": { - "type": "Date", + "type": "date", "mysql": { "columnName": "first_row_stamp" } }, "confirmed": { - "type": "Date", + "type": "date", "mysql": { "columnName": "confirm_date" } diff --git a/modules/route/back/models/route-log.json b/modules/route/back/models/route-log.json index fd803a60d..37f898267 100644 --- a/modules/route/back/models/route-log.json +++ b/modules/route/back/models/route-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "number" diff --git a/modules/ticket/back/models/expedition.json b/modules/ticket/back/models/expedition.json index 518f2d347..fc94f185d 100644 --- a/modules/ticket/back/models/expedition.json +++ b/modules/ticket/back/models/expedition.json @@ -20,7 +20,7 @@ "type": "number" }, "created": { - "type": "Date" + "type": "date" }, "counter": { "type": "number" diff --git a/modules/ticket/back/models/sale-tracking.json b/modules/ticket/back/models/sale-tracking.json index e5727f2fd..4a103ea15 100644 --- a/modules/ticket/back/models/sale-tracking.json +++ b/modules/ticket/back/models/sale-tracking.json @@ -22,7 +22,7 @@ "type": "boolean" }, "created": { - "type": "Date" + "type": "date" }, "originalQuantity": { "type": "number" diff --git a/modules/ticket/back/models/stowaway.json b/modules/ticket/back/models/stowaway.json index faebad5df..ef3aeb40d 100644 --- a/modules/ticket/back/models/stowaway.json +++ b/modules/ticket/back/models/stowaway.json @@ -17,7 +17,7 @@ "required": false }, "created":{ - "type": "Date", + "type": "date", "required": false } }, diff --git a/modules/ticket/back/models/ticket-log.json b/modules/ticket/back/models/ticket-log.json index f78a10244..169bdeaa0 100644 --- a/modules/ticket/back/models/ticket-log.json +++ b/modules/ticket/back/models/ticket-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "number" diff --git a/modules/ticket/back/models/ticket-packaging.json b/modules/ticket/back/models/ticket-packaging.json index 71b347a6d..533f4064c 100644 --- a/modules/ticket/back/models/ticket-packaging.json +++ b/modules/ticket/back/models/ticket-packaging.json @@ -20,7 +20,7 @@ "type": "number" }, "created": { - "type": "Date" + "type": "date" }, "pvp": { "type": "number" diff --git a/modules/ticket/back/models/ticket-request.json b/modules/ticket/back/models/ticket-request.json index 1871cd0f7..01601c7f6 100644 --- a/modules/ticket/back/models/ticket-request.json +++ b/modules/ticket/back/models/ticket-request.json @@ -21,7 +21,7 @@ "required": true }, "created": { - "type": "Date" + "type": "date" }, "quantity": { "type": "number", diff --git a/modules/ticket/back/models/ticket-tracking.json b/modules/ticket/back/models/ticket-tracking.json index 983c3da6c..e80e2f8f4 100644 --- a/modules/ticket/back/models/ticket-tracking.json +++ b/modules/ticket/back/models/ticket-tracking.json @@ -18,7 +18,7 @@ "forceId": false }, "created": { - "type": "Date" + "type": "date" }, "ticketFk": { "type": "number" diff --git a/modules/travel/back/models/travel-log.json b/modules/travel/back/models/travel-log.json index 21a600b87..d07f83e50 100644 --- a/modules/travel/back/models/travel-log.json +++ b/modules/travel/back/models/travel-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "string" diff --git a/modules/worker/back/models/calendar-holiday.json b/modules/worker/back/models/calendar-holiday.json index f0f1ba442..f7777c2b7 100644 --- a/modules/worker/back/models/calendar-holiday.json +++ b/modules/worker/back/models/calendar-holiday.json @@ -16,7 +16,7 @@ "type": "number" }, "dated": { - "type": "Date" + "type": "date" } }, "relations": { diff --git a/modules/worker/back/models/calendar.json b/modules/worker/back/models/calendar.json index 8cd30ba02..40d29c519 100644 --- a/modules/worker/back/models/calendar.json +++ b/modules/worker/back/models/calendar.json @@ -19,7 +19,7 @@ "type": "number" }, "dated": { - "type": "Date" + "type": "date" } }, "relations": { diff --git a/modules/worker/back/models/worker-log.json b/modules/worker/back/models/worker-log.json index 8c5e59601..d2fa0487d 100644 --- a/modules/worker/back/models/worker-log.json +++ b/modules/worker/back/models/worker-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "string" diff --git a/modules/worker/back/models/worker-time-control-mail.json b/modules/worker/back/models/worker-time-control-mail.json index 533c01dfe..daf3d5155 100644 --- a/modules/worker/back/models/worker-time-control-mail.json +++ b/modules/worker/back/models/worker-time-control-mail.json @@ -25,7 +25,7 @@ "type": "string" }, "updated": { - "type": "Date" + "type": "date" }, "emailResponse": { "type": "string" diff --git a/modules/zone/back/models/zone-closure.json b/modules/zone/back/models/zone-closure.json index 92f565a57..0483a0c83 100644 --- a/modules/zone/back/models/zone-closure.json +++ b/modules/zone/back/models/zone-closure.json @@ -12,7 +12,7 @@ "type": "number" }, "dated": { - "type": "Date", + "type": "date", "required": true }, "hour": { diff --git a/modules/zone/back/models/zone-estimated-delivery.json b/modules/zone/back/models/zone-estimated-delivery.json index b39ed8722..399de8f58 100644 --- a/modules/zone/back/models/zone-estimated-delivery.json +++ b/modules/zone/back/models/zone-estimated-delivery.json @@ -24,13 +24,13 @@ "type": "number" }, "hourEffective": { - "type": "Date" + "type": "date" }, "minutesLess": { - "type": "Date" + "type": "date" }, "etc": { - "type": "Date" + "type": "date" } }, diff --git a/modules/zone/back/models/zone-event.json b/modules/zone/back/models/zone-event.json index 9a97e5e01..7cf4b8301 100644 --- a/modules/zone/back/models/zone-event.json +++ b/modules/zone/back/models/zone-event.json @@ -23,19 +23,19 @@ "type": "string" }, "dated": { - "type": "Date" + "type": "date" }, "started": { - "type": "Date" + "type": "date" }, "ended": { - "type": "Date" + "type": "date" }, "weekDays": { "type": "string" }, "hour": { - "type": "Date" + "type": "date" }, "travelingDays": { "type": "number" diff --git a/modules/zone/back/models/zone-exclusion.json b/modules/zone/back/models/zone-exclusion.json index fbd61683c..415bce40c 100644 --- a/modules/zone/back/models/zone-exclusion.json +++ b/modules/zone/back/models/zone-exclusion.json @@ -12,7 +12,7 @@ "type": "number" }, "dated": { - "type": "Date", + "type": "date", "required": true } }, diff --git a/modules/zone/back/models/zone-log.json b/modules/zone/back/models/zone-log.json index 66cc8165d..c2c66c155 100644 --- a/modules/zone/back/models/zone-log.json +++ b/modules/zone/back/models/zone-log.json @@ -33,7 +33,7 @@ "type": "object" }, "creationDate": { - "type": "Date" + "type": "date" }, "changedModelId": { "type": "string" From 1707ff7f0f9632938f66fbf8547113e361cedd1c Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 16 May 2022 10:24:02 +0200 Subject: [PATCH 139/141] duplicate test --- front/core/components/multi-check/multi-check.spec.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/front/core/components/multi-check/multi-check.spec.js b/front/core/components/multi-check/multi-check.spec.js index bda022d6b..5cb8cbbef 100644 --- a/front/core/components/multi-check/multi-check.spec.js +++ b/front/core/components/multi-check/multi-check.spec.js @@ -200,14 +200,6 @@ describe('Component vnMultiCheck', () => { expect(isCheckedDummy).toEqual(true); }); - it(`should return true only if is checked and checked dummy is enabled`, () => { - controller.checked = true; - controller.checkDummyEnabled = true; - const isCheckedDummy = controller.isCheckedDummy(); - - expect(isCheckedDummy).toEqual(true); - }); - it(`should return false if not checked`, () => { controller.checked = false; controller.checkDummyEnabled = true; From 576cad16ad2b67d4b9cbafe59ccf287072f9dc10 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 16 May 2022 11:34:29 +0200 Subject: [PATCH 140/141] SQL fixes --- .../00-clientConfig.sql | 0 db/changes/10460-mother/00-dmsForeignKey.sql | 12 ++++++------ db/changes/10460-mother/01-dmsType.sql | 6 +++--- db/changes/10460-mother/02-dmsTrigger.sql | 2 +- db/changes/10460-mother/04-acl.sql | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) rename db/changes/{10460-mothersDay => 10460-mother}/00-clientConfig.sql (100%) diff --git a/db/changes/10460-mothersDay/00-clientConfig.sql b/db/changes/10460-mother/00-clientConfig.sql similarity index 100% rename from db/changes/10460-mothersDay/00-clientConfig.sql rename to db/changes/10460-mother/00-clientConfig.sql diff --git a/db/changes/10460-mother/00-dmsForeignKey.sql b/db/changes/10460-mother/00-dmsForeignKey.sql index f44391a17..6a4736fdd 100644 --- a/db/changes/10460-mother/00-dmsForeignKey.sql +++ b/db/changes/10460-mother/00-dmsForeignKey.sql @@ -1,8 +1,8 @@ -ALTER TABLE vn.propertyDms DROP FOREIGN KEY propertyDms_FK; -ALTER TABLE vn.propertyDms ADD CONSTRAINT propertyDms_FK FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `vn`.`propertyDms` DROP FOREIGN KEY propertyDms_FK; +ALTER TABLE `vn`.`propertyDms` ADD CONSTRAINT propertyDms_FK FOREIGN KEY (dmsFk) REFERENCES `vn`.`dms`(id) ON DELETE CASCADE ON UPDATE CASCADE; -ALTER TABLE vn.clientDms DROP FOREIGN KEY clientDms_ibfk_2; -ALTER TABLE vn.clientDms ADD CONSTRAINT clientDms_ibfk_2 FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `vn`.`clientDms` DROP FOREIGN KEY clientDms_ibfk_2; +ALTER TABLE `vn`.`clientDms` ADD CONSTRAINT clientDms_ibfk_2 FOREIGN KEY (dmsFk) REFERENCES `vn`.`dms`(id) ON DELETE CASCADE ON UPDATE CASCADE; -ALTER TABLE vn.workerDocument DROP FOREIGN KEY workerDocument_ibfk_2; -ALTER TABLE vn.workerDocument ADD CONSTRAINT workerDocument_ibfk_2 FOREIGN KEY (document) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE; +ALTER TABLE `vn`.`workerDocument` DROP FOREIGN KEY workerDocument_ibfk_2; +ALTER TABLE `vn`.`workerDocument` ADD CONSTRAINT workerDocument_ibfk_2 FOREIGN KEY (document) REFERENCES `vn`.`dms`(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/changes/10460-mother/01-dmsType.sql b/db/changes/10460-mother/01-dmsType.sql index e82c086cf..649ffbc71 100644 --- a/db/changes/10460-mother/01-dmsType.sql +++ b/db/changes/10460-mother/01-dmsType.sql @@ -1,5 +1,5 @@ -ALTER TABLE vn.dmsType ADD monthToDelete INT UNSIGNED DEFAULT NULL NULL; -ALTER TABLE vn.dmsType MODIFY COLUMN monthToDelete int(10) unsigned DEFAULT NULL NULL COMMENT 'Meses en el pasado para ir borrando registros, dejar a null para no borrarlos nunca'; -UPDATE vn.dmsType +ALTER TABLE `vn`.`dmsType` ADD monthToDelete INT UNSIGNED DEFAULT NULL NULL; +ALTER TABLE `vn`.`dmsType` MODIFY COLUMN monthToDelete int(10) unsigned DEFAULT NULL NULL COMMENT 'Meses en el pasado para ir borrando registros, dejar a null para no borrarlos nunca'; +UPDATE `vn`.`dmsType` SET monthToDelete=6 WHERE id=20; diff --git a/db/changes/10460-mother/02-dmsTrigger.sql b/db/changes/10460-mother/02-dmsTrigger.sql index a92efcfab..d4525440b 100644 --- a/db/changes/10460-mother/02-dmsTrigger.sql +++ b/db/changes/10460-mother/02-dmsTrigger.sql @@ -1,7 +1,7 @@ DELIMITER $$ $$ -CREATE TRIGGER dms_beforeDelete +CREATE TRIGGER `vn`.`dms_beforeDelete` BEFORE DELETE ON dms FOR EACH ROW BEGIN diff --git a/db/changes/10460-mother/04-acl.sql b/db/changes/10460-mother/04-acl.sql index c576bf1b0..c1dc4f6ed 100644 --- a/db/changes/10460-mother/04-acl.sql +++ b/db/changes/10460-mother/04-acl.sql @@ -1,2 +1,2 @@ -INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) +INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) VALUES ('Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee') \ No newline at end of file From bf8e7eed57ef0b3b62b3d7776d439317de4f7b29 Mon Sep 17 00:00:00 2001 From: joan Date: Mon, 16 May 2022 11:37:43 +0200 Subject: [PATCH 141/141] Added SQL version 10470 --- db/changes/10470-family/delete.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 db/changes/10470-family/delete.keep diff --git a/db/changes/10470-family/delete.keep b/db/changes/10470-family/delete.keep new file mode 100644 index 000000000..e69de29bb